< draft-ietf-core-yang-cbor-12.txt   draft-ietf-core-yang-cbor-13.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 I. Petrov, Ed. Intended status: Standards Track I. Petrov, Ed.
Expires: September 10, 2020 A. Pelov Expires: January 5, 2021 A. Pelov
Acklio Acklio
March 09, 2020 July 04, 2020
CBOR Encoding of Data Modeled with YANG CBOR Encoding of Data Modeled with YANG
draft-ietf-core-yang-cbor-12 draft-ietf-core-yang-cbor-13
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, notifications and yang data template defined within YANG output, notifications and yang-data extension defined within YANG
modules using the Concise Binary Object Representation (CBOR) modules using the Concise Binary Object Representation (CBOR)
[RFC7049]. [RFC7049].
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on September 10, 2020. This Internet-Draft will expire on January 5, 2021.
Copyright Notice Copyright Notice
Copyright (c) 2020 IETF Trust and the persons identified as the Copyright (c) 2020 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
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 12 skipping to change at page 2, line 12
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3 2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3
3. Properties of the CBOR Encoding . . . . . . . . . . . . . . . 5 3. Properties of the CBOR Encoding . . . . . . . . . . . . . . . 5
3.1. CBOR diagnostic notation . . . . . . . . . . . . . . . . 5 3.1. CBOR diagnostic notation . . . . . . . . . . . . . . . . 6
3.2. YANG Schema Item iDentifier (SID) . . . . . . . . . . . . 6 3.2. YANG Schema Item iDentifier . . . . . . . . . . . . . . . 6
3.3. Name . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.3. Name . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4. Encoding of YANG Schema Node Instances . . . . . . . . . . . 9 4. Encoding of YANG Schema Node Instances . . . . . . . . . . . 9
4.1. The 'leaf' . . . . . . . . . . . . . . . . . . . . . . . 9 4.1. The 'leaf' . . . . . . . . . . . . . . . . . . . . . . . 9
4.1.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 9 4.1.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 9
4.1.2. Using names in keys . . . . . . . . . . . . . . . . . 9 4.1.2. Using names in keys . . . . . . . . . . . . . . . . . 9
4.2. The 'container' and other collections . . . . . . . . . . 10 4.2. The 'container' and other nodes from the data tree . . . 10
4.2.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 11 4.2.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 11
4.2.2. Using names in keys . . . . . . . . . . . . . . . . . 12 4.2.2. Using names in keys . . . . . . . . . . . . . . . . . 12
4.3. The 'leaf-list' . . . . . . . . . . . . . . . . . . . . . 13 4.3. The 'leaf-list' . . . . . . . . . . . . . . . . . . . . . 13
4.3.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 14 4.3.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 14
4.3.2. Using names in keys . . . . . . . . . . . . . . . . . 14 4.3.2. Using names in keys . . . . . . . . . . . . . . . . . 14
4.4. The 'list' and 'list' instance(s) . . . . . . . . . . . . 15 4.4. The 'list' and 'list' instance(s) . . . . . . . . . . . . 15
4.4.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 16 4.4.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 16
4.4.2. Using names in keys . . . . . . . . . . . . . . . . . 18 4.4.2. Using names in keys . . . . . . . . . . . . . . . . . 18
4.5. The 'anydata' . . . . . . . . . . . . . . . . . . . . . . 20 4.5. The 'anydata' . . . . . . . . . . . . . . . . . . . . . . 20
4.5.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 21 4.5.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 21
4.5.2. Using names in keys . . . . . . . . . . . . . . . . . 22 4.5.2. Using names in keys . . . . . . . . . . . . . . . . . 22
4.6. The 'anyxml' . . . . . . . . . . . . . . . . . . . . . . 23 4.6. The 'anyxml' . . . . . . . . . . . . . . . . . . . . . . 23
4.6.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 23 4.6.1. Using SIDs in keys . . . . . . . . . . . . . . . . . 23
4.6.2. Using names in keys . . . . . . . . . . . . . . . . . 24 4.6.2. Using names in keys . . . . . . . . . . . . . . . . . 24
5. Encoding of YANG data templates . . . . . . . . . . . . . . . 24 5. Encoding of 'yang-data' extension . . . . . . . . . . . . . . 24
5.1. Using SIDs in keys . . . . . . . . . . . . . . . . . . . 25 5.1. Using SIDs in keys . . . . . . . . . . . . . . . . . . . 25
5.2. Using names in keys . . . . . . . . . . . . . . . . . . . 26 5.2. Using names in keys . . . . . . . . . . . . . . . . . . . 26
6. Representing YANG Data Types in CBOR . . . . . . . . . . . . 27 6. Representing YANG Data Types in CBOR . . . . . . . . . . . . 27
6.1. The unsigned integer Types . . . . . . . . . . . . . . . 27 6.1. The unsigned integer Types . . . . . . . . . . . . . . . 27
6.2. The integer Types . . . . . . . . . . . . . . . . . . . . 28 6.2. The integer Types . . . . . . . . . . . . . . . . . . . . 28
6.3. The 'decimal64' Type . . . . . . . . . . . . . . . . . . 28 6.3. The 'decimal64' Type . . . . . . . . . . . . . . . . . . 28
6.4. The 'string' Type . . . . . . . . . . . . . . . . . . . . 29 6.4. The 'string' Type . . . . . . . . . . . . . . . . . . . . 29
6.5. The 'boolean' Type . . . . . . . . . . . . . . . . . . . 29 6.5. The 'boolean' Type . . . . . . . . . . . . . . . . . . . 29
6.6. The 'enumeration' Type . . . . . . . . . . . . . . . . . 29 6.6. The 'enumeration' Type . . . . . . . . . . . . . . . . . 30
6.7. The 'bits' Type . . . . . . . . . . . . . . . . . . . . . 30 6.7. The 'bits' Type . . . . . . . . . . . . . . . . . . . . . 31
6.8. The 'binary' Type . . . . . . . . . . . . . . . . . . . . 32 6.8. The 'binary' Type . . . . . . . . . . . . . . . . . . . . 33
6.9. The 'leafref' Type . . . . . . . . . . . . . . . . . . . 32 6.9. The 'leafref' Type . . . . . . . . . . . . . . . . . . . 33
6.10. The 'identityref' Type . . . . . . . . . . . . . . . . . 33 6.10. The 'identityref' Type . . . . . . . . . . . . . . . . . 34
6.10.1. SIDs as identityref . . . . . . . . . . . . . . . . 33 6.10.1. SIDs as identityref . . . . . . . . . . . . . . . . 34
6.10.2. Name as identityref . . . . . . . . . . . . . . . . 34 6.10.2. Name as identityref . . . . . . . . . . . . . . . . 35
6.11. The 'empty' Type . . . . . . . . . . . . . . . . . . . . 34 6.11. The 'empty' Type . . . . . . . . . . . . . . . . . . . . 35
6.12. The 'union' Type . . . . . . . . . . . . . . . . . . . . 35 6.12. The 'union' Type . . . . . . . . . . . . . . . . . . . . 36
6.13. The 'instance-identifier' Type . . . . . . . . . . . . . 36 6.13. The 'instance-identifier' Type . . . . . . . . . . . . . 37
6.13.1. SIDs as instance-identifier . . . . . . . . . . . . 36 6.13.1. SIDs as instance-identifier . . . . . . . . . . . . 37
6.13.2. Names as instance-identifier . . . . . . . . . . . . 39 6.13.2. Names as instance-identifier . . . . . . . . . . . . 40
7. Security Considerations . . . . . . . . . . . . . . . . . . . 41 7. Content-Types . . . . . . . . . . . . . . . . . . . . . . . . 42
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 41 8. Security Considerations . . . . . . . . . . . . . . . . . . . 42
8.1. CBOR Tags Registry . . . . . . . . . . . . . . . . . . . 41 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 42
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 41 9.1. Media-Types Registry . . . . . . . . . . . . . . . . . . 42
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 42 9.2. CoAP Content-Formats Registry . . . . . . . . . . . . . . 43
10.1. Normative References . . . . . . . . . . . . . . . . . . 42 9.3. CBOR Tags Registry . . . . . . . . . . . . . . . . . . . 43
10.2. Informative References . . . . . . . . . . . . . . . . . 42 10. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 43
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 43 11. References . . . . . . . . . . . . . . . . . . . . . . . . . 44
11.1. Normative References . . . . . . . . . . . . . . . . . . 44
11.2. Informative References . . . . . . . . . . . . . . . . . 44
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 45
1. Introduction 1. Introduction
The specification of the YANG 1.1 data modeling language [RFC7950] The specification of the YANG 1.1 data modeling language [RFC7950]
defines an XML encoding for data instances, i.e. contents of defines an XML encoding for data instances, i.e. contents of
configuration datastores, state data, RPC inputs and outputs, action configuration datastores, state data, RPC inputs and outputs, action
inputs and outputs, and event notifications. inputs and outputs, and event notifications.
A new set of encoding rules has been defined to allow the use of the An additional set of encoding rules has been defined in [RFC7951]
same data models in environments based on the JavaScript Object based on the JavaScript Object Notation (JSON) Data Interchange
Notation (JSON) Data Interchange Format [RFC8259]. This is Format [RFC8259].
accomplished in the JSON Encoding of Data Modeled with YANG
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",
skipping to change at page 4, line 26 skipping to change at page 4, line 28
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 [RFC8040]: The following terms are defined in [RFC8040]:
o yang-data (YANG extension) o yang-data extension
o YANG data template
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 as a child node of a container, a
container, a list, a case, a notification, an RPC input, an RPC list, a case, a notification, an RPC input, an RPC output, an
output, an action input, an action output. action input, an action output.
o delta: Difference between the current SID and a reference SID. A o delta: Difference between the current YANG SID and a reference
reference SID is defined for each context for which deltas are YANG SID. A reference YANG SID is defined for each context for
used. which deltas are used.
o item: A schema node, an identity, a module, a submodule or a o item: A schema node, an identity, a module, a submodule or a
feature defined using the YANG modeling language. feature defined using the YANG modeling language.
o parent: The collection in which a schema node is defined. o parent: The container, list, case, notification, RPC input, RPC
output, action input or action output node in which a schema node
is defined.
o YANG Schema Item iDentifier (SID): Unsigned integer used to o YANG Schema Item iDentifier (YANG SID or simply SID): Unsigned
identify different YANG items. integer used to identify different YANG items.
3. Properties of the CBOR Encoding 3. Properties of the CBOR Encoding
This document defines CBOR encoding rules for YANG schema trees and This document defines CBOR encoding rules for YANG data trees and
their subtrees. their subtrees.
A collection such as container, list instance, notification, RPC A node from the data tree such as container, list instance,
input, RPC output, action input and action output is serialized using notification, RPC input, RPC output, action input and action output
a CBOR map in which each child schema node is encoded using a key and is serialized using a CBOR map in which each child schema node is
a value. This specification supports two type of CBOR keys; YANG encoded using a key and a value. This specification supports two
Schema Item iDentifier (SID) as defined in Section 3.2 and names as types of CBOR keys; YANG Schema Item iDentifier (YANG SID) as defined
defined in Section 3.3. Each of these key types is encoded using a in Section 3.2 and names as defined in Section 3.3. Each of these
specific CBOR type which allows their interpretation during the key types is encoded using a specific CBOR type which allows their
deserialization process. Protocols or mechanisms implementing this interpretation during the deserialization process. Protocols or
specification can mandate the use of a specific key type. mechanisms implementing this specification can mandate the use of a
specific key type.
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 avoids any unnecessary meta-information beyond those natively mapping avoids any unnecessary meta-information beyond those natively
supported by CBOR. For instance, CBOR tags are used solely in the supported by CBOR. For instance, CBOR tags are used solely in the
case of SID not encoded as delta, anyxml schema nodes and the union case of SID not encoded as delta, anyxml schema nodes and the union
datatype to distinguish explicitly the use of different YANG datatype to distinguish explicitly the use of different YANG
datatypes encoded using the same CBOR major type. datatypes encoded using the same CBOR major type.
Unless specified otherwise by the protocol or mechanism implementing Unless specified otherwise by the protocol or mechanism implementing
this specification, the indefinite lengths encoding as defined in this specification, the indefinite lengths encoding as defined in
[RFC7049] section 2.2 SHALL be supported by CBOR decoders. [RFC7049] section 2.2 SHALL be supported by CBOR decoders.
Data nodes implemented using a CBOR array, map, byte string, and text Data nodes implemented using a CBOR array, map, byte string, and text
string can be instantiated but empty. In this case, they are encoded string can be instantiated but empty. In this case, they are encoded
with a length of zero. with a length of zero.
Application payloads carrying a value serialized using the rules When schema node are serialized using the rules defined by this
defined by this specification (e.g. CoAP Content-Format) SHOULD specification as part of an application payload, the payload SHOULD
include the identifier (e.g. SID, namespace qualified name, include information that would allow a stateless way to identify each
instance-identifier) of this value. When SIDs are used as node, such as the SID number associated with the node, SID delta from
identifiers, the reference SID SHALL be included in the payload to another SID in the application payload, the namespace qualified name
allow stateless conversion of delta values to SIDs. or the instance-identifier.
Examples in section Section 4 include a root CBOR map with a single Examples in Section 4 include a root CBOR map with a single entry
entry having a key set to either a namespace qualified name or a SID. having a key set to either a namespace qualified name or a SID. This
This root CBOR map is provided only as a typical usage example and is root CBOR map is provided only as a typical usage example and is not
not part of the present encoding rules. Only the value within this part of the present encoding rules. Only the value within this CBOR
CBOR map is compulsory. map is compulsory.
3.1. CBOR diagnostic notation 3.1. CBOR diagnostic notation
Within this document, CBOR binary contents are represented using an Within this document, CBOR binary contents are represented using an
equivalent textual form called CBOR diagnostic notation as defined in equivalent textual form called CBOR diagnostic notation as defined in
[RFC7049] section 6. This notation is used strictly for [RFC7049] section 6. This notation is used strictly for
documentation purposes and is never used in the data serialization. documentation purposes and is never used in the data serialization.
Table 1 below provides a summary of this notation. Table 1 below provides a summary of this notation.
+----------+------+--------------------------+-----------+----------+ +----------+------+--------------------------+-----------+----------+
| CBOR | CBOR | Diagnostic notation | Example | CBOR | | CBOR | CBOR | Diagnostic notation | Example | CBOR |
| content | type | | | encoding | | content | type | | | encoding |
+----------+------+--------------------------+-----------+----------+ +----------+------+--------------------------+-----------+----------+
| Unsigned | 0 | Decimal digits | 123 | 18 7B | | Unsigned | 0 | Decimal digits | 123 | 18 7B |
| integer | | | | | | integer | | | | |
| Negative | 1 | Decimal digits prefixed | -123 | 38 7A | | Negative | 1 | Decimal digits prefixed | -123 | 38 7A |
| integer | | by a minus sign | | | | integer | | by a minus sign | | |
| Byte | 2 | Hexadecimal value | h'F15C' | 42 f15C | | Byte | 2 | Hexadecimal value | h'F15C' | 42 F15C |
| string | | enclosed between single | | | | string | | enclosed between single | | |
| | | quotes and prefixed by | | | | | | quotes and prefixed by | | |
| | | an 'h' | | | | | | an 'h' | | |
| Text | 3 | String of Unicode | "txt" | 63 | | Text | 3 | String of Unicode | "txt" | 63 |
| string | | characters enclosed | | 747874 | | string | | characters enclosed | | 747874 |
| | | between double quotes | | | | | | between double quotes | | |
| Array | 4 | Comma-separated list of | [ 1, 2 ] | 82 01 02 | | Array | 4 | Comma-separated list of | [ 1, 2 ] | 82 01 02 |
| | | values within square | | | | | | values within square | | |
| | | brackets | | | | | | brackets | | |
| Map | 5 | Comma-separated list of | { 1: 123, | a2 | | Map | 5 | Comma-separated list of | { 1: 123, | A2 |
| | | key : value pairs within | 2: 456 } | 01187B | | | | key : value pairs within | 2: 456 } | 01187B |
| | | curly braces | | 021901C8 | | | | curly braces | | 021901C8 |
| Boolean | 7/20 | false | false | F4 | | Boolean | 7/20 | false | false | F4 |
| | 7/21 | true | true | F5 | | | 7/21 | true | true | F5 |
| Null | 7/22 | null | null | F6 | | Null | 7/22 | null | null | F6 |
| Not | 7/23 | undefined | undefined | F7 | | Not | 7/23 | undefined | undefined | F7 |
| assigned | | | | | | assigned | | | | |
+----------+------+--------------------------+-----------+----------+ +----------+------+--------------------------+-----------+----------+
Table 1: CBOR diagnostic notation summary Table 1: CBOR diagnostic notation summary
Note: CBOR binary contents shown in this specification are annotated Note: CBOR binary contents shown in this specification are annotated
with comments. These comments are delimited by slashes ("/") as with comments. These comments are delimited by slashes ("/") as
defined in [RFC8610] Appendix G.6. defined in [RFC8610] Appendix G.6.
3.2. YANG Schema Item iDentifier (SID) 3.2. YANG Schema Item iDentifier
Some of the items defined in YANG [RFC7950] require the use of a Some of the items defined in YANG [RFC7950] require the use of a
unique identifier. In both NETCONF [RFC6241] and RESTCONF [RFC8040], unique identifier. In both NETCONF [RFC6241] and RESTCONF [RFC8040],
these identifiers are implemented using strings. To allow the these identifiers are implemented using strings. To allow the
implementation of data models defined in YANG in constrained devices implementation of data models defined in YANG in constrained devices
and constrained networks, a more compact method to identify YANG and constrained networks, a more compact method to identify YANG
items is required. This compact identifier, called YANG Schema Item items is required. This compact identifier, called YANG Schema Item
iDentifier (SID), is an unsigned integer. The following items are iDentifier, is an unsigned integer. The following items are
identified using SIDs: identified using YANG SIDs (often shortened to SIDs):
o identities o identities
o data nodes o data nodes
o RPCs and associated input(s) and output(s) o RPCs and associated input(s) and output(s)
o actions and associated input(s) and output(s) o actions and associated input(s) and output(s)
o notifications and associated information o notifications and associated information
skipping to change at page 8, line 38 skipping to change at page 8, line 43
import example-foomod { import example-foomod {
prefix "foomod"; prefix "foomod";
} }
augment "/foomod:top" { augment "/foomod:top" {
leaf bar { leaf bar {
type boolean; type boolean;
} }
} }
} }
A valid CBOR encoding of the 'top' container is as follow. A valid CBOR encoding of the 'top' container is as follows.
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
"example-foomod:top": { "example-foomod:top": {
"foo": 54, "foo": 54,
"example-barmod:bar": true "example-barmod:bar": true
} }
} }
Both the 'top' container and the 'bar' leaf defined in a different Both the 'top' container and the 'bar' leaf defined in a different
YANG module as its parent container are encoded as namespace YANG module as its parent container are encoded as namespace
qualified names. The 'foo' leaf defined in the same YANG module as qualified names. The 'foo' leaf defined in the same YANG module as
its parent container is encoded as simple name. its parent container is encoded as simple name.
4. Encoding of YANG Schema Node Instances 4. Encoding of YANG Schema 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
skipping to change at page 9, line 48 skipping to change at page 10, line 4
72 # text(18) 72 # text(18)
6D79686F73742E6578616D706C652E636F6D # "myhost.example.com" 6D79686F73742E6578616D706C652E636F6D # "myhost.example.com"
4.1.2. Using names in keys 4.1.2. Using names in keys
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
"ietf-system:hostname" : "myhost.example.com" "ietf-system:hostname" : "myhost.example.com"
} }
CBOR encoding: CBOR encoding:
A1 # map(1) A1 # map(1)
74 # text(20) 74 # text(20)
696574662D73797374656D3A686F73746E616D65 696574662D73797374656D3A686F73746E616D65
72 # text(18) 72 # text(18)
6D79686F73742E6578616D706C652E636F6D 6D79686F73742E6578616D706C652E636F6D
4.2. The 'container' and other collections 4.2. The 'container' and other nodes from the data tree
Collections such as containers, list instances, notification Containers, list instances, notification contents, rpc inputs, rpc
contents, rpc inputs, rpc outputs, action inputs and action outputs outputs, action inputs and action outputs MUST be encoded using a
MUST be encoded using a CBOR map data item (major type 5). A map is CBOR map data item (major type 5). A map is comprised of pairs of
comprised of pairs of data items, with each data item consisting of a data items, with each data item consisting of a key and a value.
key and a value. Each key within the CBOR map is set to a schema Each key within the CBOR map is set to a schema node identifier, each
node identifier, each value is set to the value of this schema node value is set to the value of this schema node instance according to
instance according to the instance datatype. the instance datatype.
This specification supports two type of CBOR keys; SID as defined in This specification supports two types of CBOR keys; SID as defined in
Section 3.2 and names as defined in Section 3.3. Section 3.2 and names as defined in Section 3.3.
The following examples shows the encoding of a 'system-state' The following examples shows the encoding of a 'system-state'
container instance using SIDs or names. container instance using SIDs or names.
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|[\+\-]
skipping to change at page 11, line 7 skipping to change at page 11, line 7
} }
leaf boot-datetime { leaf boot-datetime {
type date-and-time; type date-and-time;
} }
} }
} }
4.2.1. Using SIDs in keys 4.2.1. Using SIDs in keys
In the context of containers and other collections, CBOR map keys In the context of containers and other nodes from the data tree, CBOR
within inner CBOR maps can be encoded using deltas or SIDs. In the map keys within inner CBOR maps can be encoded using deltas or SIDs.
case of deltas, they MUST be encoded using a CBOR unsigned integer In the case of deltas, they MUST be encoded using a CBOR unsigned
(major type 0) or CBOR negative integer (major type 1), depending on integer (major type 0) or CBOR negative integer (major type 1),
the actual delta value. In the case of SID, they are encoded using depending on the actual delta value. In the case of SID, they are
the SID value enclosed by CBOR tag 47 as defined in Section 8.1. encoded using the SID value enclosed by CBOR tag 47 as defined in
Section 9.3.
Delta values are computed as follows: Delta values are computed as follows:
o In the case of a 'container', deltas are equal to the SID of the o In the case of a 'container', deltas are equal to the SID of the
current schema node minus the SID of the parent 'container'. current schema node minus the SID of the parent 'container'.
o In the case of a 'list', deltas are equal to the SID of the o In the case of a 'list', deltas are equal to the SID of the
current schema node minus the SID of the parent 'list'. current schema node minus the SID of the parent 'list'.
o In the case of an 'rpc input' or 'rcp output', deltas are equal to o In the case of an 'rpc input' or 'rcp output', deltas are equal to
skipping to change at page 21, line 47 skipping to change at page 21, line 47
} }
} }
} }
4.5.1. Using SIDs in keys 4.5.1. Using SIDs in keys
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
60123 : { / last-event (SID 60123) / 60123 : { / last-event (SID 60123) /
77 : { / event (SID 60200) / 77 : { / example-port-fault (SID 60200) /
1 : "0/4/21", / port-name (SID 60201) / 1 : "0/4/21", / port-name (SID 60201) /
2 : "Open pin 2" / port-fault (SID 60202) / 2 : "Open pin 2" / port-fault (SID 60202) /
} }
} }
} }
CBOR encoding: CBOR encoding:
A1 # map(1) A1 # map(1)
19 EADB # unsigned(60123) 19 EADB # unsigned(60123)
A1 # map(1) A1 # map(1)
skipping to change at page 22, line 20 skipping to change at page 22, line 20
A2 # map(2) A2 # map(2)
18 4E # unsigned(78) 18 4E # unsigned(78)
66 # text(6) 66 # text(6)
302F342F3231 # "0/4/21" 302F342F3231 # "0/4/21"
18 4F # unsigned(79) 18 4F # unsigned(79)
6A # text(10) 6A # text(10)
4F70656E2070696E2032 # "Open pin 2" 4F70656E2070696E2032 # "Open pin 2"
In some implementations, it might be simpler to use the absolute SID In some implementations, it might be simpler to use the absolute SID
tag encoding for the anydata root element. The resulting encoding is tag encoding for the anydata root element. The resulting encoding is
as follow: as follows:
{ {
60123 : { / last-event (SID 60123) / 60123 : { / last-event (SID 60123) /
47(60200) : { / event (SID 60123) / 47(60200) : { / event-port-fault (SID 60200) /
1 : "0/4/21", / port-name (SID 60201) / 1 : "0/4/21", / port-name (SID 60201) /
2 : "Open pin 2" / port-fault (SID 60202) / 2 : "Open pin 2" / port-fault (SID 60202) /
} }
} }
} }
4.5.2. Using names in keys 4.5.2. Using names in keys
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
"event-log:last-event" : { "event-log:last-event" : {
"example-port: example-port-fault" : { "example-port:example-port-fault" : {
"port-name" : "0/4/21", "port-name" : "0/4/21",
"port-fault" : "Open pin 2" "port-fault" : "Open pin 2"
} }
} }
} }
CBOR encoding: CBOR encoding:
A1 # map(1) A1 # map(1)
74 # text(20) 74 # text(20)
skipping to change at page 23, line 26 skipping to change at page 23, line 26
302F342F3231 # "0/4/21" 302F342F3231 # "0/4/21"
6A # text(10) 6A # text(10)
706F72742D6661756C74 # "port-fault" 706F72742D6661756C74 # "port-fault"
6A # text(10) 6A # text(10)
4F70656E2070696E2032 # "Open pin 2" 4F70656E2070696E2032 # "Open pin 2"
4.6. The 'anyxml' 4.6. The 'anyxml'
An anyxml schema node is used to serialize an arbitrary CBOR content, An anyxml schema node is used to serialize an arbitrary CBOR content,
i.e., its value can be any CBOR binary object. anyxml value MAY i.e., its value can be any CBOR binary object. anyxml value MAY
contain CBOR data items tagged with one of the tag listed in contain CBOR data items tagged with one of the tags listed in
Section 8.1, these tags shall be supported. Section 9.3, these tags shall be supported.
The following example shows a valid CBOR encoded instance consisting The following example shows a valid CBOR encoded instance consisting
of a CBOR array containing the CBOR simple values 'true', 'null' and of a CBOR array containing the CBOR simple values 'true', 'null' and
'true'. 'true'.
Definition example from [RFC7951]: Definition example from [RFC7951]:
module bar-module { module bar-module {
... ...
anyxml bar; anyxml bar; # SID 60000
4.6.1. Using SIDs in keys 4.6.1. Using SIDs in keys
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
60000 : [true, null, true] / bar (SID 60000) / 60000 : [true, null, true] / bar (SID 60000) /
} }
CBOR encoding: CBOR encoding:
skipping to change at page 24, line 30 skipping to change at page 24, line 30
CBOR encoding: CBOR encoding:
A1 # map(1) A1 # map(1)
6E # text(14) 6E # text(14)
6261722D6D6F64756C653A626172 # "bar-module:bar" 6261722D6D6F64756C653A626172 # "bar-module:bar"
83 # array(3) 83 # array(3)
F5 # primitive(21) F5 # primitive(21)
F6 # primitive(22) F6 # primitive(22)
F5 # primitive(21) F5 # primitive(21)
5. Encoding of YANG data templates 5. Encoding of 'yang-data' extension
YANG data templates are data structures defined in YANG but not The yang-data extension [RFC8040] is used to define data structures
intended to be implemented as part of a datastore. YANG data in YANG that are not intended to be implemented as part of a
templates are defined using the 'yang-data' extension as described by datastore.
[RFC8040].
YANG data templates MUST be encoded using the encoding rules of a The yang-data extension MUST be encoded using the encoding rules of
collection as defined in Section 4.2. nodes of data trees as defined in Section 4.2.
Just like YANG containers, YANG data templates can be encoded using Just like YANG containers, yang-data extension can be encoded using
either SIDs or names. either SIDs or names.
Definition example from [I-D.ietf-core-comi]: Definition example from [I-D.ietf-core-comi] Appendix A:
import ietf-restconf { module ietf-coreconf {
prefix rc; ...
}
rc:yang-data yang-errors { import ietf-restconf {
container error { prefix rc;
leaf error-tag { }
type identityref {
base error-tag; rc:yang-data yang-errors {
container error {
leaf error-tag {
type identityref {
base error-tag;
}
} }
} leaf error-app-tag {
leaf error-app-tag { type identityref {
type identityref { base error-app-tag;
base error-app-tag; }
}
leaf error-data-node {
type instance-identifier;
}
leaf error-message {
type string;
} }
}
leaf error-data-node {
type instance-identifier;
}
leaf error-message {
type string;
} }
} }
} }
5.1. Using SIDs in keys 5.1. Using SIDs in keys
YANG template encoded using SIDs are carried in a CBOR map containing The yang-data extensions encoded using SIDs are carried in a CBOR map
a single item pair. The key of this item is set to the SID assigned containing a single item pair. The key of this item is set to the
to the YANG template container, the value is set the CBOR encoding of SID assigned to the yang-data extension container, the value is set
this container as defined in Section 4.2. the CBOR encoding of this container as defined in Section 4.2.
This example shows a serialization example of the yang-errors This example shows a serialization example of the yang-errors yang-
template as defined in [I-D.ietf-core-comi] using SIDs as defined in data extension as defined in [I-D.ietf-core-comi] using SIDs as
Section 3.2. defined in Section 3.2.
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
1024 : { / error (SID 1024) / 1024 : { / error (SID 1024) /
4 : 1011, / error-tag (SID 1028) / 4 : 1011, / error-tag (SID 1028) /
/ = invalid-value (SID 1011) / / = invalid-value (SID 1011) /
1 : 1018, / error-app-tag (SID 1025) / 1 : 1018, / error-app-tag (SID 1025) /
/ = not-in-range (SID 1018) / / = not-in-range (SID 1018) /
2 : 1740, / error-data-node (SID 1026) / 2 : 1740, / error-data-node (SID 1026) /
skipping to change at page 26, line 34 skipping to change at page 26, line 34
01 # unsigned(1) 01 # unsigned(1)
19 03FA # unsigned(1018) 19 03FA # unsigned(1018)
02 # unsigned(2) 02 # unsigned(2)
19 06CC # unsigned(1740) 19 06CC # unsigned(1740)
03 # unsigned(3) 03 # unsigned(3)
70 # text(16) 70 # text(16)
4D6178696D756D206578636565646564 4D6178696D756D206578636565646564
5.2. Using names in keys 5.2. Using names in keys
YANG template encoded using names are carried in a CBOR map The yang-data extensions encoded using names are carried in a CBOR
containing a single item pair. The key of this item is set to the map containing a single item pair. The key of this item is set to
namespace qualified name of the YANG template container, the value is the namespace qualified name of the yang-data extension container,
set the CBOR encoding of this container as defined in Section 3.3. the value is set the CBOR encoding of this container as defined in
This example shows a serialization example of the yang-errors
template as defined in [I-D.ietf-core-comi] using names as defined
Section 3.3. Section 3.3.
This example shows a serialization example of the yang-errors yang-
data extension as defined in [I-D.ietf-core-comi] using names as
defined Section 3.3.
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
"ietf-comi:error" : { "ietf-coreconf:error" : {
"error-tag" : "invalid-value", "error-tag" : "invalid-value",
"error-app-tag" : "not-in-range", "error-app-tag" : "not-in-range",
"error-data-node" : "timezone-utc-offset", "error-data-node" : "timezone-utc-offset",
"error-message" : "Maximum exceeded" "error-message" : "Maximum exceeded"
} }
} }
CBOR encoding: CBOR encoding:
A1 # map(1) A1 # map(1)
6F # text(15) 73 # text(19)
696574662D636F6D693A6572726F72 # "ietf-comi:error" 696574662D636F7265636F6E663A6572726F72 # "ietf-coreconf:error"
A4 # map(4) A4 # map(4)
69 # text(9) 69 # text(9)
6572726F722D746167 # "error-tag" 6572726F722D746167 # "error-tag"
6D # text(13) 6D # text(13)
696E76616C69642D76616C7565 # "invalid-value" 696E76616C69642D76616C7565 # "invalid-value"
6D # text(13) 6D # text(13)
6572726F722D6170702D746167 # "error-app-tag" 6572726F722D6170702D746167 # "error-app-tag"
6C # text(12) 6C # text(12)
6E6F742D696E2D72616E6765 # "not-in-range" 6E6F742D696E2D72616E6765 # "not-in-range"
6F # text(15) 6F # text(15)
6572726F722D646174612D6E6F6465 # "error-data-node" 6572726F722D646174612D6E6F6465 # "error-data-node"
73 # text(19) 73 # text(19)
74696D657A6F6E652D7574632D6F6666736574 74696D657A6F6E652D7574632D6F6666736574
# "timezone-utc-offset" # "timezone-utc-offset"
6D # text(13) 6D # text(13)
6572726F722D6D657373616765 # "error-message" 6572726F722D6D657373616765 # "error-message"
70 # text(16) 70 # text(16)
4D6178696D756D206578636565646564 4D6178696D756D206578636565646564
6. Representing YANG Data Types in CBOR 6. Representing YANG Data Types in CBOR
The CBOR encoding of an instance of a leaf or leaf-list schema node The CBOR encoding of an instance of a leaf or leaf-list schema node
depends on the built-in type of that schema node. The following sub- depends on the built-in type of that schema node. The following sub-
section defined the CBOR encoding of each built-in type supported by section defines the CBOR encoding of each built-in type supported by
YANG as listed in [RFC7950] section 4.2.4. Each subsection shows an YANG as listed in [RFC7950] section 4.2.4. Each subsection shows an
example value assigned to a schema node instance of the discussed example value assigned to a schema node instance of the discussed
built-in type. built-in type.
6.1. The unsigned integer Types 6.1. The unsigned integer Types
Leafs of type uint8, uint16, uint32 and uint64 MUST be encoded using Leafs of type uint8, uint16, uint32 and uint64 MUST be encoded using
a CBOR unsigned integer data item (major type 0). a CBOR unsigned integer data item (major type 0).
The following example shows the encoding of a 'mtu' leaf instance set The following example shows the encoding of a 'mtu' leaf instance set
skipping to change at page 30, line 23 skipping to change at page 30, line 34
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
To avoid overlap of 'value' defined in different 'enumeration' Values of 'enumeration' types defined in a 'union' type MUST be
statements, 'enumeration' defined in a Leafs of type 'union' MUST be
encoded using a CBOR text string data item (major type 3) and MUST encoded using a CBOR text string data item (major type 3) and MUST
contain one of the names assigned by 'enum' statements in YANG. The contain one of the names assigned by 'enum' statements in YANG. The
encoding MUST be enclosed by the enumeration CBOR tag as specified in encoding MUST be enclosed by the enumeration CBOR tag as specified in
Section 8.1. Section 9.3.
Definition example from [RFC7950]: Definition example from [RFC7950]:
type union { type union {
type int32; type int32;
type enumeration { type enumeration {
enum "unbounded"; enum unbounded;
} }
} }
CBOR diagnostic notation: 44("unbounded") CBOR diagnostic notation: 44("unbounded")
CBOR encoding: D8 2C 69 756E626F756E646564 CBOR encoding: D8 2C 69 756E626F756E646564
6.7. The 'bits' Type 6.7. The 'bits' Type
Leafs of type bits MUST be encoded using a CBOR byte string data item Keeping in mind that bit positions are either explicitly assigned
(major type 2). Bits position are either explicitly assigned using using the YANG statement 'position' or automatically assigned based
the YANG statement 'position' or automatically assigned based on the on the algorithm defined in [RFC7950] section 9.7.4.2, each element
algorithm defined in [RFC7950] section 9.7.4.2. of type bits could be seen as a set of bit positions (or offsets from
position 0), that have a value of ether 1, which represents the bit
being set or 0, which represents that the bit is not set.
Bits position 0 to 7 are assigned to the first byte within the byte Leafs of type bits MUST be encoded either using a CBOR array or byte
string, bits 8 to 15 to the second byte, and subsequent bytes are string (major type 2). In case CBOR array representation is used,
assigned similarly. Within each byte, bits are assigned from least each element is either a positive integer (major type 0 with value 0
to most significant. being disallowed) that can be used to calculate the offset of the
next byte string, or a byte string (major type 2) that carries the
information whether certain bits are set or not. The initial offset
value is 0 and each unsigned integer modifies the offset value of the
next byte string by the integer value multiplied by 8. For example,
if the bit offset is 0 and there is an integer with value 5, the
first byte of the byte string that follows will represent bit
positions 40 to 47 both ends included. If the byte string has a
second byte, it will carry information about bits 48 to 55 and so on.
Within each byte, bits are assigned from least to most significant.
After the byte string, the offset is modified by the number of bytes
in the byte string multiplied by 8. Bytes with no bits set at the
end of the byte string are removed. An example follows.
The following example shows the encoding of an 'alarm-state' leaf The following example shows the encoding of an 'alarm-state' leaf
instance with the 'under-repair' and 'critical' flags set. instance with the 'critical', 'warning' and 'indeterminate' flags
set.
Definition example from [RFC8348]:
typedef alarm-state { typedef alarm-state {
type bits { type bits {
bit unknown; bit unknown;
bit under-repair; bit under-repair;
bit critical; bit critical;
bit major; bit major;
bit minor; bit minor;
bit warning; bit warning {
bit indeterminate; position 8;
}
bit indeterminate {
position 128;
}
} }
} }
leaf alarm-state { leaf alarm-state {
type alarm-state; type alarm-state;
} }
CBOR diagnostic notation: [h'0401', 14, h'01']
CBOR encoding: 83 42 0401 0E 41 01
In a number of cases the array would only need to have one element -
a byte string with a small number of bytes inside. For this case, it
is expected to omit the array element and have only the byte array
that would have been inside. To illustrate this, let us consider the
same example yang definition, but this time encoding only 'under-
repair' and 'critical' flags. The result would be
CBOR diagnostic notation: h'06' CBOR diagnostic notation: h'06'
CBOR encoding: 41 06 CBOR encoding: 41 06
To avoid overlap of 'bit' defined in different 'bits' statements, Elements in the array MUST be either byte strings or positive
'bits' defined in a Leafs of type 'union' MUST be encoded using a unsigned integers, where byte strings and integers MUST alternate,
CBOR text string data item (major type 3) and MUST contain a space- i.e., adjacent byte strings or adjacent integers are an error. An
array with a single byte string MUST instead by encoded as just that
byte string. An array with a single positive integer is an error.
Values of 'bit' types defined in a 'union' type MUST be encoded using
a CBOR text string data item (major type 3) and MUST contain a space-
separated sequence of names of 'bit' that are set. The encoding MUST separated sequence of names of 'bit' that are set. The encoding MUST
be enclosed by the bits CBOR tag as specified in Section 8.1. be enclosed by the bits CBOR tag as specified in Section 9.3.
The following example shows the encoding of an 'alarm-state' leaf The following example shows the encoding of an 'alarm-state' leaf
instance defined using a union type with the 'under-repair' and instance defined using a union type with the 'under-repair' and
'critical' flags set. 'critical' flags set.
Definition example: Definition example:
leaf alarm-state-2 { leaf alarm-state-2 {
type union { type union {
type alarm-state; type alarm-state;
skipping to change at page 33, line 30 skipping to change at page 34, line 30
} }
} }
CBOR diagnostic notation: "eth1" CBOR diagnostic notation: "eth1"
CBOR encoding: 64 65746831 CBOR encoding: 64 65746831
6.10. The 'identityref' Type 6.10. The 'identityref' Type
This specification supports two approaches for encoding identityref, This specification supports two approaches for encoding identityref,
a YANG Schema Item iDentifier (SID) as defined in Section 3.2 or a a YANG Schema Item iDentifier as defined in Section 3.2 or a name as
name as defined in [RFC7951] section 6.8. defined in [RFC7951] section 6.8.
6.10.1. SIDs as identityref 6.10.1. SIDs as identityref
When schema nodes of type identityref are implemented using SIDs, When schema nodes of type identityref are implemented using SIDs,
they MUST be encoded using a CBOR unsigned integer data item (major they MUST be encoded using a CBOR unsigned integer data item (major
type 0). (Note that no delta mechanism is employed for SIDs as type 0). (Note that no delta mechanism is employed for SIDs as
identityref.) identityref.)
The following example shows the encoding of a 'type' leaf instance The following example shows the encoding of a 'type' leaf instance
set to the value 'iana-if-type:ethernetCsmacd' (SID 1880). set to the value 'iana-if-type:ethernetCsmacd' (SID 1880).
skipping to change at page 35, line 30 skipping to change at page 36, line 30
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 enumeration o enumeration
o identityref o identityref
o instance-identifier o instance-identifier
See Section 8.1 for the assigned value of these CBOR tags. See Section 9.3 for the assigned value of these CBOR tags.
As mentioned in Section 6.6 and in Section 6.7, 'enumeration' and As mentioned in Section 6.6 and in Section 6.7, 'enumeration' and
'bits' are encoded as CBOR text string data item (major type 3) when 'bits' are encoded as CBOR text string data item (major type 3) when
defined within a 'union' type. defined within a 'union' type.
The following example shows the encoding of an 'ip-address' leaf The following example shows the encoding of an 'ip-address' leaf
instance when set to "2001:db8:a0b:12f0::1". instance when set to "2001:db8:a0b:12f0::1".
Definition example from [RFC7317]: Definition example from [RFC7317]:
skipping to change at page 36, line 42 skipping to change at page 37, 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
6.13. The 'instance-identifier' Type 6.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 YANG Schema Item iDentifier (SID) as defined identifier, one based on YANG Schema Item iDentifier as defined in
in Section 3.2 and one based on names as defined in Section 3.3. Section 3.2 and one based on names as defined in Section 3.3.
6.13.1. SIDs as instance-identifier 6.13.1. SIDs as instance-identifier
SIDs uniquely identify a schema node. In the case of a single SIDs uniquely identify a schema node. In the case of a single
instance schema node, i.e. a schema node defined at the root of a instance schema node, i.e. a schema node defined at the root of a
YANG module or submodule or schema nodes defined within a container, YANG module or submodule or schema nodes defined within a container,
the SID is sufficient to identify this instance. the SID is sufficient to identify this instance.
In the case of a schema node member of a YANG list, a SID is combined In the case of a schema node member of a YANG list, a SID is combined
with the list key(s) to identify each instance within the YANG with the list key(s) to identify each instance within the YANG
skipping to change at page 40, line 43 skipping to change at page 41, line 43
2F696574662D73797374656D3A73797374656D2F61757468656E74696361 2F696574662D73797374656D3A73797374656D2F61757468656E74696361
74696F6E2F757365725B6E616D653D27626F62275D2F617574686F72697A 74696F6E2F757365725B6E616D653D27626F62275D2F617574686F72697A
65642D6B65790D0A5B6E616D653D2761646D696E275D2F6B65792D64617461 65642D6B65790D0A5B6E616D653D2761646D696E275D2F6B65792D64617461
*Third example:* *Third example:*
This example is described in Section 6.13.1. This example is described in Section 6.13.1.
CBOR diagnostic notation: CBOR diagnostic notation:
"/ietf-system:system/authentication/user[name='bob']" "/ietf-system:system/authentication/user[name='jack']"
CBOR encoding: CBOR encoding:
78 33 78 33
2F696574662D73797374656D3A73797374656D2F61757468656E74696361 2F696574662D73797374656D3A73797374656D2F61757468656E74696361
74696F6E2F757365725B6E616D653D27626F62275D 74696F6E2F757365725B6E616D653D27626F62275D
7. Security Considerations 7. Content-Types
The following Content-Type is defined:
application/yang-data+cbor; id=name: This Content-Type represents a
CBOR YANG document containing one or multiple data node values.
Each data node is identified by its associated namespace qualified
name as defined in Section 3.3.
FORMAT: CBOR map of name, instance-value
The message payload of Content-Type 'application/yang-data+cbor'
is encoded using a CBOR map. Each entry within the CBOR map
contains the data node identifier (i.e. its namespace qualified
name) and the associated instance-value. Instance-values are
encoded using the rules defined in Section 4
8. Security Considerations
The security considerations of [RFC7049] and [RFC7950] apply. The security considerations of [RFC7049] and [RFC7950] 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.
8. IANA Considerations 9. IANA Considerations
8.1. CBOR Tags Registry 9.1. Media-Types Registry
This document adds the following Media-Type to the "Media Types"
registry.
+----------------+----------------------------+-----------+
| Name | Template | Reference |
+----------------+----------------------------+-----------+
| yang-data+cbor | application/yang-data+cbor | RFC XXXX |
+----------------+----------------------------+-----------+
// RFC Ed.: replace RFC XXXX with this RFC number and remove this
note.
9.2. CoAP Content-Formats Registry
This document adds the following Content-Format to the "CoAP Content-
Formats", within the "Constrained RESTful Environments (CoRE)
Parameters" registry.
+---------------------------------+--------------+------+-----------+
| Media Type | Content | ID | Reference |
| | Coding | | |
+---------------------------------+--------------+------+-----------+
| application/yang-data+cbor; | | TBD1 | RFC XXXX |
| id=name | | | |
+---------------------------------+--------------+------+-----------+
// RFC Ed.: replace TBD1 with assigned IDs and remove this note. //
RFC Ed.: replace RFC XXXX with this RFC number and remove this note.
9.3. CBOR 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 CBOR Tags following YANG datatypes. These tags are added to the CBOR Tags
Registry as defined in section 7.2 of [RFC7049]. Registry as defined in section 7.2 of [RFC7049].
+-----+------------------+-----------------------------+-----------+ +-----+------------------+-----------------------------+-----------+
| Tag | Data Item | Semantics | Reference | | Tag | Data Item | Semantics | Reference |
+-----+------------------+-----------------------------+-----------+ +-----+------------------+-----------------------------+-----------+
| 43 | byte string | YANG bits datatype | [this] | | 43 | text string | YANG bits datatype | [this] |
| | | ; see Section 6.7. | | | | | ; see Section 6.7. | |
| 44 | unsigned integer | YANG enumeration datatype | [this] | | 44 | text string | YANG enumeration datatype | [this] |
| | | ;see Section 6.6. | | | | | ; see Section 6.6. | |
| 45 | unsigned integer | YANG identityref datatype | [this] | | 45 | unsigned integer | YANG identityref datatype | [this] |
| | or text string | ; see Section 6.10. | | | | or text string | ; see Section 6.10. | |
| 46 | unsigned integer | YANG instance-identifier | [this] | | 46 | unsigned integer | YANG instance-identifier | [this] |
| | or text string | datatype; see Section 6.13. | [this] | | | or text string | datatype; see Section 6.13. | [this] |
| | or array | | | | | or array | | |
| 47 | unsigned integer | YANG Schema Item iDentifier | | | 47 | unsigned integer | YANG Schema Item iDentifier | |
| | | ; see Section 3.2. | [this] | | | | ; see Section 3.2. | [this] |
+-----+------------------+-----------------------------+-----------+ +-----+------------------+-----------------------------+-----------+
// RFC Ed.: replace [this] with RFC number and remove this note // RFC Ed.: replace [this] with RFC number and remove this note
9. Acknowledgments 10. 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.ietf-core-comi]. by Andy Bierman and Peter van der Stok on [I-D.ietf-core-comi].
[RFC7951] has also been a critical input to this work. The authors [RFC7951] has also been a critical input to this work. The authors
would like to thank the authors and contributors to these two drafts. would like to thank the authors and contributors 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.
10. References 11. References
10.1. Normative References 11.1. Normative References
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119, Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997, DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>. <https://www.rfc-editor.org/info/rfc2119>.
[RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, RFC 5234, Specifications: ABNF", STD 68, RFC 5234,
DOI 10.17487/RFC5234, January 2008, DOI 10.17487/RFC5234, January 2008,
<https://www.rfc-editor.org/info/rfc5234>. <https://www.rfc-editor.org/info/rfc5234>.
skipping to change at page 42, line 42 skipping to change at page 44, line 45
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>. May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data
Definition Language (CDDL): A Notational Convention to Definition Language (CDDL): A Notational Convention to
Express Concise Binary Object Representation (CBOR) and Express Concise Binary Object Representation (CBOR) and
JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610,
June 2019, <https://www.rfc-editor.org/info/rfc8610>. June 2019, <https://www.rfc-editor.org/info/rfc8610>.
10.2. Informative References 11.2. Informative References
[I-D.ietf-core-comi] [I-D.ietf-core-comi]
Veillette, M., Stok, P., Pelov, A., Bierman, A., and I. Veillette, M., Stok, P., Pelov, A., Bierman, A., and I.
Petrov, "CoAP Management Interface", draft-ietf-core- Petrov, "CoAP Management Interface", draft-ietf-core-
comi-08 (work in progress), September 2019. comi-09 (work in progress), March 2020.
[I-D.ietf-core-sid] [I-D.ietf-core-sid]
Veillette, M., Pelov, A., and I. Petrov, "YANG Schema Item Veillette, M., Pelov, A., and I. Petrov, "YANG Schema Item
iDentifier (SID)", draft-ietf-core-sid-11 (work in iDentifier (SID)", draft-ietf-core-sid-13 (work in
progress), March 2020. progress), June 2020.
[RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for
Constrained-Node Networks", RFC 7228, Constrained-Node Networks", RFC 7228,
DOI 10.17487/RFC7228, May 2014, DOI 10.17487/RFC7228, May 2014,
<https://www.rfc-editor.org/info/rfc7228>. <https://www.rfc-editor.org/info/rfc7228>.
[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, <https://www.rfc-editor.org/info/rfc7317>. 2014, <https://www.rfc-editor.org/info/rfc7317>.
 End of changes. 79 change blocks. 
200 lines changed or deleted 286 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/