ENAUTO – How to find YANG Models for different vendors on GITHUB, and how to view them using Linux Terminal!

yang11

Created a new lab in EVE with a working Ubuntu 16.04 Desktop VM within it, bridged to the LAN at my house along with 4 x 7200 series routers to do some automation stuff, so we are inching closer to getting out of the fundamentals and back into labbing! πŸ™‚

I took a screen grab as I thought it was funny that it was asking me for a Room # / Work # / Home # for Loopedback, like I would ever give that to ANYONE except maybe my HR πŸ™‚

Anyways.

This will be a less blah blah blah from me this post, and a pretty straight forward look at how to review YANG Data models, which can be found by typing in “YANG GitHub” into Google and it appears they have folders for either NX-OS or IOS-XE devices.

This is the first page you should land on, and highlighted is the folder path I’ll take:

yang1

Which clicking into this I believe brings you to folders for YANG Models for each IOS release for this IOS Image type as shown here, I will go with 16.62 to check out:

yang2

I click into this folder, and this is the mother load of modules for this Cisco IOS release:

yang3

Where you can actually literally see the correlation between SNMP MIBs and YANGs Modules, as MIB are YANG Modules, which when you click into one such as acl.yang:

 

All of these modules are huge, and once you look through them they make sense in their logic, however the values such as “Type of Service” Containers filled with ToS values were kind of a mystery to me, however they may be used in this IOS ACLs so who knows.

To obtain the Yang models you don’t even need a GitHub account, that is more for your own personal Repository or Collaborating on a Repository, you just need to find the page which in this case is at the following URL:

https://github.com/YangModels/yang

You can either download it to your OS as a zip file as shown here:

yang6

Or even better you can grab the URL from this “Clone or Download” dropdown, and copy the URL within it to use on the Ubuntu Terminal with the command “sudo clone (URL)” as shown here:

Copy the URL from GitHubs download drop down menu, not the web browser URL!

You will notice the link in the Download menu ends in a .git format, which is what we need, so always use the Download URL and not the one in your web browser although they are almost identical!

First make sure you have “GIT” installed on your Ubunutu Desktop via the Terminal:

GIT_Install

One thing to note is that I am not seeing “Clone” options for Vendor Specific Repositories, only the Root(ish) type directory /YANG/ shown here on GitHub:

yang8

However that being said, lets see if we can clone this Repository to our Ubuntu Box:

 

git_install2

So now we have the ENTIRE YANG REPOSITORY at our disposal on the command line here in Linux to Navigate, review data formats, and all that fun stuff as shown below:

yang11

So this shows all the vendors that you can choose to look through every directory / folder as you would have been able to in GitHub, the “ls” there showing the 611 YANG Library:

yang9

I am getting having trouble for getting the Terminal / Bash Shell command “pyang” working to display these .yang files in the Terminal, however the beauty of Ubuntu Desktop, is that the changes you make on the Terminal translate to the Desktop:

yang22

From the desktop there is a new folder (the Directory made itself when the GIT Clone was done to import these YANG Modules), and it brought with it all vendors / vendor Modules as well that you can open the file to review the same as the Terminal:

I’ll past this in two parts so you can see Containers inside Containers, and their leaves, and finally how their Curly Brackets } close these Containers up towards the bottom of just a few dozen lines here:

yang33

yang44.PNG

And this is a random module I clicked just to demo, you can go through these at your hearts desire, my only curiosity here is that it appears to referring to XML and YANG Containers and Leafs while also referring to Python “list” sections.

I am sure I will be digging into this much more.

That will do it for this YANG post!

Good to jump back into Ubuntu and started navigating tools once again, I looked forward into getting back into that more and more as the intro stay hopefully begins to fade πŸ™‚

Once I reboot the VM and figure out why “pyang” is not working I will replace the “I don’t know” part with a screenshot of the command showing YANG Data Models of these Modules to finish this off, h

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s