Internet-Draft | Metadata Annotations in YANG-CBOR | April 2024 |
Bormann | Expires 20 October 2024 | [Page] |
This specification defines the representation of metadata annotations (RFC 7952) in YANG-CBOR (RFC 9254).¶
This note is to be removed before publishing as an RFC.¶
Status information for this document may be found at https://datatracker.ietf.org/doc/draft-bormann-cbor-yang-metadata/.¶
Discussion of this document takes place on the cbor Working Group mailing list (mailto:cbor@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/cbor/. Subscribe at https://www.ietf.org/mailman/listinfo/cbor/.¶
Source for this draft and an issue tracker can be found at https://github.com/cabo/yang-metadata.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 20 October 2024.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
This specification defines the representation of metadata annotations [RFC7952] in YANG-CBOR [RFC9254].¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [BCP14] when, and only when, they appear in all capitals, as shown here.¶
The term "CDDL" refers to the data definition language defined in [RFC8610] and its registered extensions (such as those in [RFC9165]), as well as [I-D.ietf-cbor-update-8610-grammar].¶
Specific examples are notated in CBOR Extended Diagnostic Notation (EDN), as originally introduced in Section 8 of RFC 8949 [STD94] and extended in Appendix G of [RFC8610]. ([I-D.ietf-cbor-edn-literals] more rigorously defines and further extends EDN.)¶
RFC-Editor:
This document uses the CPA (code point allocation)
convention described in [I-D.bormann-cbor-draft-numbers]. For
each usage of the term "CPA", please remove the prefix "CPA"
from the indicated value and replace the residue with the value
assigned by IANA; perform an analogous substitution for all other
occurrences of the prefix "CPA" in the document. Finally,
please remove this note.¶
This section defines the metadata encoding for YANG-CBOR [RFC9254], analogous to the Subsections for YANG-XML and YANG-JSON of Section 5 of [RFC7952].¶
Section 5.2.1 of [RFC7952] defines a "Metadata Object" for YANG-JSON. Analogously, the YANG-CBOR encoding of metadata annotations uses a Metadata Map, which is identical in structure to the other CBOR maps used in [RFC9254].¶
Where YANG SIDs are used as the basis for the map keys for the metadata map, the map's reference SID is the reference SID of the enclosing data structure, as defined in Section 3.2 of [RFC9254]. Where names (Section 3.3 of [RFC9254]) are used as the map keys for the metadata map, they MUST be fully qualified, analogous to Section 5.2.1 of [RFC7952].¶
Metadata annotations are added to a data node instance by replacing
the representation of the instance ("Instance-Representation
") with
the structure specified in CDDL in Figure 1:¶
In essence, the annotated-data-node
stands in for the
Instance-Representation
; a consuming implementation that wants to
ignore all metadata received can simply replace each
annotated-data-node
by the Instance-Representation
embedded in it.¶
(Editor's note:) QUESTION: Do we need to represent metadata maps without the actual instance representation present? If yes, we could simply make the second element of the array in Figure 1 optional.¶
(Editor's note:) QUESTION: This representation assumes that it is good that metadata always come before the actual data node, as would also be the case with XML attributes. Sections 5.2.3 and 5.2.4 of [RFC7952] show examples with metadata last, though. Can we simply focus on one of these orders (always first, or always last), or do we really need to support both (avoid!)?¶
This section provides a number of examples, based on the examples in Section 5.2 of [RFC7952]; please see the descriptions of these examples there. Note that the examples here always show an enclosing map if needed; this is generally elided in Section 5.2 of [RFC7952] (which shows only map key and map value separated by colon).¶
All but one example below use YANG SIDs (Section 3.2 of [RFC9254]). For this, the examples assume the example SID assignments in Table 1, the relevant ones of which are also repeated at the start of each subsection:¶
name | SID |
---|---|
cask | 61600 |
seq | 61601 |
name | 61602 |
stuff | 61603 |
example-last-modified:last-modified | 61610 |
foo:flag | 61620 |
bibliomod:folio | 61630 |
For computing the outermost SID deltas, the examples assume the reference SID is 61000.¶
The examples here show that the map representing the instance
representation is not extended by a new member as in Section 5.2.2 of [RFC7952], but is enclosed in an annotated-data-node
structure like in
the other examples.¶
name | SID |
---|---|
cask | 61600 |
seq | 61601 |
name | 61602 |
example-last-modified:last-modified | 61610 |
"cask" is a container or anydata node:¶
The same "cask" example with name-based CBOR maps (Section 3.3 of [RFC9254]):¶
"seq" is a list whose key is "name"; annotation "last-modified" is added only to the first entry:¶
name | SID |
---|---|
stuff | 61603 |
example-last-modified:last-modified | 61610 |
foo:flag | 61620 |
"flag" is a leaf node of the "boolean" type defined in module "foo". The SID 61620 for "foo:flag" expresses both the name "flag" and the namespace name "foo" in its CBOR encoding:¶
"stuff" is an anyxml node:¶
name | SID |
---|---|
example-last-modified:last-modified | 61610 |
bibliomod:folio | 61630 |
The security considerations of [RFC7952] and [RFC9254] apply.¶
Andy Bierman brought up the need for this document.¶