Email us : sales@yumaworks.com

YANG details

YANG

YANG is a powerful and versatile data modeling language that was designed from the requirements of network operators for an easy to use and robust mechanism for provisioning devices and services across networks. It was originally designed at the Internet Engineering Task Force (IETF) and has been so successful that it has been adopted as the standard for modeling design in many other standards bodies such as the Metro Ethernet Forum, OpenDaylight, OpenConfig, and others. The number of YANG modules being implemented for interfaces, devices, and service is exploding.

The YANG RFC 6020 has many very readable examples.

Key IETF YANG RFCs and YumaPro support:

Fully Supported IETF StandardDescription
RFC 4253Secure Shell (SSH) Transport Layer Protocol
RFC 4741NETCONF base 1.0
RFC 4742NETCONF over SSH v1
RFC 5277NETCONF Notifications
RFC 5717NETCONF Partial Locking
RFC 5789PATCH Method for HTTP
RFC 6020YANG 1.0
RFC 6021YANG Data Types v1
RFC 6022NETCONF Monitoring
RFC 6241NETCONF base 1.1
RFC 6242NETCONF over SSH v1.1
RFC 6243NETCONF With-Defaults Capability
RFC 6470NETCONF Base Notifications
RFC 6643Translation of SMIv2 to YANG
RFC 6991YANG Data Types v2
RFC 7230*HTTP/1.1 Message Syntax and Routing
RFC 7231*HTTP/1.1 Semantics and Content
RFC 7232*HTTP/1.1 Conditional Requests
RFC 7589NETCONF over TLS with Mutual X.509 Authentication
RFC 7950YANG v1.1
RFC 7951JSON Encoding of YANG Data
RFC 8040RESTCONF
RFC 8071*Call Home
RFC 8072YANG Patch
RFC 8341, RFC 6536NETCONF Access Control Model
RFC 8342Network Management Datastore Architecture (NMDA)
RFC 8525, RFC 7895YANG Module Library
RFC 8526*NETCONF Extensions to Support NMDA
RFC 8528*YANG Schema Mount
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 8791Support for Structure and Augment-Structure YANG Extension Statements
RFC 8949*Concise Binary Object Representation (CBOR)
RFC 9254Encoding of Data Modeled with YANG in the Concise Binary Object Representation (CBOR)

*  = partially supported

 

Key YANG Module support:

YANG Module NameDescription
iana-crypt-hashStandard type for storing passwords using a hash function and features to indicate which hash functions are supported by an implementation, from RFC 7317.
iana-if-typeStandard YANG identities for IANA-registered interface types from RFC 7224.
ietf-datastoresStandard set of identities for identifying datastores for use with NMDA, from RFC 8342.
ietf-interfacesStandard YANG definitions for managing network interfaces from RFC 7223.
ietf-inet-typesStandard YANG networking data types from RFC 6021.
ietf-netconfStandard YANG data model for NETCONF protocol operations from RFC 6241.
ietf-netconf-acmStandard NETCONF Access Control Model (NACM) from RFC 6536.
ietf-netconf-monitoringStandard NETCONF monitoring data model and operation from RFC 6022 to retrieve YANG modules from the server.
ietf-netconf-nmdaStandard set of NETCONF operations to support the Network Management Datastore Architecture (NMDA) from RFC 8526.
ietf-netconf-notificationsStandard NETCONF Notification delivery with replay buffer and command interleave mode from RFC 5277.
ietf-originDefines an 'origin' metadata annotation and a set of identities for the origin value for use with NMDA, from RFC 8342.
ietf-netconf-partial-lockStandard NETCONF and operations from RFC 5717 to support concurrent non-overlapping database edits.
ietf-netconf-with-defaultsStandard NETCONF :with-defaults capability extensions to the and operations, from RFC 6243.
ietf-restconfStandard RESTCONF protocol message artifacts from RFC 8040.
ietf-restconf-monitoringStandard RESTCONF monitoring from RFC 8040.
ietf-yang-libraryStandard YANG Module Library for RESTCONF and YANG 1.1 from RFC 7895
ietf-yang-patchStandard YANG Patch Media Type used by RESTCONF and DB-API from RFC 8072
ietf-yang-typesStandard YANG data types from RFC 6021.
nc-notificationsNetconf Central YANG module for notification monitoring data model from RFC 5277.
notificationsNetconf Central YANG module for operation from RFC 5277.
toasterExample SIL module.
yuma-arpNetconf Central YANG module for Linux ARP management.
yuma-interfacesNetconf Central YANG module for Linux interface monitoring.
yuma-mysessionNetconf Central YANG module for setting and retrieving session-specific session parameters.
yuma-nacmNetconf Central YANG module for NETCONF Access Control, used as the starting point for NACM in RFC 6536.
yuma-ncxNetconf Central YANG language extensions.
yuma-procNetconf Central YANG module for Linux /proc system information.
yuma-systemNetconf Central YANG module for NETCONF system management and notifications, which was used as the starting point for RFC 6470.
yuma-time-filterNetconf Central YANG module for time-stamp based filtered of configuration data.
yuma-typesNetconf Central YANG module for extended data types.
yumaworks-attrsThis module contains abstract object definitions for the last-modified and etag XML attributes.
yumaworks-config-changeYumaPro common identities.
yumaworks-event-filterYumaWorks YANG module adds configurable event type filtering for notification delivery.
yumaworks-extensionsYumaWorks YANG language extensions.
yumaworks-getbulkYumaWorks NETCONF protocol operation.
yumaworks-idsYumaWorks YANG identities.
yumaworks-restconfYumaWorks RESTCONF monitoring extensions.
yumaworks-restconf-commit
YumaWorks RESTCONF confirmed commit extensions.
yumaworks-serverRuntime access to netconfd-pro server parameters.
yumaworks-support-saveThis module contains the get-support-save operation and the support-save-data yang-data structure.
yumaworks-systemYumaWorks extensions for CM maintenance such as the backup, restore, and delete-backup operations.
yumaworks-templatesYumaWorks configuration templates extension to edit-config.
yumaworks-term-msgNotification event for terminal message feature.
yumaworks-testThis module contains data structures representing replayable test suites for specific use cases and YANG modules for use with yangcli-pro.
yumaworks-typesYumaWorks YANG data type extensions.
yumaworks-yangmapYANG model mapping control block parameters for yangcli-pro.

