YANG

Yet Another Next Generation (YANG, /jæŋ/, which rhymes with "hang")  is a data modeling language for the definition of data sent over network management protocols such as the NETCONF and RESTCONF. The YANG data modeling language is maintained by the NETMOD working group in the Internet Engineering Task Force (IETF) and initially was published as in October 2010, with an update in August 2016. The data modeling language can be used to model both configuration data as well as state data of network elements. Furthermore, YANG can be used to define the format of event notifications emitted by network elements and it allows data modelers to define the signature of remote procedure calls that can be invoked on network elements via the NETCONF protocol. The language, being protocol independent, can then be converted into any encoding format, e.g. XML or JSON, that the network configuration protocol supports.

YANG is a modular language representing data structures in an XML tree format. The data modeling language comes with a number of built-in data types. Additional application specific data types can be derived from the built-in data types. More complex reusable data structures can be represented as groupings. YANG data models can use XPATH expressions to define constraints on the elements of a YANG data model.

History
Many network management protocols have associated data modeling languages. The first widely deployed Internet standard for network management was the Simple Network Management Protocol (SNMP). The data modeling language associated with SNMP was called the Structure of Management Information (SMI). The SMI language itself was based on the 1988 version of the Abstract Syntax Notation One (ASN.1). The current version of the SMI language, SMIv2 defined in, has developed into an extended subset of ASN.1.

In the late 1990s, a project was started to create a replacement for SMIv2, which was called SMIng. One motivation was to decouple SMIng from the management protocol SNMP and to give SMIng a syntactic structure that is both easy to parse for computer programs and easy to learn for people familiar with programming languages that use a C-like notation. While the SMIng project did not succeed in the IETF, the SMIng specifications were published as experimental documents in May 2004.

Soon after the development of the NETCONF protocol in the IETF, it became clear that a data modeling language was needed to define data models manipulated by the NETCONF protocol. A design team created a proposal that became the basis of the YANG language. The syntactic structure and the base type system was essentially borrowed from SMIng. However, based on the lessons learned from the SMIng project, no attempts were made to make the YANG protocol neutral. Instead, YANG ties into concepts of the NETCONF protocol, such as the assumption that data model instances can be serialized into XML. Standardization of YANG started with the formation of the NETMOD working group in April 2008. The YANG 1.0 specification was published as in October 2010. Recently, the NETMOD working group has been working on YANG 1.1, which has been published in August 2016 in.

Example
The following YANG module  shows a data model for team sports. The module declares a namespace and a prefix and imports the type library module  before defining the type. It then defines a container  that includes a list of  s and a list of  s. A team has a list of players that reference persons via the   type and its   restriction.

JSON encoding
The code block below shows the JSON representation of an instantiation of the  data model.

XML encoding
The code block below shows the XML representation of an instantiation of the  data model.

Language specifications and architectural documents
The following Request for Comments (RFCs) define the YANG language and some basic extensions:


 * : YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)
 * : Mapping YANG to Document Schema Definition Languages and Validating NETCONF Content
 * : The YANG 1.1 Data Modeling Language [does not replace ]
 * : JSON Encoding of Data Modeled with YANG
 * : Defining and Using Metadata with YANG
 * : Network Management Datastore Architecture (NMDA)
 * : YANG Library [obsoletes ]
 * : YANG Schema Mount
 * : YANG Data Structure Extensions
 * : Encoding of Data Modeled with YANG in the Concise Binary Object Representation (CBOR)

Guidelines and supporting documentation
The following requests for comments provide guidelines and supporting documentation:
 * : Guidelines for Authors and Reviewers of Documents Containing YANG Data Models [obsoletes ]
 * : YANG Module Classification
 * : YANG Tree Diagrams
 * : A Framework for Automating Service and Network Management with YANG
 * : A File Format for YANG Instance Data

