draft-ietf-netmod-rfc6087bis-12.txt   draft-ietf-netmod-rfc6087bis-13.txt 
Network Working Group A. Bierman Network Working Group A. Bierman
Internet-Draft YumaWorks Internet-Draft YumaWorks
Obsoletes: 6087 (if approved) March 5, 2017 Obsoletes: 6087 (if approved) June 18, 2017
Intended status: Informational Intended status: Informational
Expires: September 6, 2017 Expires: December 20, 2017
Guidelines for Authors and Reviewers of YANG Data Model Documents Guidelines for Authors and Reviewers of YANG Data Model Documents
draft-ietf-netmod-rfc6087bis-12 draft-ietf-netmod-rfc6087bis-13
Abstract Abstract
This memo provides guidelines for authors and reviewers of Standards This memo provides guidelines for authors and reviewers of Standards
Track specifications containing YANG data model modules. Applicable Track specifications containing YANG data model modules. Applicable
portions may be used as a basis for reviews of other YANG data model portions may be used as a basis for reviews of other YANG data model
documents. Recommendations and procedures are defined, which are documents. Recommendations and procedures are defined, which are
intended to increase interoperability and usability of Network intended to increase interoperability and usability of Network
Configuration Protocol (NETCONF) and RESTCONF protocol Configuration Protocol (NETCONF) and RESTCONF protocol
implementations that utilize YANG data model modules. implementations that utilize YANG data model modules. This document
obsoletes RFC 6087.
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
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
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, 2017. This Internet-Draft will expire on December 20, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 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 16 skipping to change at page 2, line 17
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 6 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1. Requirements Notation . . . . . . . . . . . . . . . . . . 6 2.1. Requirements Notation . . . . . . . . . . . . . . . . . . 6
2.2. NETCONF Terms . . . . . . . . . . . . . . . . . . . . . . 6 2.2. NETCONF Terms . . . . . . . . . . . . . . . . . . . . . . 6
2.3. YANG Terms . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3. YANG Terms . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2.4. Terms . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3. YANG Tree Diagrams . . . . . . . . . . . . . . . . . . . . . . 8 2.4.1. YANG Tree Diagrams . . . . . . . . . . . . . . . . . . 7
4. General Documentation Guidelines . . . . . . . . . . . . . . . 9 3. General Documentation Guidelines . . . . . . . . . . . . . . . 8
4.1. Module Copyright . . . . . . . . . . . . . . . . . . . . . 9 3.1. Module Copyright . . . . . . . . . . . . . . . . . . . . . 8
4.2. Code Components . . . . . . . . . . . . . . . . . . . . . 9 3.2. Code Components . . . . . . . . . . . . . . . . . . . . . 8
4.2.1. Example Modules . . . . . . . . . . . . . . . . . . . 10 3.2.1. Example Modules . . . . . . . . . . . . . . . . . . . 9
4.3. Terminology Section . . . . . . . . . . . . . . . . . . . 10 3.3. Terminology Section . . . . . . . . . . . . . . . . . . . 9
4.4. Tree Diagrams . . . . . . . . . . . . . . . . . . . . . . 11 3.4. Tree Diagrams . . . . . . . . . . . . . . . . . . . . . . 10
4.5. Narrative Sections . . . . . . . . . . . . . . . . . . . . 11 3.5. Narrative Sections . . . . . . . . . . . . . . . . . . . . 10
4.6. Definitions Section . . . . . . . . . . . . . . . . . . . 12 3.6. Definitions Section . . . . . . . . . . . . . . . . . . . 11
4.7. Security Considerations Section . . . . . . . . . . . . . 12 3.7. Security Considerations Section . . . . . . . . . . . . . 11
4.8. IANA Considerations Section . . . . . . . . . . . . . . . 13 3.8. IANA Considerations Section . . . . . . . . . . . . . . . 12
4.8.1. Documents that Create a New Namespace . . . . . . . . 13 3.8.1. Documents that Create a New Namespace . . . . . . . . 12
4.8.2. Documents that Extend an Existing Namespace . . . . . 13 3.8.2. Documents that Extend an Existing Namespace . . . . . 12
4.9. Reference Sections . . . . . . . . . . . . . . . . . . . . 13 3.9. Reference Sections . . . . . . . . . . . . . . . . . . . . 12
4.10. Validation Tools . . . . . . . . . . . . . . . . . . . . . 14 3.10. Validation Tools . . . . . . . . . . . . . . . . . . . . . 13
4.11. Module Extraction Tools . . . . . . . . . . . . . . . . . 14 3.11. Module Extraction Tools . . . . . . . . . . . . . . . . . 13
4.12. Module Usage Examples . . . . . . . . . . . . . . . . . . 14 3.12. Module Usage Examples . . . . . . . . . . . . . . . . . . 13
5. YANG Usage Guidelines . . . . . . . . . . . . . . . . . . . . 15 4. YANG Usage Guidelines . . . . . . . . . . . . . . . . . . . . 14
5.1. Module Naming Conventions . . . . . . . . . . . . . . . . 15 4.1. Module Naming Conventions . . . . . . . . . . . . . . . . 14
5.2. Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.2. Prefixes . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3. Identifiers . . . . . . . . . . . . . . . . . . . . . . . 17 4.3. Identifiers . . . . . . . . . . . . . . . . . . . . . . . 16
5.3.1. Identifier Naming Conventions . . . . . . . . . . . . 17 4.3.1. Identifier Naming Conventions . . . . . . . . . . . . 16
5.4. Defaults . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.4. Defaults . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.5. Conditional Statements . . . . . . . . . . . . . . . . . . 18 4.5. Conditional Statements . . . . . . . . . . . . . . . . . . 17
5.6. XPath Usage . . . . . . . . . . . . . . . . . . . . . . . 19 4.6. XPath Usage . . . . . . . . . . . . . . . . . . . . . . . 18
5.6.1. XPath Evaluation Contexts . . . . . . . . . . . . . . 19 4.6.1. XPath Evaluation Contexts . . . . . . . . . . . . . . 18
5.6.2. Function Library . . . . . . . . . . . . . . . . . . . 20 4.6.2. Function Library . . . . . . . . . . . . . . . . . . . 19
5.6.3. Axes . . . . . . . . . . . . . . . . . . . . . . . . . 21 4.6.3. Axes . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.6.4. Types . . . . . . . . . . . . . . . . . . . . . . . . 21 4.6.4. Types . . . . . . . . . . . . . . . . . . . . . . . . 20
5.6.5. Wildcards . . . . . . . . . . . . . . . . . . . . . . 22 4.6.5. Wildcards . . . . . . . . . . . . . . . . . . . . . . 21
5.6.6. Boolean Expressions . . . . . . . . . . . . . . . . . 22 4.6.6. Boolean Expressions . . . . . . . . . . . . . . . . . 21
5.7. Lifecycle Management . . . . . . . . . . . . . . . . . . . 23 4.7. Lifecycle Management . . . . . . . . . . . . . . . . . . . 22
5.8. Module Header, Meta, and Revision Statements . . . . . . . 24 4.8. Module Header, Meta, and Revision Statements . . . . . . . 23
5.9. Namespace Assignments . . . . . . . . . . . . . . . . . . 25 4.9. Namespace Assignments . . . . . . . . . . . . . . . . . . 24
5.10. Top-Level Data Definitions . . . . . . . . . . . . . . . . 26 4.10. Top-Level Data Definitions . . . . . . . . . . . . . . . . 25
5.11. Data Types . . . . . . . . . . . . . . . . . . . . . . . . 27 4.11. Data Types . . . . . . . . . . . . . . . . . . . . . . . . 26
5.11.1. Fixed Value Extensibility . . . . . . . . . . . . . . 27 4.11.1. Fixed Value Extensibility . . . . . . . . . . . . . . 26
5.11.2. Patterns and Ranges . . . . . . . . . . . . . . . . . 28 4.11.2. Patterns and Ranges . . . . . . . . . . . . . . . . . 27
5.11.3. Enumerations and Bits . . . . . . . . . . . . . . . . 29 4.11.3. Enumerations and Bits . . . . . . . . . . . . . . . . 28
5.11.4. Union Types . . . . . . . . . . . . . . . . . . . . . 30 4.11.4. Union Types . . . . . . . . . . . . . . . . . . . . . 29
5.11.5. Empty and Boolean . . . . . . . . . . . . . . . . . . 31 4.11.5. Empty and Boolean . . . . . . . . . . . . . . . . . . 30
5.12. Reusable Type Definitions . . . . . . . . . . . . . . . . 32 4.12. Reusable Type Definitions . . . . . . . . . . . . . . . . 31
5.13. Reusable Groupings . . . . . . . . . . . . . . . . . . . . 33 4.13. Reusable Groupings . . . . . . . . . . . . . . . . . . . . 32
5.14. Data Definitions . . . . . . . . . . . . . . . . . . . . . 33 4.14. Data Definitions . . . . . . . . . . . . . . . . . . . . . 32
5.14.1. Non-Presence Containers . . . . . . . . . . . . . . . 35 4.14.1. Non-Presence Containers . . . . . . . . . . . . . . . 34
5.14.2. Top-Level Data Nodes . . . . . . . . . . . . . . . . . 35 4.14.2. Top-Level Data Nodes . . . . . . . . . . . . . . . . . 34
5.15. Operation Definitions . . . . . . . . . . . . . . . . . . 36 4.15. Operation Definitions . . . . . . . . . . . . . . . . . . 35
5.16. Notification Definitions . . . . . . . . . . . . . . . . . 36 4.16. Notification Definitions . . . . . . . . . . . . . . . . . 35
5.17. Feature Definitions . . . . . . . . . . . . . . . . . . . 37 4.17. Feature Definitions . . . . . . . . . . . . . . . . . . . 36
5.18. YANG Data Node Constraints . . . . . . . . . . . . . . . . 37 4.18. YANG Data Node Constraints . . . . . . . . . . . . . . . . 36
5.18.1. Controlling Quantity . . . . . . . . . . . . . . . . . 37 4.18.1. Controlling Quantity . . . . . . . . . . . . . . . . . 36
5.18.2. must vs. when . . . . . . . . . . . . . . . . . . . . 38 4.18.2. must vs. when . . . . . . . . . . . . . . . . . . . . 37
5.19. Augment Statements . . . . . . . . . . . . . . . . . . . . 38 4.19. Augment Statements . . . . . . . . . . . . . . . . . . . . 37
5.19.1. Conditional Augment Statements . . . . . . . . . . . . 38 4.19.1. Conditional Augment Statements . . . . . . . . . . . . 37
5.19.2. Conditionally Mandatory Data Definition Statements . . 39 4.19.2. Conditionally Mandatory Data Definition Statements . . 38
5.20. Deviation Statements . . . . . . . . . . . . . . . . . . . 40 4.20. Deviation Statements . . . . . . . . . . . . . . . . . . . 39
5.21. Extension Statements . . . . . . . . . . . . . . . . . . . 41 4.21. Extension Statements . . . . . . . . . . . . . . . . . . . 40
5.22. Data Correlation . . . . . . . . . . . . . . . . . . . . . 42 4.22. Data Correlation . . . . . . . . . . . . . . . . . . . . . 41
5.23. Operational Data . . . . . . . . . . . . . . . . . . . . . 43 4.22.1. Use of Leafref for Key Correlation . . . . . . . . . . 42
5.24. Performance Considerations . . . . . . . . . . . . . . . . 47 4.23. Operational Data . . . . . . . . . . . . . . . . . . . . . 43
5.25. Open Systems Considerations . . . . . . . . . . . . . . . 47 4.24. Performance Considerations . . . . . . . . . . . . . . . . 43
5.26. YANG 1.1 Guidelines . . . . . . . . . . . . . . . . . . . 48 4.25. Open Systems Considerations . . . . . . . . . . . . . . . 44
5.26.1. Importing Multiple Revisions . . . . . . . . . . . . . 48 4.26. YANG 1.1 Guidelines . . . . . . . . . . . . . . . . . . . 44
5.26.2. Using Feature Logic . . . . . . . . . . . . . . . . . 48 4.26.1. Importing Multiple Revisions . . . . . . . . . . . . . 44
5.26.3. anyxml vs. anydata . . . . . . . . . . . . . . . . . . 48 4.26.2. Using Feature Logic . . . . . . . . . . . . . . . . . 44
5.26.4. action vs. rpc . . . . . . . . . . . . . . . . . . . . 48 4.26.3. anyxml vs. anydata . . . . . . . . . . . . . . . . . . 45
5.27. Updating YANG Modules (Published vs. Unpublished) . . . . 49 4.26.4. action vs. rpc . . . . . . . . . . . . . . . . . . . . 45
6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 51 4.27. Updating YANG Modules (Published vs. Unpublished) . . . . 46
7. Security Considerations . . . . . . . . . . . . . . . . . . . 52 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 47
7.1. Security Considerations Section Template . . . . . . . . . 52 6. Security Considerations . . . . . . . . . . . . . . . . . . . 48
8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 54 6.1. Security Considerations Section Template . . . . . . . . . 48
9. Changes Since RFC 6087 . . . . . . . . . . . . . . . . . . . . 55 7. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 50
10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 57 8. Changes Since RFC 6087 . . . . . . . . . . . . . . . . . . . . 51
10.1. Normative References . . . . . . . . . . . . . . . . . . . 57 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.2. Informative References . . . . . . . . . . . . . . . . . . 57 9.1. Normative References . . . . . . . . . . . . . . . . . . . 53
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 59 9.2. Informative References . . . . . . . . . . . . . . . . . . 53
A.1. v11 to v12 . . . . . . . . . . . . . . . . . . . . . . . . 59 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 56
A.2. v10 to v11 . . . . . . . . . . . . . . . . . . . . . . . . 59 A.1. v12 to v13 . . . . . . . . . . . . . . . . . . . . . . . . 56
A.3. v09 to v10 . . . . . . . . . . . . . . . . . . . . . . . . 59 A.2. v11 to v12 . . . . . . . . . . . . . . . . . . . . . . . . 56
A.4. v08 to v09 . . . . . . . . . . . . . . . . . . . . . . . . 59 A.3. v10 to v11 . . . . . . . . . . . . . . . . . . . . . . . . 56
A.5. v07 to v08 . . . . . . . . . . . . . . . . . . . . . . . . 59 A.4. v09 to v10 . . . . . . . . . . . . . . . . . . . . . . . . 56
A.6. v06 to v07 . . . . . . . . . . . . . . . . . . . . . . . . 60 A.5. v08 to v09 . . . . . . . . . . . . . . . . . . . . . . . . 56
A.7. v05 to v06 . . . . . . . . . . . . . . . . . . . . . . . . 60 A.6. v07 to v08 . . . . . . . . . . . . . . . . . . . . . . . . 57
A.8. v04 to v05 . . . . . . . . . . . . . . . . . . . . . . . . 60 A.7. v06 to v07 . . . . . . . . . . . . . . . . . . . . . . . . 57
A.9. v03 ot v04 . . . . . . . . . . . . . . . . . . . . . . . . 61 A.8. v05 to v06 . . . . . . . . . . . . . . . . . . . . . . . . 57
A.10. v02 to v03 . . . . . . . . . . . . . . . . . . . . . . . . 61 A.9. v04 to v05 . . . . . . . . . . . . . . . . . . . . . . . . 58
A.11. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . . 61 A.10. v03 ot v04 . . . . . . . . . . . . . . . . . . . . . . . . 58
A.12. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . . 61 A.11. v02 to v03 . . . . . . . . . . . . . . . . . . . . . . . . 58
Appendix B. Module Review Checklist . . . . . . . . . . . . . . . 63 A.12. v01 to v02 . . . . . . . . . . . . . . . . . . . . . . . . 59
Appendix C. YANG Module Template . . . . . . . . . . . . . . . . 65 A.13. v00 to v01 . . . . . . . . . . . . . . . . . . . . . . . . 59
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 67 Appendix B. Module Review Checklist . . . . . . . . . . . . . . . 60
Appendix C. YANG Module Template . . . . . . . . . . . . . . . . 62
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 64
1. Introduction 1. Introduction
The standardization of network configuration interfaces for use with The standardization of network configuration interfaces for use with
the Network Configuration Protocol [RFC6241] and RESTCONF the Network Configuration Protocol [RFC6241] and RESTCONF [RFC8040]
[I-D.ietf-netconf-restconf] requires a modular set of data models, requires a modular set of data models, which can be reused and
which can be reused and extended over time. extended over time.
This document defines a set of usage guidelines for Standards Track This document defines a set of usage guidelines for Standards Track
documents containing [RFC7950] data models. YANG is used to define documents containing [RFC7950] data models. YANG is used to define
the data structures, protocol operations, and notification content the data structures, protocol operations, and notification content
used within a NETCONF and/or RESTCONF server. A server that supports used within a NETCONF and/or RESTCONF server. A server that supports
a particular YANG module will support client NETCONF and/or RESTCONF a particular YANG module will support client NETCONF and/or RESTCONF
operation requests, as indicated by the specific content defined in operation requests, as indicated by the specific content defined in
the YANG module. the YANG module.
This document is similar to the Structure of Management Information This document is similar to the Structure of Management Information
skipping to change at page 5, line 43 skipping to change at page 5, line 43
defined in the YANG specification. defined in the YANG specification.
In addition, YANG allows constructs such as infinite length In addition, YANG allows constructs such as infinite length
identifiers and string values, or top-level mandatory nodes, that a identifiers and string values, or top-level mandatory nodes, that a
compliant server is not required to support. Only constructs that compliant server is not required to support. Only constructs that
all servers are required to support can be used in IETF YANG modules. all servers are required to support can be used in IETF YANG modules.
This document defines usage guidelines related to the NETCONF This document defines usage guidelines related to the NETCONF
operations layer and NETCONF content layer, as defined in [RFC6241], operations layer and NETCONF content layer, as defined in [RFC6241],
and the RESTCONF methods and RESTCONF resources, as defined in and the RESTCONF methods and RESTCONF resources, as defined in
[I-D.ietf-netconf-restconf], [RFC8040],
These guidelines are intended to be used by authors and reviewers to These guidelines are intended to be used by authors and reviewers to
improve the readability and interoperability of published YANG data improve the readability and interoperability of published YANG data
models. models.
Note that this document is not a YANG tutorial and the reader is Note that this document is not a YANG tutorial and the reader is
expected to know the YANG data modeling language before using this expected to know the YANG data modeling language before using this
document. document.
2. Terminology 2. Terminology
skipping to change at page 8, line 5 skipping to change at page 7, line 25
is considered an unstable publication that is a work-in-progress, is considered an unstable publication that is a work-in-progress,
subject to change at any time. subject to change at any time.
o YANG fragment: A set of YANG statements that are not intended to o YANG fragment: A set of YANG statements that are not intended to
represent a complete YANG module or submodule. These statements represent a complete YANG module or submodule. These statements
are not intended for actual use, except to provide an example of are not intended for actual use, except to provide an example of
YANG statement usage. The invalid syntax "..." is sometimes used YANG statement usage. The invalid syntax "..." is sometimes used
to indicate that additional YANG statements would be present in a to indicate that additional YANG statements would be present in a
real YANG module. real YANG module.
3. YANG Tree Diagrams 2.4.1. YANG Tree Diagrams
YANG tree diagrams provide a concise representation of a YANG module
to help readers understand the module structure.
The meaning of the symbols in YANG tree diagrams is as follows. Each
node is printed as:
<status> <flags> <name> <opts> <type> <if-features>
<status> is one of:
+ for current
x for deprecated
o for obsolete
<flags> is one of:
rw for configuration data
ro for non-configuration data
-x for rpcs and actions
-n for notifications
<name> is the name of the node
(<name>) means that the node is a choice node
:(<name>) means that the node is a case node
If the node is augmented into the tree from another module,
its name is printed as <prefix>:<name>.
<opts> is one of:
? for an optional leaf, choice, anydata or anyxml
! for a presence container
* for a leaf-list or list
[<keys>] for a list's keys
<type> is the name of the type for leafs and leaf-lists
If the type is a leafref, the type is printed as "-> TARGET",
where TARGET is either the leafref path, with prefixed removed
if possible.
<if-features> is the list of features this node depends on, A simplified graphical representation of the data model is used in
printed within curly brackets and a question mark "{...}?" this document. The meaning of the symbols in these diagrams is
defined in [I-D.ietf-netmod-yang-tree-diagrams].
4. General Documentation Guidelines 3. General Documentation Guidelines
YANG data model modules under review are likely to be contained in YANG data model modules under review are likely to be contained in
Internet-Drafts. All guidelines for Internet-Draft authors MUST be Internet-Drafts. All guidelines for Internet-Draft authors MUST be
followed. The RFC Editor provides guidelines for authors of RFCs, followed. The RFC Editor provides guidelines for authors of RFCs,
which are first published as Internet-Drafts. These guidelines which are first published as Internet-Drafts. These guidelines
should be followed and are defined in [RFC7322] and updated in should be followed and are defined in [RFC7322] and updated in
[RFC7841] and "RFC Document Style" [RFC-STYLE]. [RFC7841] and "RFC Document Style" [RFC-STYLE].
The following sections MUST be present in an Internet-Draft The following sections MUST be present in an Internet-Draft
containing a module: containing a module:
skipping to change at page 9, line 40 skipping to change at page 8, line 40
o normative module or submodule o normative module or submodule
o example module or submodule o example module or submodule
o example YANG fragment not part of any module or submodule o example YANG fragment not part of any module or submodule
The guidelines in this document refer mainly to a normative complete The guidelines in this document refer mainly to a normative complete
module or submodule, but may be applicable to example modules and module or submodule, but may be applicable to example modules and
YANG fragments as well. YANG fragments as well.
4.1. Module Copyright 3.1. Module Copyright
The module description statement MUST contain a reference to the The module description statement MUST contain a reference to the
latest approved IETF Trust Copyright statement, which is available latest approved IETF Trust Copyright statement, which is available
online at: online at:
http://trustee.ietf.org/license-info/ http://trustee.ietf.org/license-info/
4.2. Code Components 3.2. Code Components
Each normative YANG module or submodule contained within an Internet- Each normative YANG module or submodule contained within an Internet-
Draft or RFC is considered to be a code component. The strings Draft or RFC is considered to be a code component. The strings
"<CODE BEGINS>" and "<CODE ENDS>" MUST be used to identify each code "<CODE BEGINS>" and "<CODE ENDS>" MUST be used to identify each code
component. component.
The "<CODE BEGINS>" tag SHOULD be followed by a string identifying The "<CODE BEGINS>" tag SHOULD be followed by a string identifying
the file name specified in Section 5.2 of [RFC7950]. The following the file name specified in Section 5.2 of [RFC7950]. The name string
form that includes the revision-date SHOULD be used. The following
example is for the '2010-01-18' revision of the 'ietf-foo' module: example is for the '2010-01-18' revision of the 'ietf-foo' module:
<CODE BEGINS> file "ietf-foo@2016-03-20.yang" <CODE BEGINS> file "ietf-foo@2016-03-20.yang"
module ietf-foo { module ietf-foo {
namespace "urn:ietf:params:xml:ns:yang:ietf-foo"; namespace "urn:ietf:params:xml:ns:yang:ietf-foo";
prefix "foo"; prefix "foo";
organization "..."; organization "...";
contact "..."; contact "...";
description "..."; description "...";
revision 2016-03-20 { revision 2016-03-20 {
description "Latest revision"; description "Latest revision";
reference "RFC XXXX"; reference "RFC XXXX";
} }
// ... more statements // ... more statements
} }
<CODE ENDS> <CODE ENDS>
4.2.1. Example Modules 3.2.1. Example Modules
Example modules are not code components. The <CODE BEGINS> Example modules are not code components. The <CODE BEGINS>
convention MUST NOT be used for example modules. convention MUST NOT be used for example modules.
An example module SHOULD be named using the term "example", followed An example module SHOULD be named using the term "example", followed
by a hyphen, followed by a descriptive name, e.g., "example-toaster". by a hyphen, followed by a descriptive name, e.g., "example-toaster".
4.3. Terminology Section 3.3. Terminology Section
A terminology section MUST be present if any terms are defined in the A terminology section MUST be present if any terms are defined in the
document or if any terms are imported from other documents. document or if any terms are imported from other documents.
If YANG tree diagrams are used, then a sub-section explaining the If YANG tree diagrams are used, then a sub-section explaining the
YANG tree diagram syntax MUST be present, containing the following YANG tree diagram syntax MUST be present, containing the following
text: text:
A simplified graphical representation of the data model is used in A simplified graphical representation of the data model is used in
this document. The meaning of the symbols in these diagrams is this document. The meaning of the symbols in these diagrams is
defined in [RFCXXXX]. defined in [I-D.ietf-netmod-yang-tree-diagrams].
-- RFC Editor: Replace XXXX with RFC number and remove note
4.4. Tree Diagrams 3.4. Tree Diagrams
YANG tree diagrams provide a concise representation of a YANG module, YANG tree diagrams provide a concise representation of a YANG module,
and SHOULD be included to help readers understand YANG module and SHOULD be included to help readers understand YANG module
structure. Tree diagrams MAY be split into sections to correspond to structure. Tree diagrams MAY be split into sections to correspond to
document structure. document structure.
The following example shows a simple YANG tree diagram: The following example shows a simple YANG tree diagram:
+--rw top-level-config-container +--rw top-level-config-container
| +--rw config-list* [key-name] | +--rw config-list* [key-name]
skipping to change at page 11, line 37 skipping to change at page 10, line 37
If the YANG module is comprised of groupings only, then the tree If the YANG module is comprised of groupings only, then the tree
diagram SHOULD contain the groupings. The 'pyang' compiler can be diagram SHOULD contain the groupings. The 'pyang' compiler can be
used to produce a tree diagram with groupings using the '-f tree used to produce a tree diagram with groupings using the '-f tree
--tree-print-groupings" command line parameters. --tree-print-groupings" command line parameters.
If the YANG module contains notifications, then the tree diagram If the YANG module contains notifications, then the tree diagram
SHOULD contain the notifications. If the YANG module contains RPC SHOULD contain the notifications. If the YANG module contains RPC
statements, then the tree diagram SHOULD contain the RPC statements. statements, then the tree diagram SHOULD contain the RPC statements.
4.5. Narrative Sections 3.5. Narrative Sections
The narrative part MUST include an overview section that describes The narrative part MUST include an overview section that describes
the scope and field of application of the module(s) defined by the the scope and field of application of the module(s) defined by the
specification and that specifies the relationship (if any) of these specification and that specifies the relationship (if any) of these
modules to other standards, particularly to standards containing modules to other standards, particularly to standards containing
other YANG modules. The narrative part SHOULD include one or more other YANG modules. The narrative part SHOULD include one or more
sections to briefly describe the structure of the modules defined in sections to briefly describe the structure of the modules defined in
the specification. the specification.
If the module(s) defined by the specification imports definitions If the module(s) defined by the specification imports definitions
from other modules (except for those defined in the [RFC7950] or from other modules (except for those defined in the [RFC7950] or
[RFC6991] documents), or are always implemented in conjunction with [RFC6991] documents), or are always implemented in conjunction with
other modules, then those facts MUST be noted in the overview other modules, then those facts MUST be noted in the overview
section, as MUST be noted any special interpretations of definitions section, as MUST be noted any special interpretations of definitions
in other modules. in other modules.
4.6. Definitions Section 3.6. Definitions Section
This section contains the module(s) defined by the specification. This section contains the module(s) defined by the specification.
These modules SHOULD be written using the YANG 1.1 [RFC7950] syntax. These modules SHOULD be written using the YANG 1.1 [RFC7950] syntax.
YANG 1.0 [RFC6020] syntax MAY be used if no YANG 1.1 constructs or YANG 1.0 [RFC6020] syntax MAY be used if no YANG 1.1 constructs or
semantics are needed in the module. semantics are needed in the module.
A YIN syntax version of the module MAY also be present in the A YIN syntax version of the module MAY also be present in the
document. There MAY also be other types of modules present in the document. There MAY also be other types of modules present in the
document, such as SMIv2, which are not affected by these guidelines. document, such as SMIv2, which are not affected by these guidelines.
Note that all YANG statements within a YANG module are considered Note that all YANG statements within a YANG module are considered
normative, if the module itself is considered normative, and not an normative, if the module itself is considered normative, and not an
example module. The use of keywords defined in [RFC2119] apply to example module. The use of keywords defined in [RFC2119] apply to
YANG description statements in normative modules exactly as they YANG description statements in normative modules exactly as they
would in any other normative section. would in any other normative section.
Example YANG modules MUST NOT contain any normative text, including Example YANG modules MUST NOT contain any normative text, including
any reserved words from [RFC2119]. any reserved words from [RFC2119].
See Section 5 for guidelines on YANG usage. See Section 4 for guidelines on YANG usage.
4.7. Security Considerations Section 3.7. Security Considerations Section
Each specification that defines one or more modules MUST contain a Each specification that defines one or more modules MUST contain a
section that discusses security considerations relevant to those section that discusses security considerations relevant to those
modules. modules.
This section MUST be patterned after the latest approved template This section MUST be patterned after the latest approved template
(available at http://trac.tools.ietf.org/area/ops/trac/wiki/ (available at http://trac.tools.ietf.org/area/ops/trac/wiki/
yang-security-guidelines). Section 7.1 contains the security yang-security-guidelines). Section 6.1 contains the security
considerations template dated 2013-05-08. Authors MUST check the WEB considerations template dated 2013-05-08. Authors MUST check the WEB
page at the URL listed above in case there is a more recent version page at the URL listed above in case there is a more recent version
available. available.
In particular: In particular:
o Writable data nodes that could be especially disruptive if abused o Writable data nodes that could be especially disruptive if abused
MUST be explicitly listed by name and the associated security MUST be explicitly listed by name and the associated security
risks MUST be explained. risks MUST be explained.
o Readable data nodes that contain especially sensitive information o Readable data nodes that contain especially sensitive information
or that raise significant privacy concerns MUST be explicitly or that raise significant privacy concerns MUST be explicitly
listed by name and the reasons for the sensitivity/privacy listed by name and the reasons for the sensitivity/privacy
concerns MUST be explained. concerns MUST be explained.
o Operations (i.e., YANG 'rpc' statements) that are potentially o Operations (i.e., YANG 'rpc' statements) that are potentially
harmful to system behavior or that raise significant privacy harmful to system behavior or that raise significant privacy
concerns MUST be explicitly listed by name and the reasons for the concerns MUST be explicitly listed by name and the reasons for the
sensitivity/privacy concerns MUST be explained. sensitivity/privacy concerns MUST be explained.
4.8. IANA Considerations Section 3.8. IANA Considerations Section
In order to comply with IESG policy as set forth in In order to comply with IESG policy as set forth in
http://www.ietf.org/id-info/checklist.html, every Internet-Draft that http://www.ietf.org/id-info/checklist.html, every Internet-Draft that
is submitted to the IESG for publication MUST contain an IANA is submitted to the IESG for publication MUST contain an IANA
Considerations section. The requirements for this section vary Considerations section. The requirements for this section vary
depending on what actions are required of the IANA. If there are no depending on what actions are required of the IANA. If there are no
IANA considerations applicable to the document, then the IANA IANA considerations applicable to the document, then the IANA
Considerations section stating that there are no actions is removed Considerations section stating that there are no actions is removed
by the RFC Editor before publication. Refer to the guidelines in by the RFC Editor before publication. Refer to the guidelines in
[RFC5226] for more details. [RFC5226] for more details.
4.8.1. Documents that Create a New Namespace Each normative YANG module MUST be registered in the XML namespace
Registry [RFC3688], and the YANG Module Names Registry [RFC6020].
This applies to new modules and updated modules. Examples of these
registrations for the "ietf-template" module can be found in
Section 5.
3.8.1. Documents that Create a New Namespace
If an Internet-Draft defines a new namespace that is to be If an Internet-Draft defines a new namespace that is to be
administered by the IANA, then the document MUST include an IANA administered by the IANA, then the document MUST include an IANA
Considerations section that specifies how the namespace is to be Considerations section that specifies how the namespace is to be
administered. administered.
Specifically, if any YANG module namespace statement value contained Specifically, if any YANG module namespace statement value contained
in the document is not already registered with IANA, then a new YANG in the document is not already registered with IANA, then a new YANG
Namespace registry entry MUST be requested from the IANA. The Namespace registry entry MUST be requested from the IANA. The
[RFC7950] specification includes the procedure for this purpose in [RFC7950] specification includes the procedure for this purpose in
its IANA Considerations section. its IANA Considerations section.
4.8.2. Documents that Extend an Existing Namespace 3.8.2. Documents that Extend an Existing Namespace
It is possible to extend an existing namespace using a YANG submodule It is possible to extend an existing namespace using a YANG submodule
that belongs to an existing module already administered by IANA. In that belongs to an existing module already administered by IANA. In
this case, the document containing the main module MUST be updated to this case, the document containing the main module MUST be updated to
use the latest revision of the submodule. use the latest revision of the submodule.
4.9. Reference Sections 3.9. Reference Sections
For every import or include statement that appears in a module For every import or include statement that appears in a module
contained in the specification, which identifies a module in a contained in the specification, which identifies a module in a
separate document, a corresponding normative reference to that separate document, a corresponding normative reference to that
document MUST appear in the Normative References section. The document MUST appear in the Normative References section. The
reference MUST correspond to the specific module version actually reference MUST correspond to the specific module version actually
used within the specification. used within the specification.
For every normative reference statement that appears in a module For every normative reference statement that appears in a module
contained in the specification, which identifies a separate document, contained in the specification, which identifies a separate document,
a corresponding normative reference to that document SHOULD appear in a corresponding normative reference to that document SHOULD appear in
the Normative References section. The reference SHOULD correspond to the Normative References section. The reference SHOULD correspond to
the specific document version actually used within the specification. the specific document version actually used within the specification.
If the reference statement identifies an informative reference, which If the reference statement identifies an informative reference, which
identifies a separate document, a corresponding informative reference identifies a separate document, a corresponding informative reference
to that document MAY appear in the Informative References section. to that document MAY appear in the Informative References section.
4.10. Validation Tools 3.10. Validation Tools
All modules need to be validated before submission in an Internet All modules need to be validated before submission in an Internet
Draft. The 'pyang' YANG compiler is freely available from github: Draft. The 'pyang' YANG compiler is freely available from github:
https://github.com/mbj4668/pyang https://github.com/mbj4668/pyang
If the 'pyang' compiler is used to validate a normative module, then If the 'pyang' compiler is used to validate a normative module, then
the "--ietf" command line option MUST be used to identify any IETF the "--ietf" command line option MUST be used to identify any IETF
guideline issues. guideline issues.
If the 'pyang' compiler is used to validate an example module, then If the 'pyang' compiler is used to validate an example module, then
the "--ietf" command line option MAY be used to identify any IETF the "--ietf" command line option MAY be used to identify any IETF
guideline issues. guideline issues.
4.11. Module Extraction Tools 3.11. Module Extraction Tools
A version of 'rfcstrip' is available which will extract YANG modules A version of 'rfcstrip' is available which will extract YANG modules
from an Internet Draft or RFC. The 'rfcstrip' tool which supports from an Internet Draft or RFC. The 'rfcstrip' tool which supports
YANG module extraction is freely available: YANG module extraction is freely available:
http://www.yang-central.org/twiki/pub/Main/YangTools/rfcstrip http://www.yang-central.org/twiki/pub/Main/YangTools/rfcstrip
This tool can be used to verify that the "<CODE BEGINS>" and "<CODE This tool can be used to verify that the "<CODE BEGINS>" and "<CODE
ENDS>" tags are used correctly and that the normative YANG modules ENDS>" tags are used correctly and that the normative YANG modules
can be extracted correctly. can be extracted correctly.
4.12. Module Usage Examples 3.12. Module Usage Examples
Each specification that defines one or more modules SHOULD contain Each specification that defines one or more modules SHOULD contain
usage examples, either throughout the document or in an appendix. usage examples, either throughout the document or in an appendix.
This includes example XML instance document snippets to demonstrate This includes example instance document snippets in an appropriate
the intended usage of the YANG module(s). encoding (e.g., XML and/or JSON) to demonstrate the intended usage of
the YANG module(s).
5. YANG Usage Guidelines 4. YANG Usage Guidelines
Modules in IETF Standards Track specifications MUST comply with all Modules in IETF Standards Track specifications MUST comply with all
syntactic and semantic requirements of YANG [RFC7950]. The syntactic and semantic requirements of YANG [RFC7950]. The
guidelines in this section are intended to supplement the YANG guidelines in this section are intended to supplement the YANG
specification, which is intended to define a minimum set of specification, which is intended to define a minimum set of
conformance requirements. conformance requirements.
In order to promote interoperability and establish a set of practices In order to promote interoperability and establish a set of practices
based on previous experience, the following sections establish usage based on previous experience, the following sections establish usage
guidelines for specific YANG constructs. guidelines for specific YANG constructs.
Only guidelines that clarify or restrict the minimum conformance Only guidelines that clarify or restrict the minimum conformance
requirements are included here. requirements are included here.
5.1. Module Naming Conventions 4.1. Module Naming Conventions
Normative modules contained in Standards Track documents MUST be Normative modules contained in Standards Track documents MUST be
named according to the guidelines in the IANA Considerations section named according to the guidelines in the IANA Considerations section
of [RFC7950]. of [RFC7950].
A distinctive word or acronym (e.g., protocol name or working group A distinctive word or acronym (e.g., protocol name or working group
acronym) SHOULD be used in the module name. If new definitions are acronym) SHOULD be used in the module name. If new definitions are
being defined to extend one or more existing modules, then the same being defined to extend one or more existing modules, then the same
word or acronym should be reused, instead of creating a new one. word or acronym should be reused, instead of creating a new one.
skipping to change at page 16, line 5 skipping to change at page 15, line 5
entire organization. All normative YANG modules published by the entire organization. All normative YANG modules published by the
IETF MUST begin with the prefix "ietf-". Another standards IETF MUST begin with the prefix "ietf-". Another standards
organization, such as the IEEE, might use the prefix "ieee-" for all organization, such as the IEEE, might use the prefix "ieee-" for all
YANG modules. YANG modules.
Once a module name is published, it MUST NOT be reused, even if the Once a module name is published, it MUST NOT be reused, even if the
RFC containing the module is reclassified to 'Historic' status. A RFC containing the module is reclassified to 'Historic' status. A
module name cannot be changed in YANG, and this would be treated as a module name cannot be changed in YANG, and this would be treated as a
a new module, not a name change. a new module, not a name change.
5.2. Prefixes 4.2. Prefixes
All YANG definitions are scoped by the module containing the All YANG definitions are scoped by the module containing the
definition being referenced. This allows definitions from multiple definition being referenced. This allows definitions from multiple
modules to be used, even if the names are not unique. In the example modules to be used, even if the names are not unique. In the example
below, the identifier "foo" is used in all 3 modules: below, the identifier "foo" is used in all 3 modules:
module example-foo { module example-foo {
namespace "http://example.com/ns/foo"; namespace "http://example.com/ns/foo";
prefix f; prefix f;
skipping to change at page 17, line 20 skipping to change at page 16, line 20
data type data type
o The local module prefix MAY be used for references to typedefs, o The local module prefix MAY be used for references to typedefs,
groupings, extensions, features, and identities defined in the groupings, extensions, features, and identities defined in the
module. module.
Prefix values SHOULD be short, but also likely to be unique. Prefix Prefix values SHOULD be short, but also likely to be unique. Prefix
values SHOULD NOT conflict with known modules that have been values SHOULD NOT conflict with known modules that have been
previously published. previously published.
5.3. Identifiers 4.3. Identifiers
Identifiers for all YANG identifiers in published modules MUST be Identifiers for all YANG identifiers in published modules MUST be
between 1 and 64 characters in length. These include any construct between 1 and 64 characters in length. These include any construct
specified as an 'identifier-arg-str' token in the ABNF in Section 13 specified as an 'identifier-arg-str' token in the ABNF in Section 13
of [RFC7950]. of [RFC7950].
5.3.1. Identifier Naming Conventions 4.3.1. Identifier Naming Conventions
Identifiers SHOULD follow a consistent naming pattern throughout the Identifiers SHOULD follow a consistent naming pattern throughout the
module. Only lower-case letters, numbers, and dashes SHOULD be used module. Only lower-case letters, numbers, and dashes SHOULD be used
in identifier names. Upper-case characters and the underscore in identifier names. Upper-case characters and the underscore
character MAY be used if the identifier represents a well-known value character MAY be used if the identifier represents a well-known value
that uses these characters. that uses these characters.
Identifiers SHOULD include complete words and/or well-known acronyms Identifiers SHOULD include complete words and/or well-known acronyms
or abbreviations. Child nodes within a container or list SHOULD NOT or abbreviations. Child nodes within a container or list SHOULD NOT
replicate the parent identifier. YANG identifiers are hierarchical replicate the parent identifier. YANG identifiers are hierarchical
skipping to change at page 18, line 5 skipping to change at page 17, line 5
common data type. common data type.
Identifiers SHOULD NOT carry any special semantics that identify data Identifiers SHOULD NOT carry any special semantics that identify data
modelling properties. Only YANG statements and YANG extension modelling properties. Only YANG statements and YANG extension
statements are designed to convey machine readable data modelling statements are designed to convey machine readable data modelling
properties. For example, naming an object "config" or "state" does properties. For example, naming an object "config" or "state" does
not change whether it is configuration data or state data. Only not change whether it is configuration data or state data. Only
defined YANG statements or YANG extension statements can be used to defined YANG statements or YANG extension statements can be used to
assign semantics in a machine readable format in YANG. assign semantics in a machine readable format in YANG.
5.4. Defaults 4.4. Defaults
In general, it is suggested that substatements containing very common In general, it is suggested that substatements containing very common
default values SHOULD NOT be present. The following substatements default values SHOULD NOT be present. The following substatements
are commonly used with the default value, which would make the module are commonly used with the default value, which would make the module
difficult to read if used everywhere they are allowed. difficult to read if used everywhere they are allowed.
+--------------+---------------+ +--------------+---------------+
| Statement | Default Value | | Statement | Default Value |
+--------------+---------------+ +--------------+---------------+
| config | true | | config | true |
| mandatory | false | | mandatory | false |
| max-elements | unbounded | | max-elements | unbounded |
| min-elements | 0 | | min-elements | 0 |
| ordered-by | system | | ordered-by | system |
| status | current | | status | current |
| yin-element | false | | yin-element | false |
+--------------+---------------+ +--------------+---------------+
Statement Defaults Statement Defaults
5.5. Conditional Statements 4.5. Conditional Statements
A module may be conceptually partitioned in several ways, using the A module may be conceptually partitioned in several ways, using the
'if-feature' and/or 'when' statements. 'if-feature' and/or 'when' statements.
Data model designers need to carefully consider all modularity Data model designers need to carefully consider all modularity
aspects, including the use of YANG conditional statements. aspects, including the use of YANG conditional statements.
If a data definition is optional, depending on server support for a If a data definition is optional, depending on server support for a
NETCONF or RESTCONF protocol capability, then a YANG 'feature' NETCONF or RESTCONF protocol capability, then a YANG 'feature'
statement SHOULD be defined to indicate that the NETCONF or RESTCONF statement SHOULD be defined to indicate that the NETCONF or RESTCONF
skipping to change at page 19, line 11 skipping to change at page 18, line 11
'if-feature' statements MUST apply to any key leaf nodes for the 'if-feature' statements MUST apply to any key leaf nodes for the
list. There MUST NOT be any 'if-feature' statements applied to any list. There MUST NOT be any 'if-feature' statements applied to any
key leaf that do not also apply to the parent list node. key leaf that do not also apply to the parent list node.
There SHOULD NOT be any 'when' statements applied to a key leaf node. There SHOULD NOT be any 'when' statements applied to a key leaf node.
It is possible that a 'when' statement for an ancestor node of a key It is possible that a 'when' statement for an ancestor node of a key
leaf will have the exact node-set result as the key leaf. In such a leaf will have the exact node-set result as the key leaf. In such a
case, the 'when' statement for the key leaf is redundant and SHOULD case, the 'when' statement for the key leaf is redundant and SHOULD
be avoided. be avoided.
5.6. XPath Usage 4.6. XPath Usage
This section describes guidelines for using the XML Path Language This section describes guidelines for using the XML Path Language
[W3C.REC-xpath-19991116] (XPath) within YANG modules. [W3C.REC-xpath-19991116] (XPath) within YANG modules.
5.6.1. XPath Evaluation Contexts 4.6.1. XPath Evaluation Contexts
YANG defines 5 separate contexts for evaluation of XPath statements: YANG defines 5 separate contexts for evaluation of XPath statements:
1) The "running" datastore: collection of all YANG configuration data 1) The "running" datastore: collection of all YANG configuration data
nodes. The document root is the conceptual container, (e.g., nodes. The document root is the conceptual container, (e.g.,
"config" in the "edit-config" operation), which is the parent of all "config" in the "edit-config" operation), which is the parent of all
top-level data definition statements with a "config" statement value top-level data definition statements with a "config" statement value
of "true". of "true".
2) State data + the "running" datastore: collection of all YANG data 2) State data + the "running" datastore: collection of all YANG data
skipping to change at page 20, line 14 skipping to change at page 19, line 14
It is especially important to consider the XPath evaluation context It is especially important to consider the XPath evaluation context
for XPath expressions defined in groupings. An XPath expression for XPath expressions defined in groupings. An XPath expression
defined in a grouping may not be portable, meaning it cannot be used defined in a grouping may not be portable, meaning it cannot be used
in multiple contexts and produce proper results. in multiple contexts and produce proper results.
If the XPath expressions defined in a grouping are intended for a If the XPath expressions defined in a grouping are intended for a
particular context, then this context SHOULD be identified in the particular context, then this context SHOULD be identified in the
"description" statement for the grouping. "description" statement for the grouping.
5.6.2. Function Library 4.6.2. Function Library
The 'position' and 'last' functions SHOULD NOT be used. This applies The 'position' and 'last' functions SHOULD NOT be used. This applies
to implicit use of the 'position' function as well (e.g., to implicit use of the 'position' function as well (e.g.,
'//chapter[42]'). A server is only required to maintain the relative '//chapter[42]'). A server is only required to maintain the relative
XML document order of all instances of a particular user-ordered list XML document order of all instances of a particular user-ordered list
or leaf-list. The 'position' and 'last' functions MAY be used if or leaf-list. The 'position' and 'last' functions MAY be used if
they are evaluated in a context where the context node is a user- they are evaluated in a context where the context node is a user-
ordered 'list' or 'leaf-list'. ordered 'list' or 'leaf-list'.
The 'id' function SHOULD NOT be used. The 'ID' attribute is not The 'id' function SHOULD NOT be used. The 'ID' attribute is not
skipping to change at page 21, line 5 skipping to change at page 20, line 5
function results can also be different. Any function call that function results can also be different. Any function call that
implicitly converts a node-set to a string will also have this issue. implicitly converts a node-set to a string will also have this issue.
The 'local-name' function SHOULD NOT be used to reference local names The 'local-name' function SHOULD NOT be used to reference local names
outside of the YANG module defining the must or when expression outside of the YANG module defining the must or when expression
containing the 'local-name' function. Example of a local-name containing the 'local-name' function. Example of a local-name
function that should not be used: function that should not be used:
/*[local-name()='foo'] /*[local-name()='foo']
5.6.3. Axes 4.6.3. Axes
The 'attribute' and 'namespace' axes are not supported in YANG, and The 'attribute' and 'namespace' axes are not supported in YANG, and
MAY be empty in a NETCONF or RESTCONF server implementation. MAY be empty in a NETCONF or RESTCONF server implementation.
The 'preceding', and 'following' axes SHOULD NOT be used. These The 'preceding', and 'following' axes SHOULD NOT be used. These
constructs rely on XML document order within a NETCONF or RESTCONF constructs rely on XML document order within a NETCONF or RESTCONF
server configuration database, which may not be supported server configuration database, which may not be supported
consistently or produce reliable results across implementations. consistently or produce reliable results across implementations.
Predicate expressions based on static node properties (e.g., element Predicate expressions based on static node properties (e.g., element
name or value, 'ancestor' or 'descendant' axes) SHOULD be used name or value, 'ancestor' or 'descendant' axes) SHOULD be used
skipping to change at page 21, line 30 skipping to change at page 20, line 30
The 'preceding-sibling' and 'following-sibling' axes SHOULD NOT used, The 'preceding-sibling' and 'following-sibling' axes SHOULD NOT used,
however they MAY be used if document order is not relevant to the however they MAY be used if document order is not relevant to the
outcome of the expression. outcome of the expression.
A server is only required to maintain the relative XML document order A server is only required to maintain the relative XML document order
of all instances of a particular user-ordered list or leaf-list. The of all instances of a particular user-ordered list or leaf-list. The
'preceding-sibling' and 'following-sibling' axes MAY be used if they 'preceding-sibling' and 'following-sibling' axes MAY be used if they
are evaluated in a context where the context node is a user-ordered are evaluated in a context where the context node is a user-ordered
'list' or 'leaf-list'. 'list' or 'leaf-list'.
5.6.4. Types 4.6.4. Types
Data nodes that use the 'int64' and 'uint64' built-in type SHOULD NOT Data nodes that use the 'int64' and 'uint64' built-in type SHOULD NOT
be used within numeric or boolean expressions. There are boundary be used within numeric or boolean expressions. There are boundary
conditions in which the translation from the YANG 64-bit type to an conditions in which the translation from the YANG 64-bit type to an
XPath number can cause incorrect results. Specifically, an XPath XPath number can cause incorrect results. Specifically, an XPath
'double' precision floating point number cannot represent very large 'double' precision floating point number cannot represent very large
positive or negative 64-bit numbers because it only provides a total positive or negative 64-bit numbers because it only provides a total
precision of 53 bits. The 'int64' and 'uint64' data types MAY be precision of 53 bits. The 'int64' and 'uint64' data types MAY be
used in numeric expressions if the value can be represented with no used in numeric expressions if the value can be represented with no
more than 53 bits of precision. more than 53 bits of precision.
skipping to change at page 22, line 23 skipping to change at page 21, line 23
augment "/rt:active-route/rt:input/rt:destination-address" { augment "/rt:active-route/rt:input/rt:destination-address" {
when "rt:address-family='v4ur:ipv4-unicast'" { when "rt:address-family='v4ur:ipv4-unicast'" {
description description
"This augment is valid only for IPv4 unicast."; "This augment is valid only for IPv4 unicast.";
} }
// nodes defined here within the augment-stmt // nodes defined here within the augment-stmt
// cannot be referenced in the when-stmt // cannot be referenced in the when-stmt
} }
5.6.5. Wildcards 4.6.5. Wildcards
It is possible to construct XPath expressions that will evaluate It is possible to construct XPath expressions that will evaluate
differently when combined with several modules within a server differently when combined with several modules within a server
implementation, then when evaluated within the single module. This implementation, then when evaluated within the single module. This
is due to augmenting nodes from other modules. is due to augmenting nodes from other modules.
Wildcard expansion is done within a server against all the nodes from Wildcard expansion is done within a server against all the nodes from
all namespaces, so it is possible for a 'must' or 'when' expression all namespaces, so it is possible for a 'must' or 'when' expression
that uses the '*' operator will always evaluate to false if processed that uses the '*' operator will always evaluate to false if processed
within a single YANG module. In such cases, the 'description' within a single YANG module. In such cases, the 'description'
statement SHOULD clarify that augmenting objects are expected to statement SHOULD clarify that augmenting objects are expected to
match the wildcard expansion. match the wildcard expansion.
when /foo/services/*/active { when /foo/services/*/active {
description description
"No services directly defined in this module. "No services directly defined in this module.
Matches objects that have augmented the services container."; Matches objects that have augmented the services container.";
} }
5.6.6. Boolean Expressions 4.6.6. Boolean Expressions
The YANG "must" and "when" statements use an XPath boolean expression The YANG "must" and "when" statements use an XPath boolean expression
to define the test condition for the statement. It is important to to define the test condition for the statement. It is important to
specify these expressions in a way that will not cause inadvertent specify these expressions in a way that will not cause inadvertent
changes in the result if the objects referenced in the expression are changes in the result if the objects referenced in the expression are
updated in future revisions of the module. updated in future revisions of the module.
For example, the leaf "foo2" must exist if the leaf "foo1" is equal For example, the leaf "foo2" must exist if the leaf "foo1" is equal
to "one" or "three": to "one" or "three":
skipping to change at page 23, line 41 skipping to change at page 22, line 41
enum one; enum one;
enum two; enum two;
enum three; enum three;
enum four; enum four;
} }
} }
Now the first XPath expression will allow the enum "four" to be Now the first XPath expression will allow the enum "four" to be
accepted in addition to the "one" and "three" enum values. accepted in addition to the "one" and "three" enum values.
5.7. Lifecycle Management 4.7. Lifecycle Management
The status statement MUST be present if its value is 'deprecated' or The status statement MUST be present if its value is 'deprecated' or
'obsolete'. The status SHOULD NOT be changed from 'current' directly 'obsolete'. The status SHOULD NOT be changed from 'current' directly
to 'obsolete'. An object SHOULD be available for at least one year to 'obsolete'. An object SHOULD be available for at least one year
with 'deprecated' status before it is changed to 'obsolete'. with 'deprecated' status before it is changed to 'obsolete'.
The module or submodule name MUST NOT be changed, once the document The module or submodule name MUST NOT be changed, once the document
containing the module or submodule is published. containing the module or submodule is published.
The module namespace URI value MUST NOT be changed, once the document The module namespace URI value MUST NOT be changed, once the document
skipping to change at page 24, line 29 skipping to change at page 23, line 29
leaf reserved { leaf reserved {
type string; type string;
description description
"This object has no purpose at this time, but a future "This object has no purpose at this time, but a future
revision of this module might define a purpose revision of this module might define a purpose
for this object."; for this object.";
} }
} }
5.8. Module Header, Meta, and Revision Statements 4.8. Module Header, Meta, and Revision Statements
For published modules, the namespace MUST be a globally unique URI, For published modules, the namespace MUST be a globally unique URI,
as defined in [RFC3986]. This value is usually assigned by the IANA. as defined in [RFC3986]. This value is usually assigned by the IANA.
The organization statement MUST be present. If the module is The organization statement MUST be present. If the module is
contained in a document intended for IETF Standards Track status, contained in a document intended for IETF Standards Track status,
then the organization SHOULD be the IETF working group chartered to then the organization SHOULD be the IETF working group chartered to
write the document. For other standards organizations, a similar write the document. For other standards organizations, a similar
approach is also suggested. approach is also suggested.
The contact statement MUST be present. If the module is contained in The contact statement MUST be present. If the module is contained in
a document intended for Standards Track status, then the working a document intended for Standards Track status, then the working
group web and mailing information MUST be present, and the main group web and mailing information MUST be present, and the main
document author or editor contact information SHOULD be present. If document author or editor contact information SHOULD be present. If
additional authors or editors exist, their contact information MAY be additional authors or editors exist, their contact information MAY be
present. present.
The description statement MUST be present. For modules published The description statement MUST be present. For modules published
within IETF documents, the appropriate IETF Trust Copyright text MUST within IETF documents, the appropriate IETF Trust Copyright text MUST
be present, as described in Section 4.1. be present, as described in Section 3.1.
If the module relies on information contained in other documents, If the module relies on information contained in other documents,
which are not the same documents implied by the import statements which are not the same documents implied by the import statements
present in the module, then these documents MUST be identified in the present in the module, then these documents MUST be identified in the
reference statement. reference statement.
A revision statement MUST be present for each published version of A revision statement MUST be present for each published version of
the module. The revision statement MUST have a reference the module. The revision statement MUST have a reference
substatement. It MUST identify the published document that contains substatement. It MUST identify the published document that contains
the module. Modules are often extracted from their original the module. Modules are often extracted from their original
skipping to change at page 25, line 24 skipping to change at page 24, line 24
revision statement MAY have a description substatement. revision statement MAY have a description substatement.
It is not required to keep the full revision history of draft It is not required to keep the full revision history of draft
versions (e.g., modules contained within Internet-Drafts). That is, versions (e.g., modules contained within Internet-Drafts). That is,
within a sequence of draft versions, only the most recent revision within a sequence of draft versions, only the most recent revision
need be recorded in the module. However, whenever a new (i.e. need be recorded in the module. However, whenever a new (i.e.
changed) version is made available (e.g., via a new version of an changed) version is made available (e.g., via a new version of an
Internet-Draft), the revision date of that new version MUST be Internet-Draft), the revision date of that new version MUST be
updated to a date later than that of the previous version. updated to a date later than that of the previous version.
5.9. Namespace Assignments 4.9. Namespace Assignments
It is RECOMMENDED that only valid YANG modules be included in It is RECOMMENDED that only valid YANG modules be included in
documents, whether or not they are published yet. This allows: documents, whether or not they are published yet. This allows:
o the module to compile correctly instead of generating disruptive o the module to compile correctly instead of generating disruptive
fatal errors. fatal errors.
o early implementors to use the modules without picking a random o early implementors to use the modules without picking a random
value for the XML namespace. value for the XML namespace.
skipping to change at page 26, line 34 skipping to change at page 25, line 34
http://example.com/ns/example-interfaces http://example.com/ns/example-interfaces
http://example.com/ns/example-system http://example.com/ns/example-system
Example URIs using tags per RFC 4151 [RFC4151]: Example URIs using tags per RFC 4151 [RFC4151]:
tag:example.com,2017:example-interfaces tag:example.com,2017:example-interfaces
tag:example.com,2017:example-system tag:example.com,2017:example-system
5.10. Top-Level Data Definitions 4.10. Top-Level Data Definitions
The top-level data organization SHOULD be considered carefully, in The top-level data organization SHOULD be considered carefully, in
advance. Data model designers need to consider how the functionality advance. Data model designers need to consider how the functionality
for a given protocol or protocol family will grow over time. for a given protocol or protocol family will grow over time.
The separation of configuration data and operational data SHOULD be The separation of configuration data and operational data SHOULD be
considered carefully. It is sometimes useful to define separate top- considered carefully. It is sometimes useful to define separate top-
level containers for configuration and non-configuration data. For level containers for configuration and non-configuration data. For
some existing top-level data nodes, configuration data was not in some existing top-level data nodes, configuration data was not in
scope, so only one container representing operational data was scope, so only one container representing operational data was
skipping to change at page 27, line 16 skipping to change at page 26, line 16
A mandatory database data definition is defined as a node that a A mandatory database data definition is defined as a node that a
client must provide for the database to be valid. The server is not client must provide for the database to be valid. The server is not
required to provide a value. required to provide a value.
Top-level database data definitions MUST NOT be mandatory. If a Top-level database data definitions MUST NOT be mandatory. If a
mandatory node appears at the top level, it will immediately cause mandatory node appears at the top level, it will immediately cause
the database to be invalid. This can occur when the server boots or the database to be invalid. This can occur when the server boots or
when a module is loaded dynamically at runtime. when a module is loaded dynamically at runtime.
5.11. Data Types 4.11. Data Types
Selection of an appropriate data type (i.e., built-in type, existing Selection of an appropriate data type (i.e., built-in type, existing
derived type, or new derived type) is very subjective, and therefore derived type, or new derived type) is very subjective, and therefore
few requirements can be specified on that subject. few requirements can be specified on that subject.
Data model designers SHOULD use the most appropriate built-in data Data model designers SHOULD use the most appropriate built-in data
type for the particular application. type for the particular application.
The signed numeric data types (i.e., 'int8', 'int16', 'int32', and The signed numeric data types (i.e., 'int8', 'int16', 'int32', and
'int64') SHOULD NOT be used unless negative values are allowed for 'int64') SHOULD NOT be used unless negative values are allowed for
the desired semantics. the desired semantics.
5.11.1. Fixed Value Extensibility 4.11.1. Fixed Value Extensibility
If the set of values is fixed and the data type contents are If the set of values is fixed and the data type contents are
controlled by a single naming authority, then an enumeration data controlled by a single naming authority, then an enumeration data
type SHOULD be used. type SHOULD be used.
leaf foo { leaf foo {
type enumeration { type enumeration {
enum one; enum one;
enum two; enum two;
} }
skipping to change at page 28, line 26 skipping to change at page 27, line 26
leaf foo { leaf foo {
type identityref { type identityref {
base f:foo-type; base f:foo-type;
} }
} }
Note that any module can declare an identity with base "foo-type" Note that any module can declare an identity with base "foo-type"
that is valid for the "foo" leaf. Identityref values are considered that is valid for the "foo" leaf. Identityref values are considered
to be qualified names. to be qualified names.
5.11.2. Patterns and Ranges 4.11.2. Patterns and Ranges
For string data types, if a machine-readable pattern can be defined For string data types, if a machine-readable pattern can be defined
for the desired semantics, then one or more pattern statements SHOULD for the desired semantics, then one or more pattern statements SHOULD
be present. A single quoted string SHOULD be used to specify the be present. A single quoted string SHOULD be used to specify the
pattern, since a double-quoted string can modify the content. pattern, since a double-quoted string can modify the content.
The following typedef from [RFC6991] demonstrates the proper use of The following typedef from [RFC6991] demonstrates the proper use of
the "pattern" statement: the "pattern" statement:
typedef ipv4-address-no-zone { typedef ipv4-address-no-zone {
skipping to change at page 29, line 28 skipping to change at page 28, line 28
The following typedef from [RFC6991] demonstrates the proper use of The following typedef from [RFC6991] demonstrates the proper use of
the "range" statement: the "range" statement:
typedef dscp { typedef dscp {
type uint8 { type uint8 {
range "0..63"; range "0..63";
} }
... ...
} }
5.11.3. Enumerations and Bits 4.11.3. Enumerations and Bits
For 'enumeration' or 'bits' data types, the semantics for each 'enum' For 'enumeration' or 'bits' data types, the semantics for each 'enum'
or 'bit' SHOULD be documented. A separate description statement or 'bit' SHOULD be documented. A separate description statement
(within each 'enum' or 'bit' statement) SHOULD be present. (within each 'enum' or 'bit' statement) SHOULD be present.
leaf foo { leaf foo {
// INCORRECT // INCORRECT
type enumeration { type enumeration {
enum one; enum one;
enum two; enum two;
skipping to change at page 30, line 31 skipping to change at page 29, line 31
description "The first enum"; description "The first enum";
} }
enum two { enum two {
description "The second enum"; description "The second enum";
} }
} }
description description
"The foo enum... "; "The foo enum... ";
} }
5.11.4. Union Types 4.11.4. Union Types
The YANG "union" type is evaluated by testing a value against each The YANG "union" type is evaluated by testing a value against each
member type in the union. The first type definition that accepts a member type in the union. The first type definition that accepts a
value as valid is the member type used. In general, member types value as valid is the member type used. In general, member types
SHOULD be ordered from most restrictive to least restrictive types. SHOULD be ordered from most restrictive to least restrictive types.
In the following example, the "enumeration" type will never be In the following example, the "enumeration" type will never be
matched because the preceding "string" type will match everything. matched because the preceding "string" type will match everything.
Incorrect: Incorrect:
skipping to change at page 31, line 37 skipping to change at page 30, line 37
type int32; type int32;
} }
Correct: Correct:
type union { type union {
type int32; type int32;
type string; type string;
} }
5.11.5. Empty and Boolean 4.11.5. Empty and Boolean
YANG provides an "empty" data type, which has one value (i.e., YANG provides an "empty" data type, which has one value (i.e.,
present). The default is "not present", which is not actually a present). The default is "not present", which is not actually a
value. When used within a list key, only one value can (and must) value. When used within a list key, only one value can (and must)
exist for this key leaf. The type "empty" SHOULD NOT be used for a exist for this key leaf. The type "empty" SHOULD NOT be used for a
key leaf since it is pointless. key leaf since it is pointless.
There is really no difference between a leaf of type "empty" and a There is really no difference between a leaf of type "empty" and a
leaf-list of type "empty". Both are limited to one instance. The leaf-list of type "empty". Both are limited to one instance. The
type "empty" SHOULD NOT be used for a leaf-list. type "empty" SHOULD NOT be used for a leaf-list.
skipping to change at page 32, line 33 skipping to change at page 31, line 33
type empty; type empty;
} }
Correct: Correct:
leaf flag2 { leaf flag2 {
type boolean; type boolean;
default false; default false;
} }
5.12. Reusable Type Definitions 4.12. Reusable Type Definitions
If an appropriate derived type exists in any standard module, such as If an appropriate derived type exists in any standard module, such as
[RFC6991], then it SHOULD be used instead of defining a new derived [RFC6991], then it SHOULD be used instead of defining a new derived
type. type.
If an appropriate units identifier can be associated with the desired If an appropriate units identifier can be associated with the desired
semantics, then a units statement SHOULD be present. semantics, then a units statement SHOULD be present.
If an appropriate default value can be associated with the desired If an appropriate default value can be associated with the desired
semantics, then a default statement SHOULD be present. semantics, then a default statement SHOULD be present.
skipping to change at page 33, line 9 skipping to change at page 32, line 9
anticipated that these data types will be reused by multiple modules, anticipated that these data types will be reused by multiple modules,
then these derived types SHOULD be contained in a separate module or then these derived types SHOULD be contained in a separate module or
submodule, to allow easier reuse without unnecessary coupling. submodule, to allow easier reuse without unnecessary coupling.
The description statement MUST be present. The description statement MUST be present.
If the type definition semantics are defined in an external document If the type definition semantics are defined in an external document
(other than another YANG module indicated by an import statement), (other than another YANG module indicated by an import statement),
then the reference statement MUST be present. then the reference statement MUST be present.
5.13. Reusable Groupings 4.13. Reusable Groupings
A reusable grouping is a YANG grouping that can be imported by A reusable grouping is a YANG grouping that can be imported by
another module, and is intended for use by other modules. This is another module, and is intended for use by other modules. This is
not the same as a grouping that is used within the module it is not the same as a grouping that is used within the module it is
defined, but happens to be exportable to another module because it is defined, but happens to be exportable to another module because it is
defined at the top-level of the YANG module. defined at the top-level of the YANG module.
The following guidelines apply to reusable groupings, in order to The following guidelines apply to reusable groupings, in order to
make them as robust as possible: make them as robust as possible:
skipping to change at page 33, line 41 skipping to change at page 32, line 41
o Do not include a "default" sub-statement on a leaf or choice o Do not include a "default" sub-statement on a leaf or choice
unless the value applies on all possible contexts. unless the value applies on all possible contexts.
o Do not include a "config" sub-statement on a data node unless the o Do not include a "config" sub-statement on a data node unless the
value applies on all possible contexts. value applies on all possible contexts.
o Clearly identify any external dependencies in the grouping o Clearly identify any external dependencies in the grouping
"description" statement, such as nodes referenced by absolute path "description" statement, such as nodes referenced by absolute path
from a "path", "must", or "when" statement. from a "path", "must", or "when" statement.
5.14. Data Definitions 4.14. Data Definitions
The description statement MUST be present in the following YANG The description statement MUST be present in the following YANG
statements: statements:
o anyxml o anyxml
o augment o augment
o choice o choice
o container o container
skipping to change at page 35, line 13 skipping to change at page 34, line 13
describe the purpose of each one. describe the purpose of each one.
The "choice" statement is allowed to be directly present within a The "choice" statement is allowed to be directly present within a
"case" statement in YANG 1.1. This needs to be considered carefully. "case" statement in YANG 1.1. This needs to be considered carefully.
Consider simply including the nested "choice" as additional "case" Consider simply including the nested "choice" as additional "case"
statements within the parent "choice" statement. Note that the statements within the parent "choice" statement. Note that the
"mandatory" and "default" statements within a nested "choice" "mandatory" and "default" statements within a nested "choice"
statement only apply if the "case" containing the nested "choice" statement only apply if the "case" containing the nested "choice"
statement is first selected. statement is first selected.
5.14.1. Non-Presence Containers 4.14.1. Non-Presence Containers
A non-presence container is used to organize data into specific A non-presence container is used to organize data into specific
subtrees. It is not intended to have semantics within the data model subtrees. It is not intended to have semantics within the data model
beyond this purpose, although YANG allows it (e.g., "must" statement beyond this purpose, although YANG allows it (e.g., "must" statement
within the non-presence container). within the non-presence container).
Example using container wrappers: Example using container wrappers:
container top { container top {
container foos { container foos {
skipping to change at page 35, line 45 skipping to change at page 34, line 45
list bar { ... } list bar { ... }
} }
Use of non-presence containers to organize data is a subjective Use of non-presence containers to organize data is a subjective
matter similar to use of sub-directories in a file system. The matter similar to use of sub-directories in a file system. The
NETCONF and RESTCONF protocols do not currently support the ability NETCONF and RESTCONF protocols do not currently support the ability
to delete all list (or leaf-list) entries at once. This deficiency to delete all list (or leaf-list) entries at once. This deficiency
is sometimes avoided by use of a parent container (i.e., deleting the is sometimes avoided by use of a parent container (i.e., deleting the
container also removes all child entries). container also removes all child entries).
5.14.2. Top-Level Data Nodes 4.14.2. Top-Level Data Nodes
Use of top-level objects needs to be considered carefully Use of top-level objects needs to be considered carefully
-top-level siblings are not ordered -top-level siblings not are not -top-level siblings are not ordered -top-level siblings not are not
static, and depends on the modules that are loaded static, and depends on the modules that are loaded
o for sub-tree filtering, retrieval of a top-level leaf-list will be o for sub-tree filtering, retrieval of a top-level leaf-list will be
treated as a content-match node for all top-level-siblings treated as a content-match node for all top-level-siblings
o a top-level list with many instances may impact performance o a top-level list with many instances may impact performance
5.15. Operation Definitions 4.15. Operation Definitions
If the operation semantics are defined in an external document (other If the operation semantics are defined in an external document (other
than another YANG module indicated by an import statement), then a than another YANG module indicated by an import statement), then a
reference statement MUST be present. reference statement MUST be present.
If the operation impacts system behavior in some way, it SHOULD be If the operation impacts system behavior in some way, it SHOULD be
mentioned in the description statement. mentioned in the description statement.
If the operation is potentially harmful to system behavior in some If the operation is potentially harmful to system behavior in some
way, it MUST be mentioned in the Security Considerations section of way, it MUST be mentioned in the Security Considerations section of
the document. the document.
5.16. Notification Definitions 4.16. Notification Definitions
The description statement MUST be present. The description statement MUST be present.
If the notification semantics are defined in an external document If the notification semantics are defined in an external document
(other than another YANG module indicated by an import statement), (other than another YANG module indicated by an import statement),
then a reference statement MUST be present. then a reference statement MUST be present.
If the notification refers to a specific resource instance, then this If the notification refers to a specific resource instance, then this
instance SHOULD be identified in the notification data. This is instance SHOULD be identified in the notification data. This is
usually done by including 'leafref' leaf nodes with the key leaf usually done by including 'leafref' leaf nodes with the key leaf
skipping to change at page 37, line 5 skipping to change at page 36, line 5
} }
} }
} }
Note that there are no formal YANG statements to identify any data Note that there are no formal YANG statements to identify any data
node resources associated with a notification. The description node resources associated with a notification. The description
statement for the notification SHOULD specify if and how the statement for the notification SHOULD specify if and how the
notification identifies any data node resources associated with the notification identifies any data node resources associated with the
specific event. specific event.
5.17. Feature Definitions 4.17. Feature Definitions
The YANG "feature" statement is used to define a label for a set of The YANG "feature" statement is used to define a label for a set of
optional functionality within a module. The "if-feature" statement optional functionality within a module. The "if-feature" statement
is used in the YANG statements associated with a feature. is used in the YANG statements associated with a feature.
The set of YANG features available in a module should be considered The set of YANG features available in a module should be considered
carefully. The description-stmt within a feature-stmt MUST specify carefully. The description-stmt within a feature-stmt MUST specify
any interactions with other features. any interactions with other features.
If there is a large set of objects associated with a YANG feature, If there is a large set of objects associated with a YANG feature,
skipping to change at page 37, line 47 skipping to change at page 36, line 47
feature feature1 { feature feature1 {
description "Some protocol feature"; description "Some protocol feature";
} }
feature feature2 { feature feature2 {
if-feature "feature1"; if-feature "feature1";
description "Another protocol feature"; description "Another protocol feature";
} }
5.18. YANG Data Node Constraints 4.18. YANG Data Node Constraints
5.18.1. Controlling Quantity 4.18.1. Controlling Quantity
The "min-elements" and "max-elements" statements can be use to The "min-elements" and "max-elements" statements can be use to
control how many list or leaf-list instances are required for a control how many list or leaf-list instances are required for a
particular data node. YANG constraint statements SHOULD be used to particular data node. YANG constraint statements SHOULD be used to
identify conditions that apply to all implementations of the data identify conditions that apply to all implementations of the data
model. If platform-specific limitations (e.g., the "max-elements" model. If platform-specific limitations (e.g., the "max-elements"
supported for a particular list) are relevant to operations, then a supported for a particular list) are relevant to operations, then a
data model definition statement (e.g., "max-ports" leaf) SHOULD be data model definition statement (e.g., "max-ports" leaf) SHOULD be
used to identify the limit. used to identify the limit.
5.18.2. must vs. when 4.18.2. must vs. when
The "must" and "when" YANG statements are used to provide cross- The "must" and "when" YANG statements are used to provide cross-
object referential tests. They have very different behavior. The object referential tests. They have very different behavior. The
"when" statement causes data node instances to be silently deleted as "when" statement causes data node instances to be silently deleted as
soon as the condition becomes false. A false "when" expression is soon as the condition becomes false. A false "when" expression is
not considered to be an error. not considered to be an error.
The "when" statement SHOULD be used together with the "augment" or The "when" statement SHOULD be used together with the "augment" or
"uses" statements to achieve conditional model composition. The "uses" statements to achieve conditional model composition. The
condition SHOULD be based on static properties of the augmented entry condition SHOULD be based on static properties of the augmented entry
(e.g., list key leafs). (e.g., list key leafs).
The "must" statement causes a datastore validation error if the The "must" statement causes a datastore validation error if the
condition is false. This statement SHOULD be used for enforcing condition is false. This statement SHOULD be used for enforcing
parameter value restrictions that involve more than one data node parameter value restrictions that involve more than one data node
(e.g., end-time parameter must be after the start-time parameter). (e.g., end-time parameter must be after the start-time parameter).
5.19. Augment Statements 4.19. Augment Statements
The YANG "augment" statement is used to define a set of data The YANG "augment" statement is used to define a set of data
definition statements that will be added as child nodes of a target definition statements that will be added as child nodes of a target
data node. The module namespace for these data nodes will be the data node. The module namespace for these data nodes will be the
augmenting module, not the augmented module. augmenting module, not the augmented module.
A top-level "augment" statement SHOULD NOT be used if the target data A top-level "augment" statement SHOULD NOT be used if the target data
node is in the same module or submodule as the evaluated "augment" node is in the same module or submodule as the evaluated "augment"
statement. The data definition statements SHOULD be added inline statement. The data definition statements SHOULD be added inline
instead. instead.
5.19.1. Conditional Augment Statements 4.19.1. Conditional Augment Statements
The "augment" statement is often used together with the "when" The "augment" statement is often used together with the "when"
statement and/or "if-feature" statement to make the augmentation statement and/or "if-feature" statement to make the augmentation
conditional on some portion of the data model. conditional on some portion of the data model.
The following example from [RFC7223] shows how a conditional The following example from [RFC7223] shows how a conditional
container called "ethernet" is added to the "interface" list only for container called "ethernet" is added to the "interface" list only for
entries of the type "ethernetCsmacd". entries of the type "ethernetCsmacd".
augment "/if:interfaces/if:interface" { augment "/if:interfaces/if:interface" {
when "if:type = 'ianaift:ethernetCsmacd'"; when "if:type = 'ianaift:ethernetCsmacd'";
container ethernet { container ethernet {
leaf duplex { leaf duplex {
... ...
} }
} }
} }
5.19.2. Conditionally Mandatory Data Definition Statements 4.19.2. Conditionally Mandatory Data Definition Statements
YANG has very specific rules about how configuration data can be YANG has very specific rules about how configuration data can be
updated in new releases of a module. These rules allow an "old updated in new releases of a module. These rules allow an "old
client" to continue interoperating with a "new server". client" to continue interoperating with a "new server".
If data nodes are added to an existing entry, the old client MUST NOT If data nodes are added to an existing entry, the old client MUST NOT
be required to provide any mandatory parameters that were not in the be required to provide any mandatory parameters that were not in the
original module definition. original module definition.
It is possible to add conditional augment statements such that the It is possible to add conditional augment statements such that the
skipping to change at page 40, line 39 skipping to change at page 39, line 39
packaged in a way that requires the client to be aware of the packaged in a way that requires the client to be aware of the
mandatory data nodes if it is aware of the condition for this data. mandatory data nodes if it is aware of the condition for this data.
In the example above, the "some-new-iftype" identity is defined in In the example above, the "some-new-iftype" identity is defined in
the same module as the "mandatory-leaf" data definition statement. the same module as the "mandatory-leaf" data definition statement.
This practice is not safe for identities defined in a common module This practice is not safe for identities defined in a common module
such as "iana-if-type" because the client is not required to know such as "iana-if-type" because the client is not required to know
about "my-module" just because it knows about the "iana-if-type" about "my-module" just because it knows about the "iana-if-type"
module. module.
5.20. Deviation Statements 4.20. Deviation Statements
The YANG "deviation" statement cannot appear in IETF YANG modules, The YANG "deviation" statement cannot appear in IETF YANG modules,
but it can be useful for documenting server capabilities. Deviation but it can be useful for documenting server capabilities. Deviation
statements are not reusable and typically not shared across all statements are not reusable and typically not shared across all
platforms. platforms.
There are several reasons that deviations might be needed in an There are several reasons that deviations might be needed in an
implementation, e.g., an object cannot be supported on all platforms, implementation, e.g., an object cannot be supported on all platforms,
or feature delivery is done in multiple development phases. or feature delivery is done in multiple development phases.
Deviation statements can also be used to add annotations to a module, Deviation statements can also be used to add annotations to a module,
skipping to change at page 41, line 36 skipping to change at page 40, line 36
} }
Correct: (max-elements in a deviation) Correct: (max-elements in a deviation)
deviation /bk:backups/bk:backup { deviation /bk:backups/bk:backup {
deviate add { deviate add {
max-elements 10; max-elements 10;
} }
} }
5.21. Extension Statements 4.21. Extension Statements
The YANG "extension" statement is used to specify external The YANG "extension" statement is used to specify external
definitions. This appears in the YANG syntax as an definitions. This appears in the YANG syntax as an
"unknown-statement". Usage of extension statements in a published "unknown-statement". Usage of extension statements in a published
module needs to be considered carefully. module needs to be considered carefully.
The following guidelines apply to the usage of YANG extensions: The following guidelines apply to the usage of YANG extensions:
o The semantics of the extension MUST NOT contradict any YANG o The semantics of the extension MUST NOT contradict any YANG
statements. Extensions can add semantics not covered by the statements. Extensions can add semantics not covered by the
skipping to change at page 42, line 15 skipping to change at page 41, line 15
not, identify what conditions apply that would require not, identify what conditions apply that would require
implementation of the extension. implementation of the extension.
o The extension MUST clearly identify where it can be used within o The extension MUST clearly identify where it can be used within
other YANG statements. other YANG statements.
o The extension MUST clearly identify if YANG statements or other o The extension MUST clearly identify if YANG statements or other
extensions are allowed or required within the extension as sub- extensions are allowed or required within the extension as sub-
statements. statements.
5.22. Data Correlation 4.22. Data Correlation
Data can be correlated in various ways, using common data types, Data can be correlated in various ways, using common data types,
common data naming, and common data organization. There are several common data naming, and common data organization. There are several
ways to extend the functionality of a module, based on the degree of ways to extend the functionality of a module, based on the degree of
coupling between the old and new functionality: coupling between the old and new functionality:
o inline: update the module with new protocol-accessible objects. o inline: update the module with new protocol-accessible objects.
The naming and data organization of the original objects is used. The naming and data organization of the original objects is used.
The new objects are in the original module namespace. The new objects are in the original module namespace.
skipping to change at page 43, line 8 skipping to change at page 42, line 8
characteristics. The correlation between configuration the characteristics. The correlation between configuration the
operational data that is affected by changes in configuration is a operational data that is affected by changes in configuration is a
complex problem. There may not be a simple 1:1 relationship between complex problem. There may not be a simple 1:1 relationship between
a configuration data node and an operational data node. Further work a configuration data node and an operational data node. Further work
is needed in YANG to clarify this relationship. Protocol work may is needed in YANG to clarify this relationship. Protocol work may
also be needed to allow a client to retrieve this type of information also be needed to allow a client to retrieve this type of information
from a server. At this time the best practice is to clearly document from a server. At this time the best practice is to clearly document
any relationship to other data structures in the "description" any relationship to other data structures in the "description"
statement. statement.
5.23. Operational Data 4.22.1. Use of Leafref for Key Correlation
In YANG, any data that has a "config" statement value of "false"
could be considered operational data. The relationship between
configuration (i.e., "config" statement has a value of "true") and
operational data can be complex.
One challenge for client developers is determining if the configured
value is being used, which requires the developer to know which
operational data parameters are associated with the particular
configuration object(s).
If possible, operational data SHOULD be combined with its associated
configuration data. This prevents duplication of key leafs and
ancestor nodes. It also prevents race conditions for retrieval of
dynamic entries, and allows configuration and operational data to be
retrieved together with minimal message overhead.
Not preferred:
list foo {
...
}
list foo-state {
config false;
...
}
Preferred:
list foo {
container foo-state {
config false;
...
}
}
If it is not possible to combine configuration and operational data, Sometimes it is not practical to augment a data structure. For
then the keys used to represent list entries SHOULD be the same type. example, the correlated data could have different keys or contain
The "leafref" data type SHOULD be used in operational data for key mandatory nodes.
leafs that have corresponding configuration instances. The
"require-instance" statement MAY be set to "false" (in YANG 1.1
modules only) to indicate instances are allowed in the operational
state that do not exist in the associated configuration data.
The following example shows the use of the "leafref" data type: The following example shows the use of the "leafref" data type for
data correlation purposes:
Not preferred: Not preferred:
list foo { list foo {
key name; key name;
leaf name { leaf name {
type string; type string;
} }
... ...
} }
list foo-state { list foo-addon {
key name; key name;
config false; config false;
leaf name { leaf name {
type string; type string;
} }
... ...
} }
Preferred: Preferred:
list foo { list foo {
key name; key name;
leaf name { leaf name {
type string; type string;
} }
... ...
} }
list foo-state { list foo-addon {
key name; key name;
config false; config false;
leaf name { leaf name {
type leafref { type leafref {
path "/foo/name"; path "/foo/name";
require-instance false; require-instance false;
} }
} }
... leaf addon {
} type string;
mandatory true;
In the simplest use-cases, there is no interaction between
configuration and operational data. For example, the arbitrary
administrative name or sequence number assigned to an access control
rule. The configured value is always the value that is being used by
the system.
However, some configuration parameters interact with routing and
other signalling protocols, such that the operational value in use by
the system may not be the same as the configured value. Other
parameters specify the desired state, but environmental and other
factors can cause the actual state to be different.
For example a "temperature" configuration setting only represents the
desired temperature. An operational data parameter is needed that
reports the actual temperature in order to determine if the cooling
system is operating correctly. YANG has no mechanism other than the
"description" statement to associate the desired temperature and the
actual temperature.
Careful consideration needs to be given to the location of
operational data. It can either be located within the configuration
subtree for which it applies, or it can be located outside the
particular configuration subtree. Placing operational data within
the configuration subtree is appropriate if the operational values
can only exist if the configuration exists. Placing operational data
outside the configuration subtree is appropriate if the operational
values can exist without corresponding configuration (e.g., system
generated interfaces).
The "interfaces" and "interfaces-state" subtrees defined in [RFC7223]
are an example of a complex relationship between configuration and
operational data. The operational values can include interface
entries that have been discovered or initialized by the system. An
interface may be in use that has not been configured at all.
Therefore, the operational data for an interface cannot be located
within the configuration for that same interface.
Sometimes the configured value represents some sort of procedure to
be followed, in which the system will select an actual value, based
on protocol negotiation. In this case it is RECOMMENDED to have a
separate config false value to represented the resulting state. For
instance:
leaf duplex-admin-mode {
type enumeration {
enum auto;
enum half;
enum full;
}
}
leaf duplex-oper-mode {
config false;
type enumeration {
enum half;
enum full;
}
}
For example a "duplex" mode configuration may be "auto" to auto-
negotiate the actual value to be used. The operational parameter
will never contain the value "auto". It will always contain the
result of the auto-negotiation, such as "half" or "full". This is
just one way in which the configuration data model is not exactly the
same as the operational data model. Another is if the detailed
properties of the data are different for configured vs. learned
entries.
If all the data model properties are aligned between configuration
and operational data, then it can be useful to define the
configuration parameters within a grouping, and then replicate that
grouping within the operational data portion of the data model.
grouping parms {
// do not use config-stmt in any of the nodes
// placed in this grouping
}
container foo {
uses parms; // these are all config=true by default
state {
config false; // only exists if foo config exists
uses parms;
} }
} }
Note that this mechanism can also be used if the configuration and
operational data are in separate sub-trees:
container bar { // bar config can exist without bar-state 4.23. Operational Data
config true;
uses parms;
}
container bar-state { // bar-state can exist without bar In YANG, any data that has a "config" statement value of "false"
config false; could be considered operational data. The relationship between
uses parms; configuration (i.e., "config" statement has a value of "true") and
} operational data can be complex.
The need to replicate objects or define different operational data The original set of datastores defined in NETCONF (i.e., candidate,
objects depends on the data model. It is not possible to define one running, and startup) are not sufficient to fully manage a device
approach that will be optimal for all data models. Designers SHOULD with multiple sources of configuration data. In additional, a
describe the relationship in detail between configuration objects and separate datastore is needed to store operational state and other
any associated operational data objects. The "description" data such as statistics. Refer to
statements for both the configuration and the operational data SHOULD [I-D.ietf-netmod-revised-datastores] for details on this new "revised
be used for this purpose. datastore" architecture. Guidelines for usage of the new datastores
(including the operational datastore) is defined in
[I-D.dsdt-nmda-guidelines].
5.24. Performance Considerations 4.24. Performance Considerations
It is generally likely that certain YANG statements require more It is generally likely that certain YANG statements require more
runtime resources than other statements. Although there are no runtime resources than other statements. Although there are no
performance requirements for YANG validation, the following performance requirements for YANG validation, the following
information MAY be considered when designing YANG data models: information MAY be considered when designing YANG data models:
o Lists are generally more expensive than containers o Lists are generally more expensive than containers
o "when-stmt" evaluation is generally more expensive than o "when-stmt" evaluation is generally more expensive than
"if-feature" or "choice" statements "if-feature" or "choice" statements
skipping to change at page 47, line 45 skipping to change at page 44, line 20
o "must" statement is generally more expensive than "min-entries", o "must" statement is generally more expensive than "min-entries",
"max-entries", "mandatory", or "unique" statements "max-entries", "mandatory", or "unique" statements
o "identityref" leafs are generally more expensive than o "identityref" leafs are generally more expensive than
"enumeration" leafs "enumeration" leafs
o "leafref" and "instance-identifier" types with "require-instance" o "leafref" and "instance-identifier" types with "require-instance"
set to true are generally more expensive than if set to true are generally more expensive than if
"require-instance" is set to false "require-instance" is set to false
5.25. Open Systems Considerations 4.25. Open Systems Considerations
A YANG module MUST NOT be designed such that the set of modules found A YANG module MUST NOT be designed such that the set of modules found
on a server implementation can be predetermined in advance. Only the on a server implementation can be predetermined in advance. Only the
modules imported by a particular module can be assumed to be present modules imported by a particular module can be assumed to be present
in an implementation. An open system MAY include any combination of in an implementation. An open system MAY include any combination of
YANG modules. YANG modules.
5.26. YANG 1.1 Guidelines 4.26. YANG 1.1 Guidelines
The set of YANG 1.1 guidelines will grow as operational experience is The set of YANG 1.1 guidelines will grow as operational experience is
gained with the new language features. This section contains an gained with the new language features. This section contains an
initial set of guidelines. initial set of guidelines.
5.26.1. Importing Multiple Revisions 4.26.1. Importing Multiple Revisions
Standard modules SHOULD NOT import multiple revisions of the same Standard modules SHOULD NOT import multiple revisions of the same
module into a module. This MAY be done if the authors can module into a module. This MAY be done if the authors can
demonstrate that the "avoided" definitions from the most recent of demonstrate that the "avoided" definitions from the most recent of
the multiple revisions are somehow broken or harmful to the multiple revisions are somehow broken or harmful to
interoperability. interoperability.
5.26.2. Using Feature Logic 4.26.2. Using Feature Logic
The YANG 1.1 feature logic is much more expressive than YANG 1.0. A The YANG 1.1 feature logic is much more expressive than YANG 1.0. A
"description" statement SHOULD describe the "if-feature" logic in "description" statement SHOULD describe the "if-feature" logic in
text, to help readers understand the module. text, to help readers understand the module.
YANG features SHOULD be used instead of the "when" statement, if YANG features SHOULD be used instead of the "when" statement, if
possible. Features are advertised by the server and objects possible. Features are advertised by the server and objects
conditional by if-feature are conceptually grouped together. There conditional by if-feature are conceptually grouped together. There
is no such commonality supported for "when" statements. is no such commonality supported for "when" statements.
Features generally require less server implementation complexity and Features generally require less server implementation complexity and
runtime resources than objects that use "when" statements. Features runtime resources than objects that use "when" statements. Features
are generally static (i.e., set when module is loaded and not changed are generally static (i.e., set when module is loaded and not changed
at runtime). However every client edit might cause a "when" at runtime). However every client edit might cause a "when"
statement result to change. statement result to change.
5.26.3. anyxml vs. anydata 4.26.3. anyxml vs. anydata
The "anyxml" statement MUST NOT be used to represent a conceptual The "anyxml" statement MUST NOT be used to represent a conceptual
subtree of YANG data nodes. The "anydata" statement MUST be used for subtree of YANG data nodes. The "anydata" statement MUST be used for
this purpose. this purpose.
5.26.4. action vs. rpc 4.26.4. action vs. rpc
The use of "action" statements or "rpc" statements is a subjective The use of "action" statements or "rpc" statements is a subjective
design decision. RPC operations are not associated with any design decision. RPC operations are not associated with any
particular data node. Actions are associated with a specific data particular data node. Actions are associated with a specific data
node definition. An "action" statement SHOULD be used if the node definition. An "action" statement SHOULD be used if the
protocol operation is specific to a subset of all data nodes instead protocol operation is specific to a subset of all data nodes instead
of all possible data nodes. of all possible data nodes.
The same action name MAY be used in different definitions within The same action name MAY be used in different definitions within
different data node. For example, a "reset" action defined with a different data node. For example, a "reset" action defined with a
skipping to change at page 49, line 40 skipping to change at page 46, line 15
have read access to the specific "interface" instance, then it cannot have read access to the specific "interface" instance, then it cannot
invoke the "reset" action for that interface instance: invoke the "reset" action for that interface instance:
container interfaces { container interfaces {
list interface { list interface {
... ...
action reset { } action reset { }
} }
} }
5.27. Updating YANG Modules (Published vs. Unpublished) 4.27. Updating YANG Modules (Published vs. Unpublished)
YANG modules can change over time. Typically, new data model YANG modules can change over time. Typically, new data model
definitions are needed to support new features. YANG update rules definitions are needed to support new features. YANG update rules
defined in section 11 of [RFC7950] MUST be followed for published defined in section 11 of [RFC7950] MUST be followed for published
modules. They MAY be followed for unpublished modules. modules. They MAY be followed for unpublished modules.
The YANG update rules only apply to published module revisions. Each The YANG update rules only apply to published module revisions. Each
organization will have their own way to identify published work which organization will have their own way to identify published work which
is considered to be stable, and unpublished work which is considered is considered to be stable, and unpublished work which is considered
to be unstable. For example, in the IETF, the RFC document is used to be unstable. For example, in the IETF, the RFC document is used
for published work, and the Internet-Draft is used for unpublished for published work, and the Internet-Draft is used for unpublished
work. work.
6. IANA Considerations 5. IANA Considerations
-- RFC Ed: These registries need to be updated to reference this -- RFC Ed: These registries need to be updated to reference this
RFC instead of RFC 6087 for the ietf-template module, and RFC instead of RFC 6087 for the ietf-template module, and
remove this note. remove this note.
This document registers one URI in the IETF XML registry [RFC3688]. This document registers one URI in the IETF XML registry [RFC3688].
The following registration has been made in [RFC6087] and updated by The following registration has been made in [RFC6087] and updated by
this document. this document.
skipping to change at page 52, line 5 skipping to change at page 48, line 5
| Field | Value | | Field | Value |
+-----------+-------------------------------------------+ +-----------+-------------------------------------------+
| Name | ietf-template | | Name | ietf-template |
| Namespace | urn:ietf:params:xml:ns:yang:ietf-template | | Namespace | urn:ietf:params:xml:ns:yang:ietf-template |
| Prefix | temp | | Prefix | temp |
| Reference | RFC XXXX | | Reference | RFC XXXX |
+-----------+-------------------------------------------+ +-----------+-------------------------------------------+
YANG Registry Assignment YANG Registry Assignment
7. Security Considerations 6. Security Considerations
This document defines documentation guidelines for NETCONF or This document defines documentation guidelines for NETCONF or
RESTCONF content defined with the YANG data modeling language. The RESTCONF content defined with the YANG data modeling language. The
guidelines for how to write a Security Considerations section for a guidelines for how to write a Security Considerations section for a
YANG module are defined in the online document YANG module are defined in the online document
http://trac.tools.ietf.org/area/ops/trac/wiki/ http://trac.tools.ietf.org/area/ops/trac/wiki/
yang-security-guidelines yang-security-guidelines
This document does not introduce any new or increased security risks This document does not introduce any new or increased security risks
skipping to change at page 52, line 41 skipping to change at page 48, line 41
associated security risks MUST be spelled out. associated security risks MUST be spelled out.
Similarly, readable data nodes that contain especially sensitive Similarly, readable data nodes that contain especially sensitive
information or that raise significant privacy concerns MUST be information or that raise significant privacy concerns MUST be
explicitly listed by name and the reasons for the sensitivity/privacy explicitly listed by name and the reasons for the sensitivity/privacy
concerns MUST be explained. concerns MUST be explained.
Further, if new RPC operations have been defined, then the security Further, if new RPC operations have been defined, then the security
considerations of each new RPC operation MUST be explained. considerations of each new RPC operation MUST be explained.
7.1. Security Considerations Section Template 6.1. Security Considerations Section Template
X. Security Considerations X. Security Considerations
The YANG module defined in this memo is designed to be accessed via The YANG module defined in this memo is designed to be accessed via
the NETCONF protocol [RFC6241]. The lowest NETCONF layer is the the NETCONF protocol [RFC6241]. The lowest NETCONF layer is the
secure transport layer and the mandatory-to-implement secure secure transport layer and the mandatory-to-implement secure
transport is SSH [RFC6242]. transport is SSH [RFC6242].
-- if you have any writable data nodes (those are all the -- if you have any writable data nodes (those are all the
-- "config true" nodes, and remember, that is the default) -- "config true" nodes, and remember, that is the default)
skipping to change at page 54, line 5 skipping to change at page 50, line 5
-- if your YANG module has defined any rpc operations -- if your YANG module has defined any rpc operations
-- describe their specific sensitivity or vulnerability. -- describe their specific sensitivity or vulnerability.
Some of the RPC operations in this YANG module may be considered Some of the RPC operations in this YANG module may be considered
sensitive or vulnerable in some network environments. It is thus sensitive or vulnerable in some network environments. It is thus
important to control access to these operations. These are the important to control access to these operations. These are the
operations and their sensitivity/vulnerability: operations and their sensitivity/vulnerability:
<list RPC operations and state why they are sensitive> <list RPC operations and state why they are sensitive>
8. Acknowledgments 7. Acknowledgments
The structure and contents of this document are adapted from The structure and contents of this document are adapted from
[RFC4181], guidelines for MIB Documents, by C. M. Heard. [RFC4181], guidelines for MIB Documents, by C. M. Heard.
The working group thanks Martin Bjorklund, Juergen Schoenwaelder, The working group thanks Martin Bjorklund, Juergen Schoenwaelder,
Ladislav Lhotka, and Jernej Tuljak for their extensive reviews and Ladislav Lhotka, and Jernej Tuljak for their extensive reviews and
contributions to this document. contributions to this document.
9. Changes Since RFC 6087 8. Changes Since RFC 6087
The following changes have been made to the guidelines published in The following changes have been made to the guidelines published in
[RFC6087]: [RFC6087]:
o Updated NETCONF reference from RFC 4741 to RFC 6241 o Updated NETCONF reference from RFC 4741 to RFC 6241
o Updated NETCONF over SSH citation from RFC 4742 to RFC 6242 o Updated NETCONF over SSH citation from RFC 4742 to RFC 6242
o Updated YANG Types reference from RFC 6021 to RFC 6991 o Updated YANG Types reference from RFC 6021 to RFC 6991
skipping to change at page 57, line 5 skipping to change at page 52, line 10
o Clarified namespace and domain conventions for example modules o Clarified namespace and domain conventions for example modules
o Clarified conventions for identifying code components o Clarified conventions for identifying code components
o Added YANG 1.1 guidelines o Added YANG 1.1 guidelines
o Added Data Model Constraints section o Added Data Model Constraints section
o Added mention of RESTCONF protocol o Added mention of RESTCONF protocol
10. References o Added mention of Revised Datastores and associated guidelines
10.1. Normative References 9. References
9.1. Normative References
[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, March 1997.
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
January 2004. January 2004.
[RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform
Resource Identifier (URI): Generic Syntax", STD 66, Resource Identifier (URI): Generic Syntax", STD 66,
RFC 3986, January 2005. RFC 3986, January 2005.
skipping to change at page 57, line 39 skipping to change at page 53, line 39
[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>. <http://www.rfc-editor.org/info/rfc7950>.
[W3C.REC-xpath-19991116] [W3C.REC-xpath-19991116]
Clark, J. and S. DeRose, "XML Path Language (XPath) Clark, J. and S. DeRose, "XML Path Language (XPath)
Version 1.0", World Wide Web Consortium Version 1.0", World Wide Web Consortium
Recommendation REC-xpath-19991116, November 1999, Recommendation REC-xpath-19991116, November 1999,
<http://www.w3.org/TR/1999/REC-xpath-19991116>. <http://www.w3.org/TR/1999/REC-xpath-19991116>.
10.2. Informative References 9.2. Informative References
[I-D.ietf-netconf-restconf] [I-D.dsdt-nmda-guidelines]
Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
Protocol", draft-ietf-netconf-restconf-17 (work in and R. Wilton, "Guidelines for YANG Module Authors
progress), September 2016. (NMDA)", draft-dsdt-nmda-guidelines-01 (work in progress),
May 2017.
[I-D.ietf-netmod-revised-datastores]
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K.,
and R. Wilton, "Network Management Datastore
Architecture", draft-ietf-netmod-revised-datastores-02
(work in progress), May 2017.
[I-D.ietf-netmod-yang-tree-diagrams]
Bjorklund, M. and L. Berger, "YANG Tree Diagrams",
draft-ietf-netmod-yang-tree-diagrams-00 (work in
progress), June 2017.
[RFC-STYLE] [RFC-STYLE]
Braden, R., Ginoza, S., and A. Hagens, "RFC Document Braden, R., Ginoza, S., and A. Hagens, "RFC Document
Style", September 2009, Style", September 2009,
<http://www.rfc-editor.org/rfc-style-guide/rfc-style>. <http://www.rfc-editor.org/rfc-style-guide/rfc-style>.
[RFC2026] Bradner, S., "The Internet Standards Process -- Revision [RFC2026] Bradner, S., "The Internet Standards Process -- Revision
3", BCP 9, RFC 2026, DOI 10.17487/RFC2026, October 1996, 3", BCP 9, RFC 2026, DOI 10.17487/RFC2026, October 1996,
<http://www.rfc-editor.org/info/rfc2026>. <http://www.rfc-editor.org/info/rfc2026>.
skipping to change at page 59, line 5 skipping to change at page 55, line 8
[RFC7322] Flanagan, H. and S. Ginoza, "RFC Style Guide", RFC 7322, [RFC7322] Flanagan, H. and S. Ginoza, "RFC Style Guide", RFC 7322,
DOI 10.17487/RFC7322, September 2014, DOI 10.17487/RFC7322, September 2014,
<http://www.rfc-editor.org/info/rfc7322>. <http://www.rfc-editor.org/info/rfc7322>.
[RFC7841] Halpern, J., Ed., Daigle, L., Ed., and O. Kolkman, Ed., [RFC7841] Halpern, J., Ed., Daigle, L., Ed., and O. Kolkman, Ed.,
"RFC Streams, Headers, and Boilerplates", RFC 7841, "RFC Streams, Headers, and Boilerplates", RFC 7841,
DOI 10.17487/RFC7841, May 2016, DOI 10.17487/RFC7841, May 2016,
<http://www.rfc-editor.org/info/rfc7841>. <http://www.rfc-editor.org/info/rfc7841>.
[RFC8040] Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
Protocol", RFC 8040, DOI 10.17487/RFC8040, January 2017,
<http://www.rfc-editor.org/info/rfc8040>.
Appendix A. Change Log Appendix A. Change Log
-- RFC Ed.: remove this section before publication. -- RFC Ed.: remove this section before publication.
A.1. v11 to v12 A.1. v12 to v13
o fix incoorect location of new Module Usage Examples section o Clarify that the revision-date SHOULD be used in a CODE BEGINS
YANG file extraction macro.
A.2. v10 to v11 o Clarify the IANA requirements section wrt/ XML namespace and YANG
module name registries.
o Clarify YANG Usage section wrt/ XML and/or JSON encoding format.
o Update Operation Data section to consider revised datastores.
o Add reference to YANG Tree Diagrams and update 2 sections that use
this reference.
o Add reference to Revised Datastores and guidelines drafts
A.2. v11 to v12
o fix incorrect location of new Module Usage Examples section
A.3. v10 to v11
o updated YANG tree diagram syntax to align with pyang 1.7.1 o updated YANG tree diagram syntax to align with pyang 1.7.1
o added general guideline to include module usage examples o added general guideline to include module usage examples
A.3. v09 to v10 A.4. v09 to v10
o clarified <CODE BEGINS> is only for normative modules o clarified <CODE BEGINS> is only for normative modules
o clarified example module namespace URI conventions o clarified example module namespace URI conventions
o clarified pyang usage for normative and example modules o clarified pyang usage for normative and example modules
o updated YANG tree diagrams section with text from RFC 8022 o updated YANG tree diagrams section with text from RFC 8022
A.4. v08 to v09 A.5. v08 to v09
o fixed references o fixed references
o added mention of RESTCONF to abstract and intro o added mention of RESTCONF to abstract and intro
o created separate section for code components o created separate section for code components
o fixed document status o fixed document status
A.5. v07 to v08 A.6. v07 to v08
o changed CODE BEGINS guideline for example modules o changed CODE BEGINS guideline for example modules
o updated tree diagram guidelines o updated tree diagram guidelines
o clarified published and unpublished terms o clarified published and unpublished terms
o added section on Empty and Boolean data types o added section on Empty and Boolean data types
o clarified how to update the revision statement o clarified how to update the revision statement
skipping to change at page 60, line 4 skipping to change at page 57, line 21
o updated tree diagram guidelines o updated tree diagram guidelines
o clarified published and unpublished terms o clarified published and unpublished terms
o added section on Empty and Boolean data types o added section on Empty and Boolean data types
o clarified how to update the revision statement o clarified how to update the revision statement
o updated operational state guidelines o updated operational state guidelines
o added 'YANG fragment' to terminology section o added 'YANG fragment' to terminology section
A.6. v06 to v07 A.7. v06 to v07
o update contact statement guideline o update contact statement guideline
o update example modules guidelines o update example modules guidelines
o add guidelines on top-level data nodes o add guidelines on top-level data nodes
o add guideline on use of NP containers o add guideline on use of NP containers
o added guidelines on union types o added guidelines on union types
o add guideline on deviations o add guideline on deviations
o added section on open systems considerations o added section on open systems considerations
o added guideline about definitions reserved for future use o added guideline about definitions reserved for future use
A.7. v05 to v06 A.8. v05 to v06
o Changed example 'my-module' to 'example-module' o Changed example 'my-module' to 'example-module'
o Added section Updating YANG Modules (Published vs. Unpublished) o Added section Updating YANG Modules (Published vs. Unpublished)
o Added Example Modules section o Added Example Modules section
o Added "<EXAMPLE BEGINS>" convention for full example modules o Added "<EXAMPLE BEGINS>" convention for full example modules
o Added section on using action vs. rpc o Added section on using action vs. rpc
o Changed term "operational state" to "operational data" o Changed term "operational state" to "operational data"
o Added section on YANG Data Node Constraints o Added section on YANG Data Node Constraints
o Added guidelines on using must vs. when statements o Added guidelines on using must vs. when statements
o Made ietf-foo module validate for I-D submission o Made ietf-foo module validate for I-D submission
skipping to change at page 60, line 44 skipping to change at page 58, line 14
o Added section on using action vs. rpc o Added section on using action vs. rpc
o Changed term "operational state" to "operational data" o Changed term "operational state" to "operational data"
o Added section on YANG Data Node Constraints o Added section on YANG Data Node Constraints
o Added guidelines on using must vs. when statements o Added guidelines on using must vs. when statements
o Made ietf-foo module validate for I-D submission o Made ietf-foo module validate for I-D submission
A.8. v04 to v05 A.9. v04 to v05
o Clarified that YANG 1.1 SHOULD be used but YANG 1.0 MAY be used if o Clarified that YANG 1.1 SHOULD be used but YANG 1.0 MAY be used if
no YANG 1.1 features needed no YANG 1.1 features needed
o Changed SHOULD follow YANG naming conventions to MUST follow (for o Changed SHOULD follow YANG naming conventions to MUST follow (for
standards track documents only) standards track documents only)
o Clarified module naming conventions for normative modules, example o Clarified module naming conventions for normative modules, example
modules, and modules from other SDOs. modules, and modules from other SDOs.
skipping to change at page 61, line 19 skipping to change at page 58, line 36
o Added new section on guidelines for reusable groupings o Added new section on guidelines for reusable groupings
o Made header guidelines less IETF-specific o Made header guidelines less IETF-specific
o Added new section on guidelines for extension statements o Added new section on guidelines for extension statements
o Added guidelines for nested "choice" statement within a "case" o Added guidelines for nested "choice" statement within a "case"
statement statement
A.9. v03 ot v04 A.10. v03 ot v04
o Added sections for deviation statements and performance o Added sections for deviation statements and performance
considerations considerations
o Added YANG 1.1 section o Added YANG 1.1 section
o Updated YANG reference from 1.0 to 1.1 o Updated YANG reference from 1.0 to 1.1
A.10. v02 to v03 A.11. v02 to v03
o Updated draft based on github data tracker issues added by Benoit o Updated draft based on github data tracker issues added by Benoit
Clause (Issues 12 - 18) Clause (Issues 12 - 18)
A.11. v01 to v02 A.12. v01 to v02
o Updated draft based on mailing list comments. o Updated draft based on mailing list comments.
A.12. v00 to v01 A.13. v00 to v01
All issues from the issue tracker have been addressed. All issues from the issue tracker have been addressed.
https://github.com/netmod-wg/rfc6087bis/issues https://github.com/netmod-wg/rfc6087bis/issues
o Issue 1: Tree Diagrams: Added Section 3 so RFCs with YANG modules o Issue 1: Tree Diagrams: Added Section 2.4.1 so RFCs with YANG
can use an Informative reference to this RFC for tree diagrams. modules can use an Informative reference to this RFC for tree
Updated guidelines to reference this RFC when tree diagrams are diagrams. Updated guidelines to reference this RFC when tree
used diagrams are used
o Issue 2: XPath function restrictions: Added paragraphs in XPath o Issue 2: XPath function restrictions: Added paragraphs in XPath
usage section for 'id', 'namespace-uri', 'name', and 'lang' usage section for 'id', 'namespace-uri', 'name', and 'lang'
functions functions
o Issue 3: XPath function document order issues: Added paragraph in o Issue 3: XPath function document order issues: Added paragraph in
XPath usage section about node-set ordering for 'local-name', XPath usage section about node-set ordering for 'local-name',
'namespace-uri', 'name', 'string' and 'number' functions. Also 'namespace-uri', 'name', 'string' and 'number' functions. Also
any function that implicitly converts a node-set to a string. any function that implicitly converts a node-set to a string.
skipping to change at page 64, line 20 skipping to change at page 61, line 20
imported items are cited as normative references, and that all imported items are cited as normative references, and that all
citations point to the most current RFCs unless there is a valid citations point to the most current RFCs unless there is a valid
reason to do otherwise (for example, it is OK to include an reason to do otherwise (for example, it is OK to include an
informative reference to a previous version of a specification to informative reference to a previous version of a specification to
help explain a feature included for backward compatibility). Be help explain a feature included for backward compatibility). Be
sure citations for all imported modules are present somewhere in sure citations for all imported modules are present somewhere in
the document text (outside the YANG module). the document text (outside the YANG module).
o License -- verify that the draft contains the Simplified BSD o License -- verify that the draft contains the Simplified BSD
License in each YANG module or submodule. Some guidelines related License in each YANG module or submodule. Some guidelines related
to this requirement are described in Section 4.1. Make sure that to this requirement are described in Section 3.1. Make sure that
the correct year is used in all copyright dates. Use the approved the correct year is used in all copyright dates. Use the approved
text from the latest Trust Legal Provisions (TLP) document, which text from the latest Trust Legal Provisions (TLP) document, which
can be found at: can be found at:
http://trustee.ietf.org/license-info/ http://trustee.ietf.org/license-info/
o Other Issues -- check for any issues mentioned in o Other Issues -- check for any issues mentioned in
http://www.ietf.org/id-info/checklist.html that are not covered http://www.ietf.org/id-info/checklist.html that are not covered
elsewhere. elsewhere.
 End of changes. 119 change blocks. 
399 lines changed or deleted 279 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/