YANG [Yet Another Next Generation] is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF).
It’s a standardized way to programmatically update and modify the configuration of a network device.
To break this down further, YANG is a modeling language that has the configuration data as well as state data of a device. Whereas NETCONF is a network device management protocol that provides a mechanism for configuring devices and querying the network configuration and status. The Network Configuration Protocol (NETCONF) applies changes to the relevant datastore i.e running, startup, etc on the device. Together, NETCONF and YANG automate system configuration tasks to read and write the configuration remotely across heterogeneous devices in a software-defined network (SDN).
Traditional CLI scripting/mode which was based on man-machine interface was the primary approach for making automated configuration changes to the network prior to NETCONF. CLI scripting has several limitations including the lack of uniqueness in CLI commands from vendor to vendor. Along with that, as the CLI structure and syntax are prone to changes our script also becomes fragile.
Therefore, SNMP is another alternative approach that was designed to monitor and push configuration to network devices. However, most network engineers didn’t find it useful as it makes it harder to find the correct MIB modules. Therefore most developers and service providers use SNMP to monitor network devices which in turn brought forth the NETCONF.
The NETCONF was designed to address all these shortcomings of existing methods. It has a distinction between configuration and state data. NETCONF provides mechanisms to manipulate/configure, delete, install the configuration of network devices. In order to achieve the same, we need a data model to understand the changes, this model must be consistent in devices to get and set configurations irrespective of the difference in manufactures. If we want to configure say a cisco device or a juniper device we need a consistent data model and that is YANG. With YANG Framework one can pull configuration from the device as well as push to the device.
NETCONF is a configuration management protocol and YANG is used for data modeling and by combining both, we can automate a network configuration. Sysrepo is a YANG-based data store that holds both configuration and operational state data stores for Unix/Linux applications. It’s a C Language API that is used to store their configuration modeled by the YANG model. The enterprise applications that use Sysrepo can automatically benefit from the ability of being directly controlled via NETCONF.
YANG Modelling language, which is a self-contained top-level hierarchy of nodes, focuses on user requirements rather than on the device. It’s a language used to describe data models of network devices.
Consider configuring IP interface attributes of a router or a switch. To configure an interface on the networking device we need an interface name, an IP address, and a subnet mask. We also need to enable the interface – the device will keep the interface disabled if it doesn’t need it. The YANG model uses strict syntax rules which makes the data model standardized and easy to process with computers.
Let’s describe the different uses of a yang data model for an IP interface.
Considering the above sample interface yang model, let’s break this down:
A container is a group of related nodes, with configurational details or operational details. The container “interfaces” will hold the child nodes in the data tree (list with leaf values) for our configuration and state data.
The list statement has a set of child nodes used to define an interior data node in the schema tree.
If we have an interface named ‘eth0’, then the list is essentially every piece of configuration data that this interface consists of.
Then we have the concept of leaf, which is a unique piece of information. So if we have an interface configuration of packets in or packets out, then it’s going to represent as a leaf attribute within the list, within the container and within the yang model. Every leaf must have an associated type. In the above yang model, the type of leaf enabled is Boolean which can be only either True or False.
As mentioned above, the Yang model can state data along with configuration data. When a node is tagged with config ‘false’, it’s flagged as state data or operational status data, these are read-only nodes.
We can use the tool Pyang to validate our yang model. For this developers can be able to run the Pyang command that helps them precisely verify whether the YANG module is syntactically correct or not.
The NETCONF protocol messages are exchanged on the transport protocol layer.
NETCONF operations are done on top of a Remote Procedure Call (RPC) layer using an XML encoding. It provides a set of operations to edit configuration and query configuration on a network device.
|<get>||Obtains part or all of the running configuration and status data from the running configuration datastore.|
|<get-config>||Obtains configuration data.|
|<edit-config>||Creates, modifies or deletes configuration data.|
|<copy-config>||Replace configuration datastore with another complete configuration datastore.|
|<delete-config>||Deletes all the data in a non running configuration datastore.|
|<lock>/<unlock>||Lock or unlocks the configuration datastore of a device|
|<close-session>||Terminates a NETCONF session gracefully.|
|<kill-session>||Forcibly terminates another NETCONF Session.|
Key NETCONF Capabilities:
The rapid industry adoption of NETCONF made it a priority to define a data modeling language that complements NETCONF. At ThinkPalm, we introduce 100% YANG compliant product engineering services and solutions. With our YANG-enabled software services and products, enterprises are ensured that they are using industry-standard technology with an assured growth path.