| < draft-ietf-core-yang-cbor-02.txt | draft-ietf-core-yang-cbor-03.txt > | |||
|---|---|---|---|---|
| Internet Engineering Task Force M. Veillette, Ed. | Internet Engineering Task Force M. Veillette, Ed. | |||
| Internet-Draft Trilliant Networks Inc. | Internet-Draft Trilliant Networks Inc. | |||
| Intended status: Standards Track A. Pelov, Ed. | Intended status: Standards Track A. Pelov, Ed. | |||
| Expires: January 9, 2017 Acklio | Expires: May 4, 2017 Acklio | |||
| A. Somaraju | A. Somaraju | |||
| Tridonic GmbH & Co KG | Tridonic GmbH & Co KG | |||
| R. Turner | R. Turner | |||
| Landis+Gyr | Landis+Gyr | |||
| A. Minaburo | A. Minaburo | |||
| Acklio | Acklio | |||
| July 08, 2016 | October 31, 2016 | |||
| CBOR Encoding of Data Modeled with YANG | CBOR Encoding of Data Modeled with YANG | |||
| draft-ietf-core-yang-cbor-02 | draft-ietf-core-yang-cbor-03 | |||
| Abstract | Abstract | |||
| This document defines encoding rules for serializing configuration | This document defines encoding rules for serializing configuration | |||
| data, state data, RPC input and RPC output, Action input, Action | data, state data, RPC input and RPC output, Action input, Action | |||
| output and notifications defined within YANG modules using the | output and notifications defined within YANG modules using the | |||
| Concise Binary Object Representation (CBOR) [RFC7049]. | Concise Binary Object Representation (CBOR) [RFC7049]. | |||
| Status of This Memo | Status of This Memo | |||
| skipping to change at page 1, line 40 ¶ | skipping to change at page 1, line 40 ¶ | |||
| 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 January 9, 2017. | This Internet-Draft will expire on May 4, 2017. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2016 IETF Trust and the persons identified as the | Copyright (c) 2016 IETF Trust and the persons identified as the | |||
| document authors. All rights reserved. | document authors. All rights reserved. | |||
| This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
| Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
| (http://trustee.ietf.org/license-info) in effect on the date of | (http://trustee.ietf.org/license-info) in effect on the date of | |||
| publication of this document. Please review these documents | publication of this document. Please review these documents | |||
| skipping to change at page 3, line 9 ¶ | skipping to change at page 3, line 9 ¶ | |||
| 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 | 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 | |||
| 7.1. Tags Registry . . . . . . . . . . . . . . . . . . . . . . 26 | 7.1. Tags Registry . . . . . . . . . . . . . . . . . . . . . . 26 | |||
| 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 26 | 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 26 | |||
| 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 | 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 27 | |||
| 9.1. Normative References . . . . . . . . . . . . . . . . . . 27 | 9.1. Normative References . . . . . . . . . . . . . . . . . . 27 | |||
| 9.2. Informative References . . . . . . . . . . . . . . . . . 27 | 9.2. Informative References . . . . . . . . . . . . . . . . . 27 | |||
| Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28 | Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 28 | |||
| 1. Introduction | 1. Introduction | |||
| The specification of the YANG 1.1 data modelling language | The specification of the YANG 1.1 data modelling language [RFC7950] | |||
| [I-D.ietf-netmod-rfc6020bis] defines an XML encoding for data | defines an XML encoding for data instances, i.e. contents of | |||
| instances, i.e. contents of configuration datastores, state data, RPC | configuration datastores, state data, RPC inputs and outputs, action | |||
| inputs and outputs, action inputs and outputs, and event | inputs and outputs, and event notifications. | |||
| notifications. | ||||
| A new set of encoding rules has been defined to allow the use of the | A new set of encoding rules has been defined to allow the use of the | |||
| same data models in environments based on the JavaScript Object | same data models in environments based on the JavaScript Object | |||
| Notation (JSON) Data Interchange Format [RFC7159]. This is | Notation (JSON) Data Interchange Format [RFC7159]. This is | |||
| accomplished in the JSON Encoding of Data Modeled with YANG | accomplished in the JSON Encoding of Data Modeled with YANG | |||
| specification [I-D.ietf-netmod-yang-json]. | specification [RFC7951]. | |||
| The aim of this document is to define a set of encoding rules for the | The aim of this document is to define a set of encoding rules for the | |||
| Concise Binary Object Representation (CBOR) [RFC7049]. The resulting | Concise Binary Object Representation (CBOR) [RFC7049]. The resulting | |||
| encoding is more compact compared to XML and JSON and more suitable | encoding is more compact compared to XML and JSON and more suitable | |||
| for Constrained Nodes and/or Constrained Networks as defined by | for Constrained Nodes and/or Constrained Networks as defined by | |||
| [RFC7228]. | [RFC7228]. | |||
| 2. Terminology and Notation | 2. Terminology and Notation | |||
| The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", | |||
| "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | |||
| document are to be interpreted as described in [RFC2119]. | document are to be interpreted as described in [RFC2119]. | |||
| The following terms are defined in [I-D.ietf-netmod-rfc6020bis]: | The following terms are defined in [RFC7950]: | |||
| o action | o action | |||
| o anydata | o anydata | |||
| o anyxml | o anyxml | |||
| o data node | o data node | |||
| o data tree | o data tree | |||
| skipping to change at page 4, line 8 ¶ | skipping to change at page 4, line 8 ¶ | |||
| o notification | o notification | |||
| o RPC | o RPC | |||
| o schema node | o schema node | |||
| o schema tree | o schema tree | |||
| o submodule | o submodule | |||
| The following terms are defined in [I-D.ietf-netmod-yang-json]: | The following terms are defined in [RFC7951]: | |||
| o member name | o member name | |||
| o name of an identity | o name of an identity | |||
| o namespace-qualified | o namespace-qualified | |||
| This specification also makes use of the following terminology: | This specification also makes use of the following terminology: | |||
| o child: A schema node defined within a collection such as a | o child: A schema node defined within a collection such as a | |||
| skipping to change at page 6, line 14 ¶ | skipping to change at page 6, line 14 ¶ | |||
| Basic schema nodes such as leaf, leaf-list, list, anydata and anyxml | Basic schema nodes such as leaf, leaf-list, list, anydata and anyxml | |||
| can be encoded standalone. In this case, only the value of this | can be encoded standalone. In this case, only the value of this | |||
| schema node is encoded in CBOR. Identification of this value needs | schema node is encoded in CBOR. Identification of this value needs | |||
| to be provided by some external means when required. | to be provided by some external means when required. | |||
| A collection such as container, list instance, notification, RPC | A collection such as container, list instance, notification, RPC | |||
| input, RPC output, action input and action output is serialized using | input, RPC output, action input and action output is serialized using | |||
| a CBOR map in which each child schema node is encoded using a key and | a CBOR map in which each child schema node is encoded using a key and | |||
| a value. This specification supports two type of keys; SID as | a value. This specification supports two type of keys; SID as | |||
| defined in [I-D.somaraju-core-sid] and member names as defined in | defined in [I-D.ietf-core-sid] and member names as defined in | |||
| [I-D.ietf-netmod-yang-json]. Each of these key type is encoded using | [RFC7951]. Each of these key type is encoded using a specific CBOR | |||
| a specific CBOR type which allows their interpretation during the | type which allows their interpretation during the deserialization | |||
| deserialization process. The end user of this mapping specification | process. The end user of this mapping specification (e.g. RESFCONF, | |||
| can mandate the use of a specific key type or a specific subset of | CoMI) can mandate the use of a specific key type. | |||
| key types. | ||||
| In order to minimize the size of the encoded data, the proposed | In order to minimize the size of the encoded data, the proposed | |||
| mapping avoid any unnecessary meta-information beyond those natively | mapping avoid any unnecessary meta-information beyond those natively | |||
| supported by CBOR. For instance, CBOR tags are used sorely in the | supported by CBOR. For instance, CBOR tags are used solely in the | |||
| case of the union datatype to distinguish explicitly the use of | case of the union datatype to distinguish explicitly the use of | |||
| different YANG datatypes encoded using the same CBOR major type. | different YANG datatypes encoded using the same CBOR major type. | |||
| It is expected that application entities generating and decoding CBOR | It is expected that application entities generating and decoding CBOR | |||
| contents have enough knowledge about the information processed in | contents have enough knowledge about the information processed in | |||
| order to perform the expected task without the need of such extra | order to perform the expected task without the need of such extra | |||
| meta-information. | meta-information. | |||
| 4. Encoding of YANG Data Node Instances | 4. Encoding of YANG Data Node Instances | |||
| Schema node instances defined using the YANG modeling language are | Schema node instances defined using the YANG modeling language are | |||
| encoded using CBOR [RFC7049] based on the rules defined in this | encoded using CBOR [RFC7049] based on the rules defined in this | |||
| section. We assume that the reader is already familiar with both | section. We assume that the reader is already familiar with both | |||
| YANG [I-D.ietf-netmod-rfc6020bis] and CBOR [RFC7049]. | YANG [RFC7950] and CBOR [RFC7049]. | |||
| 4.1. The 'leaf' Data Node | 4.1. The 'leaf' Data Node | |||
| Leafs MUST be encoded based on the encoding rules specified in | Leafs MUST be encoded based on the encoding rules specified in | |||
| Section 5. | Section 5. | |||
| 4.2. The 'container' Data Node | 4.2. The 'container' Data Node | |||
| Collections such as containers, list instances, notifications, RPC | Collections such as containers, list instances, notifications, RPC | |||
| inputs, RPC outputs, action inputs and action outputs MUST be encoded | inputs, RPC outputs, action inputs and action outputs MUST be encoded | |||
| using a CBOR map data item (major type 5). A map is comprised of | using a CBOR map data item (major type 5). A map is comprised of | |||
| pairs of data items, with each data item consisting of a key and a | pairs of data items, with each data item consisting of a key and a | |||
| value. Each key within the CBOR map is set to a data node | value. Each key within the CBOR map is set to a data node | |||
| identifier, each value is set to the value of this data node | identifier, each value is set to the value of this data node | |||
| instance. | instance. | |||
| This specification supports two type of keys; SID as defined in | This specification supports two type of keys; SID as defined in | |||
| [I-D.somaraju-core-sid] encoded using CBOR unsigned or signed | [I-D.ietf-core-sid] encoded using CBOR unsigned or signed integers | |||
| integers and member names as defined in [I-D.ietf-netmod-yang-json] | and member names as defined in [RFC7951] encoded using CBOR text | |||
| encoded using CBOR text strings. The use of CBOR byte strings for | strings. The use of CBOR byte strings for keys is reserved for | |||
| keys is reserved for future extensions. | future extensions. | |||
| 4.2.1. SIDs as keys | 4.2.1. SIDs as keys | |||
| Keys implemented using SIDs MUST be encoded using a CBOR unsigned | Keys implemented using SIDs MUST be encoded using a CBOR unsigned | |||
| integer (major type 0) or CBOR signed integer (major type 1), | integer (major type 0) or CBOR signed integer (major type 1), | |||
| depending on the actual value. Keys are set to the delta of the | depending on the actual value. Keys are set to the delta of the | |||
| associated SID, delta values are computed as follows: | associated SID, delta values are computed as follows: | |||
| o The delta value is equal to the SID of the current schema node | o The delta value is equal to the SID of the current schema node | |||
| minus the SID of the parent schema node. When no parent exists in | minus the SID of the parent schema node. When no parent exists in | |||
| the context of use of this container, the delta is set to the SID | the context of use of this container, the delta is set to the SID | |||
| of the current schema node (a parent with SID equal to zero is | of the current schema node (a parent with SID equal to zero is | |||
| assumed). | assumed). | |||
| o Delta values may result in a negative number, clients and servers | o Delta values may result in a negative number, clients and servers | |||
| MUST support negative deltas. | MUST support negative deltas. | |||
| The following example shows the encoding of the 'system' container | The following example shows the encoding of the 'system' container | |||
| using the SIDs defined in [I-D.somaraju-core-sid] Appendix C. | using the SIDs defined in [I-D.ietf-core-sid] Appendix C. | |||
| Definition example from [RFC7317]: | Definition example from [RFC7317]: | |||
| typedef date-and-time { | typedef date-and-time { | |||
| type string { | type string { | |||
| pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-] | pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[\+\-] | |||
| \d{2}:\d{2})'; | \d{2}:\d{2})'; | |||
| } | } | |||
| } | } | |||
| skipping to change at page 8, line 32 ¶ | skipping to change at page 8, line 32 ¶ | |||
| 78 1a # text(26) | 78 1a # text(26) | |||
| 323031352d30392d31355430393a31323a35385a2d30353a3030 | 323031352d30392d31355430393a31323a35385a2d30353a3030 | |||
| 4.2.2. Member names as keys | 4.2.2. Member names as keys | |||
| Keys implemented using member names MUST be encoded using a CBOR text | Keys implemented using member names MUST be encoded using a CBOR text | |||
| string data item (major type 3). A namespace-qualified member name | string data item (major type 3). A namespace-qualified member name | |||
| MUST be used for all members of a top-level collection, and then also | MUST be used for all members of a top-level collection, and then also | |||
| whenever the namespaces of the schema node and its parent are | whenever the namespaces of the schema node and its parent are | |||
| different. In all other cases, the simple form of the member name | different. In all other cases, the simple form of the member name | |||
| MUST be used. Names and namespaces are defined in | MUST be used. Names and namespaces are defined in [RFC7951] section | |||
| [I-D.ietf-netmod-yang-json] section 4. | 4. | |||
| The following example shows the encoding of the the 'system' | The following example shows the encoding of the 'system' container | |||
| container using names. This example is described in Section 4.2.1. | using names. This example is described in Section 4.2.1. | |||
| CBOR diagnostic notation: | CBOR diagnostic notation: | |||
| { | { | |||
| "ietf-system:clock" : { | "ietf-system:clock" : { | |||
| "current-datetime" : "2015-10-02T14:47:24Z-05:00", | "current-datetime" : "2015-10-02T14:47:24Z-05:00", | |||
| "boot-datetime" : "2015-09-15T09:12:58Z-05:00" | "boot-datetime" : "2015-09-15T09:12:58Z-05:00" | |||
| } | } | |||
| } | } | |||
| skipping to change at page 10, line 8 ¶ | skipping to change at page 10, line 8 ¶ | |||
| 4.4. The 'list' Data Node | 4.4. The 'list' Data Node | |||
| A list MUST be encoded using a CBOR array data item (major type 4). | A list MUST be encoded using a CBOR array data item (major type 4). | |||
| Each list instance within this CBOR array is encoded using a CBOR map | Each list instance within this CBOR array is encoded using a CBOR map | |||
| data item (major type 5) based on the same rules as a YANG container | data item (major type 5) based on the same rules as a YANG container | |||
| as defined in Section 4.2. | as defined in Section 4.2. | |||
| 4.4.1. SIDs as keys | 4.4.1. SIDs as keys | |||
| The follwoing example show the encoding a the 'server' list using the | The follwoing example show the encoding a the 'server' list using the | |||
| SIDs defined in [I-D.somaraju-core-sid] Appendix C. It is important | SIDs defined in [I-D.ietf-core-sid] Appendix C. It is important to | |||
| to note that the protocol or method using this mapping may carry a | note that the protocol or method using this mapping may carry a | |||
| parent SID or may have the knowledge of this parent SID based on its | parent SID or may have the knowledge of this parent SID based on its | |||
| context. In these cases, delta encoding can be performed based on | context. In these cases, delta encoding can be performed based on | |||
| this parent SID which minimizes the size of the encoded data. | this parent SID which minimizes the size of the encoded data. | |||
| The following example shows the encoding of the 'server' list | The following example shows the encoding of the 'server' list | |||
| containing two enties. SIDs used in this example are defined in | containing two enties. SIDs used in this example are defined in | |||
| [I-D.somaraju-core-sid] Appendix C. It is important to note that the | [I-D.ietf-core-sid] Appendix C. It is important to note that the | |||
| protocol or method using this mapping may carry a parent SID or may | protocol or method using this mapping may carry a parent SID or may | |||
| have the knowledge of this parent SID based on its context. In these | have the knowledge of this parent SID based on its context. In these | |||
| cases, delta encoding can be performed based on this parent SID which | cases, delta encoding can be performed based on this parent SID which | |||
| minimizes the size of the encoded data. | minimizes the size of the encoded data. | |||
| Definition example from [RFC7317]: | Definition example from [RFC7317]: | |||
| list server { | list server { | |||
| key name; | key name; | |||
| skipping to change at page 13, line 7 ¶ | skipping to change at page 13, line 7 ¶ | |||
| 6e # text(14) | 6e # text(14) | |||
| 4e52432054414320736572766572 # "NRC TAC server" | 4e52432054414320736572766572 # "NRC TAC server" | |||
| 19 06dd # unsigned(1757) | 19 06dd # unsigned(1757) | |||
| a1 # map(1) | a1 # map(1) | |||
| 01 # unsigned(1) | 01 # unsigned(1) | |||
| 6a # text(10) | 6a # text(10) | |||
| 7461632e6e72632e6361 # "tac.nrc.ca" | 7461632e6e72632e6361 # "tac.nrc.ca" | |||
| 4.4.2. Member names as keys | 4.4.2. Member names as keys | |||
| The following example shows the encoding of the the 'server' list | The following example shows the encoding of the 'server' list using | |||
| using names. This example is described in Section 4.4.1. | names. This example is described in Section 4.4.1. | |||
| CBOR diagnostic notation: | CBOR diagnostic notation: | |||
| [ | [ | |||
| { | { | |||
| "ietf-system:name" : "NRC TIC server", | "ietf-system:name" : "NRC TIC server", | |||
| "ietf-system:udp" : { | "ietf-system:udp" : { | |||
| "address" : "tic.nrc.ca", | "address" : "tic.nrc.ca", | |||
| "port" : 123 | "port" : 123 | |||
| }, | }, | |||
| skipping to change at page 16, line 17 ¶ | skipping to change at page 16, line 17 ¶ | |||
| range "-1500 .. 1500"; | range "-1500 .. 1500"; | |||
| } | } | |||
| } | } | |||
| CBOR diagnostic notation: -300 | CBOR diagnostic notation: -300 | |||
| CBOR encoding: 39 012b | CBOR encoding: 39 012b | |||
| 5.3. The 'decimal64' Type | 5.3. The 'decimal64' Type | |||
| Leafs of type decimal64 MUST be encoded using either CBOR unsigned | Leafs of type decimal64 MUST be encoded using a decimal fraction as | |||
| integer (major type 0) or CBOR signed integer (major type 1), | defined in [RFC7049] section 2.4.3. | |||
| depending on the actual value. The position of the decimal point is | ||||
| defined by the fraction-digits YANG statement and is not available in | ||||
| the CBOR encoding. | ||||
| The following example shows the encoding of leaf 'my-decimal' set to | The following example shows the encoding of leaf 'my-decimal' set to | |||
| 2.57. | 2.57. | |||
| Definition example from [RFC7317]: | Definition example from [RFC7317]: | |||
| leaf my-decimal { | leaf my-decimal { | |||
| type decimal64 { | type decimal64 { | |||
| fraction-digits 2; | fraction-digits 2; | |||
| range "1 .. 3.14 | 10 | 20..max"; | range "1 .. 3.14 | 10 | 20..max"; | |||
| } | } | |||
| } | } | |||
| CBOR diagnostic notation: 257 | CBOR diagnostic notation: 4([-2, 257]) | |||
| CBOR encoding: 19 0101 | CBOR encoding: c4 82 21 19 0101 | |||
| 5.4. The 'string' Type | 5.4. The 'string' Type | |||
| Leafs of type string MUST be encoded using a CBOR text string data | Leafs of type string MUST be encoded using a CBOR text string data | |||
| item (major type 3). | item (major type 3). | |||
| The following example shows the encoding of leaf 'name' set to | The following example shows the encoding of leaf 'name' set to | |||
| "eth0". | "eth0". | |||
| Definition example from [RFC7223]: | Definition example from [RFC7223]: | |||
| skipping to change at page 17, line 33 ¶ | skipping to change at page 17, line 30 ¶ | |||
| CBOR diagnostic notation: true | CBOR diagnostic notation: true | |||
| CBOR encoding: f5 | CBOR encoding: f5 | |||
| 5.6. The 'enumeration' Type | 5.6. The 'enumeration' Type | |||
| Leafs of type enumeration MUST be encoded using a CBOR unsigned | Leafs of type enumeration MUST be encoded using a CBOR unsigned | |||
| integer (major type 0) or CBOR signed integer (major type 1), | integer (major type 0) or CBOR signed integer (major type 1), | |||
| depending on the actual value. Enumeration values are either | depending on the actual value. Enumeration values are either | |||
| explicitly assigned using the YANG statement 'value' or automatically | explicitly assigned using the YANG statement 'value' or automatically | |||
| assigned based on the algorithm defined in | assigned based on the algorithm defined in [RFC7950] section 9.6.4.2. | |||
| [I-D.ietf-netmod-rfc6020bis] section 9.6.4.2. | ||||
| The following example shows the encoding of leaf 'oper-status' set to | The following example shows the encoding of leaf 'oper-status' set to | |||
| 'testing'. | 'testing'. | |||
| Definition example from [RFC7317]: | Definition example from [RFC7317]: | |||
| leaf oper-status { | leaf oper-status { | |||
| type enumeration { | type enumeration { | |||
| enum up { value 1; } | enum up { value 1; } | |||
| enum down { value 2; } | enum down { value 2; } | |||
| skipping to change at page 18, line 4 ¶ | skipping to change at page 17, line 48 ¶ | |||
| type enumeration { | type enumeration { | |||
| enum up { value 1; } | enum up { value 1; } | |||
| enum down { value 2; } | enum down { value 2; } | |||
| enum testing { value 3; } | enum testing { value 3; } | |||
| enum unknown { value 4; } | enum unknown { value 4; } | |||
| enum dormant { value 5; } | enum dormant { value 5; } | |||
| enum not-present { value 6; } | enum not-present { value 6; } | |||
| enum lower-layer-down { value 7; } | enum lower-layer-down { value 7; } | |||
| } | } | |||
| } | } | |||
| CBOR diagnostic notation: 3 | CBOR diagnostic notation: 3 | |||
| CBOR encoding: 03 | CBOR encoding: 03 | |||
| 5.7. The 'bits' Type | 5.7. The 'bits' Type | |||
| Leafs of type bits MUST be encoded using a CBOR byte string data item | Leafs of type bits MUST be encoded using a CBOR byte string data item | |||
| (major type 2). Bits position are either explicitly assigned using | (major type 2). Bits position are either explicitly assigned using | |||
| the YANG statement 'position' or automatically assigned based on the | the YANG statement 'position' or automatically assigned based on the | |||
| algorithm defined in [I-D.ietf-netmod-rfc6020bis] section 9.7.4.2. | algorithm defined in [RFC7950] section 9.7.4.2. | |||
| Bits position 0 to 7 are assigned to the first byte within the byte | Bits position 0 to 7 are assigned to the first byte within the byte | |||
| string, bits 8 to 15 to the second byte, and subsequent bytes are | string, bits 8 to 15 to the second byte, and subsequent bytes are | |||
| assigned similarly. Within each byte, bits are assigned from least | assigned similarly. Within each byte, bits are assigned from least | |||
| to most significant. | to most significant. | |||
| The following example shows the encoding of leaf 'mybits' with the | The following example shows the encoding of leaf 'mybits' with the | |||
| 'disable-nagle' and '10-Mb-only' flags set. | 'disable-nagle' and '10-Mb-only' flags set. | |||
| Definition example from [I-D.ietf-netmod-rfc6020bis]: | Definition example from [RFC7950]: | |||
| leaf mybits { | leaf mybits { | |||
| type bits { | type bits { | |||
| bit disable-nagle { | bit disable-nagle { | |||
| position 0; | position 0; | |||
| } | } | |||
| bit auto-sense-speed { | bit auto-sense-speed { | |||
| position 1; | position 1; | |||
| } | } | |||
| bit 10-Mb-only { | bit 10-Mb-only { | |||
| skipping to change at page 19, line 50 ¶ | skipping to change at page 19, line 50 ¶ | |||
| } | } | |||
| } | } | |||
| CBOR diagnostic notation: "eth1" | CBOR diagnostic notation: "eth1" | |||
| CBOR encoding: 64 65746831 | CBOR encoding: 64 65746831 | |||
| 5.10. The 'identityref' Type | 5.10. The 'identityref' Type | |||
| This specification supports two approaches for encoding identityref, | This specification supports two approaches for encoding identityref, | |||
| a SID as defined in [I-D.somaraju-core-sid] or a name as defined in | a SID as defined in [I-D.ietf-core-sid] or a name as defined in | |||
| [I-D.ietf-netmod-yang-json] section 6.8. | [RFC7951] section 6.8. | |||
| 5.10.1. SIDs as identityref | 5.10.1. SIDs as identityref | |||
| SIDs are globally unique and may be used as identityref. This | SIDs are globally unique and may be used as identityref. This | |||
| approach is both compact and simple to implement. When SIDs are | approach is both compact and simple to implement. When SIDs are | |||
| used, identityref MUST be encoded using a CBOR unsigned integer data | used, identityref MUST be encoded using a CBOR unsigned integer data | |||
| item (major type 0) and set to a SID allocated from a registered SID | item (major type 0) and set to a SID allocated from a registered SID | |||
| range. | range. | |||
| The following example shows the encoding of leaf 'type' set to the | The following example shows the encoding of leaf 'type' set to the | |||
| skipping to change at page 20, line 42 ¶ | skipping to change at page 20, line 42 ¶ | |||
| } | } | |||
| } | } | |||
| CBOR diagnostic notation: 1180 | CBOR diagnostic notation: 1180 | |||
| CBOR encoding: 19 049c | CBOR encoding: 19 049c | |||
| 5.10.2. Name as identityref | 5.10.2. Name as identityref | |||
| Alternatively, an identityref may be encoded using a name as defined | Alternatively, an identityref may be encoded using a name as defined | |||
| in [I-D.ietf-netmod-yang-json] section 6.8. When names are used, | in [RFC7951] section 6.8. When names are used, identityref MUST be | |||
| identityref MUST be encoded using a CBOR text string data item (major | encoded using a CBOR text string data item (major type 3). If the | |||
| type 3). If the identity is defined in another module than the leaf | identity is defined in another module than the leaf node containing | |||
| node containing the identityref value, the namespace-qualified form | the identityref value, the namespace-qualified form MUST be used. | |||
| MUST be used. Otherwise, both the simple and namespace-qualified | Otherwise, both the simple and namespace-qualified forms are | |||
| forms are permitted. Names and namespaces are defined in | permitted. Names and namespaces are defined in [RFC7951] section 4. | |||
| [I-D.ietf-netmod-yang-json] section 4. | ||||
| The following example shows the encoding of the identity 'iana-if- | The following example shows the encoding of the identity 'iana-if- | |||
| type:ethernetCsmacd' using its name. This example is described in | type:ethernetCsmacd' using its name. This example is described in | |||
| Section 5.10.1. | Section 5.10.1. | |||
| CBOR diagnostic notation: "iana-if-type:ethernetCsmacd" | CBOR diagnostic notation: "iana-if-type:ethernetCsmacd" | |||
| CBOR encoding: 78 1b | CBOR encoding: 78 1b | |||
| 69616e612d69662d747970653a65746865726e657443736d616364 | 69616e612d69662d747970653a65746865726e657443736d616364 | |||
| skipping to change at page 21, line 37 ¶ | skipping to change at page 21, line 37 ¶ | |||
| 5.12. The 'union' Type | 5.12. The 'union' Type | |||
| Leafs of type union MUST be encoded using the rules associated with | Leafs of type union MUST be encoded using the rules associated with | |||
| one of the types listed. When used in a union, the following YANG | one of the types listed. When used in a union, the following YANG | |||
| datatypes are prefixed by CBOR tag to avoid confusion between | datatypes are prefixed by CBOR tag to avoid confusion between | |||
| different YANG datatypes encoded using the same CBOR major type. | different YANG datatypes encoded using the same CBOR major type. | |||
| o bits | o bits | |||
| o decimal64 | ||||
| o enumeration | o enumeration | |||
| o identityref | o identityref | |||
| o instance-identifier | o instance-identifier | |||
| o leafref (Only when the datatype of the leaf referenced using the | ||||
| 'path' YANG statement require a CBOR tag) | ||||
| See Section 7.1 for more information about these CBOR tags. | See Section 7.1 for more information about these CBOR tags. | |||
| The following example shows the encoding of leaf 'ip-address' when | The following example shows the encoding of leaf 'ip-address' when | |||
| set to "2001:db8:a0b:12f0::1". | set to "2001:db8:a0b:12f0::1". | |||
| Definition example from [RFC7317]: | Definition example from [RFC7317]: | |||
| typedef ipv4-address { | typedef ipv4-address { | |||
| type string { | type string { | |||
| pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3} | pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3} | |||
| skipping to change at page 22, line 44 ¶ | skipping to change at page 22, line 42 ¶ | |||
| type inet:ip-address; | type inet:ip-address; | |||
| } | } | |||
| CBOR diagnostic notation: "2001:db8:a0b:12f0::1" | CBOR diagnostic notation: "2001:db8:a0b:12f0::1" | |||
| CBOR encoding: 74 323030313a6462383a6130623a313266303a3a31 | CBOR encoding: 74 323030313a6462383a6130623a313266303a3a31 | |||
| 5.13. The 'instance-identifier' Type | 5.13. The 'instance-identifier' Type | |||
| This specification supports two approaches for encoding an instance- | This specification supports two approaches for encoding an instance- | |||
| identifier, one based on SIDs as defined in [I-D.somaraju-core-sid] | identifier, one based on SIDs as defined in [I-D.ietf-core-sid] and | |||
| and one based on names as defined in [I-D.ietf-netmod-yang-json] | one based on names as defined in [RFC7951] section 6.11. | |||
| section 6.13. | ||||
| 5.13.1. SIDs as instance-identifier | 5.13.1. SIDs as instance-identifier | |||
| SIDs uniquely identify a data node. For a single instance data node, | SIDs uniquely identify a data node. In the case of a single instance | |||
| the SID is sufficient to identify this instance. For a multi- | data node, a data node defined at the root of a YANG module or | |||
| instance data node, a SID is combined with the list key(s) to | submodule or data nodes defined within a container, the SID is | |||
| identify each instance of this data node within the YANG list(s). | sufficient to identify this instance. | |||
| In the case of a data node member of a YANG list, a SID is combined | ||||
| with the list key(s) to identify each instance within the YANG | ||||
| list(s). | ||||
| Single instance data nodes MUST be encoded using a CBOR unsigned | Single instance data nodes MUST be encoded using a CBOR unsigned | |||
| integer data item (major type 0) and set to the targeted data node | integer data item (major type 0) and set to the targeted data node | |||
| SID. | SID. | |||
| Multi-instances data nodes MUST be encoded using a CBOR array data | Data nodes member of a YANG list MUST be encoded using a CBOR array | |||
| item (major type 4) containing the following entries: | data item (major type 4) containing the following entries: | |||
| o The first entry MUST be encoded as a CBOR unsigned integer data | o The first entry MUST be encoded as a CBOR unsigned integer data | |||
| item (major type 0) and set to the targeted data node SID. | item (major type 0) and set to the targeted data node SID. | |||
| o The following entries MUST contain the value of each key required | o The following entries MUST contain the value of each key required | |||
| to identify the instance of the targeted data node. These keys | to identify the instance of the targeted data node. These keys | |||
| MUST be ordered as defined in the 'key' YANG statement, starting | MUST be ordered as defined in the 'key' YANG statement, starting | |||
| from top level list, and follow by each of the subordinate | from top level list, and follow by each of the subordinate | |||
| list(s). | list(s). | |||
| skipping to change at page 25, line 12 ¶ | skipping to change at page 25, line 12 ¶ | |||
| CBOR encoding: | CBOR encoding: | |||
| 82 # array(2) | 82 # array(2) | |||
| 19 06be # unsigned(1726) | 19 06be # unsigned(1726) | |||
| 64 # text(4) | 64 # text(4) | |||
| 6a61636b # "jack" | 6a61636b # "jack" | |||
| 5.13.2. Names as instance-identifier | 5.13.2. Names as instance-identifier | |||
| The use of names as instance-identifier is defined in | The use of names as instance-identifier is defined in [RFC7951] | |||
| [I-D.ietf-netmod-yang-json] section 6.11. The resulting xpath MUST | section 6.11. The resulting xpath MUST be encoded using a CBOR text | |||
| be encoded using a CBOR text string data item (major type 3). | string data item (major type 3). | |||
| *First example:* | *First example:* | |||
| This example is described in Section 5.13.1. | This example is described in Section 5.13.1. | |||
| CBOR diagnostic notation: "/ietf-system:system/contact" | CBOR diagnostic notation: "/ietf-system:system/contact" | |||
| CBOR encoding: | CBOR encoding: | |||
| 78 1c 2f20696574662d73797374656d3a73797374656d2f636f6e74616374 | 78 1c 2f20696574662d73797374656d3a73797374656d2f636f6e74616374 | |||
| skipping to change at page 26, line 11 ¶ | skipping to change at page 26, line 11 ¶ | |||
| "/ietf-system:system/authentication/user[name='bob']" | "/ietf-system:system/authentication/user[name='bob']" | |||
| CBOR encoding: | CBOR encoding: | |||
| 78 33 | 78 33 | |||
| 2f696574662d73797374656d3a73797374656d2f61757468656e74696361 | 2f696574662d73797374656d3a73797374656d2f61757468656e74696361 | |||
| 74696f6e2f757365725b6e616d653d27626f62275d | 74696f6e2f757365725b6e616d653d27626f62275d | |||
| 6. Security Considerations | 6. Security Considerations | |||
| The security considerations of [RFC7049] and | The security considerations of [RFC7049] and [RFC7950] apply. | |||
| [I-D.ietf-netmod-rfc6020bis] apply. | ||||
| This document defines an alternative encoding for data modeled in the | This document defines an alternative encoding for data modeled in the | |||
| YANG data modeling language. As such, this encoding does not | YANG data modeling language. As such, this encoding does not | |||
| contribute any new security issues in addition of those identified | contribute any new security issues in addition of those identified | |||
| for the specific protocol or context for which it is used. | for the specific protocol or context for which it is used. | |||
| To minimize security risks, software on the receiving side SHOULD | To minimize security risks, software on the receiving side SHOULD | |||
| reject all messages that do not comply to the rules of this document | reject all messages that do not comply to the rules of this document | |||
| and reply with an appropriate error message to the sender. | and reply with an appropriate error message to the sender. | |||
| skipping to change at page 26, line 35 ¶ | skipping to change at page 26, line 34 ¶ | |||
| 7.1. Tags Registry | 7.1. Tags Registry | |||
| This specification requires the assignment of CBOR tags for the | This specification requires the assignment of CBOR tags for the | |||
| following YANG datatypes. These tags are added to the Tags Registry | following YANG datatypes. These tags are added to the Tags Registry | |||
| as defined in section 7.2 of [RFC7049]. | as defined in section 7.2 of [RFC7049]. | |||
| +-----+---------------------+---------------------------+-----------+ | +-----+---------------------+---------------------------+-----------+ | |||
| | Tag | Data Item | Semantics | Reference | | | Tag | Data Item | Semantics | Reference | | |||
| +-----+---------------------+---------------------------+-----------+ | +-----+---------------------+---------------------------+-----------+ | |||
| | 40 | bits | YANG bits datatype | RFC XXXX | | | 40 | bits | YANG bits datatype | RFC XXXX | | |||
| | 41 | decimal64 | YANG decimal64 datatype | RFC XXXX | | | 41 | enumeration | YANG enumeration datatype | RFC XXXX | | |||
| | 42 | enumeration | YANG enumeration datatype | RFC XXXX | | | 42 | identityref | YANG identityref datatype | RFC XXXX | | |||
| | 43 | identityref | YANG identityref datatype | RFC XXXX | | | 43 | instance-identifier | YANG instance-identifier | RFC XXXX | | |||
| | 44 | instance-identifier | YANG instance-identifier | RFC XXXX | | ||||
| | | | datatype | | | | | | datatype | | | |||
| +-----+---------------------+---------------------------+-----------+ | +-----+---------------------+---------------------------+-----------+ | |||
| // RFC Ed.: update Tag values using allocated tags if needed and | // RFC Ed.: update Tag values using allocated tags if needed and | |||
| remove this note // RFC Ed.: replace XXXX with RFC number and remove | remove this note // RFC Ed.: replace XXXX with RFC number and remove | |||
| this note | this note | |||
| 8. Acknowledgments | 8. Acknowledgments | |||
| This document has been largely inspired by the extensive works done | This document has been largely inspired by the extensive works done | |||
| by Andy Bierman and Peter van der Stok on [I-D.vanderstok-core-comi]. | by Andy Bierman and Peter van der Stok on [I-D.vanderstok-core-comi]. | |||
| [I-D.ietf-netmod-yang-json] has also been a critical input to this | [RFC7951] has also been a critical input to this work. The authors | |||
| work. The authors would like to thank the authors and contributors | would like to thank the authors and contributors to these two drafts. | |||
| to these two drafts. | ||||
| The authors would also like to acknowledge the review, feedback, and | The authors would also like to acknowledge the review, feedback, and | |||
| comments from Ladislav Lhotka and Juergen Schoenwaelder. | comments from Ladislav Lhotka and Juergen Schoenwaelder. | |||
| 9. References | 9. References | |||
| 9.1. Normative References | 9.1. Normative References | |||
| [I-D.ietf-netmod-rfc6020bis] | ||||
| Bjorklund, M., "The YANG 1.1 Data Modeling Language", | ||||
| draft-ietf-netmod-rfc6020bis-14 (work in progress), June | ||||
| 2016. | ||||
| [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, | Requirement Levels", BCP 14, RFC 2119, | |||
| DOI 10.17487/RFC2119, March 1997, | DOI 10.17487/RFC2119, March 1997, | |||
| <http://www.rfc-editor.org/info/rfc2119>. | <http://www.rfc-editor.org/info/rfc2119>. | |||
| [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object | [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object | |||
| Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, | Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, | |||
| October 2013, <http://www.rfc-editor.org/info/rfc7049>. | October 2013, <http://www.rfc-editor.org/info/rfc7049>. | |||
| 9.2. Informative References | [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", | |||
| RFC 7950, DOI 10.17487/RFC7950, August 2016, | ||||
| <http://www.rfc-editor.org/info/rfc7950>. | ||||
| [I-D.ietf-netmod-yang-json] | 9.2. Informative References | |||
| Lhotka, L., "JSON Encoding of Data Modeled with YANG", | ||||
| draft-ietf-netmod-yang-json-10 (work in progress), March | ||||
| 2016. | ||||
| [I-D.somaraju-core-sid] | [I-D.ietf-core-sid] | |||
| Somaraju, A., Veillette, M., Pelov, A., Turner, R., and A. | Somaraju, A., Veillette, M., Pelov, A., Turner, R., and A. | |||
| Minaburo, "Structure Identifier (SID)", draft-somaraju- | Minaburo, "YANG Schema Item iDentifier (SID)", draft-ietf- | |||
| core-sid-00 (work in progress), March 2016. | core-sid-00 (work in progress), October 2016. | |||
| [I-D.vanderstok-core-comi] | [I-D.vanderstok-core-comi] | |||
| Stok, P. and A. Bierman, "CoAP Management Interface", | Stok, P., Bierman, A., Veillette, M., and A. Pelov, "CoAP | |||
| draft-vanderstok-core-comi-09 (work in progress), March | Management Interface", draft-vanderstok-core-comi-10 (work | |||
| 2016. | in progress), October 2016. | |||
| [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data | [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data | |||
| Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March | Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March | |||
| 2014, <http://www.rfc-editor.org/info/rfc7159>. | 2014, <http://www.rfc-editor.org/info/rfc7159>. | |||
| [RFC7223] Bjorklund, M., "A YANG Data Model for Interface | [RFC7223] Bjorklund, M., "A YANG Data Model for Interface | |||
| Management", RFC 7223, DOI 10.17487/RFC7223, May 2014, | Management", RFC 7223, DOI 10.17487/RFC7223, May 2014, | |||
| <http://www.rfc-editor.org/info/rfc7223>. | <http://www.rfc-editor.org/info/rfc7223>. | |||
| [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for | [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for | |||
| skipping to change at page 28, line 18 ¶ | skipping to change at page 28, line 9 ¶ | |||
| <http://www.rfc-editor.org/info/rfc7228>. | <http://www.rfc-editor.org/info/rfc7228>. | |||
| [RFC7277] Bjorklund, M., "A YANG Data Model for IP Management", | [RFC7277] Bjorklund, M., "A YANG Data Model for IP Management", | |||
| RFC 7277, DOI 10.17487/RFC7277, June 2014, | RFC 7277, DOI 10.17487/RFC7277, June 2014, | |||
| <http://www.rfc-editor.org/info/rfc7277>. | <http://www.rfc-editor.org/info/rfc7277>. | |||
| [RFC7317] Bierman, A. and M. Bjorklund, "A YANG Data Model for | [RFC7317] Bierman, A. and M. Bjorklund, "A YANG Data Model for | |||
| System Management", RFC 7317, DOI 10.17487/RFC7317, August | System Management", RFC 7317, DOI 10.17487/RFC7317, August | |||
| 2014, <http://www.rfc-editor.org/info/rfc7317>. | 2014, <http://www.rfc-editor.org/info/rfc7317>. | |||
| [RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG", | ||||
| RFC 7951, DOI 10.17487/RFC7951, August 2016, | ||||
| <http://www.rfc-editor.org/info/rfc7951>. | ||||
| Authors' Addresses | Authors' Addresses | |||
| Michel Veillette (editor) | Michel Veillette (editor) | |||
| Trilliant Networks Inc. | Trilliant Networks Inc. | |||
| 610 Rue du Luxembourg | 610 Rue du Luxembourg | |||
| Granby, Quebec J2J 2V2 | Granby, Quebec J2J 2V2 | |||
| Canada | Canada | |||
| Phone: +14503750556 | Phone: +14503750556 | |||
| Email: michel.veillette@trilliantinc.com | Email: michel.veillette@trilliantinc.com | |||
| End of changes. 43 change blocks. | ||||
| 96 lines changed or deleted | 83 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||