Questions tagged [ietf-netmod-yang]

YANG is a data modeling language originally designed to model data manipulated by the Network Configuration Protocol (NETCONF). Since the publication of YANG version 1 (RFC6020), YANG has been used or proposed to be used for other protocols (e.g., RESTCONF and CoMI). Use this tag for questions related to the YANG data modeling language and tools that process it.

YANG is the data modeling language for the Network Configuration Protocol (NETCONF). The name is an acronym for Yet Another Next Generation. The YANG data modeling language was developed by the NETMOD working group (NETMOD WG) in the Internet Engineering Task Force (IETF) and was published as RFC 6020 in October 2010. A new maintenance release of the core YANG specification has been published by the NETMOD WG in August 2016 (YANG 1.1, RFC 7950).

YANG is a language originally designed to model data for the NETCONF protocol. A YANG module defines a hierarchy of data that can be used for NETCONF-based operations, including configuration, state data, Remote Procedure Calls (RPCs), and notifications. This allows a complete description of all data sent between a NETCONF client and server. Although out of scope for YANG specification, YANG can also be used with protocols other than NETCONF.

YANG models the hierarchical organization of data as a tree in which each node has a name, and either a value or a set of child nodes. It provides clear and concise descriptions of the nodes, as well as the interaction between those nodes.

An example YANG module:

module example-forest {

  namespace "http://example.org/example-forest";
  prefix et;
  revision 2015-11-26;

  import ietf-yang-types {
    prefix yang;
  }

  typedef tree-species {
    type string;
    description "Defines the species of a tree.";
  }

  typedef a-tree {
    type leafref {
      path "/et:forest/et:trees/et:tree/et:id";
    }
    description "Represents a known tree.";
  }

  /*
   * Our forest.
   */
  container forest {
    description "A forest full of trees and potentially other stuff.";

    container trees {
      description "The trees of a forest.";

      list tree {
        description "Describes one tree in a forest.";        
        key id;

        leaf id {
          type string;
          description "A unique identifier of a tree.";
        }
        leaf species {
          type et:tree-species;
          description "The tree species.";
          mandatory true;
        }        
        leaf description {
          type string;
          description "A short description of the tree.";
        }
        leaf location {
          type string;
          mandatory true;
          description "The location of the tree";
        }
        leaf height {
          type uint8;
          units "meters";
          description "The height of the tree.";
        }

      }
    }
  }

  /**
   * Cutting schedules.
   */
  container cutting-schedules {
    description "Our cutting schedules.";

    list cutting-schedule {
      description "A cutting schedule.";    
      key "name date";

      leaf name {
        type string;
        description "A name for the schedule.";
      }
      leaf date {
        type yang:date-and-time;
        description "When to start cutting down trees.";
      }
      leaf-list tree {
        type a-tree;
        min-elements 1;
        description "Which trees to cut down.";
      }
    }
  }
}

Sample data in XML encoding:

<?xml version="1.0" encoding="utf-8"?>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

  <forest xmlns="http://example.org/example-forest">
    <trees>
      <tree>
        <id>Lisa</id>
        <species>pine</species>
        <location>Right in the centre of the forest.</location>
        <height>15</height>
      </tree>
      <tree>
        <id>Bob</id>
        <species>oak</species>
        <location>At the first Y split of the path through forest.</location>
        <height>20</height>
      </tree>
      <tree>
        <id>John</id>
        <species>birch</species>
        <description>Struck by lightning a few years ago.</description>
        <location>Next to the burnt down tree-house debris.</location>
        <height>10</height>
      </tree>
    </trees>
  </forest>

  <cutting-schedules xmlns="http://example.org/example-forest">
    <cutting-schedule>
      <name>High priority cleanup</name>
      <date>2015-11-30T16:00:00Z</date>
      <tree>Bob</tree>
      <tree>John</tree>
    </cutting-schedule>
  </cutting-schedules>

</data>

Learn more about YANG here:

161 questions
0
votes
1 answer

Yang used as Xml or Json?

i just want to know is yang modeling language specific and can only be used with NetConf protocol, or can it be used to model data like Xml and Json ? Thank you
0
votes
1 answer

leafref require-instance allows to carry non existing values

