With the YANG language, we can model the data for an application in a YANG module. For example, we can model the data for the BGP protocol in a YANG module.
A YANG module comes with its own revision history and has rules for backward compatibility.
However, it is also interesting to have a way to model sets of YANG models. This can be useful in determining which set of models are supported in an implementation. This is where the YANG library becomes very useful. This allows a way of tracking which set of YANG modules are supported on a particular server.
One of the interesting aspects of YANG is the kind of tooling it enables. Because of it’s structured tree-like nature, it naturally renders itself to have corresponding API (corresponding to each model). These API can either be generic path-based (similar to XPath) or specific to each data model (as it is in YDK).
This API can then be used in various tools which may be used to configure and monitor devices which support the corresponding models. Also applications which deal with processing the modeled data can make use of such API.
The YANG data modeling language has several attractive features:
- It is relatively easy to read and understand
- It is relatively easy to extend
- It enables expressing syntactical and semantic constraints
- It enables programmability, for example, by enabling code generation
- It can be easily transformed into data instances expressed as JSON or XML
One of the reasons why modeled data is a powerful advancement is that it makes processing of such data easier. It allows for programmability and automation. When much of the networking data is CLI-based, the operational and configuration data from network devices is mostly hand-crafted. As a result, there has to be a lot of screen-scraping and manual testing to process such data. With the advent of modeled data, which could be modeled using a language like YANG, it can be easily processed by automated programs.
When it comes to storing, retrieving and analyzing large chunks of data, it is greatly helpful if the said data conforms to some model instead of being unstructured free form data. This is where data modeling languages like YANG come in.
The beauty of YANG is that it lets the consumers know the specific details of the data, including constraints like range, allowed regex patterns among many others.
It also can model semantic constraints, meaning that it can tell you if a value is allowed in a certain context.