Code Monkey home page Code Monkey logo

pyats.contrib's People

Contributors

ahersi2-cisco avatar bastell avatar chowed85 avatar danielgraziano avatar danmill2 avatar domachad avatar dwapstra avatar edmchow avatar fwclements avatar gerriorl avatar hpreston avatar jeaubin avatar jeremypng avatar kani999 avatar karmoham avatar lkwatciscodotcom avatar lsheikal avatar lukasmcclelland avatar omehrabi avatar renatoalmeidaoliveira avatar simingy avatar taarini avatar tahigash avatar terraytm avatar thomasjryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyats.contrib's Issues

Unable to create testbed.yaml with xlsx file

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?
error

equinor/fmu-tools#88

Unable to use Netbox Testbed Creator after 22.3

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

version 22.2

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

version 22.3 and 22.4

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

pyats create testbed netbox issue

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:

  1. create new folder and cd into it
  2. create venv and activate
  3. pip install "pyats[full]" and pip install pyats.contrib (Requirements already satisfied by "pyats[full]", I guess)
  4. cd into bin folder
  5. pyats create testbed netbox --output testbed.yaml --netbox-url=https://netbox.domain.com --user-token=XXX

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?

Testbed File Creator fails with paths including "-"

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.