netconfcentral logo


  module yang-data-ext {

    yang-version 1;


    prefix yd;

      "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

      "WG Web:   <>
     WG List:  <>

     Author:   Andy Bierman

      "This module contains conceptual YANG specifications
     for augmenting abstract 'yang-data' data structures.

     Copyright (c) 2017 IETF Trust and the persons identified as
     authors of the code.  All rights reserved.

     Redistribution and use in source and binary forms, with or
     without modification, is permitted pursuant to, and subject
     to the license terms contained in, the Simplified BSD License
     set forth in Section 4.c of the IETF Trust's Legal Provisions
     Relating to IETF Documents

    revision "2017-07-03" {
      description "Initial revision.";
        "RFC XXXX: YANG Data Extensions.";


    extension augment-yang-data {
      argument "path" {
        yin-element true;
        "This extension is used to specify an augmentation to
       conceptual data defined with the 'yang-data' statement.
       It is intended to describe hierarchical data independent
       of protocol context or specific message encoding format.

       This statement has almost the same structure as the
       'augment-stmt'. Data definition statements within this
       statement specify the semantics and generic syntax for the
       additional data to be added to the specific YANG data template,
       identified by the 'path' argument.

       Note that this extension does not define a media-type.
       A specification using this extension MUST specify the
       message encoding rules, including the content media type.

       The mandatory 'path' parameter value identifies the YANG
       conceptual data node that is being augmented, represented
       as an absolute-schema-nodeid string.

       This extension is ignored unless it appears as a top-level
       statement. The sub-statements of this extension MUST follow
       the 'data-def-stmt' rule in the YANG ABNF.

       The module name and namespace value for the YANG module using
       the extension statement is assigned to instance document data
       conforming to the data definition statements within
       this extension.

       The XPath document root is the augmented extension statement
       itself, such that the child nodes of the document root are
       represented by the data-def-stmt sub-statements within
       the augmented yang-data statement.

       The context node of the augment-yang-data statement is derived
       in the same way as the 'augment' statement, as defined in
       section 6.4.1 of [RFC7950]. This conceptual node is
       considered the context node for the following YANG statements:

         - must-stmt
         - when-stmt
         - path-stmt
         - min-elements-stmt
         - max-elements-stmt
         - mandatory-stmt
         - unique-stmt
         - ordered-by
         - instance-identifier data type

       The following data-def-stmt sub-statements are constrained
       when used within a augment-yang-data extension statement.

         - The list-stmt is not required to have a key-stmt defined.
         - The if-feature-stmt is ignored if present.
         - The config-stmt is ignored if present.
         - The available identity values for any 'identityref'
           leaf or leaf-list nodes is limited to the module
           containing this extension statement, and the modules
           imported into that module.


          foo.yang {
             import ietf-restconf { prefix rc; }

             rc:yang-data foo-data {
               container foo-con { }

          bar.yang {
             import yang-data-ext { prefix yd; }
             import foo { prefix foo; }

             yd:augment-yang-data /foo:foo-con {
               leaf add-leaf1 { type int32; }
               leaf add-leaf2 { type string; }
  }  // module yang-data-ext