What is Yang?

YANG is a way to model data that will be used by the NETCONF protocol and NETCONF is a standard way to manage network elements (NE’s). Programming languages have BNF’s that define how the languages work which allows programmers to determine if a line of code contains a valid syntax. YANG is similar to a BNF in that it defines valid Remote Procedure Calls (RPC’s) that can be used to control an NE, the schema for the NE configuration, NE state information and what alarms/responses can be expected from the NE in question.

If all you want to do is extract configuration information, you can do that with a simple NETCONF get-config command. YANG becomes important when you want to remotely change a configuration. If you are monitoring an NE and determine that it is not configured correctly, you can use an RPC to alter the configuration. In cases where field service people are installing new devices, these can be detected by an OSS which could use NETCONF and RPC’s to provide an initial configuration.

YANG models can describe limits on configuration information making it easy to perform range checking before configurations are applied to NE’s. YANG models also describe types of data and provide a mechanism for users to define custom types. Type casting data provides another mechanism for the verification of user supplied configuration data. If the NE is expecting a String and you provide an Integer, the config would be flagged as broken and not applied to an NE.

In cases where an NE can have multiple uses / personalities, YANG can be used to document a configuration for each application.

YANG models can be translated into an XML compliant file format called YIN. In some cases YIN models may be easier to parse. A mechanism to translate back to YANG models is provided to support conversion in both directions.

YANG provides four basic types for data modelling, Leaf Nodes, Leaf-list Nodes, Container Nodes and List Nodes.

  • Leaf Nodes have one key-value pair.
  • Leaf-list Nodes contain lists of leaf nodes.
  • Container Nodes are used to group related leaf nodes
  • List Nodes contain lists of a mix of node types.

Here is an example of a YANG file extracted from the RFC (RFC6020)


This entry was posted in Uncategorized and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *