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'])