<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<!DOCTYPE rfc SYSTEM 'rfc2629.dtd'>
<?rfc toc="yes"?>
<?rfc compact="no"?>
<?rfc subcompact="no"?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>
<?rfc iprnotified="no"?>
<?rfc strict="yes"?>
<rfc ipr="trust200902"   category="std"
    docName="draft-bierman-netmod-yang-data-ext-00" >
    <front>
    <title abbrev="YANG Data Extensions">YANG Data Extensions</title>

    <author initials="A" surname="Bierman" fullname='Andy Bierman' >
      <organization>YumaWorks</organization>
      <address>
        <email>andy@yumaworks.com</email>
      </address>
    </author>
	<date/>
    <abstract>
	<t>
This document describes YANG mechanisms for
extending the utility of the &apos;yang&#8209;data&apos; extension statement
defined in RFC 8040.
	</t>
</abstract>
</front>
<middle>
<section title="Introduction">
    <t>
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 &apos;yang&#8209;data&apos; extension statement from RFC 8040 <xref target="RFC8040"/>
is defined for this purpose, however it is limited in its
functionality.
    </t>
    <t>
The intended use of the &quot;yang&#8209;data&quot; extension is to model
all or part of a protocol message, such as the &quot;errors&quot;
definition in ietf-restconf.yang <xref target="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.
    </t>
    <t>
This document defines a new YANG extension statement
called &quot;augment&#8209;yang&#8209;data&quot;, which allows abstract data structures
to be augmented from external modules, similar to the
existing YANG &quot;augment&quot; statement, which cannot be used
because a YANG compiler or other tool is not required to
understand the &quot;yang&#8209;data&quot; extension.
    </t>
<section title="Terminology">
    <t>
The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quot;SHALL&quot;, &quot;SHALL
NOT&quot;, &quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;,  &quot;MAY&quot;, and
&quot;OPTIONAL&quot; in this document are to be interpreted as described in
<xref target="RFC2119"/>.
    </t>
<section title="NETCONF">
    <t>
The following terms are defined in <xref target="RFC6241"/>:
    </t>
<t>
 <list style="symbols">
 <t>
configuration data
 </t>
 <t>
state data
 </t>
 </list>
</t>
</section>
<section title="YANG">
    <t>
The following terms are defined in <xref target="RFC7950"/>:
    </t>
<t>
 <list style="symbols">
 <t>
absolute-schema-nodeid
 </t>
 <t>
container
 </t>
 <t>
data node
 </t>
 <t>
leaf
 </t>
 <t>
leaf-list
 </t>
 <t>
list
 </t>
 </list>
</t>
</section>
</section>
</section>
<section title="Definitions">
<section title="Restrictions on Conceptual YANG Data">
    <t>
This document places restrictions on the &quot;yang&#8209;data&quot; external
statements that can be used with the &quot;augment&#8209;yang&#8209;data&quot;
extension. The conceptual data definitions
are considered to be in the same identifier namespace
as defined in section 6.2.1 of <xref target="RFC7950"/>. In particular,
bullet 7:
    </t>
	<figure>
	    <artwork><![CDATA[
   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.
	    ]]></artwork>
	</figure>
    <t>
This means that conceptual data defined with the &quot;yang&#8209;data&quot;
or &quot;augment&#8209;yang&#8209;data&quot; statements cannot have the same local-name
as sibling nodes from regular YANG data-def statements or
other &quot;yang&#8209;data&quot; or &quot;augment&#8209;yang&#8209;data&quot; statements.
    </t>
</section>
<section title="YANG Data Extensions Module" anchor="mod">
    <t>
The &quot;yang&#8209;data&#8209;ext&quot; module defines the &apos;augment&#8209;yang&#8209;data&apos; extension
to augment conceptual data already defined with the
RESTCONF &quot;yang&#8209;data&quot; extension.
    </t>
    <t>
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.
    </t>
