Name | dcnodatg JSON |
Version |
1.0.10.4
JSON |
| download |
home_page | None |
Summary | Gets run-state details from a list of Arista switches and builds a GNS3 virtual-lab to emulate them. |
upload_time | 2024-10-24 01:41:53 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.12 |
license | Modified BSD License ==================== *Copyright © 2024, H. L. Mencken Davidson* *All rights reserved.* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of dcnodatg nor the names of its contributors may be used to endorse or promote products, derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL H. L. MENCKEN DAVIDSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
arista
eapi
eos
gns3
lab
virtual
ceos
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Preamble
I wrote this package (dcnodatg) specifically to assist in *fast/low-effort* modeling of a production EVPN Layer-3 Leaf & Spine physical network of Arista switches in a pre-existing GNS3 server, using Arista cEOS docker images. (Also, to teach myself how to write/publish Python packages, but *really* for modeling Arista switches.)
- Documentation at: [https://menckend.github.io/dcnodatg/](https://menckend.github.io/dcnodatg/)
- Repository at: [https://github.com/menckend/dcnodatg](https://github.com/menckend/dcnodatg)
- (Latest) Package at: [https://pypi.org/project/dcnodatg/](https://pypi.org/project/dcnodatg/)
- (testing) Package at: [https://test.pypi.org/project/dcnodatg/](https://test.pypi.org/project/dcnodatg/)
## What it does
- Grabs startup configuration, version info, and lldp neighbor information from a list of Arista switches
- Uses Arista eAPI (credentials must be provided as arguments) to retrieve all data
- Sanitizes the switch configs for use in a cEOS environment
- Removes all AAA and username configuration
- Reformats interface names to match the cEOS interface naming convention Ethernet_n , not Ethernt_n/1
- Comments out incompatible commands ("queue..." not supported on cEOS)
- Configures the system mac-address of the production switch
- Increase verisimilitude with prod device that is being modeled
- Avoids mLAG incompatibility with cEOS
- Docker container default mac address has U/L bit set to L instead of U, which prevents MLAG from working
- Builds a table of interconnections between the switches
- Inferred from the "show lldp neighbor" and "show lldp local" output
- Creates a GNS3 project
- Instantiates a cEOS container node in the project for each switch in the input list
- Modeled devices mirror the following properties of the switches they are modeling:
- cEOS version (a pre-existing GNS3 docker template using the matching cEOS version must be present)
- Ethernet interface count
- system-mac-address
- Startup configuration
- "startup-config" is pushed from the dcnodatg package directly to the containerd service on the GNS3 server
- Avoiding the need for dcnodatg to run *on* the gns3 server
- Creates the connections between the GNS3/cEOS nodes, mirroring all inter-switch connections discovered in LLDP tables
## What you'll need
### Python
- The dcnodatg project was written using Python 3.12.
- I haven't tested it with any other versions.
- The host running the dcnodatg packages will need to have Python and the packages listed in the dependencies section of pyproject.toml installed
- Once Python is installed, use pip to install either the test or "stable" version of dcnodatg (which will install its dependencies as well):
- For the test version:
- 'pip install -i https://test.pypi.org/simple/ --no-cache --user --extra-index-url https://pypi.org/simple dcnodatg'
- For the "real" version:
- 'pip install --user dcnodatg'
### GNS3 server
- The dcnodatg module was written against version 2.2.18 of GNS3 server.
- The GNS3 server must be pre-configured with cEOS docker templates
- dcnodatg will compare the EOS version string on the switches you tell it to process to the tags of the docker-images on the GNS3 server
- The docker images need to be named as "ceos:*n.n...*" for the matching to work
- The containerd service must be listening on TCP port 2375 of the GNS3 server
### Arista Switches
All switches that you will be modeling will need to have:
- EAPI services accessible from the host running the dcnodatg module
- And you will need to provide auth. credentials with sufficient privileges to invoke the following methods:
- node.enable(("show version", "show lldp neighbors", "show lldp local-info"), format="json")
- node.startup_config.splitlines()
### Instructions
### Prep
- Have Python and the dcnodatg package installed on the host that will run dcnodatg
- Have your login credentials for your production switches handy
- Make sure that your production switches can receive eAPI connections from your GNS3 server
- Optionally, create a file named "input-switch-list"
- - Populate 'input-switch-list' with the names of the switches that you want to model in gns3
- One switch name per line (no quotes or commas)
### Parameter/argument list
dcnodatg uses the following arguments (passed as keyword pairs):
- filename *or* switchlist
- No default value
- If *both* arguments are provided, dcnodatg will exit.
- If *no* argument is provided, dcnodatg will try use the input function to prompt for switch names
- "filename" is (path and) name of the file containing the list of switches to process
- One switch-name (FQDN or resolvable short-name) per line in the file
- E.G.: ./switch-list.txt
- "switchlist" is a python list of switch-names
- E.g.: ["name1", "name2", "nameN"]
- servername
- No default value
- The name (FQDN or resolvable short-name) of the GNS3 server
- If not provided, dcnodatg will try to use the input function to prompt for a value
- E.g.: gns3server.whathwere.there
- username
- No default value
- The username dcnodatg will provide to the switches when authenticating the eapi connections
- If not provided, dcnodatg will try to use the input function to prompt for a value
- passwd
- No default value
- The password dcnodatg will provide to the switches when authenticating the eapi connections
- If not provided, dcnodatg will try to use the input function to prompt for a value
- prjname
- No default value
- The name to assign to the new project that dcnodatg will create on the GNS3 server
### Execution
#### As a Python script
Installing dcnodatg via pip will save you the effor of installing the additional dependencies list in pyproject.toml, but you can also just grab the contents of the dcnodatg folder [directly from the git repository](https://github.com/menckend/dcnodatg/tree/main/dcnodatg) and store them on the host you'll run them from.
You'll also need to move the "dcnod-cli.py" file *up* one level in the directory structure from the dcnodatg folder after copying the entire folder to your host. This is to work around "goofiness" with regards to how Python treats namespaces when accessing Python code as a "script" vs accessing it "as a module."
To actually run the utility, you'll enter the following command:
```
python [path-to]dcnod-cli.py'
```
##### To run interactively
Enter:
```bash
python [path-to]dcnod-cli.py'
```
As dcnodatg executes, you will be prompted to respond with values for all of the parameters/arguments. No quotes or delimiters should be required as you enter the values.
- The FQDNs of the switches you want to process
- Type a switch-name and press Enter
- Repeat until you've entered all the switches you want to model
- Then press Enter again
- The name of the GNS3 project to create
- Type a project name (adhere to whatever GNS3's project-naming semantics) and press enter
- The EOS username to use when querying the switches
- Type the name and press enter
- The EOS password to use when querying the switches
- The getpass function is used, obscuring the password on-screen as you type it
- The password itself isn't written to any file
- Type the password and press Enter
- The FQDN of the GNS3 server you'll be using
##### To run non-interactively
Enter:
```python
python [path-to]dcnod-cli.py [arguments]
```
The arguments are keyword/value pairs, in the form of:
```python
keyword='value'
```
The arguments can be entered in any order, separate by a space. Examples of each argument follow:
```text
username= 'mynameismud'
passwd= 'mypasswordisalsomud'
servername= 'gns3server.menckend.com'
switchlist= 'sw1.menckend.com sw2 sw3 sw4.menckend.com'
filename= './switchlist.txt'
prjname= 'dcnodatg-project-dujour'
```
Remember that the switchlist and filename arguments are mutually exclusive, if you pass *both*, dcnodatg will exit.
An example of a fully-argumented invocation would be:
```bash
python ./dcnodatg.py username='fakeid' passwd='b@dp@ssw0rd' servername='gn3server.com' prjname='giveitanme' switchlist='switch1 switch2 switch3'
```
##### As a Python module
Install dcnodatg with pip as described above and include an import statement ('import dcnodatg') in your python module. E.g.
```python
from dcnodatg import dcnodatg
sn='gns3server.bibbity.bobbity.boo'
un='myuserid'
pw='weakpassword'
prjn='new-gns3-project-today'
sl=['switch1.internal', 'switch15.internal', 'switch1.menckend.com']
dcnodatg.p_to_v(username=sn, passwd=pw, servername=sn, switchlist=sl, prjname=prjn)
```
> [!IMPORTANT]
> The 'switchlist' parameter, when dcnodatg is being accessed as a module is a dict structure, and the formatting in the example above is mandatory when specifying the switchlist data as a kwarg.
Raw data
{
"_id": null,
"home_page": null,
"name": "dcnodatg",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": "Mencken Davidson <mencken@gmail.com>",
"keywords": "arista, eapi, eos, gns3, lab, virtual, ceos",
"author": null,
"author_email": "Mencken Davidson <mencken@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/43/15/2ad43d022be5622581d434cca305faadf376f5cf05518c4ca00fd1da89d5/dcnodatg-1.0.10.4.tar.gz",
"platform": null,
"description": "# Preamble\n\nI wrote this package (dcnodatg) specifically to assist in *fast/low-effort* modeling of a production EVPN Layer-3 Leaf & Spine physical network of Arista switches in a pre-existing GNS3 server, using Arista cEOS docker images. (Also, to teach myself how to write/publish Python packages, but *really* for modeling Arista switches.)\n\n- Documentation at: [https://menckend.github.io/dcnodatg/](https://menckend.github.io/dcnodatg/)\n- Repository at: [https://github.com/menckend/dcnodatg](https://github.com/menckend/dcnodatg)\n- (Latest) Package at: [https://pypi.org/project/dcnodatg/](https://pypi.org/project/dcnodatg/)\n- (testing) Package at: [https://test.pypi.org/project/dcnodatg/](https://test.pypi.org/project/dcnodatg/)\n\n## What it does\n\n- Grabs startup configuration, version info, and lldp neighbor information from a list of Arista switches\n- Uses Arista eAPI (credentials must be provided as arguments) to retrieve all data\n- Sanitizes the switch configs for use in a cEOS environment\n - Removes all AAA and username configuration\n - Reformats interface names to match the cEOS interface naming convention Ethernet_n , not Ethernt_n/1\n - Comments out incompatible commands (\"queue...\" not supported on cEOS)\n - Configures the system mac-address of the production switch\n - Increase verisimilitude with prod device that is being modeled\n - Avoids mLAG incompatibility with cEOS\n - Docker container default mac address has U/L bit set to L instead of U, which prevents MLAG from working\n- Builds a table of interconnections between the switches\n - Inferred from the \"show lldp neighbor\" and \"show lldp local\" output\n- Creates a GNS3 project\n - Instantiates a cEOS container node in the project for each switch in the input list\n - Modeled devices mirror the following properties of the switches they are modeling:\n - cEOS version (a pre-existing GNS3 docker template using the matching cEOS version must be present) \n - Ethernet interface count\n - system-mac-address\n - Startup configuration\n - \"startup-config\" is pushed from the dcnodatg package directly to the containerd service on the GNS3 server\n - Avoiding the need for dcnodatg to run *on* the gns3 server\n - Creates the connections between the GNS3/cEOS nodes, mirroring all inter-switch connections discovered in LLDP tables\n\n## What you'll need\n\n### Python\n\n- The dcnodatg project was written using Python 3.12.\n - I haven't tested it with any other versions.\n- The host running the dcnodatg packages will need to have Python and the packages listed in the dependencies section of pyproject.toml installed\n- Once Python is installed, use pip to install either the test or \"stable\" version of dcnodatg (which will install its dependencies as well):\n - For the test version:\n - 'pip install -i https://test.pypi.org/simple/ --no-cache --user --extra-index-url https://pypi.org/simple dcnodatg'\n - For the \"real\" version:\n - 'pip install --user dcnodatg'\n\n### GNS3 server\n\n- The dcnodatg module was written against version 2.2.18 of GNS3 server.\n- The GNS3 server must be pre-configured with cEOS docker templates\n - dcnodatg will compare the EOS version string on the switches you tell it to process to the tags of the docker-images on the GNS3 server\n - The docker images need to be named as \"ceos:*n.n...*\" for the matching to work\n- The containerd service must be listening on TCP port 2375 of the GNS3 server\n\n### Arista Switches\n\nAll switches that you will be modeling will need to have:\n\n- EAPI services accessible from the host running the dcnodatg module\n - And you will need to provide auth. credentials with sufficient privileges to invoke the following methods:\n - node.enable((\"show version\", \"show lldp neighbors\", \"show lldp local-info\"), format=\"json\")\n - node.startup_config.splitlines()\n\n### Instructions\n\n### Prep\n\n- Have Python and the dcnodatg package installed on the host that will run dcnodatg\n- Have your login credentials for your production switches handy\n- Make sure that your production switches can receive eAPI connections from your GNS3 server\n- Optionally, create a file named \"input-switch-list\"\n - - Populate 'input-switch-list' with the names of the switches that you want to model in gns3\n - One switch name per line (no quotes or commas)\n\n### Parameter/argument list\n\ndcnodatg uses the following arguments (passed as keyword pairs):\n\n- filename *or* switchlist\n - No default value\n - If *both* arguments are provided, dcnodatg will exit.\n - If *no* argument is provided, dcnodatg will try use the input function to prompt for switch names\n - \"filename\" is (path and) name of the file containing the list of switches to process\n - One switch-name (FQDN or resolvable short-name) per line in the file\n - E.G.: ./switch-list.txt\n - \"switchlist\" is a python list of switch-names\n - E.g.: [\"name1\", \"name2\", \"nameN\"]\n- servername\n - No default value\n - The name (FQDN or resolvable short-name) of the GNS3 server\n - If not provided, dcnodatg will try to use the input function to prompt for a value\n - E.g.: gns3server.whathwere.there\n- username\n - No default value\n - The username dcnodatg will provide to the switches when authenticating the eapi connections\n - If not provided, dcnodatg will try to use the input function to prompt for a value\n- passwd\n - No default value\n - The password dcnodatg will provide to the switches when authenticating the eapi connections\n - If not provided, dcnodatg will try to use the input function to prompt for a value\n- prjname\n - No default value\n - The name to assign to the new project that dcnodatg will create on the GNS3 server\n\n### Execution\n\n#### As a Python script\n\nInstalling dcnodatg via pip will save you the effor of installing the additional dependencies list in pyproject.toml, but you can also just grab the contents of the dcnodatg folder [directly from the git repository](https://github.com/menckend/dcnodatg/tree/main/dcnodatg) and store them on the host you'll run them from.\n\nYou'll also need to move the \"dcnod-cli.py\" file *up* one level in the directory structure from the dcnodatg folder after copying the entire folder to your host. This is to work around \"goofiness\" with regards to how Python treats namespaces when accessing Python code as a \"script\" vs accessing it \"as a module.\"\n\nTo actually run the utility, you'll enter the following command:\n\n```\npython [path-to]dcnod-cli.py'\n```\n\n##### To run interactively\n\nEnter:\n\n```bash\npython [path-to]dcnod-cli.py'\n```\n\nAs dcnodatg executes, you will be prompted to respond with values for all of the parameters/arguments. No quotes or delimiters should be required as you enter the values.\n\n- The FQDNs of the switches you want to process\n - Type a switch-name and press Enter\n - Repeat until you've entered all the switches you want to model\n - Then press Enter again\n- The name of the GNS3 project to create\n - Type a project name (adhere to whatever GNS3's project-naming semantics) and press enter\n- The EOS username to use when querying the switches\n - Type the name and press enter\n- The EOS password to use when querying the switches\n - The getpass function is used, obscuring the password on-screen as you type it\n - The password itself isn't written to any file\n - Type the password and press Enter\n- The FQDN of the GNS3 server you'll be using\n\n##### To run non-interactively\n\nEnter: \n\n```python\npython [path-to]dcnod-cli.py [arguments]\n```\n\nThe arguments are keyword/value pairs, in the form of:\n\n```python\nkeyword='value'\n```\n\nThe arguments can be entered in any order, separate by a space. Examples of each argument follow:\n\n```text\nusername= 'mynameismud'\npasswd= 'mypasswordisalsomud'\nservername= 'gns3server.menckend.com'\nswitchlist= 'sw1.menckend.com sw2 sw3 sw4.menckend.com'\nfilename= './switchlist.txt'\nprjname= 'dcnodatg-project-dujour'\n```\n\nRemember that the switchlist and filename arguments are mutually exclusive, if you pass *both*, dcnodatg will exit.\n\nAn example of a fully-argumented invocation would be:\n\n```bash\npython ./dcnodatg.py username='fakeid' passwd='b@dp@ssw0rd' servername='gn3server.com' prjname='giveitanme' switchlist='switch1 switch2 switch3'\n```\n\n##### As a Python module\n\nInstall dcnodatg with pip as described above and include an import statement ('import dcnodatg') in your python module. E.g.\n\n```python\nfrom dcnodatg import dcnodatg\n\nsn='gns3server.bibbity.bobbity.boo'\nun='myuserid'\npw='weakpassword'\nprjn='new-gns3-project-today'\nsl=['switch1.internal', 'switch15.internal', 'switch1.menckend.com']\n\ndcnodatg.p_to_v(username=sn, passwd=pw, servername=sn, switchlist=sl, prjname=prjn)\n```\n\n> [!IMPORTANT] \n> The 'switchlist' parameter, when dcnodatg is being accessed as a module is a dict structure, and the formatting in the example above is mandatory when specifying the switchlist data as a kwarg.\n",
"bugtrack_url": null,
"license": "Modified BSD License ==================== *Copyright \u00a9 2024, H. L. Mencken Davidson* *All rights reserved.* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of dcnodatg nor the names of its contributors may be used to endorse or promote products, derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \u201cAS IS\u201d AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL H. L. MENCKEN DAVIDSON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Gets run-state details from a list of Arista switches and builds a GNS3 virtual-lab to emulate them.",
"version": "1.0.10.4",
"project_urls": {
"Homepage": "https://menckend.github.io/dcnodatg",
"Issues": "https://github.com/menckend/dcnodatg/issues",
"Repository": "https://github.com/menckend/dcnodatg.git"
},
"split_keywords": [
"arista",
" eapi",
" eos",
" gns3",
" lab",
" virtual",
" ceos"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3a17d1fd964d2d493499f893e69669176f1026733966e0051b17901e7d428404",
"md5": "aa79ee335c8c8853e1b810ee448221d8",
"sha256": "8b927dce034c49b967de46cc31ac37bf306b1c2d8b0d1f9aab8a78589d4df2a9"
},
"downloads": -1,
"filename": "dcnodatg-1.0.10.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "aa79ee335c8c8853e1b810ee448221d8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 27979,
"upload_time": "2024-10-24T01:41:52",
"upload_time_iso_8601": "2024-10-24T01:41:52.807521Z",
"url": "https://files.pythonhosted.org/packages/3a/17/d1fd964d2d493499f893e69669176f1026733966e0051b17901e7d428404/dcnodatg-1.0.10.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "43152ad43d022be5622581d434cca305faadf376f5cf05518c4ca00fd1da89d5",
"md5": "6db29fc7f9bb274e2666136c9e5f9a8a",
"sha256": "cc5d0b3c94f16ef567fa65de7bffc4a9e7ea3372fe48e5f7d1db0283ddaaa16b"
},
"downloads": -1,
"filename": "dcnodatg-1.0.10.4.tar.gz",
"has_sig": false,
"md5_digest": "6db29fc7f9bb274e2666136c9e5f9a8a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 26327,
"upload_time": "2024-10-24T01:41:53",
"upload_time_iso_8601": "2024-10-24T01:41:53.890103Z",
"url": "https://files.pythonhosted.org/packages/43/15/2ad43d022be5622581d434cca305faadf376f5cf05518c4ca00fd1da89d5/dcnodatg-1.0.10.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-24 01:41:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "menckend",
"github_project": "dcnodatg",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "dcnodatg"
}