YANG
YANG is a Data Modeling Language
Data Modeled
- Config
- State
- RPCs (to make changes)
- Notifications (to get events)
YANG was intended for NETCONF.
- Functional Overview
YANG is a language used to model data for the NETCONF protocol. A YANG module defines a hierarchy of data that can be used for NETCONF- based operations, including configuration, state data, Remote Procedure Calls (RPCs), and notifications. This allows a complete description of all data sent between a NETCONF client and server.
Source RFC 6020 Section 4.1.
Terms
YANG — Yet Another Next Generation
Structured
- Data that is formated for automation to use
- Data that follows a schema
Schema
- Rules around how data is allowed to be structured
Why
Device CLI output provides unstructured data
%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/9, changed state to down
YANG provides structured data which follows a schema
<config xmlns="http://tail-f.com/ns/config/1.0">
<router xmlns="http://com/example/routermodel">
<name>switch</name>
<address>192.168.0.10</address>
<operational-status>down</operational-status>
<interface>
<type>GigabitEthernet</type>
<enabled>true</enabled>
<interface-id>0/9</interface-id>
</interface>
</router>
</config>
Features
- Tree structured
- Defined structured
- Modular
- Encoding Variety
- XML, JSON
- Meant for automated tooling
Node Types
Container
- Groups nodes
Leaf
- A data
Leaf-List
- Multiple units of one data
List
Models
Different organizations make different models.
At present multiple models are needed to get all features.
This is a BGP example.

Courtesy of IETF 98, Rob Shakir & Anees Shaikh
- AKA, Vendor Model
- AKA, Native Model
- AKA, IOS-XE Model
- Best Supported
- Industry supported
- Primary focus: operational usability
- Secondary focus: ease to implement
- Very New
- Associated with the Linux Foundation
References
Cisco Blog - Native, IETF, OpenConfig… Why so many YANG models? - Hank Preston
Cisco Live - Exploring YANG Data Modeling - Aayushi Mahajan - DEVNET-1882
GitHub - OpenConfig YANG models
IETF 98 - Observations on Modeling Configuration and State in YANG
RFC 6020 - YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)