rfc9254v5.txt   rfc9254.txt 
skipping to change at line 213 skipping to change at line 213
notification, an RPC, or an action. notification, an RPC, or an action.
item: item:
A schema node, an identity, a module, or a feature defined using A schema node, an identity, a module, or a feature defined using
the YANG modeling language. the YANG modeling language.
list entry: list entry:
The data associated with a single entry of a list (see Section 7.8 The data associated with a single entry of a list (see Section 7.8
of [RFC7950]). of [RFC7950]).
container-like instance:
An instance of a container, a YANG data structure, notification
contents, RPC input, RPC output, action input, or action output
(Section 4.2); a list entry in a list (Section 4.4); or an anydata
node (Section 4.5).
parent (of a representation node): parent (of a representation node):
The schema node of the closest enclosing representation node in The schema node of the closest enclosing representation node in
which a given representation node is defined. which a given representation node is defined.
3. Properties of the CBOR Encoding 3. Properties of the CBOR Encoding
This document defines CBOR encoding rules for YANG data trees and This document defines CBOR encoding rules for YANG data trees and
their subtrees. their subtrees.
A YANG data tree can be enclosed by a representation of a schema A YANG data tree can be enclosed by a representation of a schema
node, such as a YANG data structure, a notification, an RPC, or an node, such as a YANG data structure, a notification, an RPC, or an
action; this is called a representation tree. The data tree nodes action; this is called a representation tree. The data tree nodes
and the enclosing schema node representation, if any, are and the enclosing schema node representation, if any, are
collectively called the representation nodes. collectively called the representation nodes.
A representation node, such as a container, list entry, YANG data A representation node, such as a container, list entry, YANG data
structure, notification, RPC input, RPC output, action input, or structure, notification, RPC input, RPC output, action input, action
action output, is serialized using a CBOR map in which each schema output, or anydata node, is serialized using a CBOR map in which each
node defined within is encoded using a key and a value. This schema node defined within is encoded using a key and a value. This
specification supports two types of CBOR keys: YANG Schema Item specification supports two types of CBOR keys: YANG Schema Item
iDentifier (YANG SID), as defined in Section 3.2, and names, as iDentifier (YANG SID), as defined in Section 3.2, and names, as
defined in Section 3.3. Each of these key types is encoded using a defined in Section 3.3. Each of these key types is encoded using a
specific CBOR type that allows their interpretation during the specific CBOR type that allows their interpretation during the
deserialization process. Protocols or mechanisms implementing this deserialization process. Protocols or mechanisms implementing this
specification can mandate the use of a specific key type or allow the specification can mandate the use of a specific key type or allow the
generator to choose freely per key. generator to choose freely per key.
In order to minimize the size of the encoded data, the mapping avoids In order to minimize the size of the encoded data, the mapping avoids
any unnecessary meta-information beyond that directly provided by the any unnecessary meta-information beyond that directly provided by the
skipping to change at line 542 skipping to change at line 548
74 # text(20) 74 # text(20)
696574662D73797374656D3A686F73746E616D65 696574662D73797374656D3A686F73746E616D65
72 # text(18) 72 # text(18)
6D79686F73742E6578616D706C652E636F6D 6D79686F73742E6578616D706C652E636F6D
4.2. The 'container' and Other Nodes from the Data Tree 4.2. The 'container' and Other Nodes from the Data Tree
Instances of containers, YANG data structures, notification contents, Instances of containers, YANG data structures, notification contents,
RPC inputs, RPC outputs, action inputs, and action outputs MUST be RPC inputs, RPC outputs, action inputs, and action outputs MUST be
encoded using a CBOR map data item (major type 5). The same encoding encoded using a CBOR map data item (major type 5). The same encoding
is also used for the list entries in a list (Section 4.4). A map is also used for the list entries in a list (Section 4.4) and for
consists of pairs of data items, with each pair consisting of a key anydata nodes (Section 4.5). Collectively, we speak of these
and a value. Each key within the CBOR map is set to a schema node instances as "container-like instances".
identifier, and each value is set to the value of this representation
node according to the instance datatype. A map consists of pairs of data items, with each pair consisting of a
key and a value. Each key within the CBOR map is set to a schema
node identifier, and each value is set to the value of this
representation node according to the instance datatype.
This specification supports two types of CBOR map keys: SID, as This specification supports two types of CBOR map keys: SID, as
defined in Section 3.2, and names, as defined in Section 3.3. defined in Section 3.2, and names, as defined in Section 3.3.
The following examples show the encoding of a 'system-state' The following examples show the encoding of a 'system-state'
container representation instance using SIDs or names. container representation instance using SIDs or names.
Definition example adapted from [RFC6991] and [RFC7317]: Definition example adapted from [RFC6991] and [RFC7317]:
typedef date-and-time { typedef date-and-time {
skipping to change at line 739 skipping to change at line 748
68 # text(8) 68 # text(8)
696574662E6F7267 # "ietf.org" 696574662E6F7267 # "ietf.org"
68 # text(8) 68 # text(8)
696565652E6F7267 # "ieee.org" 696565652E6F7267 # "ieee.org"
4.4. The 'list' and the 'list' Entries 4.4. The 'list' and the 'list' Entries
A list or a subset of a list MUST be encoded using a CBOR array data A list or a subset of a list MUST be encoded using a CBOR array data
item (major type 4). Each list entry within this CBOR array is item (major type 4). Each list entry within this CBOR array is
encoded using a CBOR map data item (major type 5) based on the encoded using a CBOR map data item (major type 5) based on the
encoding rules of a collection, as defined in Section 4.2. encoding rules of a container-like instance, as defined in
Section 4.2.
It is important to note that this encoding rule also applies to a It is important to note that this encoding rule also applies to a
'list' representation node instance that has a single entry. 'list' representation node instance that has a single entry.
The following examples show the encoding of a 'server' list using The following examples show the encoding of a 'server' list using
SIDs or names. SIDs or names.
Definition example adapted from [RFC7317]: Definition example adapted from [RFC7317]:
list server { list server {
skipping to change at line 921 skipping to change at line 931
61646472657373 # "address" 61646472657373 # "address"
6A # text(10) 6A # text(10)
7461632E6E72632E6361 # "tac.nrc.ca" 7461632E6E72632E6361 # "tac.nrc.ca"
4.5. The 'anydata' 4.5. The 'anydata'
An anydata node serves as a container for an arbitrary set of An anydata node serves as a container for an arbitrary set of
representation nodes that otherwise appear as normal YANG-modeled representation nodes that otherwise appear as normal YANG-modeled
data. An anydata representation node instance is encoded using the data. An anydata representation node instance is encoded using the
same rules as a container, i.e., using a CBOR map data item (major same rules as a container, i.e., using a CBOR map data item (major
type 5) based on the encoding rules of a collection, as defined in type 5) based on the encoding rules of a container-like instance, as
Section 4.2. defined in Section 4.2.
The following example shows a possible use of an anydata node. In The following example shows a possible use of an anydata node. In
this example, an anydata node is used to define a representation node this example, an anydata node is used to define a representation node
containing a notification event; this representation node can be part containing a notification event; this representation node can be part
of a YANG list to create an event logger. of a YANG list to create an event logger.
Definition example: Definition example:
module event-log { module event-log {
... ...
anydata last-event; # SID 60123 anydata last-event; // SID 60123
} }
This example also assumes the assistance of the following This example also assumes the assistance of the following
notification. notification.
module example-port { module example-port {
... ...
notification example-port-fault { # SID 60200 notification example-port-fault { // SID 60200
leaf port-name { # SID 60201 leaf port-name { // SID 60201
type string; type string;
} }
leaf port-fault { # SID 60202 leaf port-fault { // SID 60202
type string; type string;
} }
} }
} }
4.5.1. Using SIDs in Keys 4.5.1. Using SIDs in Keys
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
skipping to change at line 1041 skipping to change at line 1051
supported. supported.
The following example shows a valid CBOR-encoded anyxml The following example shows a valid CBOR-encoded anyxml
representation node instance consisting of a CBOR array containing representation node instance consisting of a CBOR array containing
the CBOR simple values 'true', 'null', and 'true'. the CBOR simple values 'true', 'null', and 'true'.
Definition example adapted from [RFC7951]: Definition example adapted from [RFC7951]:
module bar-module { module bar-module {
... ...
anyxml bar; # SID 60000 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) /
} }
skipping to change at line 1145 skipping to change at line 1155
{ {
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) /
/ = timezone-utc-offset (SID 1740) / / = timezone-utc-offset (SID 1740) /
3 : "Maximum exceeded" / error-message (SID 1027) / 3 : "Maximum exceeded" / error-message (SID 1027) /
} }
} }
CBOR encoding: CBOR encoding:
A1 # map(1) A1 # map(1)
19 0400 # unsigned(1024) 19 0400 # unsigned(1024)
A4 # map(4) A4 # map(4)
04 # unsigned(4) 04 # unsigned(4)
19 03F3 # unsigned(1011) 19 03F3 # unsigned(1011)
01 # unsigned(1) 01 # unsigned(1)
skipping to change at line 2219 skipping to change at line 2229
Ivaylo Petrov (editor) Ivaylo Petrov (editor)
Google Switzerland GmbH Google Switzerland GmbH
Brandschenkestrasse 110 Brandschenkestrasse 110
CH-8002 Zurich CH-8002 Zurich
Switzerland Switzerland
Email: ivaylopetrov@google.com Email: ivaylopetrov@google.com
Alexander Pelov Alexander Pelov
Acklio Acklio
1137A Avenue des Champs Blancs 1137A avenue des Champs Blancs
35510 Cesson-Sevigne 35510 Cesson-Sevigne Cedex
France France
Email: a@ackl.io Email: a@ackl.io
Carsten Bormann Carsten Bormann
Universität Bremen TZI Universität Bremen TZI
Postfach 330440 Postfach 330440
D-28359 Bremen D-28359 Bremen
Germany Germany
Phone: +49-421-218-63921 Phone: +49-421-218-63921
Email: cabo@tzi.org Email: cabo@tzi.org
 End of changes. 11 change blocks. 
19 lines changed or deleted 29 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/