Network Working Group A. Bierman
Internet-Draft YumaWorks
Intended status: Standards Track July 3, 2017
Expires: January 4, 2018

YANG Data Extensions


This document describes YANG mechanisms for extending the utility of the 'yang‑data' extension statement defined in RFC 8040.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on January 4, 2018.

Copyright Notice

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

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents ( in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

Table of Contents

1. Introduction

There is a need for standard mechanisms to allow the definition of abstract data that is not intended to be implemented as configuration data or state data. The 'yang‑data' extension statement from RFC 8040 [RFC8040] is defined for this purpose, however it is limited in its functionality.

The intended use of the "yang‑data" extension is to model all or part of a protocol message, such as the "errors" definition in ietf-restconf.yang [RFC8040]. However, protocols are often layered such that the header or payload portions of the message can be extended by external documents. The YANG statements that model a protocol need to support this extensibility that is already found in that protocol.

This document defines a new YANG extension statement called "augment‑yang‑data", which allows abstract data structures to be augmented from external modules, similar to the existing YANG "augment" statement, which cannot be used because a YANG compiler or other tool is not required to understand the "yang‑data" extension.

1.1. Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

1.1.1. NETCONF

The following terms are defined in [RFC6241]:

1.1.2. YANG

The following terms are defined in [RFC7950]:

2. Definitions

2.1. Restrictions on Conceptual YANG Data

This document places restrictions on the "yang‑data" external statements that can be used with the "augment‑yang‑data" extension. The conceptual data definitions are considered to be in the same identifier namespace as defined in section 6.2.1 of [RFC7950]. In particular, bullet 7:

   All leafs, leaf-lists, lists, containers, choices, rpcs, actions,
   notifications, anydatas, and anyxmls defined (directly or through
   a "uses" statement) within a parent node or at the top level of
   the module or its submodules share the same identifier namespace.

This means that conceptual data defined with the "yang‑data" or "augment‑yang‑data" statements cannot have the same local-name as sibling nodes from regular YANG data-def statements or other "yang‑data" or "augment‑yang‑data" statements.

2.2. YANG Data Extensions Module

The "yang‑data‑ext" module defines the 'augment‑yang‑data' extension to augment conceptual data already defined with the RESTCONF "yang‑data" extension.

Note that there is no YANG tree diagram provided because pyang does not produce any tree output for a module containing only an extension statement.

<CODE BEGINS> file "yang-data-ext@2017-07-03.yang"

module yang-data-ext {
  namespace "urn:ietf:params:xml:ns:yang:yang-data-ext";
  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 {
      "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; }



3. IANA Considerations

3.1. YANG Module Registry


4. Security Considerations

This document defines a YANG extension which is used to define conceptual YANG data. It does not introduce any new vulnerabilities beyond those specified in YANG 1.1 [RFC7950].

5. Normative References

[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC6241] Enns, R., Bjorklund, M., Schoenwaelder, J. and A. Bierman, "Network Configuration Protocol (NETCONF)", RFC 6241, June 2011.
[RFC7950] Bjorklund, M., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, August 2016.
[RFC8040] Bierman, A., Bjorklund, M. and K. Watsen, "RESTCONF Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017.

Author's Address

Andy Bierman YumaWorks EMail: