{ "info": { "author": "David Flores", "author_email": "davidflores7_8@hotmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "[![Circle CI](https://circleci.com/gh/davidban77/gns3fy/tree/develop.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/davidban77/gns3fy/tree/develop)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)[![codecov](https://img.shields.io/codecov/c/github/davidban77/gns3fy)](https://codecov.io/gh/davidban77/gns3fy)[![Total alerts](https://img.shields.io/lgtm/alerts/g/davidban77/gns3fy.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/davidban77/gns3fy/alerts/)[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/davidban77/gns3fy.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/davidban77/gns3fy/context:python)\n\n\n# gns3fy\nPython wrapper around [GNS3 Server API](http://api.gns3.net/en/2.2/index.html).\n\nIts main objective is to interact with the GNS3 server in a programatic way, so it can be integrated with the likes of Ansible, docker and scripts. Ideal for network CI/CD pipeline tooling.\n\n## Documentation\n\nCheck out the [Documentation](https://davidban77.github.io/gns3fy/) to explore use cases and the API Reference\n\n## Use cases\n\nHere are some examples where gns3fy is used in a programmatic way:\n\n- [Ansible-collection-gns3](https://galaxy.ansible.com/davidban77/gns3): Useful for CI/CD pipelines to interact with GNS3 server using Ansible. It can create/delete projects, nodes and links in an ansible playbook.\n- Terraform: Coming soon... (although it might be a Go version of it)\n- [Migrate templates between GNS3 servers](https://davidban77.github.io/gns3fy/user-guide/#migrate-templates-between-gns3-servers)\n- [Check server usage](https://davidban77.github.io/gns3fy/user-guide/#check-server-cpu-and-memory-usage) before turning up resource-hungry nodes\n- [Manipulate project snapshots](https://davidban77.github.io/gns3fy/user-guide/#create-and-list-project-snapshots) like create, delete or list the snapshots configured for the project.\n\n## Install\n\n```\npip install gns3fy\n```\n\n### Development version\n\nUse [poetry](https://github.com/sdispater/poetry) to install the package when cloning it.\n\n## How it works\n\nYou can start the library and use the `Gns3Connector` object and the `Project` object.\n\nFor example:\n\n```python\n>>> import gns3fy\n>>> from tabulate import tabulate\n\n# Define the server object to establish the connection\n>>> gns3_server = gns3fy.Gns3Connector(\"http://:3080\")\n\n# Show the available projects on the server\n>>> print(\n tabulate(\n gns3_server.projects_summary(is_print=False),\n headers=[\"Project Name\", \"Project ID\", \"Total Nodes\", \"Total Links\", \"Status\"],\n )\n )\n\"\"\"\nProject Name Project ID Total Nodes Total Links Status\n-------------- ------------------------------------ ------------- ------------- --------\ntest2 c9dc56bf-37b9-453b-8f95-2845ce8908e3 10 9 opened\nAPI_TEST 4b21dfb3-675a-4efa-8613-2f7fb32e76fe 6 4 opened\nmpls-bgpv2 f5de5917-0ac5-4850-82b1-1d7e3c777fa1 30 40 closed\n\"\"\"\n\n# Define the lab you want to load and assign the server connector\n>>> lab = gns3fy.Project(name=\"API_TEST\", connector=gns3_server)\n\n# Retrieve its information and display\n>>> lab.get()\n>>> print(lab)\n\"Project(project_id='4b21dfb3-675a-4efa-8613-2f7fb32e76fe', name='API_TEST', status='opened', ...)\"\n\n# Access the project attributes\n>>> print(f\"Name: {lab.name} -- Status: {lab.status} -- Is auto_closed?: {lab.auto_close}\")\n\"Name: API_TEST -- Status: closed -- Is auto_closed?: False\"\n\n# Open the project\n>>> lab.open()\n>>> lab.status\nopened\n\n# Verify the stats\n>>> lab.stats\n{'drawings': 0, 'links': 4, 'nodes': 6, 'snapshots': 0}\n\n# List the names and status of all the nodes in the project\n>>> for node in lab.nodes:\n... print(f\"Node: {node.name} -- Node Type: {node.node_type} -- Status: {node.status}\")\n\n\"Node: Ethernetswitch-1 -- Node Type: ethernet_switch -- Status: started\"\n...\n```\n\nTake a look at the API documentation for complete information about the attributes retrieved.\n\n### Usage of Node and Link objects\n\nYou have access to the `Node` and `Link` objects as well, this gives you the ability to start, stop, suspend the individual element in a GNS3 project.\n\n```python\n>>> from gns3fy import Node, Link, Gns3Connector\n\n>>> PROJECT_ID = \"\"\n>>> server = Gns3Connector(\"http://:3080\")\n\n>>> alpine1 = Node(project_id=PROJECT_ID, name=\"alpine-1\", connector=server)\n\n>>> alpine1.get()\n>>> print(alpine1)\n\"Node(name='alpine-1', node_type='docker', node_directory= ...)\"\n\n# And you can access the attributes the same way as the project\n>>> print(f\"Name: {alpine1.name} -- Status: {alpine1.status} -- Console: {alpine1.console}\")\n\"Name: alpine-1 -- Status: started -- Console: 5005\"\n\n# Stop the node and start (you can just restart it as well)\n>>> alpine1.stop()\n>>> alpine1.status\nstopped\n\n>>> alpine1.start()\n>>> alpine1.status\nstarted\n\n# You can also see the Link objects assigned to this node\n>>> alpine1.links\n[Link(link_id='4d9f1235-7fd1-466b-ad26-0b4b08beb778', link_type='ethernet', ...)]\n\n# And in the same way you can interact with a Link object\n>>> link1 = alpine1.links[0]\n>>> print(f\"Link Type: {link1.link_type} -- Capturing?: {link1.capturing} -- Endpoints: {link1.nodes}\")\n\"Link Type: ethernet -- Capturing?: False -- Endpoints: [{'adapter_number': 2, ...}]\"\n```\n\n### Useful functions\n\nYou also have some commodity methods like the `nodes_summary` and `links_summary`, that if used with a library like `tabulate` you can see the following:\n\n```python\n\n>>> from tabulate import tabulate\n\n>>> nodes_summary = lab.nodes_summary(is_print=False)\n\n>>> print(\n... tabulate(nodes_summary, headers=[\"Node\", \"Status\", \"Console Port\", \"ID\"])\n... )\n\"\"\"\nNode Status Console Port ID\n---------------- -------- -------------- ------------------------------------\nEthernetswitch-1 started 5000 da28e1c0-9465-4f7c-b42c-49b2f4e1c64d\nIOU1 started 5001 de23a89a-aa1f-446a-a950-31d4bf98653c\nIOU2 started 5002 0d10d697-ef8d-40af-a4f3-fafe71f5458b\nvEOS-4.21.5F-1 started 5003 8283b923-df0e-4bc1-8199-be6fea40f500\nalpine-1 started 5005 ef503c45-e998-499d-88fc-2765614b313e\nCloud-1 started cde85a31-c97f-4551-9596-a3ed12c08498\n\"\"\"\n>>> links_summary = lab.links_summary(is_print=False)\n>>> print(\n... tabulate(links_summary, headers=[\"Node A\", \"Port A\", \"Node B\", \"Port B\"])\n... )\n\"\"\"\nNode A Port A Node B Port B\n-------------- ----------- ---------------- -----------\nIOU1 Ethernet1/0 IOU2 Ethernet1/0\nvEOS-4.21.5F-1 Management1 Ethernetswitch-1 Ethernet0\nvEOS-4.21.5F-1 Ethernet1 alpine-1 eth0\nCloud-1 eth1 Ethernetswitch-1 Ethernet7\n\"\"\"\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/davidban77/gns3fy", "keywords": "network,gns3,python,restapi", "license": "MIT", "maintainer": "David Flores", "maintainer_email": "davidflores7_8@hotmail.com", "name": "gns3fy", "package_url": "https://pypi.org/project/gns3fy/", "platform": "", "project_url": "https://pypi.org/project/gns3fy/", "project_urls": { "Homepage": "https://github.com/davidban77/gns3fy", "Repository": "https://github.com/davidban77/gns3fy" }, "release_url": "https://pypi.org/project/gns3fy/0.5.2/", "requires_dist": [ "requests (>=2.22,<3.0)", "pydantic" ], "requires_python": ">=3.6,<4.0", "summary": "Python wrapper around GNS3 Server API", "version": "0.5.2" }, "last_serial": 5911885, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3e326f2767216db8390ec234e92e4260", "sha256": "8c0eccde3ebcaf80e73773658d2837dcb23b067ff9b90df6c41c74e13d386c6f" }, "downloads": -1, "filename": "gns3fy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3e326f2767216db8390ec234e92e4260", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 6612, "upload_time": "2019-08-01T14:47:31", "url": "https://files.pythonhosted.org/packages/6b/bd/61eb4fa2ca177cb1ce2624380290b7fac81832c701b77a06047a649ac4bc/gns3fy-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f389086ca7faacb2c38707af2a8a1dab", "sha256": "e0239c9e603f1d21c3431c3b85c1d4b9c6a961f9d18e5a0b9def3bfebf92951c" }, "downloads": -1, "filename": "gns3fy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f389086ca7faacb2c38707af2a8a1dab", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 6199, "upload_time": "2019-08-01T14:47:33", "url": "https://files.pythonhosted.org/packages/56/97/6cc94c43507f0673cfce132b8c1241d3500242626800293aa62b41227678/gns3fy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "5bace2c985825fcce23cca75b3b657dc", "sha256": "e310ed50f10f432694c9d9c3b93ed1dcce22a6f83914c2478734038b26b07506" }, "downloads": -1, "filename": "gns3fy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5bace2c985825fcce23cca75b3b657dc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 8492, "upload_time": "2019-08-01T20:25:12", "url": "https://files.pythonhosted.org/packages/dc/e5/6891e15974b6031e3b553ff7fde3adc616f3e69dda1c681dfce0910c5393/gns3fy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8d04eaff50255a80a9f5465bcacfc987", "sha256": "93573357378cac50306be138cb8557feb2f2d4fc96e03ba9a51605d0f7e0f526" }, "downloads": -1, "filename": "gns3fy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8d04eaff50255a80a9f5465bcacfc987", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 10244, "upload_time": "2019-08-01T20:25:14", "url": "https://files.pythonhosted.org/packages/7b/c9/7ebf466690e1de4119acc2914d0042c0b39be1726033a47a5335dbf16a55/gns3fy-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "b21f476d7d8a28433a34b7a9c6f94459", "sha256": "48e3f422ec686e506cc05c0ecf9854625bf59c57d237cd74685b52e2f10f3eaf" }, "downloads": -1, "filename": "gns3fy-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b21f476d7d8a28433a34b7a9c6f94459", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 11332, "upload_time": "2019-08-18T22:37:16", "url": "https://files.pythonhosted.org/packages/05/23/4871d677a5f6a37930a99268f29be795e0b8f55fb0f6e5457e19dd5d5fe0/gns3fy-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "19ed0bf3ee2f52f437c13c3a197f1679", "sha256": "d15c529e2af57491f3c5fc25ae726b18bfc9e317abd2b25d3682f8127c2ab44d" }, "downloads": -1, "filename": "gns3fy-0.2.0.tar.gz", "has_sig": false, "md5_digest": "19ed0bf3ee2f52f437c13c3a197f1679", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 13492, "upload_time": "2019-08-18T22:37:18", "url": "https://files.pythonhosted.org/packages/07/9a/83877a599f3318cf5d49dd992ee35387f26c5452ca6b481d484e2887045b/gns3fy-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "0e2dc3339fdb05180e814a5267b56f22", "sha256": "ce681ddcaeb36fb01e670dde1b170b3b5e1366edef5030bfeae5022213ba580d" }, "downloads": -1, "filename": "gns3fy-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0e2dc3339fdb05180e814a5267b56f22", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 11984, "upload_time": "2019-09-11T14:13:30", "url": "https://files.pythonhosted.org/packages/a5/51/7a0e7b1d9487587d48494f696fe87209054554b7c8ce093445ccc4aab88f/gns3fy-0.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c3343ed0b17ae0656a424fca71355439", "sha256": "fd3f831f1d2e29e5cc3f84baf8a4fa37578a358aae504fa4e1f38c6e8a401b48" }, "downloads": -1, "filename": "gns3fy-0.3.0.tar.gz", "has_sig": false, "md5_digest": "c3343ed0b17ae0656a424fca71355439", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 14568, "upload_time": "2019-09-11T14:13:31", "url": "https://files.pythonhosted.org/packages/fb/0d/00e3d22e75e65bdcb321ee04e783f40effc26bb92631a1fbefbba02851b5/gns3fy-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "e195531268ae2b9f0932bf62d3310a37", "sha256": "8dee91a0a60ec54002e1ee5a0b4b661d76df32df77c39d6ab9bab48407050771" }, "downloads": -1, "filename": "gns3fy-0.4.0-py3-none-any.whl", "has_sig": false, "md5_digest": "e195531268ae2b9f0932bf62d3310a37", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.7,<4.0", "size": 12634, "upload_time": "2019-09-18T11:40:15", "url": "https://files.pythonhosted.org/packages/bd/f6/29ba93e7d2e23d36bd2ca2d17f7da92c534cd0108c049e6e20e5a9e6f087/gns3fy-0.4.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e327ca27c9e9b3f106c9a94bc1f0b63e", "sha256": "c5ed40d2d724fd1bd1b9d7629d922a6a9d6157b041b5c1c531a48aa8315a82b5" }, "downloads": -1, "filename": "gns3fy-0.4.0.tar.gz", "has_sig": false, "md5_digest": "e327ca27c9e9b3f106c9a94bc1f0b63e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.7,<4.0", "size": 15357, "upload_time": "2019-09-18T11:40:17", "url": "https://files.pythonhosted.org/packages/db/9f/d5bedd265a1eafc4571587cfea1e7d09ce85743efa49266bcdb4e093c52d/gns3fy-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "62a81008f008539b7e7fe6ddae4c7fef", "sha256": "b1091472846c464e50a136b68151eeb0968364b4c28cb90f74b4d0e7a5c5f1b6" }, "downloads": -1, "filename": "gns3fy-0.4.1-py3-none-any.whl", "has_sig": false, "md5_digest": "62a81008f008539b7e7fe6ddae4c7fef", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 12635, "upload_time": "2019-09-18T11:52:21", "url": "https://files.pythonhosted.org/packages/b5/e5/0ef499fd0651a54d8be5bbff8de0dd37f5a5acaebbc9e1c6ee5f774451e1/gns3fy-0.4.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c0969c99802947ef73166dca04f5f923", "sha256": "249a5e6e35cec9022f38e905c8bc098cef9cf302710e1d15fd0d857464c5b7e3" }, "downloads": -1, "filename": "gns3fy-0.4.1.tar.gz", "has_sig": false, "md5_digest": "c0969c99802947ef73166dca04f5f923", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 15362, "upload_time": "2019-09-18T11:52:22", "url": "https://files.pythonhosted.org/packages/29/47/b7a3456089d352d968eb978d0a5c2699eef2cfd0fc579bbd13971ea1074c/gns3fy-0.4.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "109819db38cf67059bf5bdf2d21afb3c", "sha256": "6e85538bd4441d33eb44ea7ee2fb7d577991f6bbb7f00174fbc4e8c82448a017" }, "downloads": -1, "filename": "gns3fy-0.5.0-py3-none-any.whl", "has_sig": false, "md5_digest": "109819db38cf67059bf5bdf2d21afb3c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 13590, "upload_time": "2019-09-29T08:53:09", "url": "https://files.pythonhosted.org/packages/47/57/970e7a77f117b5c5c19090255f90df237b56cd489ef1f63b5268ba6450c4/gns3fy-0.5.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e2a290edc18ebf3550bd1f1556cb74dd", "sha256": "6b37225c12ba0f224493440315b9be30cfdf4ae1b3a4a04cd48bbe3b1db22280" }, "downloads": -1, "filename": "gns3fy-0.5.0.tar.gz", "has_sig": false, "md5_digest": "e2a290edc18ebf3550bd1f1556cb74dd", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 16508, "upload_time": "2019-09-29T08:53:11", "url": "https://files.pythonhosted.org/packages/c4/36/522dc1cb690ec14baca228cf2b93810c7483db46babc4492c4b679371d1d/gns3fy-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "27451283d6a037cd28a26b352f6dc910", "sha256": "56374513e6be25cb0be3ad6494df3555c1a21944d3b9ec0447d24701a1e0d4db" }, "downloads": -1, "filename": "gns3fy-0.5.1-py3-none-any.whl", "has_sig": false, "md5_digest": "27451283d6a037cd28a26b352f6dc910", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 13633, "upload_time": "2019-10-01T10:01:30", "url": "https://files.pythonhosted.org/packages/23/f6/114e620a9391ca90a41af1c3e9677f5e60633d759bddc700636812f6e1e7/gns3fy-0.5.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf7b48ec2e831ab2595c156c2bc92b6e", "sha256": "4d80a8bc111603032e09f71a288e36a6f88e6a55af399cd7162efcd9d2c51b13" }, "downloads": -1, "filename": "gns3fy-0.5.1.tar.gz", "has_sig": false, "md5_digest": "bf7b48ec2e831ab2595c156c2bc92b6e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 16542, "upload_time": "2019-10-01T10:01:32", "url": "https://files.pythonhosted.org/packages/71/d9/f2ac4c9160ec61a1d9c15524e4e6701bf53f93559fd4e4ecc8effeeae575/gns3fy-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "0c9fb205311a12cc9f77bfd880cecafa", "sha256": "ee1e8bc26452bf4e8856eb543239b478da05f8a48793d0acc6eb30d58dad7fbf" }, "downloads": -1, "filename": "gns3fy-0.5.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0c9fb205311a12cc9f77bfd880cecafa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 13692, "upload_time": "2019-10-01T12:14:23", "url": "https://files.pythonhosted.org/packages/e9/f2/e767ae5a720e2119ee9f7da52c90326df08dccf768671ba148b2bab7c8e7/gns3fy-0.5.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6bd0844bc0adf07d72e83c12a9812fa", "sha256": "0bbded68195fe4886c6357c497fb71cd4cb4ce60ee9600bf79ca3f45518e170f" }, "downloads": -1, "filename": "gns3fy-0.5.2.tar.gz", "has_sig": false, "md5_digest": "e6bd0844bc0adf07d72e83c12a9812fa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 16602, "upload_time": "2019-10-01T12:14:25", "url": "https://files.pythonhosted.org/packages/7e/56/375c3e3eedb969aa2bf3e85b434ac7d5007c82c10aa23993dfd68908c5a4/gns3fy-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0c9fb205311a12cc9f77bfd880cecafa", "sha256": "ee1e8bc26452bf4e8856eb543239b478da05f8a48793d0acc6eb30d58dad7fbf" }, "downloads": -1, "filename": "gns3fy-0.5.2-py3-none-any.whl", "has_sig": false, "md5_digest": "0c9fb205311a12cc9f77bfd880cecafa", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6,<4.0", "size": 13692, "upload_time": "2019-10-01T12:14:23", "url": "https://files.pythonhosted.org/packages/e9/f2/e767ae5a720e2119ee9f7da52c90326df08dccf768671ba148b2bab7c8e7/gns3fy-0.5.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6bd0844bc0adf07d72e83c12a9812fa", "sha256": "0bbded68195fe4886c6357c497fb71cd4cb4ce60ee9600bf79ca3f45518e170f" }, "downloads": -1, "filename": "gns3fy-0.5.2.tar.gz", "has_sig": false, "md5_digest": "e6bd0844bc0adf07d72e83c12a9812fa", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6,<4.0", "size": 16602, "upload_time": "2019-10-01T12:14:25", "url": "https://files.pythonhosted.org/packages/7e/56/375c3e3eedb969aa2bf3e85b434ac7d5007c82c10aa23993dfd68908c5a4/gns3fy-0.5.2.tar.gz" } ] }