DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1

the Cisco IOS XE version number and prints it to the
screen.


Example 15-9 pyATS Test

Click here to view code image


#! /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'])

The output variable is a Python dictionary that contains
the JSON standardized data returned by the show
version command. This makes it very easy to parse and
extract the needed data from the output of the show
command.


EXAM PREPARATION TASKS


As mentioned in the section “How to Use This Book” in
the Introduction, you have a couple of choices for exam
preparation: the exercises here, Chapter 19, “Final
Preparation,” and the exam simulation questions on the
companion website.


REVIEW ALL KEY TOPICS

Free download pdf