idnits 2.17.1
draft-ietf-netmod-yang-json-10.txt:
Checking boilerplate required by RFC 5378 and the IETF Trust (see
https://trustee.ietf.org/license-info):
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt:
----------------------------------------------------------------------------
No issues found here.
Checking nits according to https://www.ietf.org/id-info/checklist :
----------------------------------------------------------------------------
** The document seems to lack an IANA Considerations section. (See Section
2.2 of https://www.ietf.org/id-info/checklist for how to handle the case
when there are no actions for IANA.)
Miscellaneous warnings:
----------------------------------------------------------------------------
== The copyright year in the IETF Trust and authors Copyright Line does not
match the current year
-- The document date (March 26, 2016) is 2946 days in the past. Is this
intentional?
Checking references for intended status: Proposed Standard
----------------------------------------------------------------------------
(See RFCs 3967 and 4897 for information about using normative references
to lower-maturity documents in RFCs)
-- Looks like a reference, but probably isn't: '123' on line 353
-- Looks like a reference, but probably isn't: '0' on line 353
== Outdated reference: A later version (-14) exists of
draft-ietf-netmod-rfc6020bis-11
** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259)
== Outdated reference: A later version (-18) exists of
draft-ietf-netconf-restconf-10
-- Obsolete informational reference (is this intentional?): RFC 7223
(Obsoleted by RFC 8343)
Summary: 2 errors (**), 0 flaws (~~), 3 warnings (==), 4 comments (--).
Run idnits with the --verbose option for more detailed information about
the items above.
--------------------------------------------------------------------------------
2 NETMOD Working Group L. Lhotka
3 Internet-Draft CZ.NIC
4 Intended status: Standards Track March 26, 2016
5 Expires: September 27, 2016
7 JSON Encoding of Data Modeled with YANG
8 draft-ietf-netmod-yang-json-10
10 Abstract
12 This document defines encoding rules for representing configuration
13 data, state data, parameters of RPC operations or actions, and
14 notifications defined using YANG as JavaScript Object Notation (JSON)
15 text.
17 Status of This Memo
19 This Internet-Draft is submitted in full conformance with the
20 provisions of BCP 78 and BCP 79.
22 Internet-Drafts are working documents of the Internet Engineering
23 Task Force (IETF). Note that other groups may also distribute
24 working documents as Internet-Drafts. The list of current Internet-
25 Drafts is at http://datatracker.ietf.org/drafts/current/.
27 Internet-Drafts are draft documents valid for a maximum of six months
28 and may be updated, replaced, or obsoleted by other documents at any
29 time. It is inappropriate to use Internet-Drafts as reference
30 material or to cite them other than as "work in progress."
32 This Internet-Draft will expire on September 27, 2016.
34 Copyright Notice
36 Copyright (c) 2016 IETF Trust and the persons identified as the
37 document authors. All rights reserved.
39 This document is subject to BCP 78 and the IETF Trust's Legal
40 Provisions Relating to IETF Documents
41 (http://trustee.ietf.org/license-info) in effect on the date of
42 publication of this document. Please review these documents
43 carefully, as they describe your rights and restrictions with respect
44 to this document. Code Components extracted from this document must
45 include Simplified BSD License text as described in Section 4.e of
46 the Trust Legal Provisions and are provided without warranty as
47 described in the Simplified BSD License.
49 Table of Contents
51 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
52 2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3
53 3. Properties of the JSON Encoding . . . . . . . . . . . . . . . 4
54 4. Names and Namespaces . . . . . . . . . . . . . . . . . . . . 5
55 5. Encoding of YANG Data Node Instances . . . . . . . . . . . . 7
56 5.1. The "leaf" Data Node . . . . . . . . . . . . . . . . . . 7
57 5.2. The "container" Data Node . . . . . . . . . . . . . . . . 7
58 5.3. The "leaf-list" Data Node . . . . . . . . . . . . . . . . 8
59 5.4. The "list" Data Node . . . . . . . . . . . . . . . . . . 8
60 5.5. The "anydata" Data Node . . . . . . . . . . . . . . . . . 9
61 5.6. The "anyxml" Data Node . . . . . . . . . . . . . . . . . 10
62 5.7. Metadata Objects . . . . . . . . . . . . . . . . . . . . 10
63 6. Representing YANG Data Types in JSON Values . . . . . . . . . 10
64 6.1. Numeric Types . . . . . . . . . . . . . . . . . . . . . . 11
65 6.2. The "string" Type . . . . . . . . . . . . . . . . . . . . 11
66 6.3. The "boolean" Type . . . . . . . . . . . . . . . . . . . 11
67 6.4. The "enumeration" Type . . . . . . . . . . . . . . . . . 11
68 6.5. The "bits" Type . . . . . . . . . . . . . . . . . . . . . 11
69 6.6. The "binary" Type . . . . . . . . . . . . . . . . . . . . 12
70 6.7. The "leafref" Type . . . . . . . . . . . . . . . . . . . 12
71 6.8. The "identityref" Type . . . . . . . . . . . . . . . . . 12
72 6.9. The "empty" Type . . . . . . . . . . . . . . . . . . . . 13
73 6.10. The "union" Type . . . . . . . . . . . . . . . . . . . . 13
74 6.11. The "instance-identifier" Type . . . . . . . . . . . . . 14
75 7. I-JSON Compliance . . . . . . . . . . . . . . . . . . . . . . 14
76 8. Security Considerations . . . . . . . . . . . . . . . . . . . 15
77 9. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 15
78 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 15
79 10.1. Normative References . . . . . . . . . . . . . . . . . . 16
80 10.2. Informative References . . . . . . . . . . . . . . . . . 16
81 Appendix A. A Complete Example . . . . . . . . . . . . . . . . . 17
82 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 19
83 B.1. Changes Between Revisions -09 and -10 . . . . . . . . . . 19
84 B.2. Changes Between Revisions -08 and -09 . . . . . . . . . . 19
85 B.3. Changes Between Revisions -07 and -08 . . . . . . . . . . 20
86 B.4. Changes Between Revisions -06 and -07 . . . . . . . . . . 20
87 B.5. Changes Between Revisions -05 and -06 . . . . . . . . . . 20
88 B.6. Changes Between Revisions -04 and -05 . . . . . . . . . . 20
89 B.7. Changes Between Revisions -03 and -04 . . . . . . . . . . 20
90 B.8. Changes Between Revisions -02 and -03 . . . . . . . . . . 20
91 B.9. Changes Between Revisions -01 and -02 . . . . . . . . . . 20
92 B.10. Changes Between Revisions -00 and -01 . . . . . . . . . . 21
93 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 21
95 1. Introduction
97 The NETCONF protocol [RFC6241] uses XML [W3C.REC-xml-20081126] for
98 encoding data in its Content Layer. Other management protocols might
99 want to use other encodings while still benefiting from using YANG
100 [I-D.ietf-netmod-rfc6020bis] as the data modeling language.
102 For example, the RESTCONF protocol [I-D.ietf-netconf-restconf]
103 supports two encodings: XML (media type "application/yang.data+xml")
104 and JSON (media type "application/yang.data+json").
106 The specification of YANG 1.1 data modelling language
107 [I-D.ietf-netmod-rfc6020bis] defines only XML encoding of data trees,
108 i.e., configuration data, state data, input/output parameters of RPC
109 operations or actions, and notifications. The aim of this document
110 is to define rules for encoding the same data as JavaScript Object
111 Notation (JSON) text [RFC7159].
113 2. Terminology and Notation
115 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
116 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
117 document are to be interpreted as described in [RFC2119].
119 The following terms are defined in [I-D.ietf-netmod-rfc6020bis]:
121 o action,
123 o anydata,
125 o anyxml,
127 o augment,
129 o container,
131 o data node,
133 o data tree,
135 o identity,
137 o instance identifier,
139 o leaf,
141 o leaf-list,
142 o list,
144 o module,
146 o RPC operation,
148 o submodule.
150 The following terms are defined in [RFC6241]:
152 o configuration data,
154 o notification,
156 o state data.
158 3. Properties of the JSON Encoding
160 This document defines JSON encoding for YANG data trees and their
161 subtrees. It is always assumed that the top-level structure in JSON-
162 encoded data is an object.
164 Instances of YANG data nodes (leafs, containers, leaf-lists, lists,
165 anydata and anyxml nodes) are encoded as members of a JSON object,
166 i.e., name/value pairs. Section 4 defines how the name part is
167 formed, and the following sections deal with the value part. The
168 encoding rules are identical for all types of data trees, i.e.,
169 configuration data, state data, parameters of RPC operations,
170 actions, and notifications.
172 With the exception of "anydata" encoding (Section 5.5), all rules in
173 this document are also applicable to YANG 1.0 [RFC6020].
175 Unlike XML element content, JSON values carry partial type
176 information (number, string, boolean). The JSON encoding is defined
177 so that this information is never in conflict with the data type of
178 the corresponding YANG leaf or leaf-list.
180 With the exception of anyxml and schema-less anydata nodes, it is
181 possible to map a JSON-encoded data tree to XML encoding as defined
182 in [I-D.ietf-netmod-rfc6020bis], and vice versa. However, such
183 conversions require the YANG data model to be available.
185 In order to achieve maximum interoperability while allowing
186 implementations to use a variety of existing JSON parsers, the JSON
187 encoding rules follow, as much as possible, the constraints of the
188 I-JSON restricted profile [RFC7493]. Section 7 discusses I-JSON
189 conformance in more detail.
191 4. Names and Namespaces
193 A JSON object member name MUST be in one of the following forms:
195 o simple - identical to the identifier of the corresponding YANG
196 data node;
198 o namespace-qualified - the data node identifier is prefixed with
199 the name of the module in which the data node is defined,
200 separated from the data node identifier by the colon character
201 (":").
203 The name of a module determines the namespace of all data node names
204 defined in that module. If a data node is defined in a submodule,
205 then the namespace-qualified member name uses the name of the main
206 module to which the submodule belongs.
208 ABNF syntax [RFC5234] of a member name is shown in Figure 1, where
209 the production for "identifier" is defined in sec. 13 of
210 [I-D.ietf-netmod-rfc6020bis].
212 member-name = [identifier ":"] identifier
214 Figure 1: ABNF production for a JSON member name.
216 A namespace-qualified member name MUST be used for all members of a
217 top-level JSON object, and then also whenever the namespaces of the
218 data node and its parent node are different. In all other cases, the
219 simple form of the member name MUST be used.
221 For example, consider the following YANG module:
223 module example-foomod {
225 namespace "http://example.com/foomod";
227 prefix "foomod";
229 container top {
230 leaf foo {
231 type uint8;
232 }
233 }
234 }
236 If the data model consists only of this module, then the following is
237 a valid JSON-encoded configuration data:
239 {
240 "example-foomod:top": {
241 "foo": 54
242 }
243 }
245 Note that the member of the top-level object uses the namespace-
246 qualified name but the "foo" leaf doesn't because it is defined in
247 the same module as its parent container "top".
249 Now, assume the container "top" is augmented from another module,
250 "example-barmod":
252 module example-barmod {
254 namespace "http://example.com/barmod";
256 prefix "barmod";
258 import example-foomod {
259 prefix "foomod";
260 }
262 augment "/foo:top" {
263 leaf bar {
264 type boolean;
265 }
266 }
267 }
269 A valid JSON-encoded configuration data containing both leafs may
270 then look like this:
272 {
273 "example-foomod:top": {
274 "foo": 54,
275 "example-barmod:bar": true
276 }
277 }
279 The name of the "bar" leaf is prefixed with the namespace identifier
280 because its parent is defined in a different module.
282 Explicit namespace identifiers are sometimes needed when encoding
283 values of the "identityref" and "instances-identifier" types. The
284 same form of namespace-qualified name as defined above is then used.
285 See Sections 6.8 and 6.11 for details.
287 5. Encoding of YANG Data Node Instances
289 Every data node instance is encoded as a name/value pair where the
290 name is formed from the data node identifier using the rules of
291 Section 4. The value depends on the category of the data node as
292 explained in the following subsections.
294 Character encoding MUST be UTF-8.
296 5.1. The "leaf" Data Node
298 A leaf instance is encoded as a name/value pair where the value can
299 be a string, number, literal "true" or "false", or the special array
300 "[null]", depending on the type of the leaf (see Section 6 for the
301 type encoding rules).
303 Example: For the leaf node definition
305 leaf foo {
306 type uint8;
307 }
309 the following is a valid JSON-encoded instance:
311 "foo": 123
313 5.2. The "container" Data Node
315 A container instance is encoded as a name/object pair. The
316 container's child data nodes are encoded as members of the object.
318 Example: For the container definition
320 container bar {
321 leaf foo {
322 type uint8;
323 }
324 }
326 the following is a valid JSON-encoded instance:
328 "bar": {
329 "foo": 123
330 }
332 5.3. The "leaf-list" Data Node
334 A leaf-list is encoded as a name/array pair, and the array elements
335 are values of some scalar type, which can be a string, number,
336 literal "true" or "false", or the special array "[null]", depending
337 on the type of the leaf-list (see Section 6 for the type encoding
338 rules).
340 The ordering of array elements follows the same rules as the ordering
341 of XML elements representing leaf-list entries in the XML encoding.
342 Specifically, the "ordered-by" properties (sec. 7.7.7 in
343 [I-D.ietf-netmod-rfc6020bis]) MUST be observed.
345 Example: For the leaf-list definition
347 leaf-list foo {
348 type uint8;
349 }
351 the following is a valid JSON-encoded instance:
353 "foo": [123, 0]
355 5.4. The "list" Data Node
357 A list instance is encoded as a name/array pair, and the array
358 elements are JSON objects.
360 The ordering of array elements follows the same rules as the ordering
361 of XML elements representing list entries in the XML encoding.
362 Specifically, the "ordered-by" properties (sec. 7.7.7 in
363 [I-D.ietf-netmod-rfc6020bis]) MUST be observed.
365 Unlike the XML encoding, where list keys are required to precede any
366 other siblings within a list entry, and appear in the order specified
367 by the data model, the order of members in a JSON-encoded list entry
368 is arbitrary because JSON objects are fundamentally unordered
369 collections of members.
371 Example: For the list definition
372 list bar {
373 key foo;
374 leaf foo {
375 type uint8;
376 }
377 leaf baz {
378 type string;
379 }
380 }
382 the following is a valid JSON-encoded instance:
384 "bar": [
385 {
386 "foo": 123,
387 "baz": "zig"
388 },
389 {
390 "baz": "zag",
391 "foo": 0
392 }
393 ]
395 5.5. The "anydata" Data Node
397 Anydata data node serves as a container for an arbitrary set of nodes
398 that otherwise appear as normal YANG-modeled data. A data model for
399 anydata content may or may not be known at run time. In the latter
400 case, converting JSON-encoded instances to the XML encoding defined
401 in [I-D.ietf-netmod-rfc6020bis] may be impossible.
403 An anydata instance is encoded in the same way as a container, i.e.,
404 as a value/object pair. The requirement that anydata content can be
405 modeled by YANG implies the following rules for the JSON text inside
406 the object:
408 o It is valid I-JSON [RFC7493].
410 o All object member names satisfy the ABNF production in Figure 1.
412 o Any JSON array contains either only unique scalar values (as a
413 leaf-list, see Section 5.3), or only objects (as a list, see
414 Section 5.4).
416 o The "null" value is only allowed in the single-element array
417 "[null]" corresponding to the encoding of the "empty" type, see
418 Section 6.9.
420 Example: for the anydata definition
422 anydata data;
424 the following is a valid JSON-encoded instance:
426 "data": {
427 "ietf-notification:notification": {
428 "eventTime": "2014-07-29T13:43:01Z",
429 "example-event:event": {
430 "event-class": "fault",
431 "reporting-entity": {
432 "card": "Ethernet0"
433 },
434 "severity": "major"
435 }
436 }
437 }
439 5.6. The "anyxml" Data Node
441 An anyxml instance is encoded as a JSON name/value pair. The value
442 MUST satisfy I-JSON constraints.
444 Example: For the anyxml definition
446 anyxml bar;
448 the following is a valid JSON-encoded instance:
450 "bar": [true, null, true]
452 5.7. Metadata Objects
454 Apart from instances of YANG data nodes, a JSON document MAY contain
455 special object members whose name starts with the "@" character
456 (COMMERCIAL AT). Such members are used for special purposes such as
457 encoding metadata [I-D.ietf-netmod-yang-metadata]. Exact syntax and
458 semantics of such members are outside the scope of this document.
460 6. Representing YANG Data Types in JSON Values
462 The type of the JSON value in an instance of the leaf or leaf-list
463 data node depends on the type of that data node as specified in the
464 following subsections.
466 6.1. Numeric Types
468 A value of the types "int8", "int16", "int32", "uint8", "uint16" and
469 "uint32" is represented as a JSON number.
471 A value of the "int64", "uint64" or "decimal64" type is represented
472 as a JSON string whose content is the lexical representation of the
473 corresponding YANG type as specified in sections 9.2.1 and 9.3.1 of
474 [I-D.ietf-netmod-rfc6020bis].
476 For example, if the type of the leaf "foo" in Section 5.1 was
477 "uint64" instead of "uint8", the instance would have to be encoded as
479 "foo": "123"
481 The special handling of 64-bit numbers follows from the I-JSON
482 recommendation to encode numbers exceeding the IEEE 754-2008 double
483 precision range as strings, see sec. 2.2 in [RFC7493].
485 6.2. The "string" Type
487 A "string" value is represented as a JSON string, subject to JSON
488 string encoding rules.
490 6.3. The "boolean" Type
492 A "boolean" value is represented as the corresponding JSON literal
493 name "true" or "false".
495 6.4. The "enumeration" Type
497 An "enumeration" value is represented as a JSON string - one of the
498 names assigned by "enum" statements in YANG.
500 The representation is identical to the lexical representation of the
501 "enumeration" type in XML, see sec. 9.6 in
502 [I-D.ietf-netmod-rfc6020bis].
504 6.5. The "bits" Type
506 A "bits" value is represented as a JSON string - a space-separated
507 sequence of names of bits that are set. The permitted bit names are
508 assigned by "bit" statements in YANG.
510 The representation is identical to the lexical representation of the
511 "bits" type, see sec. 9.7 in [I-D.ietf-netmod-rfc6020bis].
513 6.6. The "binary" Type
515 A "binary" value is represented as a JSON string - base64-encoding of
516 arbitrary binary data.
518 The representation is identical to the lexical representation of the
519 "binary" type in XML, see sec. 9.8 in [I-D.ietf-netmod-rfc6020bis].
521 6.7. The "leafref" Type
523 A "leafref" value is represented using the same rules as the type of
524 the leaf to which the leafref value refers.
526 6.8. The "identityref" Type
528 An "identityref" value is represented as a string - the name of an
529 identity. If the identity is defined in another module than the leaf
530 node containing the identityref value, the namespace-qualified form
531 (Section 4) MUST be used. Otherwise, both the simple and namespace-
532 qualified forms are permitted.
534 For example, consider the following schematic module:
536 module example-mod {
537 ...
538 import ietf-interfaces {
539 prefix if;
540 }
541 import iana-if-type {
542 prefix ianaift;
543 }
544 ...
545 leaf type {
546 type identityref {
547 base "if:interface-type";
548 }
549 }
550 }
552 A valid instance of the "type" leaf is then encoded as follows:
554 "type": "iana-if-type:ethernetCsmacd"
556 The namespace identifier "iana-if-type" must be present in this case
557 because the "ethernetCsmacd" identity is not defined in the same
558 module as the "type" leaf.
560 6.9. The "empty" Type
562 An "empty" value is represented as "[null]", i.e., an array with the
563 "null" literal being its only element. For the purposes of this
564 document, "[null]" is considered an atomic scalar value.
566 This encoding of the "empty" type was chosen instead of using simply
567 "null" in order to facilitate the use of empty leafs in common
568 programming languages where the "null" value of a member is treated
569 as if the member is not present.
571 Example: For the leaf definition
573 leaf foo {
574 type empty;
575 }
577 a valid instance is
579 "foo": [null]
581 6.10. The "union" Type
583 A value of the "union" type is encoded as the value of any of the
584 member types.
586 When validating a value of the "union" type, the type information
587 conveyed by the JSON encoding MUST also be taken into account. JSON
588 syntax thus provides additional means for resolving union member type
589 that are not available in XML encoding.
591 For example, consider the following YANG definition:
593 leaf bar {
594 type union {
595 type uint16;
596 type string;
597 }
598 }
600 In RESTCONF [I-D.ietf-netconf-restconf], it is possible to set the
601 value of "bar" in the following way when using the "application/
602 yang.data+xml" media type:
604 13.5
605 because the value may be interpreted as a string, i.e., the second
606 member type of the union. When using the "application/
607 yang.data+json" media type, however, this is an error:
609 "bar": 13.5
611 In this case, the JSON encoding indicates the value is supposed to be
612 a number rather than a string, and it is not a valid "uint16" value.
614 Conversely, the value of
616 "bar": "1"
618 is to be interpreted as a string.
620 6.11. The "instance-identifier" Type
622 An "instance-identifier" value is encoded as a string that is
623 analogical to the lexical representation in XML encoding, see
624 sec. 9.13.3 in [I-D.ietf-netmod-rfc6020bis]. However, the encoding
625 of namespaces in instance-identifier values follows the rules stated
626 in Section 4, namely:
628 o The leftmost (top-level) data node name is always in the
629 namespace-qualified form.
631 o Any subsequent data node name is in the namespace-qualified form
632 if the node is defined in another module than its parent node, and
633 the simple form is used otherwise. This rule also holds for node
634 names appearing in predicates.
636 For example,
638 /ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ip
640 is a valid instance-identifer value because the data nodes
641 "interfaces", "interface" and "name" are defined in the module "ietf-
642 interfaces", whereas "ipv4" and "ip" are defined in "ietf-ip".
644 7. I-JSON Compliance
646 I-JSON [RFC7493] is a restricted profile of JSON that guarantees
647 maximum interoperability for protocols that use JSON in their
648 messages, no matter what JSON encoders/decoders are used in protocol
649 implementations. The encoding defined in this document therefore
650 observes the I-JSON requirements and recommendations as closely as
651 possible.
653 In particular, the following properties are guaranteed:
655 o Character encoding is UTF-8.
657 o Member names within the same JSON object are always unique.
659 o The order of JSON object members is never relied upon.
661 o Numbers of any type supported by YANG can be exchanged reliably.
662 See Section 6.1 for details.
664 The JSON encoding defined in this document deviates from I-JSON only
665 in the representation of the "binary" type. In order to remain
666 compatible with XML encoding, the base64 encoding scheme is used
667 (Section 6.6), whilst I-JSON recommends base64url instead.
669 8. Security Considerations
671 This document defines an alternative encoding for data modeled in the
672 YANG data modeling language. As such, it doesn't contribute any new
673 security issues beyond those discussed in sec. 16 of
674 [I-D.ietf-netmod-rfc6020bis].
676 This document defines no mechanisms for signing and encrypting data
677 modeled with YANG. Under normal circumstances, data security and
678 integrity is guaranteed by the management protocol in use, such as
679 NETCONF [RFC6241] or RESTCONF [I-D.ietf-netconf-restconf]. If it is
680 not the case, external mechanisms, such as PKCS #7 [RFC2315] or JOSE
681 ([RFC7515] and [RFC7516]), need to be considered.
683 JSON processing is rather different from XML, and JSON parsers may
684 thus suffer from other types of vulnerabilities than their XML
685 counterparts. To minimize these new security risks, software on the
686 receiving side SHOULD reject all messages that do not comply to the
687 rules of this document and reply with an appropriate error message to
688 the sender.
690 9. Acknowledgments
692 The author wishes to thank Andy Bierman, Martin Bjorklund, Dean
693 Bogdanovic, Balazs Lengyel, Juergen Schoenwaelder and Phil Shafer for
694 their helpful comments and suggestions.
696 10. References
697 10.1. Normative References
699 [I-D.ietf-netmod-rfc6020bis]
700 Bjorklund, M., "The YANG 1.1 Data Modeling Language",
701 draft-ietf-netmod-rfc6020bis-11 (work in progress),
702 February 2016.
704 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
705 Requirement Levels", BCP 14, RFC 2119,
706 DOI 10.17487/RFC2119, March 1997,
707 .
709 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
710 Specifications: ABNF", STD 68, RFC 5234,
711 DOI 10.17487/RFC5234, January 2008,
712 .
714 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
715 and A. Bierman, Ed., "Network Configuration Protocol
716 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
717 .
719 [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
720 Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
721 2014, .
723 [RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493,
724 DOI 10.17487/RFC7493, March 2015,
725 .
727 10.2. Informative References
729 [I-D.ietf-netconf-restconf]
730 Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
731 Protocol", draft-ietf-netconf-restconf-10 (work in
732 progress), March 2016.
734 [I-D.ietf-netmod-yang-metadata]
735 Lhotka, L., "Defining and Using Metadata with YANG",
736 draft-ietf-netmod-yang-metadata-07 (work in progress),
737 March 2016.
739 [RFC2315] Kaliski, B., "PKCS #7: Cryptographic Message Syntax
740 Version 1.5", RFC 2315, DOI 10.17487/RFC2315, March 1998,
741 .
743 [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for
744 the Network Configuration Protocol (NETCONF)", RFC 6020,
745 DOI 10.17487/RFC6020, October 2010,
746 .
748 [RFC7223] Bjorklund, M., "A YANG Data Model for Interface
749 Management", RFC 7223, DOI 10.17487/RFC7223, May 2014,
750 .
752 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web
753 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May
754 2015, .
756 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)",
757 RFC 7516, DOI 10.17487/RFC7516, May 2015,
758 .
760 [W3C.REC-xml-20081126]
761 Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and
762 F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth
763 Edition)", World Wide Web Consortium Recommendation REC-
764 xml-20081126, November 2008,
765 .
767 Appendix A. A Complete Example
769 The JSON document shown below represents the same data as the reply
770 to the NETCONF request appearing in Appendix D of [RFC7223].
771 The data model is a combination of two YANG modules: "ietf-
772 interfaces" and "ex-vlan" (the latter is an example module from
773 Appendix C of [RFC7223]). The "if-mib" feature defined in the "ietf-
774 interfaces" module is supported.
776 {
777 "ietf-interfaces:interfaces": {
778 "interface": [
779 {
780 "name": "eth0",
781 "type": "iana-if-type:ethernetCsmacd",
782 "enabled": false
783 },
784 {
785 "name": "eth1",
786 "type": "iana-if-type:ethernetCsmacd",
787 "enabled": true,
788 "ex-vlan:vlan-tagging": true
789 },
790 {
791 "name": "eth1.10",
792 "type": "iana-if-type:l2vlan",
793 "enabled": true,
794 "ex-vlan:base-interface": "eth1",
795 "ex-vlan:vlan-id": 10
796 },
797 {
798 "name": "lo1",
799 "type": "iana-if-type:softwareLoopback",
800 "enabled": true
801 }
802 ]
803 },
804 "ietf-interfaces:interfaces-state": {
805 "interface": [
806 {
807 "name": "eth0",
808 "type": "iana-if-type:ethernetCsmacd",
809 "admin-status": "down",
810 "oper-status": "down",
811 "if-index": 2,
812 "phys-address": "00:01:02:03:04:05",
813 "statistics": {
814 "discontinuity-time": "2013-04-01T03:00:00+00:00"
815 }
816 },
817 {
818 "name": "eth1",
819 "type": "iana-if-type:ethernetCsmacd",
820 "admin-status": "up",
821 "oper-status": "up",
822 "if-index": 7,
823 "phys-address": "00:01:02:03:04:06",
824 "higher-layer-if": [
825 "eth1.10"
826 ],
827 "statistics": {
828 "discontinuity-time": "2013-04-01T03:00:00+00:00"
829 }
830 },
831 {
832 "name": "eth1.10",
833 "type": "iana-if-type:l2vlan",
834 "admin-status": "up",
835 "oper-status": "up",
836 "if-index": 9,
837 "lower-layer-if": [
838 "eth1"
840 ],
841 "statistics": {
842 "discontinuity-time": "2013-04-01T03:00:00+00:00"
843 }
844 },
845 {
846 "name": "eth2",
847 "type": "iana-if-type:ethernetCsmacd",
848 "admin-status": "down",
849 "oper-status": "down",
850 "if-index": 8,
851 "phys-address": "00:01:02:03:04:07",
852 "statistics": {
853 "discontinuity-time": "2013-04-01T03:00:00+00:00"
854 }
855 },
856 {
857 "name": "lo1",
858 "type": "iana-if-type:softwareLoopback",
859 "admin-status": "up",
860 "oper-status": "up",
861 "if-index": 1,
862 "statistics": {
863 "discontinuity-time": "2013-04-01T03:00:00+00:00"
864 }
865 }
866 ]
867 }
868 }
870 Appendix B. Change Log
872 RFC Editor: Remove this section upon publication as an RFC.
874 B.1. Changes Between Revisions -09 and -10
876 o A sentence about signing and encrypting data was added, together
877 with informative references to RFCs 2315, 7515 and 7516.
879 B.2. Changes Between Revisions -08 and -09
881 o References to RFC 6241 term in the Terminology section were added.
883 o Prefixes in the example in Sec. 4 were changed so as to be
884 different from node names.
886 B.3. Changes Between Revisions -07 and -08
888 o Changed the names of example modules so that they start with
889 "example-".
891 B.4. Changes Between Revisions -06 and -07
893 o General permit on object members whose names start with "@".
895 B.5. Changes Between Revisions -05 and -06
897 o More text and a new example about resolving union-type values.
899 B.6. Changes Between Revisions -04 and -05
901 o Removed section "Validation of JSON-encoded Instance Data" and
902 other text about XML-JSON mapping.
904 o Added section "Properties of the JSON Encoding".
906 B.7. Changes Between Revisions -03 and -04
908 o I-D.ietf-netmod-rfc6020bis is used as a normative reference
909 instead of RFC 6020.
911 o Removed noncharacters as an I-JSON issue because it doesn't exist
912 in YANG 1.1.
914 o Section about anydata encoding was added.
916 o Require I-JSON for anyxml encoding.
918 o Use ABNF for defining qualified name.
920 B.8. Changes Between Revisions -02 and -03
922 o Namespace encoding is defined without using RFC 2119 keywords.
924 o Specification for anyxml nodes was extended and clarified.
926 o Text about ordering of list entries was corrected.
928 B.9. Changes Between Revisions -01 and -02
930 o Encoding of namespaces in instance-identifiers was changed.
932 o Text specifying the order of array elements in leaf-list and list
933 instances was added.
935 B.10. Changes Between Revisions -00 and -01
937 o Metadata encoding was moved to a separate I-D, draft-lhotka-
938 netmod-yang-metadata.
940 o JSON encoding is now defined directly rather than via XML-JSON
941 mapping.
943 o The rules for namespace encoding has changed. This affect both
944 node instance names and instance-identifiers.
946 o I-JSON-related changes. The most significant is the string
947 encoding of 64-bit numbers.
949 o When validating union type, the partial type info present in JSON
950 encoding is taken into account.
952 o Added section about I-JSON compliance.
954 o Updated the example in appendix.
956 o Wrote Security Considerations.
958 o Removed IANA Considerations as there are none.
960 Author's Address
962 Ladislav Lhotka
963 CZ.NIC
965 Email: lhotka@nic.cz