draft-ietf-netmod-yang-data-ext-05.txt   rfc8791.txt 
Network Working Group A. Bierman Internet Engineering Task Force (IETF) A. Bierman
Internet-Draft YumaWorks Request for Comments: 8791 YumaWorks
Updates: 8340 (if approved) M. Bjorklund Updates: 8340 M. Bjorklund
Intended status: Standards Track Cisco Category: Standards Track Cisco
Expires: June 12, 2020 K. Watsen ISSN: 2070-1721 K. Watsen
Watsen Networks Watsen Networks
December 10, 2019 June 2020
YANG Data Structure Extensions YANG Data Structure Extensions
draft-ietf-netmod-yang-data-ext-05
Abstract Abstract
This document describes YANG mechanisms for defining abstract data This document describes YANG mechanisms for defining abstract data
structures with YANG. structures with YANG.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This is an Internet Standards Track document.
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 https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months This document is a product of the Internet Engineering Task Force
and may be updated, replaced, or obsoleted by other documents at any (IETF). It represents the consensus of the IETF community. It has
time. It is inappropriate to use Internet-Drafts as reference received public review and has been approved for publication by the
material or to cite them other than as "work in progress." Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in Section 2 of RFC 7841.
This Internet-Draft will expire on June 12, 2020. Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
https://www.rfc-editor.org/info/rfc8791.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2020 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology
1.1.1. NMDA . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.1. NMDA
1.1.2. YANG . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.2. YANG
2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Definitions
3. YANG Data Structures in YANG Tree Diagrams . . . . . . . . . 5 3. YANG Data Structures in YANG Tree Diagrams
4. YANG Data Structure Extensions Module . . . . . . . . . . . . 5 4. YANG Data Structure Extensions Module
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 5. IANA Considerations
5.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 10 5.1. YANG Module Registry
6. Security Considerations . . . . . . . . . . . . . . . . . . . 10 6. Security Considerations
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 7. References
7.1. Normative References . . . . . . . . . . . . . . . . . . 10 7.1. Normative References
7.2. Informative References . . . . . . . . . . . . . . . . . 11 7.2. Informative References
Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 11 Appendix A. Examples
A.1. "structure" Example . . . . . . . . . . . . . . . . . . . 11 A.1. "structure" Example
A.2. "augment-structure" Example . . . . . . . . . . . . . . . 13 A.2. "augment-structure" Example
A.3. XML Encoding Example . . . . . . . . . . . . . . . . . . 13 A.3. XML Encoding Example
A.4. JSON Encoding Example . . . . . . . . . . . . . . . . . . 14 A.4. JSON Encoding Example
A.5. "structure" example that defines a non-top-level A.5. "structure" Example That Defines a Non-top-level Structure
structure . . . . . . . . . . . . . . . . . . . . . . . . 14 Authors' Addresses
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 15
1. Introduction 1. Introduction
There is a need for standard mechanisms to allow the definition of There is a need for standard mechanisms to allow the definition of
abstract data that is not intended to be implemented as configuration abstract data that is not intended to be implemented as configuration
or operational state. The "yang-data" extension statement from RFC or operational state. The "yang-data" extension statement from RFC
8040 [RFC8040] was defined for this purpose but it is limited in its 8040 [RFC8040] was defined for this purpose, but it is limited in its
functionality. functionality.
The intended use of the "yang-data" extension was to model all or The intended use of the "yang-data" extension was to model all or
part of a protocol message, such as the "errors" definition in the part of a protocol message, such as the "errors" definition in the
YANG module "ietf-restconf" [RFC8040], or the contents of a file. YANG module "ietf-restconf" [RFC8040], or the contents of a file.
However, protocols are often layered such that the header or payload However, protocols are often layered such that the header or payload
portions of the message can be extended by external documents. The portions of the message can be extended by external documents. The
YANG statements that model a protocol need to support this YANG statements that model a protocol need to support this
extensibility that is already found in that protocol. extensibility that is already found in that protocol.
This document defines a new YANG extension statement called This document defines a new YANG extension statement called
"structure", which is similar to but more flexible than the "structure", which is similar to but more flexible than the "yang-
"yang-data" extension from [RFC8040]. There is no assumption that a data" extension from [RFC8040]. There is no assumption that a YANG
YANG data structure can only be used as a top-level abstraction, and data structure can only be used as a top-level abstraction, and it
it may also be nested within some other data structure. may also be nested within some other data structure.
This document also defines a new YANG extension statement called This document also defines a new YANG extension statement called
"augment-structure", which allows abstract data structures to be "augment-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" statement. Note that "augment" cannot be used to augment a "augment" statement. Note that "augment" cannot be used to augment a
YANG data structure since a YANG compiler or other tool is not YANG data structure since a YANG compiler or other tool is not
required to understand the "structure" extension. required to understand the "structure" extension.
1.1. Terminology 1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
The following terms are used within this document: The following term is used within this document:
o YANG data structure: A data structure defined with the "structure" YANG data structure: A data structure defined with the "structure"
statement. statement.
1.1.1. NMDA 1.1.1. NMDA
The following terms are defined in the Network Management Datastore The following terms are defined in the Network Management Datastore
Architecture (NMDA) [RFC8342], and are not redefined here: Architecture (NMDA) [RFC8342] and are not redefined here:
o configuration * configuration
o operational state * operational state
1.1.2. YANG 1.1.2. YANG
The following terms are defined in [RFC7950]: The following terms are defined in [RFC7950] and are not redefined
here:
o absolute-schema-nodeid * absolute-schema-nodeid
o container * container
o data definition statement * data definition statement
o data node * data node
o leaf * leaf
o leaf-list * leaf-list
o list * list
2. Definitions 2. Definitions
A YANG data structure is defined with the "structure" extension A YANG data structure is defined with the "structure" extension
statement, defined in the YANG module "ietf-yang-structure-ext". The statement, which is defined in the YANG module "ietf-yang-structure-
argument to the "structure" extension statement is the name of the ext". The argument to the "structure" extension statement is the
data structure. The data structures are considered to be in the same name of the data structure. The data structures are considered to be
identifier namespace as defined in section 6.2.1 of [RFC7950]. In in the same identifier namespace as defined in Section 6.2.1 of
particular, bullet 7: [RFC7950]. In particular, the seventh bullet states:
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.
This means that data structures defined with the "structure" This means that data structures defined with the "structure"
statement cannot have the same name as sibling nodes from regular statement cannot have the same name as sibling nodes from regular
YANG data definition statements or other "structure" statements in YANG data definition statements or other "structure" statements in
the same YANG module. the same YANG module.
This does not mean a YANG data structure, once defined, has to be 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 used as a top-level protocol message or other top-level data
structure. structure.
skipping to change at page 5, line 7 skipping to change at line 185
} }
can be encoded in JSON as: can be encoded in JSON as:
"example-errors:my-error": { "example-errors:my-error": {
"error-number": 131 "error-number": 131
} }
3. YANG Data Structures in YANG Tree Diagrams 3. YANG Data Structures in YANG Tree Diagrams
A YANG data structure can be printed in a YANG Tree Diagram A YANG data structure can be printed in a YANG tree diagram
[RFC8340]. This document updates RFC 8340 by defining two new [RFC8340]. This document updates RFC 8340 [RFC8340] by defining two
sections in the tree diagram for a module: new sections in the tree diagram for a module:
1. YANG data structures, offset by two spaces and identified by the 1. YANG data structures, which are offset by two spaces and
keyword "structure" followed by the name of the YANG data identified by the keyword "structure" followed by the name of the
structure and a colon (":") character. YANG data structure and a colon (":") character.
2. YANG data structure augmentations, offset by 2 spaces and 2. YANG data structure augmentations, which are offset by 2 spaces
identified by the keyword "augment-structure" followed by the and identified by the keyword "augment-structure" followed by the
augment target structure name and a colon (":") character. augment target structure name and a colon (":") character.
The new sections, including spaces conventions is: The new sections, including spaces conventions, appear as follows:
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>
Nodes in YANG data structures are printed according to the rules Nodes in YANG data structures are printed according to the rules
defined in section 2.6 in [RFC8340]. defined in Section 2.6 of [RFC8340]. The nodes in YANG data
structures do not have any <flags>.
4. YANG Data Structure Extensions Module 4. YANG Data Structure Extensions Module
RFC Ed.: update the date below with the date of RFC publication and <CODE BEGINS> file "ietf-yang-structure-ext@2020-06-17.yang"
remove this note.
<CODE BEGINS> file "ietf-yang-structure-ext@2019-03-07.yang"
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-17 {
// 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
skipping to change at page 7, line 17 skipping to change at line 285
} }
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 page 10, line 14 skipping to change at line 428
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; }
} }
} }
"; ";
} }
} }
<CODE ENDS> <CODE ENDS>
5. IANA Considerations 5. IANA Considerations
5.1. YANG Module Registry 5.1. YANG Module Registry
This document registers one URI as a namespace in the "IETF XML IANA has registered the following URI in the "ns" subregistry within
Registry" [RFC3688]: the "IETF XML Registry" [RFC3688]:
URI: urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext URI: urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext
Registrant Contact: The IESG. Registrant Contact: The IESG.
XML: N/A; the requested URI is an XML namespace. XML: N/A; the requested URI is an XML namespace.
This document registers one YANG module in the "YANG Module Names" IANA has registered the following YANG module in the "YANG Module
registry [RFC6020]: Names" subregistry [RFC6020] within the "YANG Parameters" registry:
name: ietf-yang-structure-ext Name: ietf-yang-structure-ext
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
// RFC Ed.: replace XXXX with RFC number and remove this note Reference: RFC 8791
reference: RFC XXXX
6. Security Considerations 6. Security Considerations
This document defines YANG extensions that are used to define This document defines YANG extensions that are used to define
conceptual YANG data structures. It does not introduce any new conceptual YANG data structures. It does not introduce any new
vulnerabilities beyond those specified in YANG 1.1 [RFC7950]. vulnerabilities beyond those specified in YANG 1.1 [RFC7950].
7. References 7. References
7.1. Normative References 7.1. Normative References
skipping to change at page 11, line 26 skipping to change at line 485
[RFC8340] Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", [RFC8340] Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams",
BCP 215, RFC 8340, DOI 10.17487/RFC8340, March 2018, BCP 215, RFC 8340, DOI 10.17487/RFC8340, March 2018,
<https://www.rfc-editor.org/info/rfc8340>. <https://www.rfc-editor.org/info/rfc8340>.
[RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., [RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
and R. Wilton, "Network Management Datastore Architecture and R. Wilton, "Network Management Datastore Architecture
(NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018, (NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018,
<https://www.rfc-editor.org/info/rfc8342>. <https://www.rfc-editor.org/info/rfc8342>.
[W3C.REC-xml-20081126]
Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and
F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth
Edition)", World Wide Web Consortium Recommendation REC-
xml-20081126, November 2008,
<http://www.w3.org/TR/2008/REC-xml-20081126>.
7.2. Informative References 7.2. Informative References
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
DOI 10.17487/RFC3688, January 2004, DOI 10.17487/RFC3688, January 2004,
<https://www.rfc-editor.org/info/rfc3688>. <https://www.rfc-editor.org/info/rfc3688>.
[RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for
the Network Configuration Protocol (NETCONF)", RFC 6020, the Network Configuration Protocol (NETCONF)", RFC 6020,
DOI 10.17487/RFC6020, October 2010, DOI 10.17487/RFC6020, October 2010,
<https://www.rfc-editor.org/info/rfc6020>. <https://www.rfc-editor.org/info/rfc6020>.
Appendix A. Examples Appendix A. Examples
A.1. "structure" Example A.1. "structure" Example
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:
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;
} }
skipping to change at page 12, line 41 skipping to change at line 546
description "City name"; description "City name";
} }
leaf state { leaf state {
type string; type string;
description "State name"; description "State name";
} }
} }
} }
} }
Below is the tree diagram of this module. Below is the tree diagram of this module:
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
skipping to change at page 13, line 33 skipping to change at line 586
type string; type string;
description "County name"; description "County name";
} }
leaf zipcode { leaf zipcode {
type string; type string;
description "Postal zipcode"; description "Postal zipcode";
} }
} }
} }
Below is the tree diagram of this module. Below is the tree diagram of this module:
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
A.3. XML Encoding Example A.3. XML Encoding Example
This example shows how an address book can be encoded in XML: This example shows how an address book can be encoded in XML
[W3C.REC-xml-20081126]:
<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>
skipping to change at page 14, line 45 skipping to change at line 639
{ {
"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"
} }
] ]
} }
A.5. "structure" example that defines a non-top-level structure A.5. "structure" Example That Defines a Non-top-level Structure
The following example defines a data structure with error The following example defines a data structure with error information
information, that can be included in an <error-info> element in an that can be included in an <error-info> element in an <rpc-error>:
<rpc-error>.
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;
} }
} }
} }
The example below shows how this structure can be used in an The example below shows how this structure can be used in an
<rpc-error>. <rpc-error>:
<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">
skipping to change at page 15, line 50 skipping to change at line 689
Authors' Addresses Authors' Addresses
Andy Bierman Andy Bierman
YumaWorks YumaWorks
Email: andy@yumaworks.com Email: andy@yumaworks.com
Martin Bjorklund Martin Bjorklund
Cisco Cisco
Email: mbj@tail-f.com Email: mbj+ietf@4668.se
Kent Watsen Kent Watsen
Watsen Networks Watsen Networks
Email: kent+ietf@watsen.net Email: kent+ietf@watsen.net
 End of changes. 68 change blocks. 
137 lines changed or deleted 134 lines changed or added

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