YANG

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

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:

Guidelines and supporting documentation

The following requests for comments provide guidelines and supporting documentation:

IETF usage

Standards-track protocol specifications

The following requests for comments define standards-track protocols that are (partially) defined using YANG modules:

Standards-track data models

The following RFCs define standards-track YANG data models:

Experimental specifications

The following requests for comments are experimental specifications that use or extend YANG:

References

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Template:IETF RFC : Policy-Based Management Framework for the Simplified Use of Policy Abstractions (SUPA)
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "Citation/CS1".
  8. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

External links

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