ciscotestautomation / pyats.contrib Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
I tried to generate testbed.yaml file from xlsx file.
I run the same code on different ubuntu box, both are running 18.4. pyats version is 20.9 on both box as well.
One is ok and the other throw the error as the attachment.
The only difference I can find is the working ubuntu is running xlrd version 1.2, but the other one is running with version 2.0.
Does it related to the below issue?
I've run into an issue with creating testbed file with pyats==22.3
and after.
Everything works fine with version pyats==22.2
.
Netbox version 3.2.3
pyats create testbed netbox --output=out --netbox-url=<NETBOX_URL> --user-token=<TOKEN>--verbose --def_user=<USER> --def_pass=<PASSWORD> --url_filter="platform_id__n=null&has_primary_ip=True"
Begin retrieving data from netbox...
Starting new HTTPS connection (1): <NETBOX_URL>:443
<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&platform_id__n=null&has_primary_ip=True HTTP/1.1" 200 102346
Starting new HTTPS connection (1): <NETBOX_URL>:443
<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&has_primary_ip=True&limit=50&offset=50&platform_id__n=null HTTP/1.1" 200 109298
Starting new HTTPS connection (1): <NETBOX_URL>:443
<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&has_primary_ip=True&limit=50&offset=100&platform_id__n=null HTTP/1.1" 200 108083
Starting new HTTPS connection (1): <NETBOX_URL>:443
<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&has_primary_ip=True&limit=50&offset=150&platform_id__n=null HTTP/1.1" 200 26860
Starting new HTTPS connection (1): <NETBOX_URL>:443
<NETBOX_URL>:443 "GET /api/virtualization/virtual-machines/?format=json&platform_id__n=null&has_primary_ip=True HTTP/1.1" 200 52
Retrieving associated data for DEV1...
Retrieving associated data for DEV2...
OS type is not valid for DEV3. Skipping...
Testbed file generated:
out
pyats create testbed netbox --output=out --netbox-url=<NETBOX_URL> --user-token=<TOKEN>--verbose --def_user=<USER> --def_pass=<PASSWORD> --url_filter="platform_id__n=null&has_primary_ip=True"
Begin retrieving data from netbox...
Starting new HTTPS connection (1): <NETBOX_URL>:443
https://<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&platform_id__n=null&has_primary_ip=True HTTP/1.1" 200 102346
Starting new HTTPS connection (1): <NETBOX_URL>:443
https://<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&has_primary_ip=True&limit=50&offset=50&platform_id__n=null HTTP/1.1" 200 109298
Starting new HTTPS connection (1): <NETBOX_URL>:443
https://<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&has_primary_ip=True&limit=50&offset=100&platform_id__n=null HTTP/1.1" 200 108083
Starting new HTTPS connection (1): <NETBOX_URL>:443
https://<NETBOX_URL>:443 "GET /api/dcim/devices/?format=json&has_primary_ip=True&limit=50&offset=150&platform_id__n=null HTTP/1.1" 200 26860
Starting new HTTPS connection (1): <NETBOX_URL>:443
https://<NETBOX_URL>:443 "GET /api/virtualization/virtual-machines/?format=json&platform_id__n=null&has_primary_ip=True HTTP/1.1" 200 52
Retrieving associated data for DEV1...
Traceback (most recent call last):
File "src/pyats/cli/base.py", line 207, in pyats.cli.base.Command.main
File "src/pyats/cli/base.py", line 337, in pyats.cli.base.CommandWithSubcommands.run
File "src/genie/cli/commands/create_testbed.py", line 34, in genie.cli.commands.create_testbed.CreateTestbed.run
File "/home/jankrupa/pyats_newest/venv/lib/python3.8/site-packages/pyats/contrib/creators/creator.py", line 208, in to_testbed_file
testbed = self._generate()
File "/home/jankrupa/pyats_newest/venv/lib/python3.8/site-packages/pyats/contrib/creators/netbox.py", line 634, in _generate
self._get_info(device,self._custom_data_source))
File "/home/jankrupa/pyats_newest/venv/lib/python3.8/site-packages/pyats/contrib/creators/netbox.py", line 535, in _get_info
for key in keys:
TypeError: 'NoneType' object is not iterable
'NoneType' object is not iterable
Problem with iterating through None
https://github.com/CiscoTestAutomation/pyats.contrib/blob/release_22.4/src/pyats/contrib/creators/netbox.py#L535
Hello,
I hope this is the right place for my issue.
I have an issue while creating a testbed file from netbox.
Netbox version: v2.11.2
Steps:
Output:
Begin retrieving data from netbox...
'NoneType' object is not iterable
I had more arguments in the begining and reduced the arguments to the required ones.
I get the same error everytime.
Any ideas what I'm doing wrong or is this a bug?
Error is in file netbox.py
The variable self._verify
is of type str
. The requests
module expects a bool
Quick fix:
verify=False
Or fix it in the class definition
Ran into an error when trying to create a testbed from a file with this command
pyats create testbed file --path nso-sandbox-devices.xlsx --output nso-sandbox-testbed.yaml -vvv
The error at was
Traceback (most recent call last):
File "src/pyats/cli/base.py", line 207, in pyats.cli.base.Command.main
File "src/pyats/cli/base.py", line 337, in pyats.cli.base.CommandWithSubcommands.run
File "src/genie/cli/commands/create_testbed.py", line 34, in genie.cli.commands.create_testbed.CreateTestbed.run
File "/Users/hpreston/virtualenvs/std/lib/python3.8/site-packages/pyats/contrib/creators/file.py", line 68, in to_testbed_file
testbed = self._generate()
File "/Users/hpreston/virtualenvs/std/lib/python3.8/site-packages/pyats/contrib/creators/file.py", line 124, in _generate
devices = self._read_device_data(self._path)
File "/Users/hpreston/virtualenvs/std/lib/python3.8/site-packages/pyats/contrib/creators/file.py", line 139, in _read_device_data
_, extension = os.path.splitext(file)
File "/usr/local/Cellar/[email protected]/3.8.9/bin/../Frameworks/Python.framework/Versions/3.8/lib/python3.8/posixpath.py", line 118, in splitext
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not bool
expected str, bytes or os.PathLike object, not bool
Changing the file names to use underscores instead of dashes worked no problem.
pyats create testbed file --path nso_sandbox_devices.xlsx --output nso_sandbox_testbed.yaml -vvv
Testbed file generated:
nso_sandbox_devices.xlsx -> nso_sandbox_testbed.yaml
While python generally prefers underscores to dashes, this seems like a bad restriction on the creation utility. Furthermore, a much better error would be nice to the user.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.