YANG Example of reusable groups

grouping target {
         leaf address {
             type inet:ip-address;
             description "Target IP address";
         }
         leaf port {
             type inet:port-number;
             description "Target port number";
         }
     }

     container peer {
         container destination {
             uses target;
         }
     }

NETCONF XML Example for the above

     <peer>
       <destination>
         <address>192.0.2.1</address>
         <port>830</port>
       </destination>
     </peer>

YANG Example of must and error-message

container interface {
         leaf ifType {
             type enumeration {
                 enum ethernet;
                 enum atm;
             }
         }
         leaf ifMTU {
             type uint32;
         }
         must "ifType != 'ethernet' or " +
              "(ifType = 'ethernet' and ifMTU = 1500)" {
             error-message "An ethernet MTU must be 1500";
         }
         must "ifType != 'atm' or " +
              "(ifType = 'atm' and ifMTU <= 17966 and ifMTU >= 64)" {
             error-message "An atm MTU must be  64 .. 17966";
         }
     }

YANG Example of <edit-config> operations

Given the following container definition:

     container system {
         description "Contains various system parameters";
         container services {
             description "Configure externally available services";
             container "ssh" {
                 presence "Enables SSH";
                 description "SSH service specific configuration";
                 // more leafs, containers and stuff here...
             }
         }
     }

A corresponding XML instance example:

     <system>
       <services>
         <ssh/>
       </services>
     </system>

Since the <ssh> element is present, ssh is enabled.

To delete a container with an <edit-config>:

     <rpc message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
          xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config>
           <system xmlns="http://example.com/schema/config">
             <services>
               <ssh nc:operation="delete"/>
             </services>
           </system>
         </config>
       </edit-config>
     </rpc>
  • YANG is the data modeling language for NETCONF
  • designed to be human readable and easy to understand
  • composed of hierarchical schema encoded in XML that can closely resemble an implementation’s native data structures
  • organizes the semantics and data representation
  • augments inserts nodes into an existing hierarchy so they can augment existing YANG modules, e.g. a standard module where the implementation provides additional vendor specific data/service
  • deviations over-ride nodes in an existing hierarchy so they can deviate from existing YANG modules, e.g. a standard module where the implementation cannot provide the data/service for a particular node
  • “if”, “when”, and “choice” constructs
  • contains a rich set of standard types and can create derived types and unions of types
  • grouping allows collections of nodes to be reused
  • “rpc” statement defines methods, input and output parameters
  • provides notifications
  • robust development is supported with versioning and with modularity. Modules can include sub-modules, which in turn can include yet more sub-modules

YumaWorks’ YumaPro SDK implements the YANG standard fully, including optional requirements.

Key features of YumaPro’s YANG implementation:

  • YumaPro is a 100% “native YANG” implementation – YANG modules are used directly by all the tools to control all aspects of NETCONF protocol usage
  • all YumaPro programs use the same centralized YANG language parser
  • keeps current with evolving standard’s features
  • YumaPro programs support concurrent usage of different revisions of the same module or sub-module
  • translation of existing investment in SNMP MIB data into YANG with freely available smidump tool