draft-ietf-core-yang-cbor-04.txt   draft-ietf-core-yang-cbor-05.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: August 11, 2017 Acklio Expires: February 9, 2018 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
February 07, 2017 August 08, 2017
CBOR Encoding of Data Modeled with YANG CBOR Encoding of Data Modeled with YANG
draft-ietf-core-yang-cbor-04 draft-ietf-core-yang-cbor-05
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 August 11, 2017. This Internet-Draft will expire on February 9, 2018.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 22 skipping to change at page 2, line 22
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3 2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3
2.1. YANG Schema Item iDentifier (SID) . . . . . . . . . . . . 4 2.1. YANG Schema Item iDentifier (SID) . . . . . . . . . . . . 4
2.2. CBOR diagnostic notation . . . . . . . . . . . . . . . . 5 2.2. CBOR diagnostic notation . . . . . . . . . . . . . . . . 5
3. Properties of the CBOR Encoding . . . . . . . . . . . . . . . 6 3. Properties of the CBOR Encoding . . . . . . . . . . . . . . . 6
4. Encoding of YANG Data Node Instances . . . . . . . . . . . . 7 4. Encoding of YANG Data Node Instances . . . . . . . . . . . . 7
4.1. The 'leaf' Data Node . . . . . . . . . . . . . . . . . . 7 4.1. The 'leaf' Data Node . . . . . . . . . . . . . . . . . . 7
4.2. The 'container' Data Node . . . . . . . . . . . . . . . . 7 4.2. The 'container' Data Node . . . . . . . . . . . . . . . . 7
4.2.1. SIDs as keys . . . . . . . . . . . . . . . . . . . . 8 4.2.1. SIDs as keys . . . . . . . . . . . . . . . . . . . . 8
4.2.2. Member names as keys . . . . . . . . . . . . . . . . 9 4.2.2. Member names as keys . . . . . . . . . . . . . . . . 10
4.3. The 'leaf-list' Data Node . . . . . . . . . . . . . . . . 10 4.3. The 'leaf-list' Data Node . . . . . . . . . . . . . . . . 10
4.4. The 'list' Data Node . . . . . . . . . . . . . . . . . . 10 4.4. The 'list' Data Node . . . . . . . . . . . . . . . . . . 11
4.4.1. SIDs as keys . . . . . . . . . . . . . . . . . . . . 10 4.4.1. SIDs as keys . . . . . . . . . . . . . . . . . . . . 11
4.4.2. Member names as keys . . . . . . . . . . . . . . . . 13 4.4.2. Member names as keys . . . . . . . . . . . . . . . . 14
4.5. The 'anydata' Data Node . . . . . . . . . . . . . . . . . 14 4.5. The 'anydata' Data Node . . . . . . . . . . . . . . . . . 15
4.6. The 'anyxml' Data Node . . . . . . . . . . . . . . . . . 16 4.6. The 'anyxml' Data Node . . . . . . . . . . . . . . . . . 17
5. Representing YANG Data Types in CBOR . . . . . . . . . . . . 16 5. Representing YANG Data Types in CBOR . . . . . . . . . . . . 17
5.1. The unsigned integer Types . . . . . . . . . . . . . . . 16 5.1. The unsigned integer Types . . . . . . . . . . . . . . . 17
5.2. The integer Types . . . . . . . . . . . . . . . . . . . . 17 5.2. The integer Types . . . . . . . . . . . . . . . . . . . . 18
5.3. The 'decimal64' Type . . . . . . . . . . . . . . . . . . 17 5.3. The 'decimal64' Type . . . . . . . . . . . . . . . . . . 18
5.4. The 'string' Type . . . . . . . . . . . . . . . . . . . . 17 5.4. The 'string' Type . . . . . . . . . . . . . . . . . . . . 18
5.5. The 'boolean' Type . . . . . . . . . . . . . . . . . . . 18 5.5. The 'boolean' Type . . . . . . . . . . . . . . . . . . . 19
5.6. The 'enumeration' Type . . . . . . . . . . . . . . . . . 18 5.6. The 'enumeration' Type . . . . . . . . . . . . . . . . . 19
5.7. The 'bits' Type . . . . . . . . . . . . . . . . . . . . . 19 5.7. The 'bits' Type . . . . . . . . . . . . . . . . . . . . . 20
5.8. The 'binary' Type . . . . . . . . . . . . . . . . . . . . 20 5.8. The 'binary' Type . . . . . . . . . . . . . . . . . . . . 21
5.9. The 'leafref' Type . . . . . . . . . . . . . . . . . . . 20 5.9. The 'leafref' Type . . . . . . . . . . . . . . . . . . . 21
5.10. The 'identityref' Type . . . . . . . . . . . . . . . . . 21 5.10. The 'identityref' Type . . . . . . . . . . . . . . . . . 22
5.10.1. SIDs as identityref . . . . . . . . . . . . . . . . 21 5.10.1. SIDs as identityref . . . . . . . . . . . . . . . . 22
5.10.2. Name as identityref . . . . . . . . . . . . . . . . 22 5.10.2. Name as identityref . . . . . . . . . . . . . . . . 23
5.11. The 'empty' Type . . . . . . . . . . . . . . . . . . . . 22 5.11. The 'empty' Type . . . . . . . . . . . . . . . . . . . . 23
5.12. The 'union' Type . . . . . . . . . . . . . . . . . . . . 23 5.12. The 'union' Type . . . . . . . . . . . . . . . . . . . . 24
5.13. The 'instance-identifier' Type . . . . . . . . . . . . . 24 5.13. The 'instance-identifier' Type . . . . . . . . . . . . . 25
5.13.1. SIDs as instance-identifier . . . . . . . . . . . . 24 5.13.1. SIDs as instance-identifier . . . . . . . . . . . . 25
5.13.2. Names as instance-identifier . . . . . . . . . . . . 27 5.13.2. Names as instance-identifier . . . . . . . . . . . . 28
6. Security Considerations . . . . . . . . . . . . . . . . . . . 28 6. Security Considerations . . . . . . . . . . . . . . . . . . . 29
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 28 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 29
7.1. Tags Registry . . . . . . . . . . . . . . . . . . . . . . 28 7.1. Tags Registry . . . . . . . . . . . . . . . . . . . . . . 29
8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 28 8. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 29
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 29 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 30
9.1. Normative References . . . . . . . . . . . . . . . . . . 29 9.1. Normative References . . . . . . . . . . . . . . . . . . 30
9.2. Informative References . . . . . . . . . . . . . . . . . 29 9.2. Informative References . . . . . . . . . . . . . . . . . 30
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 30 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 31
1. Introduction 1. Introduction
The specification of the YANG 1.1 data modelling language [RFC7950] The specification of the YANG 1.1 data modelling 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 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
skipping to change at page 8, line 21 skipping to change at page 8, line 21
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 (i.e., a parent with SID equal to zero of the current schema node (i.e., a parent with SID equal to zero
is assumed). is 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 both unsigned and negative deltas. MUST support both unsigned and negative deltas.
The following example shows the encoding of a 'system' container The following example shows the encoding of a 'system-state'
instance. container instance with a single child, a clock container. The clock
container container has two children, a 'current-datetime' leaf and a
'boot-datetime' leaf.
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})';
} }
} }
container clock { container system-state {
leaf current-datetime {
type date-and-time; container clock {
leaf current-datetime {
type date-and-time;
}
leaf boot-datetime {
type date-and-time;
}
} }
}
leaf boot-datetime { For this first representation, we assume that parent SID of the root
type date-and-time; container (i.e. 'system-state') is not available to the serializer.
In this case, root data nodes are encoded using absolute SIDs.
CBOR diagnostic notation:
{
1717 : { / clock (SID 1717) /
+2 : "2015-10-02T14:47:24Z-05:00", / current-datetime (SID 1719)/
+1 : "2015-09-15T09:12:58Z-05:00" / boot-datetime (SID 1718) /
} }
} }
CBOR encoding:
a1 # map(1)
19 06b5 # unsigned(1717)
a2 # map(2)
02 # unsigned(2)
78 1a # text(26)
323031352d31302d30325431343a34373a32345a2d30353a3030
01 # unsigned(1)
78 1a # text(26)
323031352d30392d31355430393a31323a35385a2d30353a3030
On the other hand, if the serializer is aware of the parent SID, 1716
in the case 'system-state' container, root data nodes are encoded
using deltas.
CBOR diagnostic notation: CBOR diagnostic notation:
{ {
1717 : { / clock (SID 1717) / +1 : { / clock (SID 1717) /
+2 : "2015-10-02T14:47:24Z-05:00", / current-datetime (SID 1719) / +2 : "2015-10-02T14:47:24Z-05:00", / current-datetime (SID 1719)/
+1 : "2015-09-15T09:12:58Z-05:00" / boot-datetime (SID 1718) / +1 : "2015-09-15T09:12:58Z-05:00" / boot-datetime (SID 1718) /
}
} }
}
CBOR encoding: CBOR encoding:
a1 # map(1) a1 # map(1)
19 06b5 # unsigned(1717) 01 # unsigned(1)
a2 # map(2) a2 # map(2)
02 # unsigned(2) 02 # unsigned(2)
78 1a # text(26) 78 1a # text(26)
323031352d31302d30325431343a34373a32345a2d30353a3030 323031352d31302d30325431343a34373a32345a2d30353a3030
01 # unsigned(1) 01 # unsigned(1)
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 [RFC7951] section MUST be used. Names and namespaces are defined in [RFC7951] section
skipping to change at page 29, line 30 skipping to change at page 30, line 30
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>.
[RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language",
RFC 7950, DOI 10.17487/RFC7950, August 2016, RFC 7950, DOI 10.17487/RFC7950, August 2016,
<http://www.rfc-editor.org/info/rfc7950>. <http://www.rfc-editor.org/info/rfc7950>.
9.2. Informative References 9.2. Informative References
[I-D.ietf-core-comi] [I-D.ietf-core-comi]
Stok, P., Bierman, A., Veillette, M., and A. Pelov, "CoAP Veillette, M., Stok, P., Pelov, A., and A. Bierman, "CoAP
Management Interface", draft-ietf-core-comi-00 (work in Management Interface", draft-ietf-core-comi-01 (work in
progress), January 2017. progress), July 2017.
[I-D.ietf-core-sid] [I-D.ietf-core-sid]
Somaraju, A., Veillette, M., Pelov, A., Turner, R., and A. Veillette, M., Pelov, A., Turner, R., Minaburo, A., and A.
Minaburo, "YANG Schema Item iDentifier (SID)", draft-ietf- Somaraju, "YANG Schema Item iDentifier (SID)", draft-ietf-
core-sid-00 (work in progress), October 2016. core-sid-01 (work in progress), May 2017.
[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
 End of changes. 17 change blocks. 
61 lines changed or deleted 95 lines changed or added

This html diff was produced by rfcdiff 1.45. The latest version is available from http://tools.ietf.org/tools/rfcdiff/