<t>&lt;CODE BEGINS> file "yang-data-ext@2017-07-03.yang"</t>
	<figure>
	    <artwork><![CDATA[
module yang-data-ext {
  namespace "urn:ietf:params:xml:ns:yang:yang-data-ext";
  prefix "yd";

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

  contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     Author:   Andy Bierman
               <mailto:andy@yumaworks.com>";

  description
    "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
     (http://trustee.ietf.org/license-info).";

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

  extension augment-yang-data {
    argument path {
      yin-element true;
    }
    description
      "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.

       Example:

          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; }
             }
          }
      ";
  }

}
	    ]]></artwork>
	</figure>
<t>&lt;CODE ENDS></t>
</section>
</section>
<section title="IANA Considerations" anchor="iana">
<section title="YANG Module Registry">
    <t>
TBD
    </t>
</section>
</section>
<section title="Security Considerations">
    <t>
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 <xref target="RFC7950"/>.
    </t>
</section>
</middle>
<back>
<references title="Normative References">


  <reference anchor="RFC2119">
    <front>
      <title>Key words for use in RFCs to Indicate Requirement Levels</title>
      <author initials="S." surname="Bradner" fullname="S.  Bradner">
        <organization>Harvard University</organization>
      </author>
      <date month="March" year="1997"/>
      <abstract>
        <t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized.  This document defines these words as they should be interpreted in IETF documents.</t>
      </abstract>
    </front>
    <seriesInfo name="BCP" value="14"/>
    <seriesInfo name="RFC" value="2119"/>
    <format type="TXT" octets="4723" target="ftp://ftp.isi.edu/in-notes/rfc2119.txt"/>
  </reference>

  <reference anchor='RFC6241'>
      <front>
        <title>Network Configuration Protocol (NETCONF)</title>
        <author initials='R.' surname='Enns' fullname='R. Enns' role="editor">
          <organization/>
        </author>
        <author initials='M.' surname='Bjorklund' fullname='M. Bjorklund' role="editor">
          <organization/>
        </author>
        <author initials='J.' surname='Schoenwaelder' fullname='J. Schoenwaelder' role="editor">
          <organization/>
        </author>
        <author initials='A.' surname='Bierman' fullname='A. Bierman' role="editor">
          <organization/>
        </author>
        <date year='2011' month='June'/>
      </front>
      <seriesInfo name='RFC' value='6241'/>
  </reference>


<reference anchor="RFC7950" target="http://www.rfc-editor.org/info/rfc7950">
<front>
<title>The YANG 1.1 Data Modeling Language</title>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="editor">
<organization/>
</author>
<date year="2016" month="August"/>
<abstract>
<t>
YANG is a data modeling language used to model configuration data, state data, Remote Procedure Calls, and notifications for network management protocols. This document describes the syntax and semantics of version 1.1 of the YANG language. YANG version 1.1 is a maintenance release of the YANG language, addressing ambiguities and defects in the original specification. There are a small number of backward incompatibilities from YANG version 1. This document also specifies the YANG mappings to the Network Configuration Protocol (NETCONF).
</t>
</abstract>
</front>
<seriesInfo name="RFC" value="7950"/>
<seriesInfo name="DOI" value="10.17487/RFC7950"/>
</reference>

<reference anchor="RFC8040" target="http://www.rfc-editor.org/info/rfc8040">
<front>
<title>RESTCONF Protocol</title>
<author initials="A." surname="Bierman" fullname="A. Bierman">
<organization/>
</author>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
<organization/>
</author>
<author initials="K." surname="Watsen" fullname="K. Watsen">
<organization/>
</author>
<date year="2017" month="January"/>
<abstract>
<t>
This document describes an HTTP-based protocol that provides a programmatic interface for accessing data defined in YANG, using the datastore concepts defined in the Network Configuration Protocol (NETCONF).
</t>
</abstract>
</front>
<seriesInfo name="RFC" value="8040"/>
<seriesInfo name="DOI" value="10.17487/RFC8040"/>
</reference>

</references>
</back></rfc>
