cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
412
Views
0
Helpful
1
Replies

pyATS testbed

netmart2
Level 1
Level 1

Hello,

I am trying to run this simplified  testbed file and receive the following issue:

Also if you could please advise on the platform value required in testbed.yaml file when using cat4500.

PID: WS-C4507R+E

$ python3 pyATSTEST.py
Traceback (most recent call last):
File "src/pyats/utils/yaml/loader.py", line 176, in pyats.utils.yaml.loader.Loader.load
File "src/pyats/utils/schemaengine.py", line 242, in pyats.utils.schemaengine.Schema.validate
File "src/pyats/utils/schemaengine.py", line 213, in pyats.utils.schemaengine.Schema.apply_fallback
File "src/pyats/datastructures/listdict.py", line 253, in pyats.datastructures.listdict.ListDict.reconstruct
TypeError: string indices must be integers

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/wolfm/CiscoDevNet/200-901/Mod1.3-SoftDev/pyATSTEST.py", line 4, in <module>
tb = load('testbed.yaml')
File "src/genie/testbed.py", line 4, in genie.testbed.load
File "src/genie/conf/main.py", line 103, in genie.conf.main.Genie.init
File "/home/wolfm/.local/lib/python3.10/site-packages/pyats/topology/loader/__init__.py", line 44, in load
return TestbedFileLoader(**init_kwargs).load(loadable, **kwargs)
File "src/pyats/utils/yaml/loader.py", line 181, in pyats.utils.yaml.loader.Loader.load
File "src/pyats/utils/schemaengine.py", line 242, in pyats.utils.schemaengine.Schema.validate
File "src/pyats/utils/schemaengine.py", line 213, in pyats.utils.schemaengine.Schema.apply_fallback
File "src/pyats/datastructures/listdict.py", line 253, in pyats.datastructures.listdict.ListDict.reconstruct
TypeError: string indices must be integers

 

testbed.yaml

---
devices:
  cisco-switch:
    type: 'router'
  os: 'iosxe'
  platform: WS-C4507R+E
  alias: 'uut'
  credentials:
    default:
      username: cisco
      password: test
  connections:
    cli:
        protocol: ssh
        port: 22
        ip: "10..0.0.1"

pyATStest.py

#! /usr/bin/env python
from genie.testbed import load
# Load the testbed
tb = load('testbed.yaml')
# Find the device with alias uut
dev = tb.devices['uut']
# Connect to the device
dev.connect()
# Parse the output of the show version command
output = dev.parse('show version')
# Extract the version number and print it to the screen
print('IOS-XE version number: ' + output['version']['version'])
1 Reply 1

balaji.bandi
Hall of Fame
Hall of Fame

You need to provide more environment information for us to help :

check below guide :

https://pubhub.devnetcloud.com/media/pyats-getting-started/docs/quickstart/manageconnections.html?highlight=telnet

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help