--- 1/draft-ietf-netmod-rfc6020bis-01.txt 2014-11-14 02:14:52.211507258 -0800 +++ 2/draft-ietf-netmod-rfc6020bis-02.txt 2014-11-14 02:14:52.507514523 -0800 @@ -1,20 +1,20 @@ Network Working Group M. Bjorklund, Ed. Internet-Draft Tail-f Systems -Obsoletes: 6020 (if approved) October 2, 2014 +Obsoletes: 6020 (if approved) November 14, 2014 Intended status: Standards Track -Expires: April 5, 2015 +Expires: May 18, 2015 YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF) - draft-ietf-netmod-rfc6020bis-01 + draft-ietf-netmod-rfc6020bis-02 Abstract YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. This document obsoletes RFC 6020. Status of This Memo @@ -24,21 +24,21 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at http://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on April 5, 2015. + This Internet-Draft will expire on May 18, 2015. Copyright Notice Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -59,299 +59,300 @@ not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 8 1.1. Summary of Changes from RFC 6020 . . . . . . . . . . . . 8 2. Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 9 - 3.1. Mandatory Nodes . . . . . . . . . . . . . . . . . . . . . 11 + 3.1. Mandatory Nodes . . . . . . . . . . . . . . . . . . . . . 12 4. YANG Overview . . . . . . . . . . . . . . . . . . . . . . . . 12 4.1. Functional Overview . . . . . . . . . . . . . . . . . . . 12 - 4.2. Language Overview . . . . . . . . . . . . . . . . . . . . 13 + 4.2. Language Overview . . . . . . . . . . . . . . . . . . . . 14 4.2.1. Modules and Submodules . . . . . . . . . . . . . . . 14 4.2.2. Data Modeling Basics . . . . . . . . . . . . . . . . 14 - 4.2.3. State Data . . . . . . . . . . . . . . . . . . . . . 18 - 4.2.4. Built-In Types . . . . . . . . . . . . . . . . . . . 18 - 4.2.5. Derived Types (typedef) . . . . . . . . . . . . . . . 19 - 4.2.6. Reusable Node Groups (grouping) . . . . . . . . . . . 20 - 4.2.7. Choices . . . . . . . . . . . . . . . . . . . . . . . 21 - 4.2.8. Extending Data Models (augment) . . . . . . . . . . . 22 - 4.2.9. RPC Definitions . . . . . . . . . . . . . . . . . . . 23 - 4.2.10. Notification Definitions . . . . . . . . . . . . . . 24 - 5. Language Concepts . . . . . . . . . . . . . . . . . . . . . . 25 - 5.1. Modules and Submodules . . . . . . . . . . . . . . . . . 25 - 5.1.1. Import and Include by Revision . . . . . . . . . . . 26 - 5.1.2. Module Hierarchies . . . . . . . . . . . . . . . . . 27 - 5.2. File Layout . . . . . . . . . . . . . . . . . . . . . . . 28 - 5.3. XML Namespaces . . . . . . . . . . . . . . . . . . . . . 28 - 5.3.1. YANG XML Namespace . . . . . . . . . . . . . . . . . 29 - 5.4. Resolving Grouping, Type, and Identity Names . . . . . . 29 - 5.5. Nested Typedefs and Groupings . . . . . . . . . . . . . . 29 - 5.6. Conformance . . . . . . . . . . . . . . . . . . . . . . . 30 - 5.6.1. Basic Behavior . . . . . . . . . . . . . . . . . . . 30 - 5.6.2. Optional Features . . . . . . . . . . . . . . . . . . 31 - 5.6.3. Deviations . . . . . . . . . . . . . . . . . . . . . 31 + 4.2.3. State Data . . . . . . . . . . . . . . . . . . . . . 19 + 4.2.4. Built-In Types . . . . . . . . . . . . . . . . . . . 19 + 4.2.5. Derived Types (typedef) . . . . . . . . . . . . . . . 20 + 4.2.6. Reusable Node Groups (grouping) . . . . . . . . . . . 21 + 4.2.7. Choices . . . . . . . . . . . . . . . . . . . . . . . 22 + 4.2.8. Extending Data Models (augment) . . . . . . . . . . . 23 + 4.2.9. RPC Definitions . . . . . . . . . . . . . . . . . . . 24 + 4.2.10. Notification Definitions . . . . . . . . . . . . . . 25 + 5. Language Concepts . . . . . . . . . . . . . . . . . . . . . . 26 + 5.1. Modules and Submodules . . . . . . . . . . . . . . . . . 26 + 5.1.1. Import and Include by Revision . . . . . . . . . . . 27 + 5.1.2. Module Hierarchies . . . . . . . . . . . . . . . . . 28 + 5.2. File Layout . . . . . . . . . . . . . . . . . . . . . . . 29 + 5.3. XML Namespaces . . . . . . . . . . . . . . . . . . . . . 29 + 5.3.1. YANG XML Namespace . . . . . . . . . . . . . . . . . 30 + 5.4. Resolving Grouping, Type, and Identity Names . . . . . . 30 + 5.5. Nested Typedefs and Groupings . . . . . . . . . . . . . . 30 + 5.6. Conformance . . . . . . . . . . . . . . . . . . . . . . . 31 + 5.6.1. Basic Behavior . . . . . . . . . . . . . . . . . . . 31 + 5.6.2. Optional Features . . . . . . . . . . . . . . . . . . 32 + 5.6.3. Deviations . . . . . . . . . . . . . . . . . . . . . 32 5.6.4. Announcing Conformance Information in the - Message . . . . . . . . . . . . . . . . . . . . . . . 32 - 5.7. Data Store Modification . . . . . . . . . . . . . . . . . 34 - 6. YANG Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 34 - 6.1. Lexical Tokenization . . . . . . . . . . . . . . . . . . 34 - 6.1.1. Comments . . . . . . . . . . . . . . . . . . . . . . 34 - 6.1.2. Tokens . . . . . . . . . . . . . . . . . . . . . . . 35 - 6.1.3. Quoting . . . . . . . . . . . . . . . . . . . . . . . 35 - 6.2. Identifiers . . . . . . . . . . . . . . . . . . . . . . . 36 - 6.2.1. Identifiers and Their Namespaces . . . . . . . . . . 36 - 6.3. Statements . . . . . . . . . . . . . . . . . . . . . . . 37 - 6.3.1. Language Extensions . . . . . . . . . . . . . . . . . 38 - 6.4. XPath Evaluations . . . . . . . . . . . . . . . . . . . . 38 - 6.4.1. XPath Context . . . . . . . . . . . . . . . . . . . . 38 - 6.5. Schema Node Identifier . . . . . . . . . . . . . . . . . 39 - 7. YANG Statements . . . . . . . . . . . . . . . . . . . . . . . 39 - 7.1. The module Statement . . . . . . . . . . . . . . . . . . 40 - 7.1.1. The module's Substatements . . . . . . . . . . . . . 41 - 7.1.2. The yang-version Statement . . . . . . . . . . . . . 41 - 7.1.3. The namespace Statement . . . . . . . . . . . . . . . 42 - 7.1.4. The prefix Statement . . . . . . . . . . . . . . . . 42 - 7.1.5. The import Statement . . . . . . . . . . . . . . . . 42 - 7.1.6. The include Statement . . . . . . . . . . . . . . . . 43 - 7.1.7. The organization Statement . . . . . . . . . . . . . 44 - 7.1.8. The contact Statement . . . . . . . . . . . . . . . . 44 - 7.1.9. The revision Statement . . . . . . . . . . . . . . . 44 - 7.1.10. Usage Example . . . . . . . . . . . . . . . . . . . . 45 - 7.2. The submodule Statement . . . . . . . . . . . . . . . . . 46 - 7.2.1. The submodule's Substatements . . . . . . . . . . . . 47 - 7.2.2. The belongs-to Statement . . . . . . . . . . . . . . 48 - 7.2.3. Usage Example . . . . . . . . . . . . . . . . . . . . 49 - 7.3. The typedef Statement . . . . . . . . . . . . . . . . . . 49 - 7.3.1. The typedef's Substatements . . . . . . . . . . . . . 50 - 7.3.2. The typedef's type Statement . . . . . . . . . . . . 50 - 7.3.3. The units Statement . . . . . . . . . . . . . . . . . 50 - 7.3.4. The typedef's default Statement . . . . . . . . . . . 50 - 7.3.5. Usage Example . . . . . . . . . . . . . . . . . . . . 51 - 7.4. The type Statement . . . . . . . . . . . . . . . . . . . 51 - 7.4.1. The type's Substatements . . . . . . . . . . . . . . 51 - 7.5. The container Statement . . . . . . . . . . . . . . . . . 51 - 7.5.1. Containers with Presence . . . . . . . . . . . . . . 52 - 7.5.2. The container's Substatements . . . . . . . . . . . . 52 - 7.5.3. The must Statement . . . . . . . . . . . . . . . . . 53 - 7.5.4. The must's Substatements . . . . . . . . . . . . . . 54 - 7.5.5. The presence Statement . . . . . . . . . . . . . . . 55 - 7.5.6. The container's Child Node Statements . . . . . . . . 56 - 7.5.7. XML Mapping Rules . . . . . . . . . . . . . . . . . . 56 - 7.5.8. NETCONF Operations . . . . . . . . . . 56 - 7.5.9. Usage Example . . . . . . . . . . . . . . . . . . . . 57 - 7.6. The leaf Statement . . . . . . . . . . . . . . . . . . . 58 - 7.6.1. The leaf's default value . . . . . . . . . . . . . . 58 - 7.6.2. The leaf's Substatements . . . . . . . . . . . . . . 59 - 7.6.3. The leaf's type Statement . . . . . . . . . . . . . . 59 - 7.6.4. The leaf's default Statement . . . . . . . . . . . . 59 - 7.6.5. The leaf's mandatory Statement . . . . . . . . . . . 59 - 7.6.6. XML Mapping Rules . . . . . . . . . . . . . . . . . . 60 - 7.6.7. NETCONF Operations . . . . . . . . . . 60 - 7.6.8. Usage Example . . . . . . . . . . . . . . . . . . . . 60 - 7.7. The leaf-list Statement . . . . . . . . . . . . . . . . . 61 - 7.7.1. Ordering . . . . . . . . . . . . . . . . . . . . . . 62 - 7.7.2. The leaf-list's Substatements . . . . . . . . . . . . 62 - 7.7.3. The min-elements Statement . . . . . . . . . . . . . 63 - 7.7.4. The max-elements Statement . . . . . . . . . . . . . 63 - 7.7.5. The ordered-by Statement . . . . . . . . . . . . . . 64 - 7.7.6. XML Mapping Rules . . . . . . . . . . . . . . . . . . 64 - 7.7.7. NETCONF Operations . . . . . . . . . . 65 - 7.7.8. Usage Example . . . . . . . . . . . . . . . . . . . . 66 - 7.8. The list Statement . . . . . . . . . . . . . . . . . . . 67 - 7.8.1. The list's Substatements . . . . . . . . . . . . . . 67 - 7.8.2. The list's key Statement . . . . . . . . . . . . . . 68 - 7.8.3. The list's unique Statement . . . . . . . . . . . . . 69 - 7.8.4. The list's Child Node Statements . . . . . . . . . . 70 - 7.8.5. XML Mapping Rules . . . . . . . . . . . . . . . . . . 70 - 7.8.6. NETCONF Operations . . . . . . . . . . 71 - 7.8.7. Usage Example . . . . . . . . . . . . . . . . . . . . 72 - 7.9. The choice Statement . . . . . . . . . . . . . . . . . . 75 - 7.9.1. The choice's Substatements . . . . . . . . . . . . . 75 - 7.9.2. The choice's case Statement . . . . . . . . . . . . . 76 - 7.9.3. The choice's default Statement . . . . . . . . . . . 77 - 7.9.4. The choice's mandatory Statement . . . . . . . . . . 79 - 7.9.5. XML Mapping Rules . . . . . . . . . . . . . . . . . . 79 - 7.9.6. NETCONF Operations . . . . . . . . . . 79 - 7.9.7. Usage Example . . . . . . . . . . . . . . . . . . . . 79 - 7.10. The anyxml Statement . . . . . . . . . . . . . . . . . . 80 - 7.10.1. The anyxml's Substatements . . . . . . . . . . . . . 81 - 7.10.2. XML Mapping Rules . . . . . . . . . . . . . . . . . 81 - 7.10.3. NETCONF Operations . . . . . . . . . . 81 - 7.10.4. Usage Example . . . . . . . . . . . . . . . . . . . 82 - 7.11. The grouping Statement . . . . . . . . . . . . . . . . . 82 - 7.11.1. The grouping's Substatements . . . . . . . . . . . . 83 - 7.11.2. Usage Example . . . . . . . . . . . . . . . . . . . 83 - 7.12. The uses Statement . . . . . . . . . . . . . . . . . . . 84 - 7.12.1. The uses's Substatements . . . . . . . . . . . . . . 84 - 7.12.2. The refine Statement . . . . . . . . . . . . . . . . 84 - 7.12.3. XML Mapping Rules . . . . . . . . . . . . . . . . . 85 - 7.12.4. Usage Example . . . . . . . . . . . . . . . . . . . 85 + Message . . . . . . . . . . . . . . . . . . . . . . . 33 + 5.7. Data Store Modification . . . . . . . . . . . . . . . . . 35 + 6. YANG Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 35 + 6.1. Lexical Tokenization . . . . . . . . . . . . . . . . . . 35 + 6.1.1. Comments . . . . . . . . . . . . . . . . . . . . . . 36 + 6.1.2. Tokens . . . . . . . . . . . . . . . . . . . . . . . 36 + 6.1.3. Quoting . . . . . . . . . . . . . . . . . . . . . . . 36 + 6.2. Identifiers . . . . . . . . . . . . . . . . . . . . . . . 37 + 6.2.1. Identifiers and Their Namespaces . . . . . . . . . . 38 + 6.3. Statements . . . . . . . . . . . . . . . . . . . . . . . 39 + 6.3.1. Language Extensions . . . . . . . . . . . . . . . . . 39 + 6.4. XPath Evaluations . . . . . . . . . . . . . . . . . . . . 39 + 6.4.1. XPath Context . . . . . . . . . . . . . . . . . . . . 40 + 6.5. Schema Node Identifier . . . . . . . . . . . . . . . . . 41 + 7. YANG Statements . . . . . . . . . . . . . . . . . . . . . . . 41 + 7.1. The module Statement . . . . . . . . . . . . . . . . . . 42 + 7.1.1. The module's Substatements . . . . . . . . . . . . . 43 + 7.1.2. The yang-version Statement . . . . . . . . . . . . . 44 + 7.1.3. The namespace Statement . . . . . . . . . . . . . . . 45 + 7.1.4. The prefix Statement . . . . . . . . . . . . . . . . 45 + 7.1.5. The import Statement . . . . . . . . . . . . . . . . 45 + 7.1.6. The include Statement . . . . . . . . . . . . . . . . 46 + 7.1.7. The organization Statement . . . . . . . . . . . . . 47 + 7.1.8. The contact Statement . . . . . . . . . . . . . . . . 47 + 7.1.9. The revision Statement . . . . . . . . . . . . . . . 47 + 7.1.10. Usage Example . . . . . . . . . . . . . . . . . . . . 48 + 7.2. The submodule Statement . . . . . . . . . . . . . . . . . 49 + 7.2.1. The submodule's Substatements . . . . . . . . . . . . 50 + 7.2.2. The belongs-to Statement . . . . . . . . . . . . . . 51 + 7.2.3. Usage Example . . . . . . . . . . . . . . . . . . . . 52 + 7.3. The typedef Statement . . . . . . . . . . . . . . . . . . 52 + 7.3.1. The typedef's Substatements . . . . . . . . . . . . . 53 + 7.3.2. The typedef's type Statement . . . . . . . . . . . . 53 + 7.3.3. The units Statement . . . . . . . . . . . . . . . . . 53 + 7.3.4. The typedef's default Statement . . . . . . . . . . . 53 + 7.3.5. Usage Example . . . . . . . . . . . . . . . . . . . . 54 + 7.4. The type Statement . . . . . . . . . . . . . . . . . . . 54 + 7.4.1. The type's Substatements . . . . . . . . . . . . . . 54 + 7.5. The container Statement . . . . . . . . . . . . . . . . . 54 + 7.5.1. Containers with Presence . . . . . . . . . . . . . . 55 + 7.5.2. The container's Substatements . . . . . . . . . . . . 55 + 7.5.3. The must Statement . . . . . . . . . . . . . . . . . 56 + 7.5.4. The must's Substatements . . . . . . . . . . . . . . 57 + 7.5.5. The presence Statement . . . . . . . . . . . . . . . 58 + 7.5.6. The container's Child Node Statements . . . . . . . . 58 + 7.5.7. XML Mapping Rules . . . . . . . . . . . . . . . . . . 58 + 7.5.8. NETCONF Operations . . . . . . . . . . 59 + 7.5.9. Usage Example . . . . . . . . . . . . . . . . . . . . 59 + 7.6. The leaf Statement . . . . . . . . . . . . . . . . . . . 60 + 7.6.1. The leaf's default value . . . . . . . . . . . . . . 61 + 7.6.2. The leaf's Substatements . . . . . . . . . . . . . . 61 + 7.6.3. The leaf's type Statement . . . . . . . . . . . . . . 62 + 7.6.4. The leaf's default Statement . . . . . . . . . . . . 62 + 7.6.5. The leaf's mandatory Statement . . . . . . . . . . . 62 + 7.6.6. XML Mapping Rules . . . . . . . . . . . . . . . . . . 62 + 7.6.7. NETCONF Operations . . . . . . . . . . 63 + 7.6.8. Usage Example . . . . . . . . . . . . . . . . . . . . 63 + 7.7. The leaf-list Statement . . . . . . . . . . . . . . . . . 64 + 7.7.1. Ordering . . . . . . . . . . . . . . . . . . . . . . 64 + 7.7.2. The leaf-list's Substatements . . . . . . . . . . . . 65 + 7.7.3. The min-elements Statement . . . . . . . . . . . . . 65 + 7.7.4. The max-elements Statement . . . . . . . . . . . . . 66 + 7.7.5. The ordered-by Statement . . . . . . . . . . . . . . 66 + 7.7.6. XML Mapping Rules . . . . . . . . . . . . . . . . . . 67 + 7.7.7. NETCONF Operations . . . . . . . . . . 67 + 7.7.8. Usage Example . . . . . . . . . . . . . . . . . . . . 68 + 7.8. The list Statement . . . . . . . . . . . . . . . . . . . 70 + 7.8.1. The list's Substatements . . . . . . . . . . . . . . 70 + 7.8.2. The list's key Statement . . . . . . . . . . . . . . 71 + 7.8.3. The list's unique Statement . . . . . . . . . . . . . 72 + 7.8.4. The list's Child Node Statements . . . . . . . . . . 73 + 7.8.5. XML Mapping Rules . . . . . . . . . . . . . . . . . . 73 + 7.8.6. NETCONF Operations . . . . . . . . . . 74 + 7.8.7. Usage Example . . . . . . . . . . . . . . . . . . . . 75 + 7.9. The choice Statement . . . . . . . . . . . . . . . . . . 78 + 7.9.1. The choice's Substatements . . . . . . . . . . . . . 78 + 7.9.2. The choice's case Statement . . . . . . . . . . . . . 79 + 7.9.3. The choice's default Statement . . . . . . . . . . . 80 + 7.9.4. The choice's mandatory Statement . . . . . . . . . . 82 + 7.9.5. XML Mapping Rules . . . . . . . . . . . . . . . . . . 82 + 7.9.6. NETCONF Operations . . . . . . . . . . 82 + 7.9.7. Usage Example . . . . . . . . . . . . . . . . . . . . 82 + 7.10. The anyxml Statement . . . . . . . . . . . . . . . . . . 83 + 7.10.1. The anyxml's Substatements . . . . . . . . . . . . . 84 + 7.10.2. XML Mapping Rules . . . . . . . . . . . . . . . . . 84 + 7.10.3. NETCONF Operations . . . . . . . . . . 84 + 7.10.4. Usage Example . . . . . . . . . . . . . . . . . . . 85 + 7.11. The grouping Statement . . . . . . . . . . . . . . . . . 85 + 7.11.1. The grouping's Substatements . . . . . . . . . . . . 86 + 7.11.2. Usage Example . . . . . . . . . . . . . . . . . . . 86 + 7.12. The uses Statement . . . . . . . . . . . . . . . . . . . 87 + 7.12.1. The uses's Substatements . . . . . . . . . . . . . . 87 + 7.12.2. The refine Statement . . . . . . . . . . . . . . . . 87 + 7.12.3. XML Mapping Rules . . . . . . . . . . . . . . . . . 88 + 7.12.4. Usage Example . . . . . . . . . . . . . . . . . . . 88 - 7.13. The rpc Statement . . . . . . . . . . . . . . . . . . . . 87 - 7.13.1. The rpc's Substatements . . . . . . . . . . . . . . 87 - 7.13.2. The input Statement . . . . . . . . . . . . . . . . 87 - 7.13.3. The output Statement . . . . . . . . . . . . . . . . 88 - 7.13.4. XML Mapping Rules . . . . . . . . . . . . . . . . . 89 - 7.13.5. Usage Example . . . . . . . . . . . . . . . . . . . 89 - 7.14. The notification Statement . . . . . . . . . . . . . . . 90 - 7.14.1. The notification's Substatements . . . . . . . . . . 91 - 7.14.2. XML Mapping Rules . . . . . . . . . . . . . . . . . 91 - 7.14.3. Usage Example . . . . . . . . . . . . . . . . . . . 91 - 7.15. The augment Statement . . . . . . . . . . . . . . . . . . 92 - 7.15.1. The augment's Substatements . . . . . . . . . . . . 93 - 7.15.2. XML Mapping Rules . . . . . . . . . . . . . . . . . 93 - 7.15.3. Usage Example . . . . . . . . . . . . . . . . . . . 93 - 7.16. The identity Statement . . . . . . . . . . . . . . . . . 95 - 7.16.1. The identity's Substatements . . . . . . . . . . . . 95 - 7.16.2. The base Statement . . . . . . . . . . . . . . . . . 96 - 7.16.3. Usage Example . . . . . . . . . . . . . . . . . . . 96 - 7.17. The extension Statement . . . . . . . . . . . . . . . . . 97 - 7.17.1. The extension's Substatements . . . . . . . . . . . 98 - 7.17.2. The argument Statement . . . . . . . . . . . . . . . 98 - 7.17.3. Usage Example . . . . . . . . . . . . . . . . . . . 99 - 7.18. Conformance-Related Statements . . . . . . . . . . . . . 99 - 7.18.1. The feature Statement . . . . . . . . . . . . . . . 99 - 7.18.2. The if-feature Statement . . . . . . . . . . . . . . 101 - 7.18.3. The deviation Statement . . . . . . . . . . . . . . 102 - 7.19. Common Statements . . . . . . . . . . . . . . . . . . . . 104 - 7.19.1. The config Statement . . . . . . . . . . . . . . . . 104 - 7.19.2. The status Statement . . . . . . . . . . . . . . . . 105 - 7.19.3. The description Statement . . . . . . . . . . . . . 106 - 7.19.4. The reference Statement . . . . . . . . . . . . . . 106 - 7.19.5. The when Statement . . . . . . . . . . . . . . . . . 106 - 8. Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 108 - 8.1. Constraints on Data . . . . . . . . . . . . . . . . . . . 108 - 8.2. Hierarchy of Constraints . . . . . . . . . . . . . . . . 108 - 8.3. Constraint Enforcement Model . . . . . . . . . . . . . . 108 - 8.3.1. Payload Parsing . . . . . . . . . . . . . . . . . . . 109 - 8.3.2. NETCONF Processing . . . . . . . . . . 109 - 8.3.3. Validation . . . . . . . . . . . . . . . . . . . . . 110 - 9. Built-In Types . . . . . . . . . . . . . . . . . . . . . . . 110 - 9.1. Canonical Representation . . . . . . . . . . . . . . . . 111 - 9.2. The Integer Built-In Types . . . . . . . . . . . . . . . 111 - 9.2.1. Lexical Representation . . . . . . . . . . . . . . . 112 - 9.2.2. Canonical Form . . . . . . . . . . . . . . . . . . . 112 - 9.2.3. Restrictions . . . . . . . . . . . . . . . . . . . . 113 - 9.2.4. The range Statement . . . . . . . . . . . . . . . . . 113 - 9.2.5. Usage Example . . . . . . . . . . . . . . . . . . . . 113 - 9.3. The decimal64 Built-In Type . . . . . . . . . . . . . . . 114 - 9.3.1. Lexical Representation . . . . . . . . . . . . . . . 114 - 9.3.2. Canonical Form . . . . . . . . . . . . . . . . . . . 114 - 9.3.3. Restrictions . . . . . . . . . . . . . . . . . . . . 115 - 9.3.4. The fraction-digits Statement . . . . . . . . . . . . 115 - 9.3.5. Usage Example . . . . . . . . . . . . . . . . . . . . 115 - 9.4. The string Built-In Type . . . . . . . . . . . . . . . . 116 - 9.4.1. Lexical Representation . . . . . . . . . . . . . . . 116 - 9.4.2. Canonical Form . . . . . . . . . . . . . . . . . . . 116 - 9.4.3. Restrictions . . . . . . . . . . . . . . . . . . . . 116 - 9.4.4. The length Statement . . . . . . . . . . . . . . . . 116 - 9.4.5. The pattern Statement . . . . . . . . . . . . . . . . 117 - 9.4.6. The modifier Statement . . . . . . . . . . . . . . . 118 - 9.4.7. Usage Example . . . . . . . . . . . . . . . . . . . . 118 - 9.5. The boolean Built-In Type . . . . . . . . . . . . . . . . 119 - 9.5.1. Lexical Representation . . . . . . . . . . . . . . . 119 - 9.5.2. Canonical Form . . . . . . . . . . . . . . . . . . . 119 - 9.5.3. Restrictions . . . . . . . . . . . . . . . . . . . . 119 - 9.6. The enumeration Built-In Type . . . . . . . . . . . . . . 119 - 9.6.1. Lexical Representation . . . . . . . . . . . . . . . 119 - 9.6.2. Canonical Form . . . . . . . . . . . . . . . . . . . 120 - 9.6.3. Restrictions . . . . . . . . . . . . . . . . . . . . 120 - 9.6.4. The enum Statement . . . . . . . . . . . . . . . . . 120 - 9.6.5. Usage Example . . . . . . . . . . . . . . . . . . . . 121 - 9.7. The bits Built-In Type . . . . . . . . . . . . . . . . . 121 - 9.7.1. Restrictions . . . . . . . . . . . . . . . . . . . . 121 - 9.7.2. Lexical Representation . . . . . . . . . . . . . . . 121 - 9.7.3. Canonical Form . . . . . . . . . . . . . . . . . . . 121 - 9.7.4. The bit Statement . . . . . . . . . . . . . . . . . . 121 - 9.7.5. Usage Example . . . . . . . . . . . . . . . . . . . . 122 - 9.8. The binary Built-In Type . . . . . . . . . . . . . . . . 123 - 9.8.1. Restrictions . . . . . . . . . . . . . . . . . . . . 123 - 9.8.2. Lexical Representation . . . . . . . . . . . . . . . 123 - 9.8.3. Canonical Form . . . . . . . . . . . . . . . . . . . 123 - 9.9. The leafref Built-In Type . . . . . . . . . . . . . . . . 123 - 9.9.1. Restrictions . . . . . . . . . . . . . . . . . . . . 124 - 9.9.2. The path Statement . . . . . . . . . . . . . . . . . 124 - 9.9.3. The require-instance Statement . . . . . . . . . . . 125 - 9.9.4. Lexical Representation . . . . . . . . . . . . . . . 125 - 9.9.5. Canonical Form . . . . . . . . . . . . . . . . . . . 125 - 9.9.6. Usage Example . . . . . . . . . . . . . . . . . . . . 125 - 9.10. The identityref Built-In Type . . . . . . . . . . . . . . 129 - 9.10.1. Restrictions . . . . . . . . . . . . . . . . . . . . 129 - 9.10.2. The identityref's base Statement . . . . . . . . . . 129 - 9.10.3. Lexical Representation . . . . . . . . . . . . . . . 130 - 9.10.4. Canonical Form . . . . . . . . . . . . . . . . . . . 130 - 9.10.5. Usage Example . . . . . . . . . . . . . . . . . . . 130 - 9.11. The empty Built-In Type . . . . . . . . . . . . . . . . . 132 - 9.11.1. Restrictions . . . . . . . . . . . . . . . . . . . . 132 - 9.11.2. Lexical Representation . . . . . . . . . . . . . . . 132 - 9.11.3. Canonical Form . . . . . . . . . . . . . . . . . . . 132 - 9.11.4. Usage Example . . . . . . . . . . . . . . . . . . . 132 - 9.12. The union Built-In Type . . . . . . . . . . . . . . . . . 132 - 9.12.1. Restrictions . . . . . . . . . . . . . . . . . . . . 133 - 9.12.2. Lexical Representation . . . . . . . . . . . . . . . 133 - 9.12.3. Canonical Form . . . . . . . . . . . . . . . . . . . 133 - 9.12.4. Usage Example . . . . . . . . . . . . . . . . . . . 133 - 9.13. The instance-identifier Built-In Type . . . . . . . . . . 134 - 9.13.1. Restrictions . . . . . . . . . . . . . . . . . . . . 135 - 9.13.2. Lexical Representation . . . . . . . . . . . . . . . 135 - 9.13.3. Canonical Form . . . . . . . . . . . . . . . . . . . 136 - 9.13.4. Usage Example . . . . . . . . . . . . . . . . . . . 136 - 10. XPath Functions . . . . . . . . . . . . . . . . . . . . . . . 136 - 10.1. Functions for Node Sets . . . . . . . . . . . . . . . . 136 - 10.1.1. current() . . . . . . . . . . . . . . . . . . . . . 136 - 10.2. Functions for Strings . . . . . . . . . . . . . . . . . 137 - 10.2.1. re-match() . . . . . . . . . . . . . . . . . . . . . 137 + 7.13. The rpc Statement . . . . . . . . . . . . . . . . . . . . 90 + 7.13.1. The rpc's Substatements . . . . . . . . . . . . . . 90 + 7.13.2. The input Statement . . . . . . . . . . . . . . . . 90 + 7.13.3. The output Statement . . . . . . . . . . . . . . . . 91 + 7.13.4. XML Mapping Rules . . . . . . . . . . . . . . . . . 92 + 7.13.5. Usage Example . . . . . . . . . . . . . . . . . . . 92 + 7.14. The notification Statement . . . . . . . . . . . . . . . 93 + 7.14.1. The notification's Substatements . . . . . . . . . . 94 + 7.14.2. XML Mapping Rules . . . . . . . . . . . . . . . . . 94 + 7.14.3. Usage Example . . . . . . . . . . . . . . . . . . . 94 + 7.15. The augment Statement . . . . . . . . . . . . . . . . . . 95 + 7.15.1. The augment's Substatements . . . . . . . . . . . . 96 + 7.15.2. XML Mapping Rules . . . . . . . . . . . . . . . . . 96 + 7.15.3. Usage Example . . . . . . . . . . . . . . . . . . . 96 + 7.16. The identity Statement . . . . . . . . . . . . . . . . . 98 + 7.16.1. The identity's Substatements . . . . . . . . . . . . 98 + 7.16.2. The base Statement . . . . . . . . . . . . . . . . . 99 + 7.16.3. Usage Example . . . . . . . . . . . . . . . . . . . 99 + 7.17. The extension Statement . . . . . . . . . . . . . . . . . 100 + 7.17.1. The extension's Substatements . . . . . . . . . . . 101 + 7.17.2. The argument Statement . . . . . . . . . . . . . . . 101 + 7.17.3. Usage Example . . . . . . . . . . . . . . . . . . . 102 + 7.18. Conformance-Related Statements . . . . . . . . . . . . . 102 + 7.18.1. The feature Statement . . . . . . . . . . . . . . . 102 + 7.18.2. The if-feature Statement . . . . . . . . . . . . . . 104 + 7.18.3. The deviation Statement . . . . . . . . . . . . . . 105 + 7.19. Common Statements . . . . . . . . . . . . . . . . . . . . 107 + 7.19.1. The config Statement . . . . . . . . . . . . . . . . 107 + 7.19.2. The status Statement . . . . . . . . . . . . . . . . 108 + 7.19.3. The description Statement . . . . . . . . . . . . . 109 + 7.19.4. The reference Statement . . . . . . . . . . . . . . 109 + 7.19.5. The when Statement . . . . . . . . . . . . . . . . . 109 + 8. Constraints . . . . . . . . . . . . . . . . . . . . . . . . . 110 + 8.1. Constraints on Data . . . . . . . . . . . . . . . . . . . 110 + 8.2. Hierarchy of Constraints . . . . . . . . . . . . . . . . 111 + 8.3. Constraint Enforcement Model . . . . . . . . . . . . . . 111 + 8.3.1. Payload Parsing . . . . . . . . . . . . . . . . . . . 111 + 8.3.2. NETCONF Processing . . . . . . . . . . 112 + 8.3.3. Validation . . . . . . . . . . . . . . . . . . . . . 113 + 9. Built-In Types . . . . . . . . . . . . . . . . . . . . . . . 113 + 9.1. Canonical Representation . . . . . . . . . . . . . . . . 113 + 9.2. The Integer Built-In Types . . . . . . . . . . . . . . . 114 + 9.2.1. Lexical Representation . . . . . . . . . . . . . . . 114 + 9.2.2. Canonical Form . . . . . . . . . . . . . . . . . . . 115 + 9.2.3. Restrictions . . . . . . . . . . . . . . . . . . . . 115 + 9.2.4. The range Statement . . . . . . . . . . . . . . . . . 115 + 9.2.5. Usage Example . . . . . . . . . . . . . . . . . . . . 116 + 9.3. The decimal64 Built-In Type . . . . . . . . . . . . . . . 116 + 9.3.1. Lexical Representation . . . . . . . . . . . . . . . 117 + 9.3.2. Canonical Form . . . . . . . . . . . . . . . . . . . 117 + 9.3.3. Restrictions . . . . . . . . . . . . . . . . . . . . 117 + 9.3.4. The fraction-digits Statement . . . . . . . . . . . . 117 + 9.3.5. Usage Example . . . . . . . . . . . . . . . . . . . . 118 + 9.4. The string Built-In Type . . . . . . . . . . . . . . . . 118 + 9.4.1. Lexical Representation . . . . . . . . . . . . . . . 118 + 9.4.2. Canonical Form . . . . . . . . . . . . . . . . . . . 119 + 9.4.3. Restrictions . . . . . . . . . . . . . . . . . . . . 119 + 9.4.4. The length Statement . . . . . . . . . . . . . . . . 119 + 9.4.5. The pattern Statement . . . . . . . . . . . . . . . . 120 + 9.4.6. The modifier Statement . . . . . . . . . . . . . . . 120 + 9.4.7. Usage Example . . . . . . . . . . . . . . . . . . . . 120 + 9.5. The boolean Built-In Type . . . . . . . . . . . . . . . . 121 + 9.5.1. Lexical Representation . . . . . . . . . . . . . . . 122 + 9.5.2. Canonical Form . . . . . . . . . . . . . . . . . . . 122 + 9.5.3. Restrictions . . . . . . . . . . . . . . . . . . . . 122 + 9.6. The enumeration Built-In Type . . . . . . . . . . . . . . 122 + 9.6.1. Lexical Representation . . . . . . . . . . . . . . . 122 + 9.6.2. Canonical Form . . . . . . . . . . . . . . . . . . . 122 + 9.6.3. Restrictions . . . . . . . . . . . . . . . . . . . . 122 + 9.6.4. The enum Statement . . . . . . . . . . . . . . . . . 122 + 9.6.5. Usage Example . . . . . . . . . . . . . . . . . . . . 123 + 9.7. The bits Built-In Type . . . . . . . . . . . . . . . . . 124 + 9.7.1. Restrictions . . . . . . . . . . . . . . . . . . . . 124 + 9.7.2. Lexical Representation . . . . . . . . . . . . . . . 124 + 9.7.3. Canonical Form . . . . . . . . . . . . . . . . . . . 124 + 9.7.4. The bit Statement . . . . . . . . . . . . . . . . . . 124 + 9.7.5. Usage Example . . . . . . . . . . . . . . . . . . . . 125 + 9.8. The binary Built-In Type . . . . . . . . . . . . . . . . 126 + 9.8.1. Restrictions . . . . . . . . . . . . . . . . . . . . 126 + 9.8.2. Lexical Representation . . . . . . . . . . . . . . . 126 + 9.8.3. Canonical Form . . . . . . . . . . . . . . . . . . . 126 + 9.9. The leafref Built-In Type . . . . . . . . . . . . . . . . 126 + 9.9.1. Restrictions . . . . . . . . . . . . . . . . . . . . 126 + 9.9.2. The path Statement . . . . . . . . . . . . . . . . . 127 + 9.9.3. The require-instance Statement . . . . . . . . . . . 127 + 9.9.4. Lexical Representation . . . . . . . . . . . . . . . 127 + 9.9.5. Canonical Form . . . . . . . . . . . . . . . . . . . 128 + 9.9.6. Usage Example . . . . . . . . . . . . . . . . . . . . 128 + 9.10. The identityref Built-In Type . . . . . . . . . . . . . . 131 + 9.10.1. Restrictions . . . . . . . . . . . . . . . . . . . . 131 + 9.10.2. The identityref's base Statement . . . . . . . . . . 131 + 9.10.3. Lexical Representation . . . . . . . . . . . . . . . 132 + 9.10.4. Canonical Form . . . . . . . . . . . . . . . . . . . 132 + 9.10.5. Usage Example . . . . . . . . . . . . . . . . . . . 132 + 9.11. The empty Built-In Type . . . . . . . . . . . . . . . . . 134 + 9.11.1. Restrictions . . . . . . . . . . . . . . . . . . . . 134 + 9.11.2. Lexical Representation . . . . . . . . . . . . . . . 134 + 9.11.3. Canonical Form . . . . . . . . . . . . . . . . . . . 134 + 9.11.4. Usage Example . . . . . . . . . . . . . . . . . . . 134 + 9.12. The union Built-In Type . . . . . . . . . . . . . . . . . 134 + 9.12.1. Restrictions . . . . . . . . . . . . . . . . . . . . 135 + 9.12.2. Lexical Representation . . . . . . . . . . . . . . . 135 + 9.12.3. Canonical Form . . . . . . . . . . . . . . . . . . . 135 + 9.12.4. Usage Example . . . . . . . . . . . . . . . . . . . 135 + 9.13. The instance-identifier Built-In Type . . . . . . . . . . 136 + 9.13.1. Restrictions . . . . . . . . . . . . . . . . . . . . 137 + 9.13.2. Lexical Representation . . . . . . . . . . . . . . . 137 + 9.13.3. Canonical Form . . . . . . . . . . . . . . . . . . . 137 + 9.13.4. Usage Example . . . . . . . . . . . . . . . . . . . 137 + 10. XPath Functions . . . . . . . . . . . . . . . . . . . . . . . 138 + 10.1. Functions for Node Sets . . . . . . . . . . . . . . . . 138 + 10.1.1. current() . . . . . . . . . . . . . . . . . . . . . 138 + 10.2. Functions for Strings . . . . . . . . . . . . . . . . . 138 + 10.2.1. re-match() . . . . . . . . . . . . . . . . . . . . . 138 10.3. Functions for the YANG Types "leafref" and "instance- - identifier" . . . . . . . . . . . . . . . . . . . . . . 137 - 10.3.1. deref() . . . . . . . . . . . . . . . . . . . . . . 137 - 10.4. Functions for the YANG Type "identityref" . . . . . . . 138 - 10.4.1. derived-from() . . . . . . . . . . . . . . . . . . . 138 - 10.5. Functions for the YANG Type "enumeration" . . . . . . . 139 - 10.5.1. enum-value() . . . . . . . . . . . . . . . . . . . . 139 - 10.6. Functions for the YANG Type "bits" . . . . . . . . . . . 140 - 10.6.1. bit-is-set() . . . . . . . . . . . . . . . . . . . . 140 - 11. Updating a Module . . . . . . . . . . . . . . . . . . . . . . 141 - 12. YIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 - 12.1. Formal YIN Definition . . . . . . . . . . . . . . . . . 143 - 12.1.1. Usage Example . . . . . . . . . . . . . . . . . . . 146 - 13. YANG ABNF Grammar . . . . . . . . . . . . . . . . . . . . . . 147 - 14. Error Responses for YANG Related Errors . . . . . . . . . . . 170 - 14.1. Error Message for Data That Violates a unique Statement 170 + identifier" . . . . . . . . . . . . . . . . . . . . . . 139 + 10.3.1. deref() . . . . . . . . . . . . . . . . . . . . . . 139 + 10.4. Functions for the YANG Type "identityref" . . . . . . . 140 + 10.4.1. derived-from() . . . . . . . . . . . . . . . . . . . 140 + 10.5. Functions for the YANG Type "enumeration" . . . . . . . 141 + 10.5.1. enum-value() . . . . . . . . . . . . . . . . . . . . 141 + 10.6. Functions for the YANG Type "bits" . . . . . . . . . . . 142 + 10.6.1. bit-is-set() . . . . . . . . . . . . . . . . . . . . 142 + 11. Updating a Module . . . . . . . . . . . . . . . . . . . . . . 143 + 12. YIN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 + 12.1. Formal YIN Definition . . . . . . . . . . . . . . . . . 145 + 12.1.1. Usage Example . . . . . . . . . . . . . . . . . . . 148 + 13. YANG ABNF Grammar . . . . . . . . . . . . . . . . . . . . . . 149 + 14. Error Responses for YANG Related Errors . . . . . . . . . . . 172 + 14.1. Error Message for Data That Violates a unique Statement 173 14.2. Error Message for Data That Violates a max-elements - Statement . . . . . . . . . . . . . . . . . . . . . . . 170 + Statement . . . . . . . . . . . . . . . . . . . . . . . 173 14.3. Error Message for Data That Violates a min-elements - Statement . . . . . . . . . . . . . . . . . . . . . . . 170 - 14.4. Error Message for Data That Violates a must Statement . 171 + Statement . . . . . . . . . . . . . . . . . . . . . . . 173 + 14.4. Error Message for Data That Violates a must Statement . 173 14.5. Error Message for Data That Violates a require-instance - Statement . . . . . . . . . . . . . . . . . . . . . . . 171 + Statement . . . . . . . . . . . . . . . . . . . . . . . 174 14.6. Error Message for Data That Does Not Match a leafref - Type . . . . . . . . . . . . . . . . . . . . . . . . . . 171 + Type . . . . . . . . . . . . . . . . . . . . . . . . . . 174 14.7. Error Message for Data That Violates a mandatory choice - Statement . . . . . . . . . . . . . . . . . . . . . . . 171 - 14.8. Error Message for the "insert" Operation . . . . . . . . 172 - 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 172 - 15.1. Media type application/yang . . . . . . . . . . . . . . 173 - 15.2. Media type application/yin+xml . . . . . . . . . . . . . 174 - 16. Security Considerations . . . . . . . . . . . . . . . . . . . 176 - 17. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 176 - 18. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 177 - 19. ChangeLog . . . . . . . . . . . . . . . . . . . . . . . . . . 177 - 19.1. Version -01 . . . . . . . . . . . . . . . . . . . . . . 177 - 19.2. Version -00 . . . . . . . . . . . . . . . . . . . . . . 177 - 20. References . . . . . . . . . . . . . . . . . . . . . . . . . 177 - 20.1. Normative References . . . . . . . . . . . . . . . . . . 178 - 20.2. Informative References . . . . . . . . . . . . . . . . . 179 - Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 179 + Statement . . . . . . . . . . . . . . . . . . . . . . . 174 + 14.8. Error Message for the "insert" Operation . . . . . . . . 174 + 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 175 + 15.1. Media type application/yang . . . . . . . . . . . . . . 176 + 15.2. Media type application/yin+xml . . . . . . . . . . . . . 176 + 16. Security Considerations . . . . . . . . . . . . . . . . . . . 178 + 17. Contributors . . . . . . . . . . . . . . . . . . . . . . . . 178 + 18. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 179 + 19. ChangeLog . . . . . . . . . . . . . . . . . . . . . . . . . . 179 + 19.1. Version -02 . . . . . . . . . . . . . . . . . . . . . . 179 + 19.2. Version -01 . . . . . . . . . . . . . . . . . . . . . . 179 + 19.3. Version -00 . . . . . . . . . . . . . . . . . . . . . . 180 + 20. References . . . . . . . . . . . . . . . . . . . . . . . . . 180 + 20.1. Normative References . . . . . . . . . . . . . . . . . . 180 + 20.2. Informative References . . . . . . . . . . . . . . . . . 181 + Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 182 1. Introduction YANG is a data modeling language used to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF remote procedure calls, and NETCONF notifications. YANG is used to model the operations and content layers of NETCONF (see the NETCONF Configuration Protocol [RFC6241], Section 1.2). This document describes the syntax and semantics of the YANG @@ -360,33 +361,43 @@ are used to manipulate the data. 1.1. Summary of Changes from RFC 6020 This document defines version 1.1 of the YANG language. YANG version 1.1 is a maintenance release of the YANG language, addressing ambiguities and defects in the original specification [RFC6020]. o Changed the YANG version from "1" to "1.1". + o Made noncharacters illegal in the built-in type "string". + + o Defined the legal characters in YANG modules. + o Made the "yang-version" statement mandatory. o Changed the rules for the interpretation of escaped characters in double quoted strings. This is an backwards incompatible change from YANG 1.0. A module that uses a character sequence that is now illegal must change the string to match the new rules. See Section 6.1.3 for details. o Extended the "if-feature" syntax to be a boolean expression over feature names. + o Allow "if-feature" in "bit", "enum", and "identity". + o Added a set of new XPath functions in Section 10. + o Clarified the XPath context's tree in Section 6.4.1. + + o Allow "must" in "input", "output", and "notification". + o Added a new substatement "modifier" to pattern (see Section 9.4.6). o Defined the string value of an identityref in XPath expressions (see Section 9.10). o Allow "if-feature" in "refine". o Made "when" and "if-feature" illegal on list keys, unless the parent is also conditional, and the condition matches the parent's @@ -1558,20 +1569,26 @@ 6. YANG Syntax The YANG syntax is similar to that of SMIng [RFC3780] and programming languages like C and C++. This C-like syntax was chosen specifically for its readability, since YANG values the time and effort of the readers of models above those of modules writers and YANG tool-chain developers. This section introduces the YANG syntax. YANG modules use the UTF-8 [RFC3629] character encoding. + Legal characters in YANG modules are the Unicode and ISO/IEC 10646 + [ISO.10646] characters, including tab, carriage return, and line feed + but excluding the other C0 control characters, the surrogate blocks, + and the noncharacters. The character syntax is formally defined by + the rule "yang-char" in Section 13. + 6.1. Lexical Tokenization YANG modules are parsed as a series of tokens. This section details the rules for recognizing tokens from an input stream. YANG tokenization rules are both simple and powerful. The simplicity is driven by a need to keep the parsers easy to implement, while the power is driven by the fact that modelers need to express their models in readable formats. 6.1.1. Comments @@ -1779,20 +1796,64 @@ o The function library is the core function library defined in [XPATH], and the functions defined in Section 10. o The set of variable bindings is empty. The mechanism for handling unprefixed names is adopted from XPath 2.0 [XPATH2.0], and helps simplify XPath expressions in YANG. No ambiguity may ever arise because YANG node identifiers are always qualified names with a non-null namespace URI. + The accessible tree depends on where the statement with the XPath + expression is defined: + + o If the XPath expression is defined in substatement to a data node + that represents configuration, the accessible tree is the data in + the NETCONF datastore where the context node exists. The root + node has all top-level configuration data nodes in all modules as + children. + + o If the XPath expression is defined in a substatement to a data + node that represents state data, the accessible tree is all all + state data on the device, and the "running" datastore. The root + node has all top-level data nodes in all modules as children. + + o If the XPath expression is defined in a substatement to a + "notification" statement, the accessible tree is the notification + instance, all state data on the device, and the "running" + datastore. The root node has the node representing the + notification being defined and all top-level data nodes in all + modules as children. + + o If the XPath expression is defined in a substatement to an "input" + statement in an "rpc" statement, the accessible tree is the RPC + operation instance, all state data on the device, and the + "running" datastore. The root node has the node representing the + operation being defined and all top-level data nodes in all + modules as children. The node representing the operation being + defined has the operation's input parameters as children. + + o If the XPath expression is defined in a substatement to an + "output" statement in an "rpc" statement, the accessible tree is + the RPC operation's output, all state data on the device, and the + "running" datastore. The root node has the node representing the + operation being defined and all top-level data nodes in all + modules as children. The node representing the operation being + defined has the operation's output parameters as children. + + In the accessible tree, all leafs with default values in use exist + (See Section 7.6.1). + + If a node that exists in the accessible tree has a non-presence + container as a child, then the non-presence container also exists in + the tree. + The context node varies with the YANG XPath expression, and is specified where the YANG statement with the XPath expression is defined. 6.5. Schema Node Identifier A schema node identifier is a string that identifies a node in the schema tree. It has two forms, "absolute" and "descendant", defined by the rules "absolute-schema-nodeid" and "descendant-schema-nodeid" in Section 13, respectively. A schema node identifier consists of a @@ -2412,50 +2472,22 @@ conceptually evaluated once for each data node in the data tree, and for all leafs with default values in use (see Section 7.6.1). If a data node does not exist in the data tree, and it does not have a default value, its "must" statements are not evaluated. All such constraints MUST evaluate to true for the data to be valid. The XPath expression is conceptually evaluated in the following context, in addition to the definition in Section 6.4.1: - o The context node is the node in the data tree for which the "must" - statement is defined. - - o The accessible tree is made up of all nodes in the data tree, and - all leafs with default values in use (see Section 7.6.1). - - The accessible tree depends on the context node: - - o If the context node represents configuration, the tree is the data - in the NETCONF datastore where the context node exists. The XPath - root node has all top-level configuration data nodes in all - modules as children. - - o If the context node represents state data, the tree is all state - data on the device, and the "running" datastore. The XPath root - node has all top-level data nodes in all modules as children. - - o If the context node represents notification content, the tree is - the notification XML instance document. The XPath root node has - the element representing the notification being defined as the - only child. - - o If the context node represents RPC input parameters, the tree is - the RPC XML instance document. The XPath root node has the - element representing the RPC operation being defined as the only - child. - - o If the context node represents RPC output parameters, the tree is - the RPC reply instance document. The XPath root node has the - elements representing the RPC output parameters as children. + o The context node is the node in the accessible tree for which the + "must" statement is defined. The result of the XPath expression is converted to a boolean value using the standard XPath rules. Note that since all leaf values in the data tree are conceptually stored in their canonical form (see Section 7.6 and Section 7.7), any XPath comparisons are done on the canonical value. Also note that the XPath expression is conceptually evaluated. This means that an implementation does not have to use an XPath evaluator @@ -3970,20 +4002,21 @@ +--------------+---------+-------------+ | substatement | section | cardinality | +--------------+---------+-------------+ | anyxml | 7.10 | 0..n | | choice | 7.9 | 0..n | | container | 7.5 | 0..n | | grouping | 7.11 | 0..n | | leaf | 7.6 | 0..n | | leaf-list | 7.7 | 0..n | | list | 7.8 | 0..n | + | must | 7.5.3 | 0..n | | typedef | 7.3 | 0..n | | uses | 7.12 | 0..n | +--------------+---------+-------------+ 7.13.3. The output Statement The "output" statement, which is optional, is used to define output parameters to the RPC operation. It does not take an argument. The substatements to "output" define nodes under the RPC's output node. @@ -4007,20 +4040,21 @@ +--------------+---------+-------------+ | substatement | section | cardinality | +--------------+---------+-------------+ | anyxml | 7.10 | 0..n | | choice | 7.9 | 0..n | | container | 7.5 | 0..n | | grouping | 7.11 | 0..n | | leaf | 7.6 | 0..n | | leaf-list | 7.7 | 0..n | | list | 7.8 | 0..n | + | must | 7.5.3 | 0..n | | typedef | 7.3 | 0..n | | uses | 7.12 | 0..n | +--------------+---------+-------------+ 7.13.4. XML Mapping Rules An rpc node is encoded as a child XML element to the element defined in [RFC6241]. The element's local name is the rpc's identifier, and its namespace is the module's XML namespace (see Section 7.1.3). @@ -4095,20 +4129,21 @@ +--------------+---------+-------------+ | anyxml | 7.10 | 0..n | | choice | 7.9 | 0..n | | container | 7.5 | 0..n | | description | 7.19.3 | 0..1 | | grouping | 7.11 | 0..n | | if-feature | 7.18.2 | 0..n | | leaf | 7.6 | 0..n | | leaf-list | 7.7 | 0..n | | list | 7.8 | 0..n | + | must | 7.5.3 | 0..n | | reference | 7.19.4 | 0..1 | | status | 7.19.2 | 0..1 | | typedef | 7.3 | 0..n | | uses | 7.12 | 0..n | +--------------+---------+-------------+ 7.14.2. XML Mapping Rules A notification node is encoded as a child XML element to the element defined in NETCONF Event Notifications @@ -4306,20 +4341,21 @@ The built-in datatype "identityref" (see Section 9.10) can be used to reference identities within a data model. 7.16.1. The identity's Substatements +--------------+---------+-------------+ | substatement | section | cardinality | +--------------+---------+-------------+ | base | 7.16.2 | 0..1 | | description | 7.19.3 | 0..1 | + | if-feature | 7.18.2 | 0..n | | reference | 7.19.4 | 0..1 | | status | 7.19.2 | 0..1 | +--------------+---------+-------------+ 7.16.2. The base Statement The "base" statement, which is optional, takes as an argument a string that is the name of an existing identity, from which the new identity is derived. If no "base" statement is present, the identity is defined from scratch. @@ -4827,50 +4863,22 @@ the target node is a data node. Otherwise, the context node is the closest ancestor node to the target node that is also a data node. o If the "when" statement is a child of a "uses", "choice", or "case" statement, then the context node is the closest ancestor node to the "uses", "choice", or "case" node that is also a data node. o If the "when" statement is a child of any other data definition - statement, the context node is the data definition's node in the - data tree. - - o The accessible tree is made up of all nodes in the data tree, and - all leafs with default values in use (see Section 7.6.1). - - The accessible tree depends on the context node: - - o If the context node represents configuration, the tree is the data - in the NETCONF datastore where the context node exists. The XPath - root node has all top-level configuration data nodes in all - modules as children. - - o If the context node represents state data, the tree is all state - data on the device, and the "running" datastore. The XPath root - node has all top-level data nodes in all modules as children. - - o If the context node represents notification content, the tree is - the notification XML instance document. The XPath root node has - the element representing the notification being defined as the - only child. - - o If the context node represents RPC input parameters, the tree is - the RPC XML instance document. The XPath root node has the - element representing the RPC operation being defined as the only - child. - - o If the context node represents RPC output parameters, the tree is - the RPC reply instance document. The XPath root node has the - elements representing the RPC output parameters as children. + statement, the context node is the node in the accessible tree for + which the "when" statement is defined. The result of the XPath expression is converted to a boolean value using the standard XPath rules. Note that the XPath expression is conceptually evaluated. This means that an implementation does not have to use an XPath evaluator on the device. The "when" statement can very well be implemented with specially written code. 8. Constraints @@ -5237,28 +5247,25 @@ typedef my-decimal { type decimal64 { fraction-digits 2; range "1 .. 3.14 | 10 | 20..max"; } } 9.4. The string Built-In Type The string built-in type represents human-readable strings in YANG. - Legal characters are tab, carriage return, line feed, and the legal - characters of Unicode and ISO/IEC 10646 [ISO.10646]: - - ;; any Unicode character, excluding the surrogate blocks, - ;; FFFE, and FFFF. - string = *char - char = %x9 / %xA / %xD / %x20-D7FF / %xE000-FFFD / - %x10000-10FFFF + Legal characters are the Unicode and ISO/IEC 10646 [ISO.10646] + characters, including tab, carriage return, and line feed but + excluding the other C0 control characters, the surrogate blocks, and + the noncharacters. The string syntax is formally defined by the rule + "yang-string" in Section 13. 9.4.1. Lexical Representation A string value is lexically represented as character data in the XML instance documents. 9.4.2. Canonical Form The canonical form is the same as the lexical representation. No Unicode normalization is performed of string values. @@ -5447,20 +5454,21 @@ holds detailed enum information. All assigned names in an enumeration MUST be unique. 9.6.4.1. The enum's Substatements +--------------+---------+-------------+ | substatement | section | cardinality | +--------------+---------+-------------+ | description | 7.19.3 | 0..1 | + | if-feature | 7.18.2 | 0..n | | reference | 7.19.4 | 0..1 | | status | 7.19.2 | 0..1 | | value | 9.6.4.2 | 0..1 | +--------------+---------+-------------+ 9.6.4.2. The value Statement The "value" statement, which is optional, is used to associate an integer value with the assigned name for the enum. This integer value MUST be in the range -2147483648 to 2147483647, and it MUST be @@ -5528,20 +5536,21 @@ identifier (see Section 6.2). All assigned names in a bits type MUST be unique. 9.7.4.1. The bit's Substatements +--------------+---------+-------------+ | substatement | section | cardinality | +--------------+---------+-------------+ | description | 7.19.3 | 0..1 | + | if-feature | 7.18.2 | 0..n | | reference | 7.19.4 | 0..1 | | status | 7.19.2 | 0..1 | | position | 9.7.4.2 | 0..1 | +--------------+---------+-------------+ 9.7.4.2. The position Statement The "position" statement, which is optional, takes as an argument a non-negative integer value that specifies the bit's position within a hypothetical bit field. The position value MUST be in the range 0 to @@ -5654,31 +5663,20 @@ The "path" expression evaluates to a node set consisting of zero, one, or more nodes. If the leaf with the leafref type represents configuration data, this node set MUST be non-empty. The "path" XPath expression is conceptually evaluated in the following context, in addition to the definition in Section 6.4.1: o The context node is the node in the data tree for which the "path" statement is defined. - The accessible tree depends on the context node: - - o If the context node represents configuration data, the tree is the - data in the NETCONF datastore where the context node exists. The - XPath root node has all top-level configuration data nodes in all - modules as children. - - o Otherwise, the tree is all state data on the device, and the - "running" datastore. The XPath root node has all top-level data - nodes in all modules as children. - 9.9.3. The require-instance Statement The "require-instance" statement, which is a substatement to the "type" statement, MAY be present if the type is "instance-identifier" or "leafref". It takes as an argument the string "true" or "false". If this statement is not present, it defaults to "true". If "require-instance" is "true", it means that the instance being referred MUST exist for the data to be valid. This constraint is enforced according to the rules in Section 8. @@ -5909,21 +5907,21 @@ base "crypto:crypto-alg"; } leaf crypto { type identityref { base "crypto:crypto-alg"; } } container aes-parameters { - when "../crypto = 'mc:aes'; + when "../crypto = 'mc:aes'"; ... } } the following is an example how the leaf "crypto" can be encoded, if the value is the "des3" identity defined in the "des" module: des:des3 Any prefixes used in the encoding are local to each instance @@ -6087,32 +6085,20 @@ their default value in use (see Section 7.6.1) for the data to be valid. This constraint is enforced according to the rules in Section 8. The "instance-identifier" XPath expression is conceptually evaluated in the following context, in addition to the definition in Section 6.4.1: o The context node is the root node in the accessible tree. - The accessible tree depends on the leaf with the instance-identifier - type: - - o If this leaf represents configuration data, the tree is the data - in the NETCONF datastore where the leaf exists. The XPath root - node has all top-level configuration data nodes in all modules as - children. - - o Otherwise, the tree is all state data on the device, and the - "running" datastore. The XPath root node has all top-level data - nodes in all modules as children. - 9.13.1. Restrictions An instance-identifier can be restricted with the "require-instance" statement (Section 9.9.3). 9.13.2. Lexical Representation An instance-identifier value is lexically represented as a string. All node names in an instance-identifier value MUST be qualified with explicit namespace prefixes, and these prefixes MUST be declared in @@ -6802,25 +6787,26 @@ yin-element-arg-str = < a string that matches the rule yin-element-arg > yin-element-arg = true-keyword / false-keyword identity-stmt = identity-keyword sep identifier-arg-str optsep (";" / "{" stmtsep ;; these stmts can appear in any order + *(if-feature-stmt stmtsep) [base-stmt stmtsep] [status-stmt stmtsep] [description-stmt stmtsep] - [reference-stmt stmtsep] + [reference-stmt stmtsep] "}") base-stmt = base-keyword sep identifier-ref-arg-str optsep stmtend feature-stmt = feature-keyword sep identifier-arg-str optsep (";" / "{" stmtsep ;; these stmts can appear in any order *(if-feature-stmt stmtsep) @@ -6828,21 +6814,21 @@ [description-stmt stmtsep] [reference-stmt stmtsep] "}") if-feature-stmt = if-feature-keyword sep if-feature-expr-str optsep stmtend if-feature-expr-str = < a string that matches the rule if-feature-expr > - if-feature-expr = '(' if-fature-expr ')' / + if-feature-expr = '(' if-feature-expr ')' / if-feature-expr sep boolean-operator sep if-feature-expr / 'not' sep if-feature-expr / identifier-ref-arg boolean-operator = 'and' / 'or' typedef-stmt = typedef-keyword sep identifier-arg-str optsep "{" stmtsep ;; these stmts can appear in any order @@ -6930,20 +6917,21 @@ modifier-arg = invert-match-keyword default-stmt = default-keyword sep string stmtend enum-specification = 1*(enum-stmt stmtsep) enum-stmt = enum-keyword sep string optsep (";" / "{" stmtsep ;; these stmts can appear in any order + *(if-feature-stmt stmtsep) [value-stmt stmtsep] [status-stmt stmtsep] [description-stmt stmtsep] [reference-stmt stmtsep] "}") leafref-specification = ;; these stmts can appear in any order path-stmt stmtsep [require-instance-stmt stmtsep] @@ -6966,20 +6955,21 @@ union-specification = 1*(type-stmt stmtsep) binary-specification = [length-stmt stmtsep] bits-specification = 1*(bit-stmt stmtsep) bit-stmt = bit-keyword sep identifier-arg-str optsep (";" / "{" stmtsep ;; these stmts can appear in any order + *(if-feature-stmt stmtsep) [position-stmt stmtsep] [status-stmt stmtsep] [description-stmt stmtsep] [reference-stmt stmtsep] "}") position-stmt = position-keyword sep position-value-arg-str stmtend position-value-arg-str = < a string that matches the rule @@ -7289,39 +7279,42 @@ [reference-stmt stmtsep] *((typedef-stmt / grouping-stmt) stmtsep) [input-stmt stmtsep] [output-stmt stmtsep] "}") input-stmt = input-keyword optsep "{" stmtsep ;; these stmts can appear in any order + *(must-stmt stmtsep) *((typedef-stmt / grouping-stmt) stmtsep) 1*(data-def-stmt stmtsep) "}" output-stmt = output-keyword optsep "{" stmtsep ;; these stmts can appear in any order + *(must-stmt stmtsep) *((typedef-stmt / grouping-stmt) stmtsep) 1*(data-def-stmt stmtsep) "}" notification-stmt = notification-keyword sep identifier-arg-str optsep (";" / "{" stmtsep ;; these stmts can appear in any order *(if-feature-stmt stmtsep) + *(must-stmt stmtsep) [status-stmt stmtsep] [description-stmt stmtsep] [reference-stmt stmtsep] *((typedef-stmt / grouping-stmt) stmtsep) *(data-def-stmt stmtsep) "}") deviation-stmt = deviation-keyword sep deviation-arg-str optsep @@ -7389,24 +7382,28 @@ add-keyword-str = < a string that matches the rule add-keyword> delete-keyword-str = < a string that matches the rule delete-keyword> replace-keyword-str = < a string that matches the rule replace-keyword> + ;; represents the usage of an extension statement unknown-statement = prefix ":" identifier [sep string] optsep - (";" / "{" *(yang-stmt stmtsep) "}") + (";" / + "{" optsep + *((yang-stmt / unknown-statement) optsep) + "}") - yang-stmt = (anyxml-stmt / + yang-stmt = anyxml-stmt / argument-stmt / augment-stmt / base-stmt / belongs-to-stmt / bit-stmt / case-stmt / choice-stmt / config-stmt / contact-stmt / container-stmt / @@ -7430,20 +7427,21 @@ include-stmt / input-stmt / key-stmt / leaf-list-stmt / leaf-stmt / length-stmt / list-stmt / mandatory-stmt / max-elements-stmt / min-elements-stmt / + modifier-stmt / module-stmt / must-stmt / namespace-stmt / notification-stmt / ordered-by-stmt / organization-stmt / output-stmt / path-stmt / pattern-stmt / position-stmt / @@ -7460,21 +7458,21 @@ submodule-stmt / typedef-stmt / type-stmt / unique-stmt / units-stmt / uses-augment-stmt / uses-stmt / value-stmt / when-stmt / yang-version-stmt / - yin-element-stmt) + yin-element-stmt ;; Ranges range-arg-str = < a string that matches the rule range-arg > range-arg = range-part *(optsep "|" optsep range-part) range-part = range-boundary [optsep ".." optsep range-boundary] @@ -7634,21 +7631,21 @@ not-supported-keyword = 'not-supported' obsolete-keyword = 'obsolete' replace-keyword = 'replace' system-keyword = 'system' true-keyword = 'true' unbounded-keyword = 'unbounded' user-keyword = 'user' current-function-invocation = current-keyword *WSP "(" *WSP ")" - ;; Basic Rules + ;;; Basic Rules prefix-arg-str = < a string that matches the rule prefix-arg > prefix-arg = prefix prefix = identifier identifier-arg-str = < a string that matches the rule identifier-arg > @@ -7658,21 +7655,48 @@ ;; An identifier MUST NOT start with (('X'|'x') ('M'|'m') ('L'|'l')) identifier = (ALPHA / "_") *(ALPHA / DIGIT / "_" / "-" / ".") identifier-ref-arg-str = < a string that matches the rule identifier-ref-arg > identifier-ref-arg = [prefix ":"] identifier string = < an unquoted string as returned by - the scanner > + the scanner, that matches the rule + yang-string > + + yang-string = *yang-char + + ;; any Unicode character including tab, carriage return, and line + ;; feed, but excluding the other C0 control characters, the surrogate + ;; blocks, and the noncharacters. + yang-char = %x9 / %xA / %xD / %x20-D7FF / + ; exclude surrogate blocks %xD800-DFFF + %xE000-FDCF / ; exclude noncharacters %xFDD0-FDEF + %xFDF0-FFFD / ; exclude noncharacters %xFFFE-FFFF + %x10000-1FFFD / ; exclude noncharacters %x1FFFE-1FFFF + %x20000-2FFFD / ; exclude noncharacters %x2FFFE-2FFFF + %x30000-3FFFD / ; exclude noncharacters %x3FFFE-3FFFF + %x40000-4FFFD / ; exclude noncharacters %x4FFFE-4FFFF + %x50000-5FFFD / ; exclude noncharacters %x5FFFE-5FFFF + %x60000-6FFFD / ; exclude noncharacters %x6FFFE-6FFFF + %x70000-7FFFD / ; exclude noncharacters %x7FFFE-7FFFF + %x80000-8FFFD / ; exclude noncharacters %x8FFFE-8FFFF + %x90000-9FFFD / ; exclude noncharacters %x9FFFE-9FFFF + %xA0000-AFFFD / ; exclude noncharacters %xAFFFE-AFFFF + %xB0000-BFFFD / ; exclude noncharacters %xBFFFE-BFFFF + %xC0000-CFFFD / ; exclude noncharacters %xCFFFE-CFFFF + %xD0000-DFFFD / ; exclude noncharacters %xDFFFE-DFFFF + %xE0000-EFFFD / ; exclude noncharacters %xEFFFE-EFFFF + %xF0000-FFFFD / ; exclude noncharacters %xFFFFE-FFFFF + %x100000-10FFFD ; exclude noncharacters %x10FFFE-10FFFF integer-value = ("-" non-negative-integer-value) / non-negative-integer-value non-negative-integer-value = "0" / positive-integer-value positive-integer-value = (non-zero-digit *DIGIT) zero-integer-value = 1*DIGIT @@ -7686,23 +7711,21 @@ line-break = CRLF / LF non-zero-digit = %x31-39 decimal-value = integer-value ("." zero-integer-value) SQUOTE = %x27 ; ' (Single Quote) - ;; - ;; RFC 5234 core rules. - ;; + ;;; RFC 5234 core rules. ALPHA = %x41-5A / %x61-7A ; A-Z / a-z CR = %x0D ; carriage return CRLF = CR LF ; Internet standard new line @@ -8023,21 +8047,33 @@ The editor wishes to thank the following individuals, who all provided helpful comments on various versions of this document: Mehmet Ersue, Washam Fan, Joel Halpern, Leif Johansson, Ladislav Lhotka, Gerhard Muenz, Tom Petch, Randy Presuhn, David Reid, and Bert Wijnen. 19. ChangeLog RFC Editor: remove this section upon publication as an RFC. -19.1. Version -01 +19.1. Version -02 + + o Included solution Y02-01. + + o Included solution Y04-02. + + o Included solution Y11-01. + + o Included solution Y41-01. + + o Included solution Y56-01. + +19.2. Version -01 o Included solution Y01-01. o Included solution Y03-01. o Included solution Y06-02. o Included solution Y07-01. o Included solution Y14-01. @@ -8047,28 +8083,29 @@ o Included solution Y23-01. o Included solution Y29-01. o Included solution Y30-01. o Included solution Y31-01. o Included solution Y35-01. -19.2. Version -00 +19.3. Version -00 o Applied all reported errata for RFC 6020. o Updated YANG version to 1.1, and made the "yang-version" statement mandatory. 20. References + 20.1. Normative References [ISO.10646] International Organization for Standardization, "Information Technology - Universal Multiple-Octet Coded Character Set (UCS)", ISO Standard 10646:2003, 2003. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.