Standards-track protocol specifications
The following requests for comments define standards-track protocols that are (partially) defined using YANG modules:
 * : Network Configuration Protocol (NETCONF)
 * : With-defaults Capability for NETCONF
 * : Network Configuration Protocol (NETCONF) Base Notifications
 * : RESTCONF Protocol
 * : NETCONF Call Home and RESTCONF Call Home
 * : YANG Patch Media Type
 * : Network Configuration Access Control Model [obsoletes ]
 * : NETCONF Extensions to Support the Network Management Datastore Architecture
 * : RESTCONF Extensions to Support the Network Management Datastore Architecture
 * : Secure Zero Touch Provisioning (SZTP)
 * : Subscription to YANG Notifications
 * : Dynamic Subscription to YANG Events and Datastores over NETCONF
 * : Subscription to YANG Notifications for Datastore Updates
 * : Dynamic Subscription to YANG Events and Datastores over RESTCONF

Standards-track data models
The following RFCs define standards-track YANG data models:
 * : YANG Module for NETCONF Monitoring
 * : Common YANG Data Types [obsoletes ]
 * : Translation of Structure of Management Information Version 2 (SMIv2) MIB Modules to YANG Modules
 * : Configuration Data Model for the IP Flow Information Export (IPFIX) and Packet Sampling (PSAMP) Protocols
 * : IANA Interface Type YANG Module
 * : A YANG Data Model for System Management
 * : A YANG Data Model for SNMP Configuration
 * : YANG Data Model for Key Chains
 * : A YANG Data Model for LMAP Measurement Agents
 * : Common YANG Data Types for the Routing Area
 * : YANG Data Model for L3VPN Service Delivery
 * : A YANG Data Model for Interface Management [obsoletes ]
 * : A YANG Data Model for IP Management [obsoletes ]
 * : A YANG Data Model for Network Topologies
 * : A YANG Data Model for Layer 3 Topologies
 * : A YANG Data Model for the Virtual Router Redundancy Protocol (VRRP)
 * : A YANG Data Model for Hardware Management
 * : A YANG Data Model for Routing Management (NMDA Version) [obsoletes ]
 * : A Voucher Artifact for Bootstrapping Protocols
 * : A YANG Data Model for the Routing Information Base (RIB)
 * : A YANG Data Model for Layer 2 Virtual Private Network (L2VPN) Service Delivery
 * : A YANG Module for Network Address Translation (NAT) and Network Prefix Translation (NPT)
 * : A YANG Data Model for Dual-Stack Lite (DS-Lite)
 * : YANG Data Model for Network Access Control Lists (ACLs)
 * : Manufacturer Usage Description Specification
 * : YANG Data Model for Network Instances
 * : YANG Model for Logical Network Elements
 * : Generic YANG Data Model for Connection-Oriented Operations, Administration, and Maintenance (OAM) Protocols
 * : Generic YANG Data Model for the Management of Operations, Administration, and Maintenance (OAM) Protocols That Use Connectionless Communications
 * : A YANG Data Model for Retrieval Methods for the Management of Operations, Administration, and Maintenance (OAM) Protocols That Use Connectionless Communication
 * : A YANG Data Model for Fabric Topology in Data-Center Networks
 * : A YANG Data Model for Microwave Radio Link
 * : YANG Data Model for the Precision Time Protocol (PTP)
 * : A YANG Data Model for Alarm Management
 * : A YANG Data Model for the Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD)
 * : A YANG Data Model for Tunnel Interface Types
 * : YANG Modules for IPv4-in-IPv6 Address plus Port (A+P) Softwires
 * : A YANG Data Model for the Routing Information Protocol (RIP)
 * : Common YANG Data Types for Traffic Engineering
 * : YANG Data Model for Traffic Engineering (TE) Topologies
 * : A YANG Data Model for Factory Default Settings
 * : A YANG Data Model for the Multicast Source Discovery Protocol (MSDP)
 * : A YANG Data Model for Layer 2 Network Topologies
 * : A YANG Data Model for MPLS Base
 * : YANG Module Tags
 * : YANG Data Model for Segment Routing
 * : A YANG Data Model for IPsec Flow Protection Based on Software-Defined Networking (SDN)
 * : A YANG Data Model for Routing Policy
 * : YANG Data Model for MPLS LDP
 * : A YANG Data Model for Layer 0 Types
 * : A YANG Data Model for Wavelength Switched Optical Networks (WSONs)
 * : A YANG Data Model for Terminal Access Controller Access-Control System Plus (TACACS+)
 * : YANG Types for DNS Classes and Resource Record Types
 * : A YANG Data Model for Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD) Snooping
 * : A YANG Grouping for Geographic Locations
 * : A Common YANG Data Model for Layer 2 and Layer 3 VPNs
 * : YANG Modules Describing Capabilities for Systems and Datastore Update Notifications
 * : A YANG Data Model for DHCPv6 Configuration
 * : A YANG Data Model for NTP
 * : A YANG Network Data Model for Layer 2 VPNs
 * : YANG Data Model for Bidirectional Forwarding Detection (BFD)
 * : YANG Data Model for Protocol Independent Multicast (PIM)
 * : YANG Data Model for the OSPF Protocol
 * : YANG Data Model for the IS-IS Protocol
 * : A YANG Module for IS-IS Reverse Metric
 * : A YANG Data Model for IP Traffic Flow Security
 * : A YANG Data Model for Static Context Header Compression (SCHC)
 * : A YANG Data Model for Network and VPN Service Performance Monitoring
 * : A YANG Data Model for Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD) Proxy Devices
 * : A YANG Data Model for RIB Extensions
 * : A YANG Network Data Model for Service Attachment Points (SAPs)
 * : A YANG Data Model for Service Assurance
 * : A YANG Data Model for Reporting Software Bills of Materials (SBOMs) and Vulnerability Information
 * : YANG Data Model for OSPFv3 Extended Link State Advertisements (LSAs)

