YANG
Template:Short description Script error: No such module "other uses".Yet Another Next Generation (YANG, /jæŋ/)[1][2][3] is a data modeling language for the definition of data sent over network management protocols such as the NETCONF[4] and RESTCONF.[5] Developed and maintained by the NETMOD[6] working group in the Internet Engineering Task Force (IETF), YANG was initially published as Template:IETF RFC in October 2010, with a significant update to version 1.1 in August 2016 (Template:IETF RFC).
YANG enables comprehensive network automation by providing a standardized way to model the configuration and state data of network elements. The language can be used to define the format of event notifications emitted by network devices and allows data modelers to define the signature of RPCs that can be invoked on network elements via the NETCONF protocol. Being protocol-independent, YANG models can be converted into various encoding formats, including XML, JSON, and CBOR, depending on the network configuration protocol's support.
YANG is a modular language and represents data structures in a hierarchical tree format. It includes numerous built-in data types, with the capability for users to derive additional application-specific types. More complex reusable data structures can be represented as "groupings," which promote model reusability and consistency. YANG data models can use XPath expressions to define constraints on the elements of a YANG data model, enabling validation of configuration data before it is committed to devices.
YANG has become the de facto standard for modeling network device configurations across the telecommunications industry and is widely supported by major network equipment manufacturers. It plays a crucial role in software-defined networking (SDN) and network function virtualization (NFV) environments by providing a consistent interface for programmatic network management.
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 Template:IETF RFC, 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 (Template:IETF RFC).
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.[7] 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 Template:IETF RFC in October 2010. Recently, the NETMOD working group has been working on YANG 1.1, which has been published in August 2016 in Template:IETF RFC.[8]
Example
The following YANG module example-sports shows a data model for team sports. The module declares a namespace and a prefix and imports the type library module ietf-yang-types before defining the type season. It then defines a container sports that includes a list of persons and a list of teams. A team has a list of players that reference persons via the leafref type and its path restriction.
module example-sports {
namespace "http://example.com/example-sports";
prefix sports;
import ietf-yang-types { prefix yang; }
typedef season {
type string;
description
"The name of a sports season, including the type and the year, e.g,
'Champions League 2014/2015'.";
}
container sports {
config true;
list person {
key "name";
leaf name { type string; }
leaf birthday { type yang:date-and-time; mandatory true; }
}
list team {
key "name";
leaf name { type string; }
list player {
key "name season";
unique number;
leaf name { type leafref { path "/sports/person/name"; } }
leaf season { type season; }
leaf number { type uint16; mandatory true; }
leaf scores { type uint16; default 0; }
}
}
}
}
JSON encoding
The code block below shows the JSON representation of an instantiation of the example-sports data model.
{
"example-sports:sports": {
"person": [
{
"name": "Lionel Andrés Messi",
"birthday": "1987-06-24T00:00:00-00:00"
},
{
"name": "Cristiano Ronaldo",
"birthday": "1985-02-05T00:00:00-00:00"
}
],
"team": [
{
"name": "FC Barcelona",
"player": [
{
"name": "Lionel Andrés Messi",
"season": "Champions League 2014/2015",
"number": 10,
"scores": 43
}
]
},
{
"name": "Real Madrid",
"player": [
{
"name": "Cristiano Ronaldo",
"season": "Champions League 2014/2015",
"number": 7,
"scores": 48
}
]
}
]
}
}
XML encoding
The code block below shows the XML representation of an instantiation of the example-sports data model.
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<sports xmlns="http://example.com/example-sports">
<person>
<name>Lionel Andrés Messi</name>
<birthday>1987-06-24T00:00:00-00:00</birthday>
</person>
<person>
<name>Cristiano Ronaldo</name>
<birthday>1985-02-05T00:00:00-00:00</birthday>
</person>
<team>
<name>FC Barcelona</name>
<player>
<name>Lionel Andrés Messi</name>
<season>Champions League 2014/2015</season>
<number>10</number>
<scores>43</scores>
</player>
</team>
<team>
<name>Real Madrid</name>
<player>
<name>Cristiano Ronaldo</name>
<season>Champions League 2014/2015</season>
<number>7</number>
<scores>48</scores>
</player>
</team>
</sports>
</data>
Documentation
Language specifications and architectural documents
The following Request for Comments (RFCs) define the YANG language and some basic extensions:
- Template:IETF RFC: YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)
- Template:IETF RFC: Mapping YANG to Document Schema Definition Languages and Validating NETCONF Content
- Template:IETF RFC: The YANG 1.1 Data Modeling Language [does not replace Template:IETF RFC]
- Template:IETF RFC: JSON Encoding of Data Modeled with YANG
- Template:IETF RFC: Defining and Using Metadata with YANG
- Template:IETF RFC: Network Management Datastore Architecture (NMDA)
- Template:IETF RFC: YANG Library [obsoletes Template:IETF RFC]
- Template:IETF RFC: YANG Schema Mount
- Template:IETF RFC: YANG Data Structure Extensions
- Template:IETF RFC: Encoding of Data Modeled with YANG in the Concise Binary Object Representation (CBOR)
- Template:IETF RFC: YANG Schema Item iDentifier (YANG SID)
Guidelines and supporting documentation
The following requests for comments provide guidelines and supporting documentation:
- Template:IETF RFC: Guidelines for Authors and Reviewers of Documents Containing YANG Data Models [obsoletes Template:IETF RFC]
- Template:IETF RFC: YANG Module Classification
- Template:IETF RFC: YANG Tree Diagrams
- Template:IETF RFC: A Framework for Automating Service and Network Management with YANG
- Template:IETF RFC: A File Format for YANG Instance Data
IETF usage
Standards-track protocol specifications
The following requests for comments define standards-track protocols that are (partially) defined using YANG modules:
- Template:IETF RFC: Network Configuration Protocol (NETCONF)
- Template:IETF RFC: With-defaults Capability for NETCONF
- Template:IETF RFC: Network Configuration Protocol (NETCONF) Base Notifications
- Template:IETF RFC: RESTCONF Protocol
- Template:IETF RFC: NETCONF Call Home and RESTCONF Call Home
- Template:IETF RFC: YANG Patch Media Type
- Template:IETF RFC: Network Configuration Access Control Model [obsoletes Template:IETF RFC]
- Template:IETF RFC: NETCONF Extensions to Support the Network Management Datastore Architecture
- Template:IETF RFC: RESTCONF Extensions to Support the Network Management Datastore Architecture
- Template:IETF RFC: Secure Zero Touch Provisioning (SZTP)
- Template:IETF RFC: Subscription to YANG Notifications
- Template:IETF RFC: Dynamic Subscription to YANG Events and Datastores over NETCONF
- Template:IETF RFC: Subscription to YANG Notifications for Datastore Updates
- Template:IETF RFC: Dynamic Subscription to YANG Events and Datastores over RESTCONF
Standards-track data models
The following RFCs define standards-track YANG data models:
- Template:IETF RFC: YANG Module for NETCONF Monitoring
- Template:IETF RFC: Common YANG Data Types [obsoletes Template:IETF RFC]
- Template:IETF RFC: Translation of Structure of Management Information Version 2 (SMIv2) MIB Modules to YANG Modules
- Template:IETF RFC: Configuration Data Model for the IP Flow Information Export (IPFIX) and Packet Sampling (PSAMP) Protocols
- Template:IETF RFC: IANA Interface Type YANG Module
- Template:IETF RFC: A YANG Data Model for System Management
- Template:IETF RFC: A YANG Data Model for SNMP Configuration
- Template:IETF RFC: YANG Data Model for Key Chains
- Template:IETF RFC: A YANG Data Model for LMAP Measurement Agents
- Template:IETF RFC: Common YANG Data Types for the Routing Area
- Template:IETF RFC: YANG Data Model for L3VPN Service Delivery
- Template:IETF RFC: A YANG Data Model for Interface Management [obsoletes Template:IETF RFC]
- Template:IETF RFC: A YANG Data Model for IP Management [obsoletes Template:IETF RFC]
- Template:IETF RFC: A YANG Data Model for Network Topologies
- Template:IETF RFC: A YANG Data Model for Layer 3 Topologies
- Template:IETF RFC: A YANG Data Model for the Virtual Router Redundancy Protocol (VRRP)
- Template:IETF RFC: A YANG Data Model for Hardware Management
- Template:IETF RFC: A YANG Data Model for Routing Management (NMDA Version) [obsoletes Template:IETF RFC]
- Template:IETF RFC: A Voucher Artifact for Bootstrapping Protocols
- Template:IETF RFC: A YANG Data Model for the Routing Information Base (RIB)
- Template:IETF RFC: A YANG Data Model for Layer 2 Virtual Private Network (L2VPN) Service Delivery
- Template:IETF RFC: A YANG Module for Network Address Translation (NAT) and Network Prefix Translation (NPT)
- Template:IETF RFC: A YANG Data Model for Dual-Stack Lite (DS-Lite)
- Template:IETF RFC: YANG Data Model for Network Access Control Lists (ACLs)
- Template:IETF RFC: Manufacturer Usage Description Specification
- Template:IETF RFC: YANG Data Model for Network Instances
- Template:IETF RFC: YANG Model for Logical Network Elements
- Template:IETF RFC: Generic YANG Data Model for Connection-Oriented Operations, Administration, and Maintenance (OAM) Protocols
- Template:IETF RFC: Generic YANG Data Model for the Management of Operations, Administration, and Maintenance (OAM) Protocols That Use Connectionless Communications
- Template:IETF RFC: A YANG Data Model for Retrieval Methods for the Management of Operations, Administration, and Maintenance (OAM) Protocols That Use Connectionless Communication
- Template:IETF RFC: A YANG Data Model for Fabric Topology in Data-Center Networks
- Template:IETF RFC: A YANG Data Model for Microwave Radio Link
- Template:IETF RFC: YANG Data Model for the Precision Time Protocol (PTP)
- Template:IETF RFC: A YANG Data Model for Alarm Management
- Template:IETF RFC: A YANG Data Model for the Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD)
- Template:IETF RFC: A YANG Data Model for Tunnel Interface Types
- Template:IETF RFC: YANG Modules for IPv4-in-IPv6 Address plus Port (A+P) Softwires
- Template:IETF RFC: A YANG Data Model for the Routing Information Protocol (RIP)
- Template:IETF RFC: Common YANG Data Types for Traffic Engineering
- Template:IETF RFC: YANG Data Model for Traffic Engineering (TE) Topologies
- Template:IETF RFC: A YANG Data Model for Factory Default Settings
- Template:IETF RFC: A YANG Data Model for the Multicast Source Discovery Protocol (MSDP)
- Template:IETF RFC: A YANG Data Model for Layer 2 Network Topologies
- Template:IETF RFC: A YANG Data Model for MPLS Base
- Template:IETF RFC: YANG Module Tags
- Template:IETF RFC: YANG Data Model for Segment Routing
- Template:IETF RFC: A YANG Data Model for IPsec Flow Protection Based on Software-Defined Networking (SDN)
- Template:IETF RFC: A YANG Data Model for Routing Policy
- Template:IETF RFC: YANG Data Model for MPLS LDP
- Template:IETF RFC: A YANG Data Model for Layer 0 Types
- Template:IETF RFC: A YANG Data Model for Wavelength Switched Optical Networks (WSONs)
- Template:IETF RFC: A YANG Data Model for Terminal Access Controller Access-Control System Plus (TACACS+)
- Template:IETF RFC: YANG Types for DNS Classes and Resource Record Types
- Template:IETF RFC: A YANG Data Model for Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD) Snooping
- Template:IETF RFC: A YANG Grouping for Geographic Locations
- Template:IETF RFC: A Common YANG Data Model for Layer 2 and Layer 3 VPNs
- Template:IETF RFC: YANG Modules Describing Capabilities for Systems and Datastore Update Notifications
- Template:IETF RFC: A YANG Data Model for DHCPv6 Configuration
- Template:IETF RFC: A YANG Data Model for NTP
- Template:IETF RFC: A YANG Network Data Model for Layer 2 VPNs
- Template:IETF RFC: YANG Data Model for Bidirectional Forwarding Detection (BFD)
- Template:IETF RFC: YANG Data Model for Protocol Independent Multicast (PIM)
- Template:IETF RFC: YANG Data Model for the OSPF Protocol
- Template:IETF RFC: YANG Data Model for the IS-IS Protocol
- Template:IETF RFC: A YANG Module for IS-IS Reverse Metric
- Template:IETF RFC: A YANG Data Model for IP Traffic Flow Security
- Template:IETF RFC: A YANG Data Model for Static Context Header Compression (SCHC)
- Template:IETF RFC: A YANG Data Model for Network and VPN Service Performance Monitoring
- Template:IETF RFC: A YANG Data Model for Internet Group Management Protocol (IGMP) and Multicast Listener Discovery (MLD) Proxy Devices
- Template:IETF RFC: A YANG Data Model for RIB Extensions
- Template:IETF RFC: A YANG Network Data Model for Service Attachment Points (SAPs)
- Template:IETF RFC: A YANG Data Model for Service Assurance
- Template:IETF RFC: A YANG Data Model for Reporting Software Bills of Materials (SBOMs) and Vulnerability Information
- Template:IETF RFC: YANG Data Model for OSPFv3 Extended Link State Advertisements (LSAs)
- Template:IETF RFC: A YANG Data Model for In Situ Operations, Administration, and Maintenance
- Template:IETF RFC: Deterministic Networking (DetNet) YANG Data Model
- Template:IETF RFC: YANG Data Types and Groupings for Cryptography
- Template:IETF RFC: A YANG Data Model for a Truststore
- Template:IETF RFC: A YANG Data Model for a Keystore
- Template:IETF RFC: YANG Groupings for TCP Clients and TCP Servers
- Template:IETF RFC: YANG Groupings for SSH Clients and SSH Servers
- Template:IETF RFC: YANG Groupings for TLS Clients and TLS Servers
- Template:IETF RFC: Conveying a Certificate Signing Request (CSR) in a Secure Zero-Touch Provisioning (SZTP)
- Template:IETF RFC: A YANG Data Model for Babel
- Template:IETF RFC: YANG Data Model for TCP
- Template:IETF RFC: A YANG Data Model for Microwave Topology
- Template:IETF RFC: A YANG Data Model for Challenge-Response-Based Remote Attestation (CHARRA) Procedures Using Trusted Platform Modules (TPMs)
- Template:IETF RFC: YANG Data Model for Maximum Segment Identifier (SID) Depth (MSD) Types and MPLS MSD
- Template:IETF RFC: YANG Data Model for Routing in Fat Trees (RIFT)
- Template:IETF RFC: A YANG Data Model for Virtual Network (VN) Operations
- Template:IETF RFC: A YANG Data Model for Syslog Management
Experimental specifications
The following requests for comments are experimental specifications that use or extend YANG:
- Template:IETF RFC: Extending YANG with Language Abstractions
- Template:IETF RFC: Time Capability in NETCONF
References
<templatestyles src="Reflist/styles.css" />
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Template:IETF RFC : Policy-Based Management Framework for the Simplified Use of Policy Abstractions (SUPA)
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "citation/CS1".
Script error: No such module "Check for unknown parameters".
External links
- Script error: No such module "Citation/CS1".Template:Cbignore
- Script error: No such module "Citation/CS1".Template:Cbignore
- YANG Model Catalog - Online catalog with a REST API
- YANG central - YANG information and tutorials
- YANG Discussion Forum - ConfD User Community Forum for discussing YANG related questions.
- For a list of YANG-based clients and servers see the NETCONF page.
- Template:ISBN - "Network Programmability with YANG: The Structure of Network Automation with YANG, NETCONF, RESTCONF, and gNMI"
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