When dealing with complex entities such as computer networks, one has to handle a lot of data: both configurational and operational. Hence the need to conceptualize the storage of data in a structured way. Data models have come about to address this problem.
When large sets of data gets stored in a structured and well-understood way, it becomes easy to access and manipulate such data. One can even conceive of algorithms and programs to deal with such data.
If the devices on the network are able to be provisioned and monitored using such structured and modeled data, one can conceive of having algorithms for managing the network.
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.
Storing and retrieving data is one of the most important requirements for most softwares. To do so in an organized and consistent way, there are multiple approaches. However, all these approaches call for having a organized way of storing and retrieving data. In other words, the data has to conform to certain data models.
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.