Experimental specifications
The following requests for comments are experimental specifications that use or extend YANG:
 * : Extending YANG with Language Abstractions
 * : Time Capability in NETCONF

Implementations
Open source implementations (sorted by name):


 * clixon is a YANG-based toolchain including interactive CLI, NETCONF and RESTCONF interfaces written in C.
 * goyang is a YANG parser and compiler written in Go to produce Go language objects
 * jnc is a pyang-based YANG-to-Java-API compiler
 * libyang is a YANG parser and toolkit written in C and providing API in C
 * pyang is an extensible YANG validator and converter written in Python
 * pyangbind is a pyang-based Python binding generator
 * Sysrepo is a YANG-based configuration and operational datastore for Unix/Linux applications.
 * yangbuilder is a builder for YANG, implemented in Apache Groovy (generate yang data models with Apache Groovy, maintain similar models with one source code base)
 * yang-ide is an Eclipse plugin for editing and visualizing YANG models
 * yang-js is a YANG parser and evaluator written in CoffeeScript/JavaScript for Node.js and the web browser
 * yang-express is a yang-js based Express.js web framework generator
 * yang-swagger is a yang-js based Swagger/OpenAPI specification generator
 * yangson is a Python 3 library for working with JSON encoded configuration and state data modeled using the YANG data modeling language.
 * YANG Tools is an OpenDaylight Project toolset written in Java
 * Yang-Explorer - is a pyang-based Yang Browser and RPC Builder Application
 * ydk-gen is a YANG-to-API compiler generating APIs in multiple languages (e.g. Python, C++)
 * yuma123 is netconf/YANG toolchain written in C providing: libyuma - API for development of applications supporting runtime compilation of YANG modules, netconfd - modular server, yangcli - interactive command line tool

Closed source implementations (sorted by name):


 * confd is a commercial management agent toolkit including a YANG compiler
 * MasterYANG is a YANG model designer, visualizer, and editor for Windows
 * Visual YANG Designer is a YANG definition file creator/editor/modeler/builder/designer and YANG compiler implemented in Java
 * yumapro is a commercial management agent toolkit including a YANG compiler