want to get clarity on the following: say, (omitting key for brevity) list l1 { leaf lx { leafref /x/y; require-instance false; mandatory false; } } because mandatory is false, I can have a l1 instance without the leaf…
user19937
  • 587
  • 1
  • 7
  • 25
0
votes
1 answer

yang path expressions to refer to data nodes and schema nodes etc

consider the following yang module module mod { yang-version 1; namespace "http://example.com/mod"; prefix m; revision "2016-09-09" { description "Initial revision."; } container foo { description 'container…
user19937
  • 587
  • 1
  • 7
  • 25
0
votes
1 answer

How to set the action for a flow in ODL beryllium YANG UI?

I try to add flows to the switches via DLUX YangUI (using Beryllium). So, I go to the API opendaylight-iventory rev.2013-08-19 -> config -> nodes -> node ->table -> flow and start to add a flow like this (Preview):…
Mohanraj V
  • 31
  • 1
  • 4
0
votes
2 answers

JavaScript to list out connection with nested Json and implement it with GOJS

I have a JSON DATA like the following [ { "name": "car", "value": "", "children": [ { "name": "v8_engine", "value": "", "children": [ { "name": "cylinder-arrangement", …
Nadvez
  • 83
  • 1
  • 9
0
votes
1 answer

Can the YANG module have a list inside a grouping?

My code is as follows. 1. grouping policy-attributes { container qospolicies { list qospolicy { key "uuid"; uses attrs:base-attributes; uses qos-policy-attributes; uses…
0
votes
1 answer

YANG model Special Characters includes @

How to use @ as a special character for name field in YANG file. I am using type as a string which help me to accept all ASCII special characters from keyboard except @ Is @ is some kind of a Keyword or carrying some special meaning for YANG…
0
votes
1 answer

Opendaylight YANG RPC modelling for anyxml /anydata types

Does Opendaylight(Beryllium) support YANG RPC data modelling types like anyxml/anydata ? I have been involved in developing an Opendaylight Controller App, in which i have to publish a dynamic JSON data as part of RPC(NorthBound API). Here is my…
Jayaprakash
  • 703
  • 6
  • 15
0
votes
1 answer

Is there a way to generate sample data out of a yang file

Our projects are based on yang modelling. there is a project which internally works on the modeled data of other projects. So, to start with that project, we need to populate the models of other projects with the data in the data stores. this…
Vikram Darsi
  • 79
  • 2
  • 8
0
votes
0 answers

How to resolve failure of dependency error?

This is the error I am getting while making maven build of Open Day Light YangTools [ERROR] Plugin org.apache.maven.plugins:maven-compiler-plugin:3.2.1 or one of its dependencies could not be resolved: Failure to find…
0
votes
3 answers

Understanding Netconf and Yang in NMS

I am really new to Network management systems where object modelling, netconf and Yang being used widely. I would like to know if there is any list of books or articles to follow to understand the whole concept. Any opensource projects in C and…
codingfreak
  • 4,467
  • 11
  • 48
  • 60
0
votes
1 answer

How to put restrictions on Pattern of String in Yang Model

how can we design the string pattern if i want to allow special characters (#@$%) also to be included in the value for Name. For Ex. All the below ones are valid entries for Name Name = aaa990ZX Name = a@#9980XS Name = $$$$$$$$ Name =…
yvk
  • 1
  • 1
  • 4
0
votes
1 answer

How to define constants in YANG?

I am trying to write a YANG file to capture an XML schema. I want to model an XML like the following. ` inbuilt a1 a2
user1793318
  • 213
  • 3
  • 11
0
votes
1 answer

How to make yang2dsl ignore the order of input parameters during yang validation?

I use pyang's yang2dsl for validating input xml instances against yang data model. But, it throws error when the order of the parameters in the xml instances is not the same as in yang model. Is there an option to make it ignore the order of…
linuxfreak
  • 2,068
  • 3
  • 20
  • 29
0
votes
1 answer

Is any function in yang model or xpath to get a current date time

Please, can anyone tell me how to get current date and time in yang model, i want to apply a must statement in yang which validates that the entered date and time must greater than the current date and time
1 2 3
10
11