Lab – Explore YANG models using the pyang tool
Objectives
Part 1: Install the pyang Python module
Part 2: Download YANG models for the IOS XE
Part 3: Use the pyang command line tool to transform the YANG models
Back
...
Lab – Explore YANG models using the pyang tool
Objectives
Part 1: Install the pyang Python module
Part 2: Download YANG models for the IOS XE
Part 3: Use the pyang command line tool to transform the YANG models
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 more easily human readable format. Using the “tree” view
transformation, you will identify what are the key elements of the ietf-interfaces YANG model.
Required Resources
• Access to the Internet
• Python 3.x environment
Part 1: Install the pyang Python module
In this part, you will install pyang module into your Python environment. Pyang is a python module that
simplifies working with YANG files. The Pyang Python module comes with a pyang command line executable
that transforms YANG files into a more human readable format (tree, html, etc.).
Step 1: Use pip to install pyang.
a. Start a new Windows command prompt (cmd).
b. Install pyang using pip in the Windows command prompt:
pip install --no-binary pyang pyang
NOTE: on mac or linux you can simply “pip install pyang” but temporarily on
Windows the binary WHL file won’t include the Windows executable pyang file.
c. Verify that pyang has been successfully installed. In the command prompt, type:
pyang -v
to display the installed pyang version
[Show More]