Sunday, May 24, 2020

What is data model - Yang ?

Data model provides the definition of any "anything" which can be easily understood and agreed upon. Using the generic data model, you can describe an individual in a way that is easy for others to understand.

Whatever the communication is done by using the API's are actually encoding in some data format and most of them uses the data model underneath. This is what we will be discussing in this post. Let's see how this can be understood by creating data model of car:

       
Module CAR
OEM: Ford, Volkswagen, Maruti
Engine: Diesel, Pertol
Color: Blue, Green,Black
Type: Sedan, Hatchback


Which language is used to define data models?
YANG is not name of any person but YANG (Yet Another Next Generation) is a data modelling language uses YANG language to write YANG models, providing a standardized way to model the operational and configuration data of a network device. YANG, being a language protocol independent, can then be converted into any data format encoding like XML or JSON. YANG is a language for describing any type of data models. But it was originally designed for networking data models. Below are good aspects of YANG to remember:
       
It is a very structured language
Every data model is a module
Containers are used to group related type of nodes.
Lists (It's same programming list) is used to identify nodes that are stored in sequence. 
Data types can be imported from another YANG module or defined within a module.
Each individual attribute of a node is represented by a leaf.


Where do these YANG models come from? Who writes these data models? Anyone having knowledge of YANG programming can easily write a YANG model. These data models mainly categorized into as open models and native models.
       
Open Models:  Designed to be platform and OEM independent models. These are mainly written by standard bodies like IETF and Open Config
Native Models: These models are mainly written by OEM and specific to platform or operating system. 


Open and Native data models can further classified into two different data models:
Device Data Models: Interfaces, Vlans, OSPF, ACL
Service Data Models: layer 3 vpn, layer 2 vpn, 


YANG model is made up from various components as shown in the image (Image copied from Cisco Live Dev Net Presentation)
       



Container - Infomration is logically grouped into form of containers. Such container is for configuration and one for state. List - Container contains list or even multiple lists. Such as a list of interfaces. Key - Each item within the list is references via a key (unique key). Leaf - Inside list we have leaf's. It contains information. Data Type - Each leaf is associated with a data type.

People who read this post also read :



No comments: