Network Automation using YANG Models across XE, XR, & NX

Cisco's YDK-Gen


In a prior module, we covered the usage of YDK for configuring and reading operational data from devices. Let's now explore the more advanced capabilities of YDK, this time programatically generating Python class bindings directly from YANG models.


Overview

In this portion of the lab, you will perform the following:

  1. From GitHub, download the ydk-gen repository.
  2. From the ydk-gen repository, install the ydk-gen Python requirements.
  3. From the devices, download select YANG models and save them to disk.
  4. From the saved YANG models, use ydk-gen to generate a Python package.
  5. From pip, install the Python package generated from ydk-gen.
  6. From Python, import our generated code.
  7. From Python, interact with our devices using the generated classes.

This workflow demonstrates how all the building blocks fit together by layering knowledge from the prior lab sections. An entire course could be dedicated to ydk-gen alone, so for this exercise we will focus on the fundamentals of installing the tool, importing the code, and working with the fundamentals that get you up and running in the fastest way possible such that you can create your own Python bindings from any arbitrary YANG model.