draft-ietf-netmod-yang-data-ext-01.txt   draft-ietf-netmod-yang-data-ext-02.txt 
Network Working Group A. Bierman Network Working Group A. Bierman
Internet-Draft YumaWorks Internet-Draft YumaWorks
Intended status: Standards Track M. Bjorklund Intended status: Standards Track M. Bjorklund
Expires: September 6, 2018 Tail-f Systems Expires: September 9, 2019 Cisco
K. Watsen K. Watsen
Juniper Networks Watsen Networks
March 5, 2018 March 8, 2019
YANG Data Extensions YANG Data Structure Extensions
draft-ietf-netmod-yang-data-ext-01 draft-ietf-netmod-yang-data-ext-02
Abstract Abstract
This document describes YANG mechanisms for defining abstract data This document describes YANG mechanisms for defining abstract data
structures with YANG. It is intended to replace and extend the structures with YANG. It is intended to replace and extend the
"yang-data" extension statement defined in RFC 8040. "yang-data" extension statement defined in RFC 8040.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
skipping to change at page 1, line 35 skipping to change at page 1, line 35
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 6, 2018. This Internet-Draft will expire on September 9, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the Copyright (c) 2019 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
(http://trustee.ietf.org/license-info) in effect on the date of (http://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 . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1. NMDA . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.1. NMDA . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2. YANG . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1.2. YANG . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1. Restrictions on Conceptual YANG Data . . . . . . . . . . 4 3. YANG Data Structure Extensions Module . . . . . . . . . . . . 4
2.2. YANG Data Extensions Module . . . . . . . . . . . . . . . 4 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
3. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 4.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 9
3.1. YANG Module Registry . . . . . . . . . . . . . . . . . . 9 5. Security Considerations . . . . . . . . . . . . . . . . . . . 9
4. Security Considerations . . . . . . . . . . . . . . . . . . . 9 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 9
5. Normative References . . . . . . . . . . . . . . . . . . . . 9 6.1. Normative References . . . . . . . . . . . . . . . . . . 9
6.2. Informative References . . . . . . . . . . . . . . . . . 10
Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 10 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 10
A.1. yang-data Example . . . . . . . . . . . . . . . . . . . . 10 A.1. "structure" Example . . . . . . . . . . . . . . . . . . . 10
A.2. augment-yang-data Example . . . . . . . . . . . . . . . . 10 A.2. "augment-structure" Example . . . . . . . . . . . . . . . 11
Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 11 A.3. XML Encoding Example . . . . . . . . . . . . . . . . . . 12
B.1. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . 11 A.4. JSON Encoding Example . . . . . . . . . . . . . . . . . . 12
Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 11 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 13
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 11 B.1. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . 13
B.2. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . 13
Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . 13
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 13
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] is defined for this purpose, however it is limited in 8040 [RFC8040] was defined for this purpose but it is limited in its
its functionality. functionality.
The intended use of the "yang-data" extension is to model all or part The intended use of the "yang-data" extension was to model all or
of a protocol message, such as the "errors" definition in ietf- part of a protocol message, such as the "errors" definition in the
restconf.yang [RFC8040], or the contents of a file. However, YANG module "ietf-restconf" [RFC8040], or the contents of a file.
protocols are often layered such that the header or payload portions However, protocols are often layered such that the header or payload
of the message can be extended by external documents. The YANG portions of the message can be extended by external documents. The
statements that model a protocol need to support this extensibility YANG statements that model a protocol need to support this
that is already found in that protocol. extensibility that is already found in that protocol.
This document defines a new YANG extension statement called The "yang-data" extension from [RFC8040] has been copied here,
"augment-yang-data", which allows abstract data structures to be renamed to "structure", and updated to be more flexible. There is no
assumption that a YANG data structure can only be used as a top-level
abstraction, instead of nested within some other data structure.
This document also defines a new YANG extension statement called
"augment-structure", which allows abstract data structures to be
augmented from external modules, similar to the existing YANG augmented from external modules, 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 "yang-data" extension. required to understand the "structure" extension.
The "yang-data" extension from [RFC8040] has been copied here and
updated to be more flexible. There is no longer a requirement for
the "yang-data" statement to result in exactly one container object.
There is no longer an assumption that a yang data structure can only
be used as a top-level abstraction, instead of nested within some
other data structure.
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", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
document are to be interpreted as described in [RFC2119]. "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here.
The following terms are used within this document: The following terms are used within this document:
o yang data structure: A data structure defined with the "yang-data" o 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) [I-D.ietf-netmod-revised-datastores]. and are Architecture (NMDA) [RFC8342]. and are not redefined here:
not redefined here:
o configuration o configuration
o operational state o operational state
1.1.2. YANG 1.1.2. YANG
The following terms are defined in [RFC7950]: The following terms are defined in [RFC7950]:
o absolute-schema-nodeid o absolute-schema-nodeid
skipping to change at page 4, line 7 skipping to change at page 4, line 7
o data node o data node
o leaf o leaf
o leaf-list o leaf-list
o list o list
2. Definitions 2. Definitions
2.1. Restrictions on Conceptual YANG Data A YANG Data Structure is defined with the "structure" extension
statement, defined in the YANG module "ietf-yang-structure-ext". The
This document places restrictions on the "yang-data" external argument to the "structure" extension statement is the name of the
statements that can be used with the "yang-data" and data structure. The data structures are considered to be in the same
"augment-yang-data" extensions. The conceptual data definitions are identifier namespace as defined in section 6.2.1 of [RFC7950]. In
considered to be in the same identifier namespace as defined in particular, bullet 7:
section 6.2.1 of [RFC7950]. In particular, bullet 7:
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 conceptual data defined with the "yang-data" or This means that data structures defined with the "structure"
"augment-yang-data" statements cannot have the same local-name as statement cannot have the same name as sibling nodes from regular
sibling nodes from regular YANG data definition statements or other YANG data definition statements or other "structure" statements in
"yang-data" or "augment-yang-data" statements. the same YANG module.
This does not mean a yang data structure has to be used as a top-
level protocol message or other top-level data structure. A yang
data structure does not have to result in a single container.
2.2. YANG Data Extensions Module This does not mean a YANG data structure has to be used as a top-
level protocol message or other top-level data structure.
The "ietf-yang-data-ext" module defines the "augment-yang-data" 3. YANG Data Structure Extensions Module
extension to augment conceptual data already defined with the
"yang-data" extension. The RESTCONF "yang-data" extension has been
moved to this document and updated.
RFC Ed.: update the date below with the date of RFC publication and RFC Ed.: update the date below with the date of RFC publication and
remove this note. remove this note.
<CODE BEGINS> file "ietf-yang-data-ext@2018-03-05.yang" <CODE BEGINS> file "ietf-yang-structure-ext@2019-03-07.yang"
module ietf-yang-data-ext { module ietf-yang-structure-ext {
yang-version 1.1; yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-data-ext"; namespace "urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext";
prefix "yd"; prefix sx;
organization organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group"; "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web: <http://tools.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
contact Author: Andy Bierman
"WG Web: <http://tools.ietf.org/wg/netmod/> <mailto:andy@yumaworks.com>
WG List: <mailto:netmod@ietf.org>
Author: Andy Bierman
<mailto:andy@yumaworks.com>
Author: Martin Bjorklund Author: Martin Bjorklund
<mailto:mbj@tail-f.com> <mailto:mbj@tail-f.com>
Author: Kent Watsen Author: Kent Watsen
<mailto:kwatsen@juniper.net>"; <mailto:kent+ietf@watsen.net>";
description description
"This module contains conceptual YANG specifications "This module contains conceptual YANG specifications for defining
for defining abstract 'yang-data' data structures. abstract data structures.
Copyright (c) 2017 - 2018 IETF Trust and the persons identified The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
as authors of the code. All rights reserved. NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here.
Redistribution and use in source and binary forms, with or Copyright (c) 2019 IETF Trust and the persons identified
without modification, is permitted pursuant to, and subject as authors of the code. All rights reserved.
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 2018-03-05 { Redistribution and use in source and binary forms, with or
description without modification, is permitted pursuant to, and subject
"Initial revision."; to the license terms contained in, the Simplified BSD License
reference set forth in Section 4.c of the IETF Trust's Legal Provisions
// RFC Ed.: replace XXXX with RFC number and remove this note Relating to IETF Documents
"RFC XXXX: YANG Data Extensions."; (http://trustee.ietf.org/license-info).";
}
extension yang-data { // RFC Ed.: update the date below with the date of RFC publication
argument name { // and remove this note.
yin-element true;
}
description
"This extension is used to specify a YANG data template which
represents conceptual data defined in YANG. It is
intended to describe hierarchical data independent of
protocol context or specific message encoding format.
Data definition statements within a yang-data extension
specify the generic syntax for the specific YANG data
template, whose name is the argument of the yang-data
extension statement.
Note that this extension does not define a media-type. revision 2019-03-07 {
description
"Initial revision.";
// RFC Ed.: replace XXXX with RFC number and remove this note
reference
"RFC XXXX: YANG Structure Extensions.";
}
A specification using this extension MUST specify the extension structure {
message encoding rules, including the content media type. argument name {
yin-element true;
}
description
"This extension is used to specify a YANG data structure that
represents conceptual data defined in YANG. It is intended to
describe hierarchical data independent of protocol context or
specific message encoding format. Data definition statements
within a 'structure' extension statement specify the generic
syntax for the specific YANG data structure, whose name is the
argument of the 'structure' extension statement.
The mandatory 'name' parameter value identifies the YANG Note that this extension does not define a media-type. A
data template that is being defined. It contains the specification using this extension MUST specify the message
template name. This parameter is only used for readability encoding rules, including the content media type, if
purposes. There are no mechanisms to reuse yang-data by applicable.
its template name value.
This extension is ignored unless it appears as a top-level The mandatory 'name' parameter value identifies the YANG data
statement. It MUST contain data definition statements structure that is being defined.
that result in a set of data definition statements.
If the yang data template is intended to be used as This extension is only valid as a top-level statement, i.e.,
a top-level structure, then the yang data template needs to given as a sub-statement to 'module' or 'submodule'.
result in a single container, so an instance of the YANG data
template can thus be translated into an XML instance document,
whose top-level element corresponds to the top-level container.
The module name and namespace value for the YANG module using The sub-statements of this extension MUST follow the ABNF
the extension statement is assigned to each of the data rules below, where the rules are defined in RFC 7950:
definition statements resulting from the yang data template.
The name of each data definition statement resulting from
a yang data template is assigned to a top-level identifier name
in the data node identifier namespace, according to RFC 7950,
section 6.2.1.
The sub-statements of this extension MUST follow the *must-stmt
'data-def-stmt' rule in the YANG ABNF. [status-stmt]
[description-stmt]
[reference-stmt]
*(typedef-stmt / grouping-stmt)
*data-def-stmt
The XPath document root is the extension statement itself, A YANG data structure defined with this extension statement is
such that the child nodes of the document root are encoded in the same way as an 'anydata' statement. This means
represented by the data-def-stmt sub-statements within that the name of the structure is encoded as a 'container',
this extension. This conceptual document is the context with the instantiated child statements encoded as child nodes
for the following YANG statements: to this node.
- must-stmt The module name and namespace value for the YANG module using
- when-stmt the extension statement is assigned to each of the data
- path-stmt definition statements resulting from the YANG data structure.
- 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 The XPath document element is the extension statement itself,
when used within a yang-data-resource extension statement. such that the child nodes of the document element are
represented by the data-def-stmt sub-statements within this
extension. This conceptual document is the context for the
following YANG statements:
- The list-stmt is not required to have a key-stmt defined. - must-stmt
- The if-feature-stmt is ignored if present. - when-stmt
- The config-stmt is ignored if present. - path-stmt
- The available identity values for any 'identityref' - min-elements-stmt
leaf or leaf-list nodes is limited to the module - max-elements-stmt
containing this extension statement, and the modules - mandatory-stmt
imported into that module. - unique-stmt
"; - ordered-by
} - instance-identifier data type
extension augment-yang-data { The following data-def-stmt sub-statements are constrained
argument path { when used within a 'structure' extension statement.
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 - The list-stmt is not required to have a key-stmt defined.
'augment-stmt'. Data definition statements within this - The config-stmt is ignored if present.
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.
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 extension augment-structure {
statement. The sub-statements of this extension MUST follow argument path {
the 'data-def-stmt' rule in the YANG ABNF. yin-element true;
}
description
"This extension is used to specify an augmentation to YANG data
structure defined with the 'structure' statement. It is
intended to describe hierarchical data independent of protocol
context or specific message encoding format.
The module name and namespace value for the YANG module using This statement has almost the same structure as the
the extension statement is assigned to instance document data 'augment-stmt'. Data definition statements within this
conforming to the data definition statements within statement specify the semantics and generic syntax for the
this extension. additional data to be added to the specific YANG data
structure, identified by the 'path' argument.
The XPath document root is the augmented extension statement The mandatory 'path' parameter value identifies the YANG
itself, such that the child nodes of the document root are conceptual data node that is being augmented, represented as
represented by the data-def-stmt sub-statements within an absolute-schema-nodeid string, where the first node in the
the augmented yang-data statement. absolute-schema-nodeid string identifies the YANG data
structure to augment, and the rest of the nodes in the string
identifies the node within the YANG structure to augment.
The context node of the augment-yang-data statement is derived This extension is only valid as a top-level statement, i.e.,
in the same way as the 'augment' statement, as defined in given as a sub-statement to 'module' or 'submodule'.
section 6.4.1 of [RFC7950]. This conceptual node is
considered the context node for the following YANG statements:
- must-stmt The sub-statements of this extension MUST follow the ABNF
- when-stmt rules below, where the rules are defined in RFC 7950:
- 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 [status-stmt]
when used within a augment-yang-data extension statement. [description-stmt]
[reference-stmt]
1*(data-def-stmt / case-stmt)
- The list-stmt is not required to have a key-stmt defined. The module name and namespace value for the YANG module using
- The if-feature-stmt is ignored if present. the extension statement is assigned to instance document data
- The config-stmt is ignored if present. conforming to the data definition statements within this
- The available identity values for any 'identityref' extension.
leaf or leaf-list nodes is limited to the module
containing this extension statement, and the modules
imported into that module.
Example: The XPath document element is the augmented extension
statement itself, such that the child nodes of the document
element are represented by the data-def-stmt sub-statements
within the augmented 'structure' statement.
foo.yang { The context node of the 'augment-structure' statement is
import yang-data-ext { prefix yd; } 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:
yd:yang-data foo-data { - must-stmt
container foo-con { } - when-stmt
} - path-stmt
} - min-elements-stmt
- max-elements-stmt
- mandatory-stmt
- unique-stmt
- ordered-by
- instance-identifier data type
bar.yang { The following data-def-stmt sub-statements are constrained
import yang-data-ext { prefix yd; } when used within an 'augment-structure' extension statement.
import foo { prefix foo; }
yd:augment-yang-data /foo:foo-con { - The list-stmt is not required to have a key-stmt defined.
leaf add-leaf1 { type int32; } - The config-stmt is ignored if present.
leaf add-leaf2 { type string; }
}
}
";
}
} Example:
module foo {
import ietf-yang-structure-ext { prefix sx; }
sx:structure foo-data {
container foo-con { }
}
}
module bar {
import ietf-yang-structure-ext { prefix sx; }
import foo { prefix foo; }
sx:augment-structure /foo:foo-data/foo:foo-con {
leaf add-leaf1 { type int32; }
leaf add-leaf2 { type string; }
}
}
";
}
}
<CODE ENDS> <CODE ENDS>
3. IANA Considerations 4. IANA Considerations
3.1. YANG Module Registry 4.1. YANG Module Registry
This document registers one URI as a namespace in the "IETF XML This document registers one URI as a namespace in the "IETF XML
Registry" [RFC3688]: Registry" [RFC3688]:
URI: urn:ietf:params:xml:ns:yang:ietf-yang-data-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" This document registers one YANG module in the "YANG Module Names"
registry [RFC6020]: registry [RFC6020]:
name: ietf-yang-data-ext name: ietf-yang-structure-ext
namespace: urn:ietf:params:xml:ns:yang:ietf-yang-data-ext namespace: urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext
prefix: yd prefix: sx
// RFC Ed.: replace XXXX with RFC number and remove this note // RFC Ed.: replace XXXX with RFC number and remove this note
reference: RFC XXXX reference: RFC XXXX
4. Security Considerations 5. 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. It does not introduce any new vulnerabilities conceptual YANG data structures. It does not introduce any new
beyond those specified in YANG 1.1 [RFC7950]. vulnerabilities beyond those specified in YANG 1.1 [RFC7950].
5. Normative References 6. References
[I-D.ietf-netmod-revised-datastores] 6.1. Normative References
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
and R. Wilton, "Network Management Datastore
Architecture", draft-ietf-netmod-revised-datastores-10
(work in progress), January 2018.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, March 1997. Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/
RFC2119, March 1997, <https://www.rfc-editor.org/info/
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, rfc2119>.
January 2004.
[RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the
Network Configuration Protocol (NETCONF)", RFC 6020,
October 2010.
[RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language",
RFC 7950, DOI 10.17487/RFC7950, August 2016, RFC 7950, DOI 10.17487/RFC7950, August 2016,
<http://www.rfc-editor.org/info/rfc7950>. <https://www.rfc-editor.org/info/rfc7950>.
[RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF [RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017, Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017,
<http://www.rfc-editor.org/info/rfc8040>. <https://www.rfc-editor.org/info/rfc8040>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC8342] Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
and R. Wilton, "Network Management Datastore Architecture
(NMDA)", RFC 8342, DOI 10.17487/RFC8342, March 2018,
<https://www.rfc-editor.org/info/rfc8342>.
6.2. Informative References
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
DOI 10.17487/RFC3688, January 2004, <https://www.rfc-
editor.org/info/rfc3688>.
[RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for
the Network Configuration Protocol (NETCONF)", RFC 6020,
DOI 10.17487/RFC6020, October 2010, <https://www.rfc-
editor.org/info/rfc6020>.
Appendix A. Examples Appendix A. Examples
A.1. yang-data 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.
yd:yang-data example-address-book { module example-module {
container address-book { yang-version 1.1;
list address { namespace "urn:example:example-module";
key "last first"; prefix exm;
leaf last {
type string;
description "Last name";
}
leaf first {
type string;
description "First name";
}
leaf street {
type string;
description "Street name";
}
leaf city {
type string;
description "City name";
}
leaf state {
type string;
description "State name";
}
}
}
}
A.2. augment-yang-data Example import ietf-yang-structure-ext {
prefix sx;
}
sx:structure address-book {
list address {
key "last first";
leaf last {
type string;
description "Last name";
}
leaf first {
type string;
description "First name";
}
leaf street {
type string;
description "Street name";
}
leaf city {
type string;
description "City name";
}
leaf state {
type string;
description "State name";
}
}
}
}
A.2. "augment-structure" Example
This example adds "county" and "zipcode" leafs to the address book: This example adds "county" and "zipcode" leafs to the address book:
yd:augment-yang-data /address-book/address { module example-module-aug {
leaf county { yang-version 1.1;
type string; namespace "urn:example:example-module-aug";
description "County name"; prefix exma;
}
leaf zipcode { import ietf-yang-structure-ext {
type string; prefix sx;
description "Postal zipcode"; }
} import example-module {
} prefix exm;
}
sx:augment-structure "/exm:address-book/exm:address" {
leaf county {
type string;
description "County name";
}
leaf zipcode {
type string;
description "Postal zipcode";
}
}
}
A.3. XML Encoding Example
This example shows how an address book can be encoded in XML:
<address-book xmlns="urn:example:example-module">
<address>
<last>Flintstone</last>
<first>Fred</first>
<street>301 Cobblestone Way</street>
<city>Bedrock</city>
<zipcode xmlns="urn:example:example-module-aug">70777</zipcode>
</address>
</address-book>
A.4. JSON Encoding Example
This example shows how an address book can be encoded in JSON:
"example-module:address-book": {
"address": [
{
"city": "Bedrock",
"example-module-aug:zipcode": "70777",
"first": "Fred",
"last": "Flintstone",
"street": "301 Cobblestone Way"
}
]
}
Appendix B. Change Log Appendix B. Change Log
B.1. v00 to v01 RFC Ed.: remove this section before publication.
B.1. v01 to v02
o terminology fixes (use the term "structure" instead of "template")
o renamed the statement to "structure" from "yang-data"
o removed limitations on if-feature and identities in YANG
structures
B.2. v00 to v01
o moved open issues to github o moved open issues to github
o added examples section o added examples section
o filled in IANA considerations o filled in IANA considerations
Appendix C. Open Issues Appendix C. Open Issues
The YANG Data Extensions issues are tracked on github.com: RFC Ed.: remove this section before publication.
The YANG Data Structure Extensions issues are tracked on github.com:
https://github.com/netmod-wg/yang-data-ext/issues https://github.com/netmod-wg/yang-data-ext/issues
Authors' Addresses Authors' Addresses
Andy Bierman Andy Bierman
YumaWorks YumaWorks
Email: andy@yumaworks.com Email: andy@yumaworks.com
Martin Bjorklund Martin Bjorklund
Tail-f Systems Cisco
Email: mbj@tail-f.com Email: mbj@tail-f.com
Kent Watsen Kent Watsen
Juniper Networks Watsen Networks
Email: kwatsen@juniper.net Email: kent+ietf@watsen.net
 End of changes. 77 change blocks. 
302 lines changed or deleted 379 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/