Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • An XML-based equivalent version of YANG is called YIN
  • YANG uses a tree to define the hierarchy of data wherein each ‘node’ has a value or/and a set of child nodes
    • 4 types of nodes
      • leaf container nodes
      • list nodes 
      • container leaf nodes
      • leaf-list nodeslist nodes
Sample YANG (store.yang)Statements and Description


Code Block
languagetext
linenumberstrue
module stores {
    yang-version 1.1;
    namespace "org:onap:ccsdk:sample";

    prefix book-store;

    revision "2020-09-15" {
        description
        "Sample Model";
    }

    typedef year {
        type uint16 {
            range "1000..9999";
        }
    }

    container bookstore { 

        leaf bookstore-name {
            type string;
        }
    list categories {

        key "code";

        leaf code {	
            type string;
        }

        leaf name {
            type string;
        }

        list books {
            key title;

            leaf title {
                type string;
            }
            leaf-list authors {
                type string; 
            }
        }
    }
    }
}




module Statement

  • YANG language defines models with modules and submodules
  • Takes one argument (module name) which is the identifier
  • Groups all statements that belong to the module
  • This module example contains the following statements for header information:
    • yang-version statement
    • namespace statement
    • prefix statement
    • revision statements






Figure 1.1 Schema tree of module 'stores'

...