Skip to content
chuck-a-black edited this page Jan 20, 2015 · 18 revisions

The Yin of YANG

"What's up with YANG" you may be asking yourself? This page will attempt to answer some of your questions about this topic. On this page you will learn about why we needed YANG in the first place, what YANG is, and how the Brocade Vyatta Controller and ODL use YANG for developing SDN applications.


Why YANG?


Network management and control systems use protocols for exchanging configuration and operational information with network devices. The earliest common protocol was the Simple Network Management Protocol (SNMP), which used a data modeling language called Structure of Management Information (SMI).

But this was over 25 years ago. SMI became SMIv2, and eventually people began looking for a "next generation" data modeling language.

As NETCONF became popular as a successor to SNMP, a new data modeling language was needed even more, one which was updated to today's environment, and which defines new aspects of a data model such as APIs to be called (referred to as "RPCs"), and notifications to be sent (from the data model to subscribers). For these reasons, YANG was developed as the chosen data modeling language for NETCONF.

Note: If you are thinking "SMI is to SNMP as YANG is to NETCONF", you are exactly correct.

However - and this is important - as a language for defining the attributes, APIs, and notifications of a model, YANG was recognized as useful in contexts other than just NETCONF. One of those contexts is MD-SAL. MD-SAL applications now use YANG to define the RPCs that will become RESTCONF APIs; to specify the information (data) contained in the object being modeled; and to specify any notifications to be sent to interested listeners.

Note: You will see many links to pages in which YANG and NETCONF are discussed together, almost as one. But remember that for YANG's use as a modeling language with MD-SAL applications, NETCONF is not involved.


What exactly is YANG?


This page is not intended to be a tutorial on YANG, as this is done adequately elsewhere. In fact, below are a few useful links for learning more about the details of YANG:

YANG Link Description
Yang Central Location for all things related to YANG, including tutorials, documents, examples
NETCONF Central NETCONF-oriented but with much information about YANG, including RFCs and tutorials
NETCONF-YANG paper Tail-F document describing both NETCONF and YANG

Note: The links above provide good tutorials on YANG and how it is used, but remember that NETCONF is not relevant to our discussion of MD-SAL's usage of YANG.

Although this is not a tutorial, a simple YANG definition may be helpful here, to give you a flavor for how the language is used. The example below is taking from the yang-central web site.

module acme-system {
    namespace "http://acme.example.com/system";
    prefix "acme";

    organization "ACME Inc.";
    contact "joe@acme.example.com";
    description
        "The module for entities implementing the ACME system.";

    revision 2007-11-05 {
        description "Initial revision.";
    }

    container system {
        leaf host-name {
            type string;
            description "Hostname for this system";
        }

        leaf-list domain-search {
            type string;
            description "List of domain names to search";
        }

        list interface {
            key "name";
            description "List of interfaces in the system";
            leaf name {
                type string;
            }
            leaf type {
                type string;
            }
            leaf mtu {
                type int32;
            }
        }
    }
}

How do the Brocade Vyatta Controller (and ODL) use YANG?


If you are looking for something a little closer to home - home being ODL and the Brocade Vyatta Controller - there are some examples available of the use of YANG in defining MD-SAL applications. The following lists the major examples of YANG definitions for MD-SAL applications:

Application Description
Ping MD-SAL application to ping a network device
Toaster Our old friend the toaster, step-by-step

If you have gone through the page in this wiki on MD-SAL, you understand that you can generate a simple, skeletal MD-SAL application using the Maven Archetype functionality. Once you have done this, you will have YANG models created for you in each of the relevant modules:

  • Model: model/src/main/yang/task.yang
  • Provider: provider/src/main/yang/task-provider-impl.yang
  • Consumer: consumer/src/main/yang/task-consumer-impl.yang

Examining these auto-generated YANG files for your MD-SAL application will give you an idea of how it is used in the definition and creation of model-based applications in ODL and the Brocade Vyatta Controller.


Conclusion


Clearly YANG is fundamental to the definition of MD-SAL applications. We have seen why it exists, what it is all about, and how it is used by ODL and by the Brocade Vyatta Controller. Hopefully this background will assist you as you embark on the journey of developing SDN applications on the Brocade Vyatta Controller.