rfc8791xml2.original.xml   rfc8791.xml 
<?xml version="1.0"?> <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?> <!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<!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" updates="8340" category="std"
docName="draft-ietf-netmod-yang-data-ext-05" >
<front>
<title abbrev="YANG Structure">YANG Data Structure Extensions</title>
<author initials="A" surname="Bierman" fullname='Andy Bierman' > <rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902"
updates="8340" category="std" consensus="true"
docName="draft-ietf-netmod-yang-data-ext-05" number="8791" obsoletes=""
submissionType="IETF" xml:lang="en" tocInclude="true" symRefs="true"
sortRefs="true" version="3">
<!-- xml2rfc v2v3 conversion 2.40.0 -->
<front>
<title abbrev="YANG Data Structure Extensions">YANG Data Structure Extension
s</title>
<seriesInfo name="RFC" value="8791"/>
<author initials="A" surname="Bierman" fullname="Andy Bierman">
<organization>YumaWorks</organization> <organization>YumaWorks</organization>
<address> <address>
<email>andy@yumaworks.com</email> <email>andy@yumaworks.com</email>
</address> </address>
</author> </author>
<author initials="M" surname="Bjorklund" fullname='Martin Bjorklund' > <author initials="M" surname="Bjorklund" fullname="Martin Bjorklund">
<organization>Cisco</organization> <organization>Cisco</organization>
<address> <address>
<email>mbj@tail-f.com</email> <email>mbj+ietf@4668.se</email>
</address> </address>
</author> </author>
<author initials="K" surname="Watsen" fullname='Kent Watsen' > <author initials="K" surname="Watsen" fullname="Kent Watsen">
<organization>Watsen Networks</organization> <organization>Watsen Networks</organization>
<address> <address>
<email>kent+ietf@watsen.net</email> <email>kent+ietf@watsen.net</email>
</address> </address>
</author> </author>
<date/> <date year="2020" month="June" />
<abstract> <abstract>
<t>
<t>
This document describes YANG mechanisms for This document describes YANG mechanisms for
defining abstract data structures with YANG. defining abstract data structures with YANG.
</t> </t>
</abstract> </abstract>
</front> </front>
<middle> <middle>
<section title="Introduction" anchor="introduction"> <section anchor="introduction" numbered="true" toc="default">
<t> <name>Introduction</name>
<t>
There is a need for standard mechanisms to allow the There is a need for standard mechanisms to allow the
definition of abstract data that is not intended to definition of abstract data that is not intended to
be implemented as configuration or operational state. be implemented as configuration or operational state.
The &quot;yang&#8209;data&quot; extension statement from RFC 8040 <xref target=" The "yang-data" extension statement from RFC 8040 <xref target="RFC8040"
RFC8040"/> format="default"/> was defined for this purpose, but it is limited in its
was defined for this purpose but it is limited in its
functionality. functionality.
</t> </t>
<t> <t>
The intended use of the &quot;yang&#8209;data&quot; extension was to model all o The intended use of the "yang-data" extension was to model all or part
r part of a protocol message, such as the "errors" definition in the
of a protocol message, such as the &quot;errors&quot; definition in the YANG YANG module "ietf-restconf" <xref target="RFC8040" format="default"/>, or the
module &quot;ietf&#8209;restconf&quot; <xref target="RFC8040"/>, or the contents contents of a file. However,
of a file. However,
protocols are often layered such that the header or payload portions protocols are often layered such that the header or payload portions
of the message can be extended by external documents. The YANG of the message can be extended by external documents. The YANG
statements that model a protocol need to support this extensibility statements that model a protocol need to support this extensibility
that is already found in that protocol. that is already found in that protocol.
</t> </t>
<t> <t>
This document defines a new YANG extension statement called This document defines a new YANG extension statement called
&quot;structure&quot;, which is similar to but more flexible than the "structure", which is similar to but more flexible than the
&quot;yang&#8209;data&quot; extension from <xref target="RFC8040"/>. There is n "yang-data" extension from <xref target="RFC8040" format="default"/>.
o assumption that a
There is no assumption that a
YANG data structure can only be used as a top-level abstraction, and YANG data structure can only be used as a top-level abstraction, and
it may also be nested within some other data structure. it may also be nested within some other data structure.
</t> </t>
<t>
<t>
This document also defines a new YANG extension statement called This document also defines a new YANG extension statement called
&quot;augment&#8209;structure&quot;, which allows abstract data structures to be "augment&nbhy;structure", which allows abstract data structures to be
augmented from external modules, similarly to the existing YANG augmented from external modules and is similar to the existing YANG "augment"
&quot;augment&quot; statement. Note that &quot;augment&quot; cannot be used to statement. Note that "augment" cannot be used to augment a YANG data
augment a structure since a YANG compiler or other tool is not required to understand
YANG data structure since a YANG compiler or other tool is not the "structure" extension.
required to understand the &quot;structure&quot; extension. </t>
</t> <section anchor="terminology" numbered="true" toc="default">
<section title="Terminology" anchor="terminology">
<t> <name>Terminology</name>
The key words &quot;MUST&quot;, &quot;MUST NOT&quot;, &quot;REQUIRED&quot;, &quo <t>
t;SHALL&quot;, &quot;SHALL NOT&quot;, The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
&quot;SHOULD&quot;, &quot;SHOULD NOT&quot;, &quot;RECOMMENDED&quot;, &quot;NOT R "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>",
ECOMMENDED&quot;, &quot;MAY&quot;, and "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>",
&quot;OPTIONAL&quot; in this document are to be interpreted as described in "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, th "<bcp14>MAY</bcp14>", and
ey appear in all "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as described in
BCP 14 <xref target="RFC2119" format="default"/> <xref target="RFC8174"
format="default"/> when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
</t> </t>
<t> <t>
The following terms are used within this document: The following term is used within this document:
</t> </t>
<t> <dl newline="false" spacing="normal">
<list style="symbols"> <dt>YANG data structure:</dt>
<t> <dd>A data structure defined with the "structure"
YANG data structure: A data structure defined with the &quot;structure&quot; statement.</dd>
statement. </dl>
</t> <section anchor="nmda" numbered="true" toc="default">
</list> <name>NMDA</name>
</t> <t>
<section title="NMDA" anchor="nmda">
<t>
The following terms are defined in the The following terms are defined in the
Network Management Datastore Architecture Network Management Datastore Architecture
(NMDA) <xref target="RFC8342"/>, (NMDA) <xref target="RFC8342" format="default"/>
and are not redefined here: and are not redefined here:</t>
</t> <ul spacing="normal">
<t> <li>configuration</li>
<list style="symbols"> <li>operational state</li>
<t> </ul>
configuration </section>
</t> <section anchor="yang" numbered="true" toc="default">
<t> <name>YANG</name>
operational state
</t> <t>The following terms are defined in <xref target="RFC7950"
</list> format="default"/> and are not redefined here:</t>
</t> <ul spacing="normal">
</section> <li>absolute-schema-nodeid</li>
<section title="YANG" anchor="yang"> <li>container</li>
<t> <li>data definition statement</li>
The following terms are defined in <xref target="RFC7950"/>: <li>data node</li>
</t> <li>leaf</li>
<t> <li>leaf-list</li>
<list style="symbols"> <li>list</li>
<t> </ul>
absolute-schema-nodeid </section>
</t> </section>
<t> </section>
container <section anchor="definitions" numbered="true" toc="default">
</t> <name>Definitions</name>
<t> <t>
data definition statement A YANG data structure is defined with the "structure" extension
</t> statement, which is defined in the YANG module
<t> "ietf-yang-structure-ext". The
data node argument to the "structure" extension statement is the name of the
</t>
<t>
leaf
</t>
<t>
leaf-list
</t>
<t>
list
</t>
</list>
</t>
</section>
</section>
</section>
<section title="Definitions" anchor="definitions">
<t>
A YANG data structure is defined with the &quot;structure&quot; extension
statement, defined in the YANG module &quot;ietf&#8209;yang&#8209;structure&#820
9;ext&quot;. The
argument to the &quot;structure&quot; extension statement is the name of the
data structure. The data structures are considered to be in the same data structure. The data structures are considered to be in the same
identifier namespace as defined in section 6.2.1 of <xref target="RFC7950"/>. In identifier namespace as defined in <xref target="RFC7950"
particular, bullet 7: sectionFormat="of" section="6.2.1"/>. In particular, the seventh bullet states:
</t> </t>
<figure> <blockquote>
<artwork><![CDATA[
All leafs, leaf-lists, lists, containers, choices, rpcs, actions, All leafs, leaf-lists, lists, containers, choices, rpcs, actions,
notifications, anydatas, and anyxmls defined (directly or through notifications, anydatas, and anyxmls defined (directly or through
a "uses" statement) within a parent node or at the top level of a "uses" statement) within a parent node or at the top level of
the module or its submodules share the same identifier namespace. the module or its submodules share the same identifier namespace.
]]></artwork> </blockquote>
</figure> <t>
<t> This means that data structures defined with the "structure" statement
This means that data structures defined with the &quot;structure&quot; statement
cannot have the same name as sibling nodes from regular YANG data cannot have the same name as sibling nodes from regular YANG data
definition statements or other &quot;structure&quot; statements in the same YANG definition statements or other "structure" statements in the same YANG
module. module.
</t> </t>
<t> <t>
This does not mean a YANG data structure, once defined, has to be used This does not mean a YANG data structure, once defined, has to be used
as a top-level protocol message or other top-level data structure. as a top-level protocol message or other top-level data structure.
</t> </t>
<t> <t>
A YANG data structure is encoded in the same way as an &quot;anydata&quot; node. A YANG data structure is encoded in the same way as an "anydata" node.
This means that the name of the structure is encoded as a &quot;container&quot;, This means that the name of the structure is encoded as a "container",
with the instantiated children encoded as child nodes to this with the instantiated children encoded as child nodes to this
node. For example, this structure: node. For example, this structure:
</t> </t>
<figure> <sourcecode type="yang"><![CDATA[
<artwork><![CDATA[
module example-errors { module example-errors {
... ...
sx:structure my-error { sx:structure my-error {
leaf error-number { leaf error-number {
type int; type int;
} }
} }
} }]]>
]]></artwork> </sourcecode>
</figure> <t>
<t>
can be encoded in JSON as: can be encoded in JSON as:
</t> </t>
<figure> <sourcecode type="json"><![CDATA[
<artwork><![CDATA[
"example-errors:my-error": { "example-errors:my-error": {
"error-number": 131 "error-number": 131
} }]]>
]]></artwork> </sourcecode>
</figure> </section>
</section> <section anchor="yang-data-structures-in-yang-tree-diagrams"
<section title="YANG Data Structures in YANG Tree Diagrams" anchor="yang-data-st numbered="true" toc="default">
ructures-in-yang-tree-diagrams"> <name>YANG Data Structures in YANG Tree Diagrams</name>
<t> <t>
A YANG data structure can be printed in a YANG Tree Diagram <xref target="RFC834 A YANG data structure can be printed in a YANG tree diagram <xref
0"/>. target="RFC8340" format="default"/>.
This document updates RFC 8340 by defining two new sections in the This document updates RFC 8340 <xref target="RFC8340" format="default"/> by defi
ning
two new sections in the
tree diagram for a module: tree diagram for a module:
</t> </t>
<t> <ol spacing="normal">
<list style="numbers"> <li>YANG data structures, which are offset by two spaces and identified by the k
<t> eyword
YANG data structures, offset by two spaces and identified by the keyword "structure" followed by the name of the YANG data structure and a colon (":")
&quot;structure&quot; followed by the name character. </li>
of the YANG data structure and a colon (&quot;:&quot;) character. <li>YANG data structure augmentations, which are offset by 2 spaces and identifi
</t> ed by
<t> the keyword "augment&nbhy;structure" followed by the augment target structure
YANG data structure augmentations, offset by 2 spaces and identified name and a colon (":") character.</li>
by the keyword &quot;augment&#8209;structure&quot; followed by the augment targe </ol>
t
structure name and a colon (&quot;:&quot;) character. <t>
</t> The new sections, including spaces conventions, appear as follows:
</list> </t>
</t> <sourcecode type="yangtree"><![CDATA[
<t>
The new sections, including spaces conventions is:
</t>
<figure>
<artwork><![CDATA[
structure <structure-name>: structure <structure-name>:
+--<node> +--<node>
+--<node> +--<node>
| +--<node> | +--<node>
+--<node> +--<node>
structure <structure-name>: structure <structure-name>:
+--<node> +--<node>
augment-structure <structure-name>: augment-structure <structure-name>:
+--<node> +--<node>
+--<node> +--<node>
| +--<node> | +--<node>
+--<node> +--<node>
augment-structure <structure-name>: augment-structure <structure-name>:
+--<node> +--<node>]]>
]]></artwork> </sourcecode>
</figure> <t>
<t> Nodes in YANG data structures are printed according to the rules defined in
Nodes in YANG data structures are printed according to the rules <xref target="RFC8340" sectionFormat="of" section="2.6"/>. The nodes in YANG
defined in section 2.6 in <xref target="RFC8340"/>. data structures do not have any &lt;flags&gt;.
</t> </t>
</section> </section>
<section title="YANG Data Structure Extensions Module" anchor="mod"> <section anchor="mod" numbered="true" toc="default">
<t> <name>YANG Data Structure Extensions Module</name>
RFC Ed.: update the date below with the date of RFC publication and
remove this note. <sourcecode type="yang" name="ietf-yang-structure-ext@2020-06-08.yang" markers="
</t> true"><![CDATA[
<t>&lt;CODE BEGINS> file "ietf-yang-structure-ext@2019-03-07.yang"</t>
<figure>
<artwork><![CDATA[
module ietf-yang-structure-ext { module ietf-yang-structure-ext {
yang-version 1.1; yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext"; namespace "urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext";
prefix sx; prefix sx;
organization organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group"; "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact contact
"WG Web: <http://tools.ietf.org/wg/netmod/> "WG Web: <https://datatracker.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org> WG List: <mailto:netmod@ietf.org>
Author: Andy Bierman Author: Andy Bierman
<mailto:andy@yumaworks.com> <mailto:andy@yumaworks.com>
Author: Martin Bjorklund Author: Martin Bjorklund
<mailto:mbj@tail-f.com> <mailto:mbj+ietf@4668.se>
Author: Kent Watsen Author: Kent Watsen
<mailto:kent+ietf@watsen.net>"; <mailto:kent+ietf@watsen.net>";
description description
"This module contains conceptual YANG specifications for defining "This module contains conceptual YANG specifications for defining
abstract data structures. abstract data structures.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as 'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here. they appear in all capitals, as shown here.
Copyright (c) 2019 IETF Trust and the persons identified as Copyright (c) 2020 IETF Trust and the persons identified as
authors of the code. All rights reserved. authors of the code. All rights reserved.
Redistribution and use in source and binary forms, with or Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject to without modification, is permitted pursuant to, and subject to
the license terms contained in, the Simplified BSD License set the license terms contained in, the Simplified BSD License set
forth in Section 4.c of the IETF Trust's Legal Provisions forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents Relating to IETF Documents
(http://trustee.ietf.org/license-info). (http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX This version of this YANG module is part of RFC 8791
(https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself (https://www.rfc-editor.org/info/rfc8791); see the RFC itself
for full legal notices."; for full legal notices.";
// RFC Ed.: update the date below with the date of RFC publication revision 2020-06-08 {
// and remove this note.
revision 2019-03-07 {
description description
"Initial revision."; "Initial revision.";
// RFC Ed.: replace XXXX with RFC number and remove this note
reference reference
"RFC XXXX: YANG Structure Extensions."; "RFC 8791: YANG Data Structure Extensions.";
} }
extension structure { extension structure {
argument name { argument name {
yin-element true; yin-element true;
} }
description description
"This extension is used to specify a YANG data structure that "This extension is used to specify a YANG data structure that
represents conceptual data defined in YANG. It is intended to represents conceptual data defined in YANG. It is intended to
describe hierarchical data independent of protocol context or describe hierarchical data independent of protocol context or
specific message encoding format. Data definition statements specific message encoding format. Data definition statements
within a 'structure' extension statement specify the generic within a 'structure' extension statement specify the generic
syntax for the specific YANG data structure, whose name is the syntax for the specific YANG data structure, whose name is the
argument of the 'structure' extension statement. argument of the 'structure' extension statement.
Note that this extension does not define a media-type. A Note that this extension does not define a media type. A
specification using this extension MUST specify the message specification using this extension MUST specify the message
encoding rules, including the content media type, if encoding rules, including the content media type, if
applicable. applicable.
The mandatory 'name' parameter value identifies the YANG data The mandatory 'name' parameter value identifies the YANG data
structure that is being defined. structure that is being defined.
This extension is only valid as a top-level statement, i.e., This extension is only valid as a top-level statement, i.e.,
given as a sub-statement to 'module' or 'submodule'. given as a substatement to 'module' or 'submodule'.
The sub-statements of this extension MUST follow the ABNF The substatements of this extension MUST follow the ABNF
rules below, where the rules are defined in RFC 7950: rules below, where the rules are defined in RFC 7950:
*must-stmt *must-stmt
[status-stmt] [status-stmt]
[description-stmt] [description-stmt]
[reference-stmt] [reference-stmt]
*(typedef-stmt / grouping-stmt) *(typedef-stmt / grouping-stmt)
*data-def-stmt *data-def-stmt
A YANG data structure defined with this extension statement is A YANG data structure defined with this extension statement is
encoded in the same way as an 'anydata' node. This means encoded in the same way as an 'anydata' node. This means
that the name of the structure is encoded as a 'container', that the name of the structure is encoded as a 'container',
with the instantiated child statements encoded as child nodes with the instantiated child statements encoded as child nodes
to this node. to this node.
The module name and namespace value for the YANG module using The module name and namespace value for the YANG module using
the extension statement is assigned to each of the data the extension statement are assigned to each of the data
definition statements resulting from the YANG data structure. definition statements resulting from the YANG data structure.
The XPath document element is the extension statement itself, The XPath document element is the extension statement itself,
such that the child nodes of the document element are such that the child nodes of the document element are
represented by the data-def-stmt sub-statements within this represented by the data-def-stmt substatements within this
extension. This conceptual document is the context for the extension. This conceptual document is the context for the
following YANG statements: following YANG statements:
- must-stmt - must-stmt
- when-stmt - when-stmt
- path-stmt - path-stmt
- min-elements-stmt - min-elements-stmt
- max-elements-stmt - max-elements-stmt
- mandatory-stmt - mandatory-stmt
- unique-stmt - unique-stmt
- ordered-by - ordered-by
- instance-identifier data type - instance-identifier data type
The following data-def-stmt sub-statements are constrained The following data-def-stmt substatements are constrained
when used within a 'structure' extension statement. when used within a 'structure' extension statement.
- The list-stmt is not required to have a key-stmt defined. - The list-stmt is not required to have a key-stmt defined.
- The config-stmt is ignored if present. - The config-stmt is ignored if present.
"; ";
} }
extension augment-structure { extension augment-structure {
argument path { argument path {
yin-element true; yin-element true;
} }
description description
"This extension is used to specify an augmentation to YANG data "This extension is used to specify an augmentation to a YANG
structure defined with the 'structure' statement. It is data structure defined with the 'structure' statement. It is
intended to describe hierarchical data independent of protocol intended to describe hierarchical data independent of protocol
context or specific message encoding format. context or specific message encoding format.
This statement has almost the same structure as the This statement has almost the same structure as the
'augment-stmt'. Data definition statements within this 'augment-stmt'. Data definition statements within this
statement specify the semantics and generic syntax for the statement specify the semantics and generic syntax for the
additional data to be added to the specific YANG data additional data to be added to the specific YANG data
structure, identified by the 'path' argument. structure, identified by the 'path' argument.
The mandatory 'path' parameter value identifies the YANG The mandatory 'path' parameter value identifies the YANG
conceptual data node that is being augmented, represented as conceptual data node that is being augmented and is
an absolute-schema-nodeid string, where the first node in the represented as an absolute-schema-nodeid string, where the
absolute-schema-nodeid string identifies the YANG data first node in the absolute-schema-nodeid string identifies the
structure to augment, and the rest of the nodes in the string YANG data structure to augment, and the rest of the nodes in
identifies the node within the YANG structure to augment. the string identifies the node within the YANG structure to
augment.
This extension is only valid as a top-level statement, i.e., This extension is only valid as a top-level statement, i.e.,
given as a sub-statement to 'module' or 'submodule'. given as a substatement to 'module' or 'submodule'.
The sub-statements of this extension MUST follow the ABNF The substatements of this extension MUST follow the ABNF
rules below, where the rules are defined in RFC 7950: rules below, where the rules are defined in RFC 7950:
[status-stmt] [status-stmt]
[description-stmt] [description-stmt]
[reference-stmt] [reference-stmt]
1*(data-def-stmt / case-stmt) 1*(data-def-stmt / case-stmt)
The module name and namespace value for the YANG module using The module name and namespace value for the YANG module using
the extension statement is assigned to instance document data the extension statement are assigned to instance document data
conforming to the data definition statements within this conforming to the data definition statements within this
extension. extension.
The XPath document element is the augmented extension The XPath document element is the augmented extension
statement itself, such that the child nodes of the document statement itself, such that the child nodes of the document
element are represented by the data-def-stmt sub-statements element are represented by the data-def-stmt substatements
within the augmented 'structure' statement. within the augmented 'structure' statement.
The context node of the 'augment-structure' statement is The context node of the 'augment-structure' statement is
derived in the same way as the 'augment' statement, as defined derived in the same way as the 'augment' statement, as defined
in section 6.4.1 of [RFC7950]. This conceptual node is in Section 6.4.1 of [RFC7950]. This conceptual node is
considered the context node for the following YANG statements: considered the context node for the following YANG statements:
- must-stmt - must-stmt
- when-stmt - when-stmt
- path-stmt - path-stmt
- min-elements-stmt - min-elements-stmt
- max-elements-stmt - max-elements-stmt
- mandatory-stmt - mandatory-stmt
- unique-stmt - unique-stmt
- ordered-by - ordered-by
- instance-identifier data type - instance-identifier data type
The following data-def-stmt sub-statements are constrained The following data-def-stmt substatements are constrained
when used within an 'augment-structure' extension statement. when used within an 'augment-structure' extension statement.
- The list-stmt is not required to have a key-stmt defined. - The list-stmt is not required to have a key-stmt defined.
- The config-stmt is ignored if present. - The config-stmt is ignored if present.
Example: Example:
module foo { module foo {
import ietf-yang-structure-ext { prefix sx; } import ietf-yang-structure-ext { prefix sx; }
skipping to change at line 465 skipping to change at line 440
import ietf-yang-structure-ext { prefix sx; } import ietf-yang-structure-ext { prefix sx; }
import foo { prefix foo; } import foo { prefix foo; }
sx:augment-structure /foo:foo-data/foo:foo-con { sx:augment-structure /foo:foo-data/foo:foo-con {
leaf add-leaf1 { type int32; } leaf add-leaf1 { type int32; }
leaf add-leaf2 { type string; } leaf add-leaf2 { type string; }
} }
} }
"; ";
} }
} }]]>
]]></artwork> </sourcecode>
</figure> </section>
<t>&lt;CODE ENDS></t> <section anchor="iana" numbered="true" toc="default">
</section> <name>IANA Considerations</name>
<section title="IANA Considerations" anchor="iana"> <section anchor="yang-module-registry" numbered="true" toc="default">
<section title="YANG Module Registry" anchor="yang-module-registry"> <name>YANG Module Registry</name>
<t> <t>
This document registers one URI as a namespace in the IANA has registered the following URI in the "ns" subregistry within the "IETF
&quot;IETF XML Registry&quot; <xref target="RFC3688"/>: XML Registry" <xref target="RFC3688" format="default"/>:
</t> </t>
<figure>
<artwork><![CDATA[ <dl newline="false" spacing="compact" indent="6">
URI: urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext <dt>URI:</dt>
Registrant Contact: The IESG. <dd>urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext</dd>
XML: N/A; the requested URI is an XML namespace. <dt>Registrant Contact: </dt>
]]></artwork> <dd>The IESG.</dd>
</figure> <dt>XML: </dt>
<t> <dd>N/A; the requested URI is an XML namespace.</dd>
This document registers one YANG module in the &quot;YANG Module Names&quot; </dl>
registry <xref target="RFC6020"/>:
</t> <t>
<figure> IANA has registered the following YANG module in the "YANG Module Names" subregi
<artwork><![CDATA[ stry
name: ietf-yang-structure-ext <xref target="RFC6020" format="default"/> within the "YANG Parameters" registry:
namespace: urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext </t>
prefix: sx
// RFC Ed.: replace XXXX with RFC number and remove this note <dl newline="false" spacing="compact" indent="6">
reference: RFC XXXX <dt>Name:</dt>
]]></artwork> <dd>ietf-yang-structure-ext</dd>
</figure> <dt>Namespace:</dt>
</section> <dd>urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext</dd>
</section> <dt>Prefix:</dt>
<section title="Security Considerations" anchor="security-considerations"> <dd>sx</dd>
<t> <dt>Reference:</dt>
This document defines YANG extensions that are used to define <dd>RFC 8791</dd>
conceptual YANG data structures. It does not introduce any new </dl>
vulnerabilities beyond those specified in YANG 1.1 <xref target="RFC7950"/>.
</t> </section>
</section> </section>
</middle> <section anchor="security-considerations" numbered="true" toc="default">
<back> <name>Security Considerations</name>
<references title="Normative References">
<reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119"> <t> This document defines YANG extensions that are used to define conceptual
<front> YANG data structures. It does not introduce any new vulnerabilities beyond
<title>Key words for use in RFCs to Indicate Requirement Levels</title> those specified in YANG 1.1 <xref target="RFC7950" format="default"/>.</t>
<author initials="S." surname="Bradner" fullname="S. Bradner"> </section>
<organization/> </middle>
</author> <back>
<date year="1997" month="March"/> <references>
<abstract> <name>References</name>
<t>In many standards track documents several words are used to signify the <references>
requirements in the specification. These words are often capitalized. This doc <name>Normative References</name>
ument defines these words as they should be interpreted in IETF documents. This <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
document specifies an Internet Best Current Practices for the Internet Communit ence.RFC.2119.xml"/>
y, and requests discussion and suggestions for improvements.</t> <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
</abstract> ence.RFC.7950.xml"/>
</front> <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
<seriesInfo name="BCP" value="14"/> ence.RFC.8040.xml"/>
<seriesInfo name="RFC" value="2119"/> <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
<seriesInfo name="DOI" value="10.17487/RFC2119"/> ence.RFC.8174.xml"/>
</reference> <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
<reference anchor="RFC7950" target="https://www.rfc-editor.org/info/rfc7950"> ence.RFC.8340.xml"/>
<front> <xi:include
<title>The YANG 1.1 Data Modeling Language</title> href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="edit 8342.xml"/>
or">
<organization/> <reference anchor='W3C.REC-xml-20081126'
</author> target='http://www.w3.org/TR/2008/REC-xml-20081126'>
<date year="2016" month="August"/> <front>
<abstract> <title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
<t>YANG is a data modeling language used to model configuration data, stat
e data, Remote Procedure Calls, and notifications for network management protoco <author initials='T.' surname='Bray' fullname='Tim Bray'>
ls. This document describes the syntax and semantics of version 1.1 of the YANG <organization />
language. YANG version 1.1 is a maintenance release of the YANG language, addr </author>
essing ambiguities and defects in the original specification. There are a small
number of backward incompatibilities from YANG version 1. This document also s <author initials='J.' surname='Paoli' fullname='Jean Paoli'>
pecifies the YANG mappings to the Network Configuration Protocol (NETCONF).</t> <organization />
</abstract> </author>
</front>
<seriesInfo name="RFC" value="7950"/> <author initials='M.' surname='Sperberg-McQueen' fullname='Michael Sperberg-McQu
<seriesInfo name="DOI" value="10.17487/RFC7950"/> een'>
</reference> <organization />
<reference anchor="RFC8040" target="https://www.rfc-editor.org/info/rfc8040"> </author>
<front>
<title>RESTCONF Protocol</title> <author initials='E.' surname='Maler' fullname='Eve Maler'>
<author initials="A." surname="Bierman" fullname="A. Bierman"> <organization />
<organization/> </author>
</author>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund"> <author initials='F.' surname='Yergeau' fullname='François Yergeau'>
<organization/> <organization />
</author> </author>
<author initials="K." surname="Watsen" fullname="K. Watsen">
<organization/> <date month='November' year='2008' />
</author> </front>
<date year="2017" month="January"/>
<abstract> <seriesInfo name='World Wide Web Consortium Recommendation' value='REC-xml-20081
<t>This document describes an HTTP-based protocol that provides a programm 126' />
atic interface for accessing data defined in YANG, using the datastore concepts <format type='HTML' target='http://www.w3.org/TR/2008/REC-xml-20081126' />
defined in the Network Configuration Protocol (NETCONF).</t>
</abstract>
</front>
<seriesInfo name="RFC" value="8040"/>
<seriesInfo name="DOI" value="10.17487/RFC8040"/>
</reference>
<reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174">
<front>
<title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
<author initials="B." surname="Leiba" fullname="B. Leiba">
<organization/>
</author>
<date year="2017" month="May"/>
<abstract>
<t>RFC 2119 specifies common key words that may be used in protocol speci
fications. This document aims to reduce the ambiguity by clarifying that only U
PPERCASE usage of the key words have the defined special meanings.</t>
</abstract>
</front>
<seriesInfo name="BCP" value="14"/>
<seriesInfo name="RFC" value="8174"/>
<seriesInfo name="DOI" value="10.17487/RFC8174"/>
</reference>
<reference anchor="RFC8340" target="https://www.rfc-editor.org/info/rfc8340">
<front>
<title>YANG Tree Diagrams</title>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
<organization/>
</author>
<author initials="L." surname="Berger" fullname="L. Berger" role="editor">
<organization/>
</author>
<date year="2018" month="March"/>
<abstract>
<t>This document captures the current syntax used in YANG module tree diag
rams. The purpose of this document is to provide a single location for this def
inition. This syntax may be updated from time to time based on the evolution of
the YANG language.</t>
</abstract>
</front>
<seriesInfo name="BCP" value="215"/>
<seriesInfo name="RFC" value="8340"/>
<seriesInfo name="DOI" value="10.17487/RFC8340"/>
</reference>
<reference anchor="RFC8342" target="https://www.rfc-editor.org/info/rfc8342">
<front>
<title>Network Management Datastore Architecture (NMDA)</title>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund">
<organization/>
</author>
<author initials="J." surname="Schoenwaelder" fullname="J. Schoenwaelder">
<organization/>
</author>
<author initials="P." surname="Shafer" fullname="P. Shafer">
<organization/>
</author>
<author initials="K." surname="Watsen" fullname="K. Watsen">
<organization/>
</author>
<author initials="R." surname="Wilton" fullname="R. Wilton">
<organization/>
</author>
<date year="2018" month="March"/>
<abstract>
<t>Datastores are a fundamental concept binding the data models written in
the YANG data modeling language to network management protocols such as the Net
work Configuration Protocol (NETCONF) and RESTCONF. This document defines an arc
hitectural framework for datastores based on the experience gained with the init
ial simpler model, addressing requirements that were not well supported in the i
nitial model. This document updates RFC 7950.</t>
</abstract>
</front>
<seriesInfo name="RFC" value="8342"/>
<seriesInfo name="DOI" value="10.17487/RFC8342"/>
</reference>
</references>
<references title="Informative References">
<reference anchor="RFC3688" target="https://www.rfc-editor.org/info/rfc3688">
<front>
<title>The IETF XML Registry</title>
<author initials="M." surname="Mealling" fullname="M. Mealling">
<organization/>
</author>
<date year="2004" month="January"/>
<abstract>
<t>This document describes an IANA maintained registry for IETF standards
which use Extensible Markup Language (XML) related items such as Namespaces, Doc
ument Type Declarations (DTDs), Schemas, and Resource Description Framework (RDF
) Schemas.</t>
</abstract>
</front>
<seriesInfo name="BCP" value="81"/>
<seriesInfo name="RFC" value="3688"/>
<seriesInfo name="DOI" value="10.17487/RFC3688"/>
</reference>
<reference anchor="RFC6020" target="https://www.rfc-editor.org/info/rfc6020">
<front>
<title>YANG - A Data Modeling Language for the Network Configuration Protoco
l (NETCONF)</title>
<author initials="M." surname="Bjorklund" fullname="M. Bjorklund" role="edit
or">
<organization/>
</author>
<date year="2010" month="October"/>
<abstract>
<t>YANG is a data modeling language used to model configuration and state
data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote
procedure calls, and NETCONF notifications. [STANDARDS-TRACK]</t>
</abstract>
</front>
<seriesInfo name="RFC" value="6020"/>
<seriesInfo name="DOI" value="10.17487/RFC6020"/>
</reference> </reference>
</references>
<section title="Examples" anchor="examples"> </references>
<section title="&quot;structure&quot; Example" anchor="structure-example"> <references>
<t> <name>Informative References</name>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
ence.RFC.3688.xml"/>
<xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refer
ence.RFC.6020.xml"/>
</references>
</references>
<section anchor="examples" numbered="true" toc="default">
<name>Examples</name>
<section anchor="structure-example" numbered="true" toc="default">
<name>"structure" Example</name>
<t>
This example shows a simple address book that could be stored as an This example shows a simple address book that could be stored as an
artifact. artifact:
</t> </t>
<figure> <sourcecode type="yang"><![CDATA[
<artwork><![CDATA[
module example-module { module example-module {
yang-version 1.1; yang-version 1.1;
namespace "urn:example:example-module"; namespace "urn:example:example-module";
prefix exm; prefix exm;
import ietf-yang-structure-ext { import ietf-yang-structure-ext {
prefix sx; prefix sx;
} }
sx:structure address-book { sx:structure address-book {
skipping to change at line 690 skipping to change at line 582
leaf city { leaf city {
type string; type string;
description "City name"; description "City name";
} }
leaf state { leaf state {
type string; type string;
description "State name"; description "State name";
} }
} }
} }
} }]]>
</sourcecode>
]]></artwork> <t>
</figure> Below is the tree diagram of this module:
<t> </t>
Below is the tree diagram of this module. <sourcecode type="yangtree"><![CDATA[
</t>
<figure>
<artwork><![CDATA[
module: example-module module: example-module
structure address-book: structure address-book:
+-- address* [last first] +-- address* [last first]
+-- last string +-- last string
+-- first string +-- first string
+-- street? string +-- street? string
+-- city? string +-- city? string
+-- state? string +-- state? string]]>
]]></artwork> </sourcecode>
</figure> </section>
</section> <section anchor="augment-structure-example" numbered="true" toc="default">
<section title="&quot;augment&#8209;structure&quot; Example" anchor="augment-str <name>"augment&nbhy;structure" Example</name>
ucture-example"> <t>
<t> This example adds "county" and "zipcode" leafs to the address book:
This example adds &quot;county&quot; and &quot;zipcode&quot; leafs to the addres </t>
s book:
</t> <sourcecode type="yang"><![CDATA[
<figure>
<artwork><![CDATA[
module example-module-aug { module example-module-aug {
yang-version 1.1; yang-version 1.1;
namespace "urn:example:example-module-aug"; namespace "urn:example:example-module-aug";
prefix exma; prefix exma;
import ietf-yang-structure-ext { import ietf-yang-structure-ext {
prefix sx; prefix sx;
} }
import example-module { import example-module {
prefix exm; prefix exm;
skipping to change at line 739 skipping to change at line 628
sx:augment-structure "/exm:address-book/exm:address" { sx:augment-structure "/exm:address-book/exm:address" {
leaf county { leaf county {
type string; type string;
description "County name"; description "County name";
} }
leaf zipcode { leaf zipcode {
type string; type string;
description "Postal zipcode"; description "Postal zipcode";
} }
} }
} }]]>
</sourcecode>
]]></artwork> <t>
</figure> Below is the tree diagram of this module:
<t> </t>
Below is the tree diagram of this module. <sourcecode type="yangtree"><![CDATA[
</t>
<figure>
<artwork><![CDATA[
module: example-module-aug module: example-module-aug
augment-structure /exm:address-book/exm:address: augment-structure /exm:address-book/exm:address:
+-- county? string +-- county? string
+-- zipcode? string +-- zipcode? string]]>
]]></artwork> </sourcecode>
</figure> </section>
</section> <section anchor="xml-encoding-example" numbered="true" toc="default">
<section title="XML Encoding Example" anchor="xml-encoding-example"> <name>XML Encoding Example</name>
<t>
This example shows how an address book can be encoded in XML: <t>
</t> This example shows how an address book can be encoded in XML <xref
<figure> target="W3C.REC-xml-20081126"/>:
<artwork><![CDATA[ </t>
<sourcecode type="xml"><![CDATA[
<address-book xmlns="urn:example:example-module"> <address-book xmlns="urn:example:example-module">
<address> <address>
<last>Flintstone</last> <last>Flintstone</last>
<first>Fred</first> <first>Fred</first>
<street>301 Cobblestone Way</street> <street>301 Cobblestone Way</street>
<city>Bedrock</city> <city>Bedrock</city>
<zipcode xmlns="urn:example:example-module-aug">70777</zipcode> <zipcode xmlns="urn:example:example-module-aug">70777</zipcode>
</address> </address>
<address> <address>
<last>Root</last> <last>Root</last>
<first>Charlie</first> <first>Charlie</first>
<street>4711 Cobblestone Way</street> <street>4711 Cobblestone Way</street>
<city>Bedrock</city> <city>Bedrock</city>
<zipcode xmlns="urn:example:example-module-aug">70777</zipcode> <zipcode xmlns="urn:example:example-module-aug">70777</zipcode>
</address> </address>
</address-book> </address-book>]]>
]]></artwork> </sourcecode>
</figure> </section>
</section> <section anchor="json-encoding-example" numbered="true" toc="default">
<section title="JSON Encoding Example" anchor="json-encoding-example"> <name>JSON Encoding Example</name>
<t> <t>
This example shows how an address book can be encoded in JSON: This example shows how an address book can be encoded in JSON:
</t> </t>
<figure> <sourcecode type="json"><![CDATA[
<artwork><![CDATA[
"example-module:address-book": { "example-module:address-book": {
"address": [ "address": [
{ {
"city": "Bedrock", "city": "Bedrock",
"example-module-aug:zipcode": "70777", "example-module-aug:zipcode": "70777",
"first": "Fred", "first": "Fred",
"last": "Flintstone", "last": "Flintstone",
"street": "301 Cobblestone Way" "street": "301 Cobblestone Way"
}, },
{ {
"city": "Bedrock", "city": "Bedrock",
"example-module-aug:zipcode": "70777", "example-module-aug:zipcode": "70777",
"first": "Charlie", "first": "Charlie",
"last": "Root", "last": "Root",
"street": "4711 Cobblestone Way" "street": "4711 Cobblestone Way"
} }
] ]
} }]]>
]]></artwork> </sourcecode>
</figure> </section>
</section> <section
<section title="&quot;structure&quot; example that defines a non-top-level struc anchor="structure-example-that-defines-a-non-top-level-structure"
ture" anchor="structure-example-that-defines-a-non-top-level-structure"> numbered="true" toc="default">
<t> <name>"structure" Example That Defines a Non-top-level Structure</name>
The following example defines a data structure with error information, <t>
that can be included in an &lt;error&#8209;info&gt; element in an &lt;rpc&#8209; The following example defines a data structure with error information
error&gt;. that can be included in an &lt;error&nbhy;info&gt; element in an
</t> &lt;rpc&nbhy;error&gt;:
<figure> </t>
<artwork><![CDATA[ <sourcecode type="yang"><![CDATA[
module example-error-info { module example-error-info {
yang-version 1.1; yang-version 1.1;
namespace "urn:example:example-error-info"; namespace "urn:example:example-error-info";
prefix exei; prefix exei;
import ietf-yang-structure-ext { import ietf-yang-structure-ext {
prefix sx; prefix sx;
} }
sx:structure my-example-error-info { sx:structure my-example-error-info {
leaf error-code { leaf error-code {
type uint32; type uint32;
} }
} }
} }]]>
]]></artwork> </sourcecode>
</figure> <t>
<t>
The example below shows how this structure can be used in an The example below shows how this structure can be used in an
&lt;rpc&#8209;error&gt;. &lt;rpc&nbhy;error&gt;:
</t> </t>
<figure> <sourcecode type="xml"><![CDATA[
<artwork><![CDATA[
<rpc-reply message-id="101" <rpc-reply message-id="101"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<rpc-error> <rpc-error>
<error-type>protocol</error-type> <error-type>protocol</error-type>
<error-tag>operation-failed</error-tag> <error-tag>operation-failed</error-tag>
<error-severity>error</error-severity> <error-severity>error</error-severity>
<error-info> <error-info>
<my-example-error-info <my-example-error-info
xmlns="urn:example:example-error-info"> xmlns="urn:example:example-error-info">
<error-code>42</error-code> <error-code>42</error-code>
</my-example-error-info> </my-example-error-info>
</error-info> </error-info>
</rpc-error> </rpc-error>
</rpc-reply> </rpc-reply>]]>
]]></artwork> </sourcecode>
</figure> </section>
</section> </section>
</section>
</back></rfc> </back>
</rfc>
 End of changes. 61 change blocks. 
517 lines changed or deleted 373 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/