draft-ietf-netmod-yang-metadata-05.txt   draft-ietf-netmod-yang-metadata-06.txt 
NETMOD Working Group L. Lhotka NETMOD Working Group L. Lhotka
Internet-Draft CZ.NIC Internet-Draft CZ.NIC
Updates: 6110 (if approved) March 10, 2016 Updates: 6110 (if approved) March 11, 2016
Intended status: Standards Track Intended status: Standards Track
Expires: September 11, 2016 Expires: September 12, 2016
Defining and Using Metadata with YANG Defining and Using Metadata with YANG
draft-ietf-netmod-yang-metadata-05 draft-ietf-netmod-yang-metadata-06
Abstract Abstract
This document defines a YANG extension statement that allows for This document defines a YANG extension statement that allows for
defining metadata annotations in YANG modules. The document also defining metadata annotations in YANG modules. The document also
specifies XML and JSON encoding of annotations and other rules for specifies XML and JSON encoding of annotations and other rules for
annotating instances of YANG data nodes. annotating instances of YANG data nodes.
Status of This Memo Status of This Memo
skipping to change at page 1, line 34 skipping to change at page 1, line 34
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 11, 2016. This Internet-Draft will expire on September 12, 2016.
Copyright Notice Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the Copyright (c) 2016 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
skipping to change at page 2, line 21 skipping to change at page 2, line 21
2.3. Namespaces and Prefixes . . . . . . . . . . . . . . . . . 6 2.3. Namespaces and Prefixes . . . . . . . . . . . . . . . . . 6
2.4. Definitions of New Terms . . . . . . . . . . . . . . . . 7 2.4. Definitions of New Terms . . . . . . . . . . . . . . . . 7
3. Defining Annotations in YANG . . . . . . . . . . . . . . . . 7 3. Defining Annotations in YANG . . . . . . . . . . . . . . . . 7
3.1. Example Definition . . . . . . . . . . . . . . . . . . . 8 3.1. Example Definition . . . . . . . . . . . . . . . . . . . 8
4. Using Annotations . . . . . . . . . . . . . . . . . . . . . . 8 4. Using Annotations . . . . . . . . . . . . . . . . . . . . . . 8
5. The Encoding of Annotations . . . . . . . . . . . . . . . . . 9 5. The Encoding of Annotations . . . . . . . . . . . . . . . . . 9
5.1. XML Encoding . . . . . . . . . . . . . . . . . . . . . . 9 5.1. XML Encoding . . . . . . . . . . . . . . . . . . . . . . 9
5.2. JSON Encoding . . . . . . . . . . . . . . . . . . . . . . 10 5.2. JSON Encoding . . . . . . . . . . . . . . . . . . . . . . 10
5.2.1. Metadata Object and Annotations . . . . . . . . . . . 10 5.2.1. Metadata Object and Annotations . . . . . . . . . . . 10
5.2.2. Adding Annotations to Anydata, Container and List 5.2.2. Adding Annotations to Anydata, Container and List
Entries . . . . . . . . . . . . . . . . . . . . . . . 10 Entries . . . . . . . . . . . . . . . . . . . . . . . 11
5.2.3. Adding Annotations to Anyxml and Leaf Instances . . . 11 5.2.3. Adding Annotations to Anyxml and Leaf Instances . . . 11
5.2.4. Adding Annotations to Leaf-list Entries . . . . . . . 12 5.2.4. Adding Annotations to Leaf-list Entries . . . . . . . 12
6. Representing Annotations in DSDL Schemas . . . . . . . . . . 12 6. Representing Annotations in DSDL Schemas . . . . . . . . . . 13
7. Metadata YANG Module . . . . . . . . . . . . . . . . . . . . 14 7. Metadata YANG Module . . . . . . . . . . . . . . . . . . . . 14
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 16
9. Security Considerations . . . . . . . . . . . . . . . . . . . 17 9. Security Considerations . . . . . . . . . . . . . . . . . . . 17
10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 17 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 17
11. References . . . . . . . . . . . . . . . . . . . . . . . . . 17 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 17
11.1. Normative References . . . . . . . . . . . . . . . . . . 17 11.1. Normative References . . . . . . . . . . . . . . . . . . 17
11.2. Informative References . . . . . . . . . . . . . . . . . 18 11.2. Informative References . . . . . . . . . . . . . . . . . 18
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 19 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 19
A.1. Changes Between Revisions -04 and -05 . . . . . . . . . . 19 A.1. Changes Between Revisions -05 and -06 . . . . . . . . . . 19
A.2. Changes Between Revisions -03 and -04 . . . . . . . . . . 19 A.2. Changes Between Revisions -04 and -05 . . . . . . . . . . 19
A.3. Changes Between Revisions -02 and -03 . . . . . . . . . . 19 A.3. Changes Between Revisions -03 and -04 . . . . . . . . . . 19
A.4. Changes Between Revisions -01 and -02 . . . . . . . . . . 19 A.4. Changes Between Revisions -02 and -03 . . . . . . . . . . 19
A.5. Changes Between Revisions -00 and -01 . . . . . . . . . . 19 A.5. Changes Between Revisions -01 and -02 . . . . . . . . . . 19
A.6. Changes Between draft-lhotka-netmod-yang-metadata-01 and A.6. Changes Between Revisions -00 and -01 . . . . . . . . . . 20
A.7. Changes Between draft-lhotka-netmod-yang-metadata-01 and
draft-ietf-netmod-yang-metadata-00 . . . . . . . . . . . 20 draft-ietf-netmod-yang-metadata-00 . . . . . . . . . . . 20
A.7. Changes Between draft-lhotka-netmod-yang-metadata-00 and A.8. Changes Between draft-lhotka-netmod-yang-metadata-00 and
-01 . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 -01 . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20
1. Introduction 1. Introduction
There is a need to be able to annotate instances of There is a need to be able to annotate instances of
YANG [I-D.ietf-netmod-rfc6020bis] data nodes with metadata. Typical YANG [I-D.ietf-netmod-rfc6020bis] data nodes with metadata. Typical
use cases are: use cases are:
o Complementing regular data model information with instance- o Complementing regular data model information with instance-
skipping to change at page 4, line 19 skipping to change at page 4, line 19
o Annotations are included in the data model. YANG compilers and o Annotations are included in the data model. YANG compilers and
tools supporting a certain annotation can thus take them into tools supporting a certain annotation can thus take them into
account and modify their behavior accordingly. account and modify their behavior accordingly.
o Semantics of an annotation are defined in the "description" and o Semantics of an annotation are defined in the "description" and
"reference" statements. "reference" statements.
o An annotation can be declared as conditional by using the "if- o An annotation can be declared as conditional by using the "if-
feature" statement. feature" statement.
o Values of annotations are not limited to strings; any YANG built- o The type of each annotation is explicitly specified; any YANG
in or derived type may be specified for them. built-in or derived type that is available for leaf or leaf-list
data nodes may be specified for annotations as well.
In the XML encoding, XML attributes are a natural instrument for In the XML encoding, XML attributes are a natural instrument for
attaching annotations to data node instances. This document attaching annotations to data node instances. This document
deliberately adopts some restrictions in order to remain compatible deliberately adopts some restrictions in order to remain compatible
with the XML encoding of YANG data node instances and limitations of with the XML encoding of YANG data node instances and limitations of
XML attributes. Specifically, XML attributes. Specifically,
o annotations are scalar values and cannot be further structured; o annotations can only be scalar values;
o annotations cannot be attached to a whole list or leaf-list o annotations cannot be attached to a whole list or leaf-list
instance, only to individual list or leaf-list entries. instance, only to individual list or leaf-list entries.
Due to the rules for YANG extensions (see sec. 6.3.1 in Due to the rules for YANG extensions (see sec. 6.3.1 in
[I-D.ietf-netmod-rfc6020bis]), annotation definitions posit [I-D.ietf-netmod-rfc6020bis]), annotation definitions posit
relatively weak conformance requirements. The alternative of relatively weak conformance requirements. The alternative of
introducing a new built-in YANG statement for defining annotations introducing a new built-in YANG statement for defining annotations
was considered, but it was seen as a major change to the language was considered, but it was seen as a major change to the language
that is inappropriate for YANG 1.1, which was chartered as a that is inappropriate for YANG 1.1, which was chartered as a
skipping to change at page 7, line 39 skipping to change at page 7, line 39
| description | 7.21.3 | 0..1 | | description | 7.21.3 | 0..1 |
| if-feature | 7.20.2 | 0..n | | if-feature | 7.20.2 | 0..n |
| reference | 7.21.4 | 0..1 | | reference | 7.21.4 | 0..1 |
| status | 7.21.2 | 0..1 | | status | 7.21.2 | 0..1 |
| type | 7.6.3 | 1 | | type | 7.6.3 | 1 |
| units | 7.3.3 | 0..1 | | units | 7.3.3 | 0..1 |
+--------------+---------------------+-------------+ +--------------+---------------------+-------------+
Table 2: Substatements of "md:annotation". Table 2: Substatements of "md:annotation".
Using the "type" statement, a type is specified for the annotation An annotation carries a single value. The type substatement, which
value according to the same rules as for YANG "leaf" type. MUST be present, takes as an argument the name of an existing built-
in or derived type, and the value of the annotation MUST match this
type. See Section 7.4 of [I-D.ietf-netmod-rfc6020bis] for details.
An annotation can be made conditional by using one or more "if- An annotation can be made conditional by using one or more "if-
feature" statements; the annotation is then supported only by servers feature" statements; the annotation is then supported only by servers
that advertise the corresponding feature. that advertise the corresponding feature.
The semantics and usage rules for an annotation SHOULD be fully The semantics and usage rules for an annotation SHOULD be fully
specified in "description", "reference" and "units" statements. specified in "description", "reference" and "units" statements.
An annotation MUST NOT change the data tree semantics defined by An annotation MUST NOT change the data tree semantics defined by
YANG. For example, it is illegal to define and use an annotation YANG. For example, it is illegal to define and use an annotation
skipping to change at page 14, line 28 skipping to change at page 14, line 41
7. Metadata YANG Module 7. Metadata YANG Module
RFC Editor: In this section, replace all occurrences of 'XXXX' with RFC Editor: In this section, replace all occurrences of 'XXXX' with
the actual RFC number and all occurrences of the revision date below the actual RFC number and all occurrences of the revision date below
with the date of RFC publication (and remove this note). with the date of RFC publication (and remove this note).
RFC Editor: Also please replace all occurrences of 'RFC 6020bis' with RFC Editor: Also please replace all occurrences of 'RFC 6020bis' with
the actual RFC number that will be assigned to the actual RFC number that will be assigned to
[I-D.ietf-netmod-rfc6020bis]. [I-D.ietf-netmod-rfc6020bis].
<CODE BEGINS> file "ietf-yang-metadata@2016-03-10.yang" <CODE BEGINS> file "ietf-yang-metadata@2016-03-11.yang"
module ietf-yang-metadata { module ietf-yang-metadata {
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-metadata"; namespace "urn:ietf:params:xml:ns:yang:ietf-yang-metadata";
prefix "md"; prefix "md";
organization organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group"; "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
skipping to change at page 15, line 26 skipping to change at page 15, line 37
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 XXXX
(http://tools.ietf.org/html/rfcXXXX); see the RFC itself for (http://tools.ietf.org/html/rfcXXXX); see the RFC itself for
full legal notices."; full legal notices.";
revision 2016-03-10 { revision 2016-03-11 {
description description
"Initial revision."; "Initial revision.";
reference reference
"RFC XXXX: Defining and Using Metadata with YANG"; "RFC XXXX: Defining and Using Metadata with YANG";
} }
extension annotation { extension annotation {
argument name; argument name;
description description
"This extension allows for defining metadata annotations in "This extension allows for defining metadata annotations in
skipping to change at page 19, line 9 skipping to change at page 19, line 14
[RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
and A. Bierman, Ed., "Network Configuration Protocol and A. Bierman, Ed., "Network Configuration Protocol
(NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
<http://www.rfc-editor.org/info/rfc6241>. <http://www.rfc-editor.org/info/rfc6241>.
Appendix A. Change Log Appendix A. Change Log
RFC Editor: Remove this section upon publication as an RFC. RFC Editor: Remove this section upon publication as an RFC.
A.1. Changes Between Revisions -04 and -05 A.1. Changes Between Revisions -05 and -06
o Added explanation of why a YANG extension is used rather than a o Added explanation of why a YANG extension is used rather than a
built-in statement. built-in statement.
A.2. Changes Between Revisions -03 and -04 A.2. Changes Between Revisions -04 and -05
o Clarification regarding the type of an annotation.
A.3. Changes Between Revisions -03 and -04
o Added explanation of what "top level of a module" means. o Added explanation of what "top level of a module" means.
A.3. Changes Between Revisions -02 and -03 A.4. Changes Between Revisions -02 and -03
o Section 4 was considerably simplified, also because member names o Section 4 was considerably simplified, also because member names
starting with "@" are now permitted by starting with "@" are now permitted by
[I-D.ietf-netmod-yang-json]. [I-D.ietf-netmod-yang-json].
A.4. Changes Between Revisions -01 and -02 A.5. Changes Between Revisions -01 and -02
o The "type" statement became mandatory. o The "type" statement became mandatory.
o Terminology section was extended. o Terminology section was extended.
o The annotation "inactive" defined in the example module was o The annotation "inactive" defined in the example module was
replaced with "last-modified" that is supposedly less replaced with "last-modified" that is supposedly less
controversial. controversial.
o Introduction now states limitation due to XML attribute o Introduction now states limitation due to XML attribute
skipping to change at page 19, line 46 skipping to change at page 20, line 7
o A recommendation was added to define annotations in a module by o A recommendation was added to define annotations in a module by
themselves. themselves.
o Section "Using Annotations" was added. o Section "Using Annotations" was added.
o An example for "anyxml" was added. o An example for "anyxml" was added.
o RFC 6241 was moved to informative references. o RFC 6241 was moved to informative references.
A.5. Changes Between Revisions -00 and -01 A.6. Changes Between Revisions -00 and -01
o Define JSON encoding for annotations attached to 'anydata' nodes. o Define JSON encoding for annotations attached to 'anydata' nodes.
A.6. Changes Between draft-lhotka-netmod-yang-metadata-01 and draft- A.7. Changes Between draft-lhotka-netmod-yang-metadata-01 and draft-
ietf-netmod-yang-metadata-00 ietf-netmod-yang-metadata-00
o References to RFC 6020 were changed to the 6020bis I-D. o References to RFC 6020 were changed to the 6020bis I-D.
o Text about RFC 2119 key words was added to "ietf-yang-metadata" o Text about RFC 2119 key words was added to "ietf-yang-metadata"
module description. module description.
A.7. Changes Between draft-lhotka-netmod-yang-metadata-00 and -01 A.8. Changes Between draft-lhotka-netmod-yang-metadata-00 and -01
o Encoding of annotations for anyxml nodes was changed to be the o Encoding of annotations for anyxml nodes was changed to be the
same as for leafs. This was necessary because anyxml value now same as for leafs. This was necessary because anyxml value now
needn't be an object. needn't be an object.
o It is stated that "md:annotation" statement defines only the o It is stated that "md:annotation" statement defines only the
syntax of an annotation. syntax of an annotation.
o Allowed "if-feature" as a substatement of "md:annotation". o Allowed "if-feature" as a substatement of "md:annotation".
 End of changes. 20 change blocks. 
27 lines changed or deleted 35 lines changed or added

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