draft-ietf-core-yang-cbor-09.txt   draft-ietf-core-yang-cbor-10.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: October 4, 2019 A. Pelov Expires: October 10, 2019 A. Pelov
Acklio Acklio
April 02, 2019 April 08, 2019
CBOR Encoding of Data Modeled with YANG CBOR Encoding of Data Modeled with YANG
draft-ietf-core-yang-cbor-09 draft-ietf-core-yang-cbor-10
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 35 skipping to change at page 1, line 35
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 October 4, 2019. This Internet-Draft will expire on October 10, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 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 50 skipping to change at page 2, line 50
6.10.1. SIDs as identityref . . . . . . . . . . . . . . . . 31 6.10.1. SIDs as identityref . . . . . . . . . . . . . . . . 31
6.10.2. Name as identityref . . . . . . . . . . . . . . . . 32 6.10.2. Name as identityref . . . . . . . . . . . . . . . . 32
6.11. The 'empty' Type . . . . . . . . . . . . . . . . . . . . 32 6.11. The 'empty' Type . . . . . . . . . . . . . . . . . . . . 32
6.12. The 'union' Type . . . . . . . . . . . . . . . . . . . . 33 6.12. The 'union' Type . . . . . . . . . . . . . . . . . . . . 33
6.13. The 'instance-identifier' Type . . . . . . . . . . . . . 34 6.13. The 'instance-identifier' Type . . . . . . . . . . . . . 34
6.13.1. SIDs as instance-identifier . . . . . . . . . . . . 34 6.13.1. SIDs as instance-identifier . . . . . . . . . . . . 34
6.13.2. Names as instance-identifier . . . . . . . . . . . . 37 6.13.2. Names as instance-identifier . . . . . . . . . . . . 37
7. Security Considerations . . . . . . . . . . . . . . . . . . . 39 7. Security Considerations . . . . . . . . . . . . . . . . . . . 39
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 39 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 39
8.1. Tags Registry . . . . . . . . . . . . . . . . . . . . . . 39 8.1. Tags Registry . . . . . . . . . . . . . . . . . . . . . . 39
9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 39 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 40
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 40 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 40
10.1. Normative References . . . . . . . . . . . . . . . . . . 40 10.1. Normative References . . . . . . . . . . . . . . . . . . 40
10.2. Informative References . . . . . . . . . . . . . . . . . 40 10.2. Informative References . . . . . . . . . . . . . . . . . 40
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41
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
skipping to change at page 10, line 30 skipping to change at page 10, line 30
type date-and-time; type date-and-time;
} }
} }
} }
4.2.1. SIDs as keys 4.2.1. SIDs as keys
CBOR map keys implemented using SIDs MUST be encoded using a CBOR CBOR map keys implemented using SIDs MUST be encoded using a CBOR
unsigned integer (major type 0) or CBOR negative integer (major type unsigned integer (major type 0) or CBOR negative integer (major type
1), depending on the actual delta or to a SID preceded by the CBOR 1), depending on the actual delta or to a SID preceded by the CBOR
tag 99. tag 42.
// RFC Ed.: replace 99 by the allocated CBOR tag.
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 34 skipping to change at page 21, line 34
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 follow:
{ {
60123 : { / last-event (SID=60123) / 60123 : { / last-event (SID=60123) /
99(60200) : { / event (SID=60123) / 42(60200) : { / event (SID=60123) /
+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) /
} }
} }
} }
// RFC Ed.: replace 99 by the allocated CBOR tag.
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 tag listed in
Section 8.1, these tags shall be supported. Section 8.1, 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'.
skipping to change at page 28, line 39 skipping to change at page 28, line 39
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: 99("unbounded") CBOR diagnostic notation: 44("unbounded")
CBOR encoding: D8 63 69 756E626F756E646564
// RFC Ed.: update 99 and D8 63 with the enumerator CBOR tag CBOR encoding: D8 2C 69 756E626F756E646564
allocated.
6.7. The 'bits' Type 6.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 [RFC7950] 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
skipping to change at page 30, line 13 skipping to change at page 30, line 4
Definition example: Definition example:
leaf alarm-state-2 { leaf alarm-state-2 {
type union { type union {
type alarm-state; type alarm-state;
type bits { type bits {
bit extra-flag; bit extra-flag;
} }
} }
} }
CBOR diagnostic notation: 43("under-repair critical")
CBOR diagnostic notation: 99("under-repair critical") CBOR encoding: D8 2B 75 756E6465722D72657061697220637269746963616C
CBOR encoding: D8 63 75 756E6465722D72657061697220637269746963616C
// RFC Ed.: update 99 and D8 63 with the bits CBOR tag allocated.
6.8. The 'binary' Type 6.8. The 'binary' Type
Leafs of type binary MUST be encoded using a CBOR byte string data Leafs of type binary MUST be encoded using a CBOR byte string data
item (major type 2). item (major type 2).
The following example shows the encoding of an 'aes128-key' leaf The following example shows the encoding of an 'aes128-key' leaf
instance set to 0x1f1ce6a3f42660d888d92a4d8030476e. instance set to 0x1f1ce6a3f42660d888d92a4d8030476e.
Definition example: Definition example:
skipping to change at page 39, line 26 skipping to change at page 39, line 26
and reply with an appropriate error message to the sender. and reply with an appropriate error message to the sender.
8. IANA Considerations 8. IANA Considerations
8.1. Tags Registry 8.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 | | Ta | Data | Semantics | Reference |
+-----+---------------------+---------------------------+-----------+ | g | Item | | |
| xx | SID | YANG Schema Item | RFC XXXX | +----+----------+---------------------+-----------------------------+
| | | iDentifier | | | 42 | unsigned | YANG Schema Item | [draft-ietf-core-yang-cbor] |
| xx | bits | YANG bits datatype | RFC XXXX | | | integer | iDentifier (sid); | |
| xx | enumeration | YANG enumeration datatype | RFC XXXX | | | | see Section 3.2. | |
| xx | identityref | YANG identityref datatype | RFC XXXX | | 43 | byte | YANG bits datatype; | [draft-ietf-core-yang-cbor] |
| xx | instance-identifier | YANG instance-identifier | RFC XXXX | | | string | see Section 6.7. | |
| | | datatype | | | 44 | unsigned | YANG enumeration | [draft-ietf-core-yang-cbor] |
+-----+---------------------+---------------------------+-----------+ | | integer | datatype; see | |
| | | Section 6.6. | |
| 45 | unsigned | YANG identityref | [draft-ietf-core-yang-cbor] |
| | integer | datatype; see | |
| | or text | Section 6.10. | |
| | string | | |
| 46 | unsigned | YANG instance- | [draft-ietf-core-yang-cbor] |
| | integer | identifier | |
| | or text | datatype; see | |
| | string | Section 6.13. | |
| | or array | | |
+----+----------+---------------------+-----------------------------+
// RFC Ed.: update Tag values using allocated tags and remove this // RFC Ed.: replace [draft-ietf-core-yang-cbor] with RFC number and
note // RFC Ed.: replace XXXX with RFC number and remove this note remove this note
9. Acknowledgments 9. 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.
 End of changes. 14 change blocks. 
34 lines changed or deleted 35 lines changed or added

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