YANG
YANG 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 and was published as RFC 6020 in October 2010. 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. The data modeling language associated with SNMP was called the Structure of Management Information. The SMI language itself was based on the 1988 version of the Abstract Syntax Notation One. The current version of the SMI language, SMIv2 defined in RFC 2578, RFC 2579, RFC 2580, 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 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 RFC 6020 in October 2010. Recently, the NETMOD working group has been working on YANG 1.1, which has been published in August 2016 in RFC 7950.
Example
The following YANG moduleexample-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 person
s and a list of team
s. A team has a list of players that reference persons via the leafref
type and its path
restriction.module example-sports
XML encoding
The code block below shows the XML representation of an instantiation of theexample-sports
data model.JSON encoding
The code block below shows the JSON representation of an instantiation of theexample-sports
data model.Documentation
Language specifications and architectural documents
The following requests for comments define the YANG language and some basic extensions:- RFC 6020: YANG - A Data Modeling Language for the Network Configuration Protocol
- RFC 6110: Mapping YANG to Document Schema Definition Languages and Validating NETCONF Content
- RFC 7950: The YANG 1.1 Data Modeling Language
- RFC 7951: JSON Encoding of Data Modeled with YANG
- RFC 7952: Defining and Using Metadata with YANG
- RFC 8342: Network Management Datastore Architecture
- RFC 8525: YANG Library
- RFC 8528: YANG Schema Mount
- RFC 8791: YANG Data Structure Extensions
Guidelines and supporting documentation
- RFC 8407: Guidelines for Authors and Reviewers of Documents Containing YANG Data Models
- RFC 8199: YANG Module Classification
- RFC 8340: YANG Tree Diagrams
IETF usage
Standards-track protocol specifications
The following requests for comments define standards-track protocols that are defined using YANG modules:- RFC 6241: Network Configuration Protocol
- RFC 6243: With-defaults Capability for NETCONF
- RFC 6470: Network Configuration Protocol Base Notifications
- RFC 8040: RESTCONF Protocol
- RFC 8071: NETCONF Call Home and RESTCONF Call Home
- RFC 8072: YANG Patch Media Type
- RFC 8341: Network Configuration Access Control Model
- RFC 8526: NETCONF Extensions to Support the Network Management Datastore Architecture
- RFC 8527: RESTCONF Extensions to Support the Network Management Datastore Architecture
- RFC 8572: Secure Zero Touch Provisioning
- RFC 8639: Subscription to YANG Notifications
- RFC 8640: Dynamic Subscription to YANG Events and Datastores over NETCONF
- RFC 8641: Subscription to YANG Notifications for Datastore Updates
- RFC 8650: Dynamic Subscription to YANG Events and Datastores over RESTCONF
Standards-track data models
- RFC 6022: YANG Module for NETCONF Monitoring
- RFC 6991: Common YANG Data Types
- RFC 6643: Translation of Structure of Management Information Version 2 MIB Modules to YANG Modules
- RFC 6728: Configuration Data Model for the IP Flow Information Export and Packet Sampling Protocols
- RFC 7224: IANA Interface Type YANG Module
- RFC 7317: A YANG Data Model for System Management
- RFC 7407: A YANG Data Model for SNMP Configuration
- RFC 8177: YANG Data Model for Key Chains
- RFC 8194: A YANG Data Model for LMAP Measurement Agents
- RFC 8294: Common YANG Data Types for the Routing Area
- RFC 8299: YANG Data Model for L3VPN Service Delivery
- RFC 8343: A YANG Data Model for Interface Management
- RFC 8344: A YANG Data Model for IP Management
- RFC 8345: A YANG Data Model for Network Topologies
- RFC 8346: A YANG Data Model for Layer 3 Topologies
- RFC 8347: A YANG Data Model for the Virtual Router Redundancy Protocol
- RFC 8348: A YANG Data Model for Hardware Management
- RFC 8349: A YANG Data Model for Routing Management
- RFC 8366: A Voucher Artifact for Bootstrapping Protocols
- RFC 8431: A YANG Data Model for the Routing Information Base
- RFC 8466: A YANG Data Model for Layer 2 Virtual Private Network Service Delivery
- RFC 8512: A YANG Module for Network Address Translation and Network Prefix Translation
- RFC 8513: A YANG Data Model for Dual-Stack Lite
- RFC 8519: YANG Data Model for Network Access Control Lists
- RFC 8520: Manufacturer Usage Description Specification
- RFC 8529: YANG Data Model for Network Instances
- RFC 8530: YANG Model for Logical Network Elements
- RFC 8531: Generic YANG Data Model for Connection-Oriented Operations, Administration, and Maintenance Protocols
- RFC 8532: Generic YANG Data Model for the Management of Operations, Administration, and Maintenance Protocols That Use Connectionless Communications
- RFC 8533: A YANG Data Model for Retrieval Methods for the Management of Operations, Administration, and Maintenance Protocols That Use Connectionless Communication
- RFC 8542: A YANG Data Model for Fabric Topology in Data-Center Networks
- RFC 8561: A YANG Data Model for Microwave Radio Link
- RFC 8575: YANG Data Model for the Precision Time Protocol
- RFC 8632: A YANG Data Model for Alarm Management
- RFC 8652: A YANG Data Model for the Internet Group Management Protocol and Multicast Listener Discovery
- RFC 8675: A YANG Data Model for Tunnel Interface Types
- RFC 8676: YANG Modules for IPv4-in-IPv6 Address plus Port Softwires
- RFC 8695: A YANG Data Model for the Routing Information Protocol
- RFC 8776: Common YANG Data Types for Traffic Engineering
Experimental specifications
- RFC 6095: Extending YANG with Language Abstractions
- RFC 7758: Time Capability in NETCONF
Implementations
- is a YANG-based toolchain including interactive CLI, NETCONF and RESTCONF interfaces written in C.
- is a YANG parser and compiler written in Go to produce Go language objects
- is a pyang-based YANG-to-Java-API compiler
- is a YANG parser and toolkit written in C and providing API in C
- is an extensible YANG validator and converter written in Python
- is a pyang-based Python binding generator
- is a YANG-based configuration and operational datastore for Unix/Linux applications.
- is a builder for YANG, implemented in
- is an Eclipse plugin for editing and visualizing YANG models
- is a YANG parser and evaluator written in CoffeeScript/JavaScript for Node.js and the web browser
- * is a yang-js based Express.js web framework generator
- * is a yang-js based Swagger/OpenAPI specification generator
- is a Python 3 library for working with JSON encoded configuration and state data modeled using the YANG data modeling language.
- is an OpenDaylight toolset written in Java
- - is a pyang-based Yang Browser and RPC Builder Application
- is a YANG-to-API compiler generating APIs in multiple languages
- 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
- is a commercial management agent toolkit including a YANG compiler
- is a YANG model designer, visualizer, and editor for Windows
- is a YANG definition file creator/editor/modeler/builder/designer and YANG compiler implemented in Java
- is a commercial management agent toolkit including a YANG compiler