8.3.5 Lab - Explore YANG Models
8.3.5 Lab - Explore YANG Models
8.3.5 Lab - Explore YANG Models
Objectives
Part 1: Launch the DEVASC VM
Part 2: Explore a YANG Model on GitHub
Part 3: Explore a YANG Model Using pyang
Background / Scenario
YANG models define the exact structure, data types, syntax and validation rules for the content of messages
exchanged between a managed device and another system communicating with the device. Working with
files using the YANG language can be a bit overwhelming for the level of details in these files.
In this lab, you will learn how to use the open source pyang tool to transform YANG data models from files
using the YANG language, into a much easier to read format. Using the “tree” view transformation, you will
identify what the key elements of the ietf-interfaces YANG model are.
Required Resources
• 1 PC with operating system of your choice
• Virtual Box or VMWare
• DEVASC Virtual Machine
Instructions
© 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 1 of 4 www.netacad.com
Lab - Explore YANG Models
default "true";
description
"This leaf contains the configured, desired state of the
interface.
Systems that implement the IF-MIB use the value of this
leaf in the 'running' datastore to set
IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
has been initialized, as described in RFC 2863.
Changes in this leaf in the 'running' datastore are
reflected in ifAdminStatus, but if ifAdminStatus is
changed over SNMP, this leaf is not affected.";
reference
"RFC 2863: The Interfaces Group MIB - ifAdminStatus";
}
devasc@labvm:~/labs/devnet-src/pyang$
© 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 2 of 4 www.netacad.com
Lab - Explore YANG Models
You now have a local version of the ietf-interfaces.yang model that you can manipulate with pyang.
Validates the YANG module in <filename> (or stdin), and all its dependencies.
Options:
-h, --help Show this help message and exit
-v, --version Show version number and exit
<output omitted>
-f FORMAT, --format=FORMAT
Convert to FORMAT. Supported formats are: yang, yin,
dsdl, jstree, jsonxsl, capability, identifiers, jtox,
uml, name, omni, tree, depend, sample-xml-skeleton
<output omitted>
devasc@labvm:~/labs/devnet-src/pyang$
c. Transform the ietf-interfaces.yang model into a tree format with the following command. Notice that the
leaf enabled is much easier to find and read in this format.
devasc@labvm:~/labs/devnet-src/pyang$ pyang -f tree ietf-interfaces.yang
© 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 3 of 4 www.netacad.com
Lab - Explore YANG Models
© 2020 - 2020 Cisco and/or its affiliates. All rights reserved. Cisco Public Page 4 of 4 www.netacad.com