Parser

Run Parser

Using CLI

  • pyats parser "show version" --testbed-file tb.yaml --devices uut

In Python Interactive Shell

from genie.testbed import load
tb = load('mock.yaml')
dev = tb.devices['nx-osv-1']
dev.connect()
p1 = dev.parse('show inventory')
print('My serial for slot1 is: ' + p1['name']['Slot 1']['serial_number'])
exit()

Pass output to parser

output = """
NAME: "1", DESCR: "WS-C3560CX-12PC-S"
PID: WS-C3560CX-12PC-S , VID: V03  , SN: FOC2419L9KY
"""

dev.parse('show inventory', output=output)

Reference

Last updated