idnits 2.17.1
draft-ietf-netmod-yang-json-08.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 (February 24, 2016) is 2977 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 340
-- Looks like a reference, but probably isn't: '0' on line 340
== 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-09
== Outdated reference: A later version (-07) exists of
draft-ietf-netmod-yang-metadata-03
-- Obsolete informational reference (is this intentional?): RFC 7223
(Obsoleted by RFC 8343)
Summary: 2 errors (**), 0 flaws (~~), 4 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 February 24, 2016
5 Expires: August 27, 2016
7 JSON Encoding of Data Modeled with YANG
8 draft-ietf-netmod-yang-json-08
10 Abstract
12 This document defines encoding rules for representing configuration,
13 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 August 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 . . . . . . . . . . . . . . . . . . . . 4
55 5. Encoding of YANG Data Node Instances . . . . . . . . . . . . 6
56 5.1. The "leaf" Data Node . . . . . . . . . . . . . . . . . . 7
57 5.2. The "container" Data Node . . . . . . . . . . . . . . . . 7
58 5.3. The "leaf-list" Data Node . . . . . . . . . . . . . . . . 7
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 . . . . . . . . . . . . . . . . . . . . . . 10
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 . . . . . . . . . . . . . . . . . . . . 11
70 6.7. The "leafref" Type . . . . . . . . . . . . . . . . . . . 12
71 6.8. The "identityref" Type . . . . . . . . . . . . . . . . . 12
72 6.9. The "empty" Type . . . . . . . . . . . . . . . . . . . . 12
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 . . . . . . . . . . . . . . . . . . 15
80 10.2. Informative References . . . . . . . . . . . . . . . . . 16
81 Appendix A. A Complete Example . . . . . . . . . . . . . . . . . 16
82 Appendix B. Change Log . . . . . . . . . . . . . . . . . . . . . 18
83 B.1. Changes Between Revisions -07 and -08 . . . . . . . . . . 18
84 B.2. Changes Between Revisions -06 and -07 . . . . . . . . . . 19
85 B.3. Changes Between Revisions -05 and -06 . . . . . . . . . . 19
86 B.4. Changes Between Revisions -04 and -05 . . . . . . . . . . 19
87 B.5. Changes Between Revisions -03 and -04 . . . . . . . . . . 19
88 B.6. Changes Between Revisions -02 and -03 . . . . . . . . . . 19
89 B.7. Changes Between Revisions -01 and -02 . . . . . . . . . . 19
90 B.8. Changes Between Revisions -00 and -01 . . . . . . . . . . 20
91 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20
93 1. Introduction
95 The NETCONF protocol [RFC6241] uses XML [W3C.REC-xml-20081126] for
96 encoding data in its Content Layer. Other management protocols might
97 want to use other encodings while still benefiting from using YANG
98 [I-D.ietf-netmod-rfc6020bis] as the data modeling language.
100 For example, the RESTCONF protocol [I-D.ietf-netconf-restconf]
101 supports two encodings: XML (media type "application/yang.data+xml")
102 and JSON (media type "application/yang.data+json").
104 The specification of YANG 1.1 data modelling language
105 [I-D.ietf-netmod-rfc6020bis] defines only XML encoding of data trees,
106 i.e., contents of configuration datastores, state data, input/output
107 parameters of RPC operations or actions, and event notifications.
108 The aim of this document is to define rules for encoding the same
109 data as JavaScript Object Notation (JSON) text [RFC7159].
111 2. Terminology and Notation
113 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
114 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
115 document are to be interpreted as described in [RFC2119].
117 The following terms are defined in [I-D.ietf-netmod-rfc6020bis]:
119 o action,
121 o anydata,
123 o anyxml,
125 o augment,
127 o container,
129 o data node,
131 o data tree,
133 o identity,
135 o instance identifier,
137 o leaf,
139 o leaf-list,
140 o list,
142 o module,
144 o RPC operation,
146 o submodule.
148 3. Properties of the JSON Encoding
150 This document defines JSON encoding for YANG data trees and their
151 subtrees. It is always assumed that the top-level structure in JSON-
152 encoded data is an object.
154 Instances of YANG data nodes (leafs, containers, leaf-lists, lists,
155 anydata and anyxml nodes) are encoded as members of a JSON object,
156 i.e., name/value pairs. Section 4 defines how the name part is
157 formed, and the following sections deal with the value part. The
158 encoding rules are identical for all types of data trees, i.e.,
159 configuration and state data, parameters of RPC operations and
160 actions, and notifications.
162 Unlike XML element content, JSON values carry partial type
163 information (number, string, boolean). The JSON encoding is defined
164 so that this information is never in conflict with the data type of
165 the corresponding YANG leaf or leaf-list.
167 With the exception of anyxml and schema-less anydata nodes, it is
168 possible to map a JSON-encoded data tree to XML encoding as defined
169 in [I-D.ietf-netmod-rfc6020bis], and vice versa. However, such
170 conversions require the YANG data model to be available.
172 In order to achieve maximum interoperability while allowing
173 implementations to use a variety of existing JSON parsers, the JSON
174 encoding rules follow, as much as possible, the constraints of the
175 I-JSON restricted profile [RFC7493]. Section 7 discusses I-JSON
176 conformance in more detail.
178 4. Names and Namespaces
180 A JSON object member name MUST be in one of the following forms:
182 o simple - identical to the identifier of the corresponding YANG
183 data node;
185 o namespace-qualified - the data node identifier is prefixed with
186 the name of the module in which the data node is defined,
187 separated from the data node identifier by the colon character
188 (":").
190 The name of a module determines the namespace of all data node names
191 defined in that module. If a data node is defined in a submodule,
192 then the namespace-qualified member name uses the name of the main
193 module to which the submodule belongs.
195 ABNF syntax [RFC5234] of a member name is shown in Figure 1, where
196 the production for "identifier" is defined in sec. 13 of
197 [I-D.ietf-netmod-rfc6020bis].
199 member-name = [identifier ":"] identifier
201 Figure 1: ABNF production for a JSON member name.
203 A namespace-qualified member name MUST be used for all members of a
204 top-level JSON object, and then also whenever the namespaces of the
205 data node and its parent node are different. In all other cases, the
206 simple form of the member name MUST be used.
208 For example, consider the following YANG module:
210 module example-foomod {
212 namespace "http://example.com/foomod";
214 prefix "foo";
216 container top {
217 leaf foo {
218 type uint8;
219 }
220 }
221 }
223 If the data model consists only of this module, then the following is
224 a valid JSON-encoded configuration:
226 {
227 "example-foomod:top": {
228 "foo": 54
229 }
230 }
232 Note that the member of the top-level object uses the namespace-
233 qualified name but the "foo" leaf doesn't because it is defined in
234 the same module as its parent container "top".
236 Now, assume the container "top" is augmented from another module,
237 "example-barmod":
239 module example-barmod {
241 namespace "http://example.com/barmod";
243 prefix "bar";
245 import example-foomod {
246 prefix "foo";
247 }
249 augment "/foo:top" {
250 leaf bar {
251 type boolean;
252 }
253 }
254 }
256 A valid JSON-encoded configuration containing both leafs may then
257 look like this:
259 {
260 "example-foomod:top": {
261 "foo": 54,
262 "example-barmod:bar": true
263 }
264 }
266 The name of the "bar" leaf is prefixed with the namespace identifier
267 because its parent is defined in a different module.
269 Explicit namespace identifiers are sometimes needed when encoding
270 values of the "identityref" and "instances-identifier" types. The
271 same form of namespace-qualified name as defined above is then used.
272 See Sections 6.8 and 6.11 for details.
274 5. Encoding of YANG Data Node Instances
276 Every data node instance is encoded as a name/value pair where the
277 name is formed from the data node identifier using the rules of
278 Section 4. The value depends on the category of the data node as
279 explained in the following subsections.
281 Character encoding MUST be UTF-8.
283 5.1. The "leaf" Data Node
285 A leaf instance is encoded as a name/value pair where the value can
286 be a string, number, literal "true" or "false", or the special array
287 "[null]", depending on the type of the leaf (see Section 6 for the
288 type encoding rules).
290 Example: For the leaf node definition
292 leaf foo {
293 type uint8;
294 }
296 the following is a valid JSON-encoded instance:
298 "foo": 123
300 5.2. The "container" Data Node
302 A container instance is encoded as a name/object pair. The
303 container's child data nodes are encoded as members of the object.
305 Example: For the container definition
307 container bar {
308 leaf foo {
309 type uint8;
310 }
311 }
313 the following is a valid JSON-encoded instance:
315 "bar": {
316 "foo": 123
317 }
319 5.3. The "leaf-list" Data Node
321 A leaf-list is encoded as a name/array pair, and the array elements
322 are values of some scalar type, which can be a string, number,
323 literal "true" or "false", or the special array "[null]", depending
324 on the type of the leaf-list (see Section 6 for the type encoding
325 rules).
327 The ordering of array elements follows the same rules as the ordering
328 of XML elements representing leaf-list entries in the XML encoding.
329 Specifically, the "ordered-by" properties (sec. 7.7.7 in
330 [I-D.ietf-netmod-rfc6020bis]) MUST be observed.
332 Example: For the leaf-list definition
334 leaf-list foo {
335 type uint8;
336 }
338 the following is a valid JSON-encoded instance:
340 "foo": [123, 0]
342 5.4. The "list" Data Node
344 A list instance is encoded as a name/array pair, and the array
345 elements are JSON objects.
347 The ordering of array elements follows the same rules as the ordering
348 of XML elements representing list entries in the XML encoding.
349 Specifically, the "ordered-by" properties (sec. 7.7.7 in
350 [I-D.ietf-netmod-rfc6020bis]) MUST be observed.
352 Unlike the XML encoding, where list keys are required to precede any
353 other siblings within a list entry, and appear in the order specified
354 by the data model, the order of members in a JSON-encoded list entry
355 is arbitrary because JSON objects are fundamentally unordered
356 collections of members.
358 Example: For the list definition
360 list bar {
361 key foo;
362 leaf foo {
363 type uint8;
364 }
365 leaf baz {
366 type string;
367 }
368 }
370 the following is a valid JSON-encoded instance:
372 "bar": [
373 {
374 "foo": 123,
375 "baz": "zig"
376 },
377 {
378 "baz": "zag",
379 "foo": 0
380 }
381 ]
383 5.5. The "anydata" Data Node
385 Anydata data node serves as a container for an arbitrary set of nodes
386 that otherwise appear as normal YANG-modeled data. A data model for
387 anydata content may or may not be known at run time. In the latter
388 case, converting JSON-encoded instances to the XML encoding defined
389 in [I-D.ietf-netmod-rfc6020bis] may be impossible.
391 An anydata instance is encoded in the same way as a container, i.e.,
392 as a value/object pair. The requirement that anydata content can be
393 modeled by YANG implies the following rules for the JSON text inside
394 the object:
396 o It is valid I-JSON [RFC7493].
398 o All object member names satisfy the ABNF production in Figure 1.
400 o Any JSON array contains either only unique scalar values (as a
401 leaf-list, see Section 5.3), or only objects (as a list, see
402 Section 5.4).
404 o The "null" value is only allowed in the single-element array
405 "[null]" corresponding to the encoding of the "empty" type, see
406 Section 6.9.
408 Example: for the anydata definition
410 anydata data;
412 the following is a valid JSON-encoded instance:
414 "data": {
415 "ietf-notification:notification": {
416 "eventTime": "2014-07-29T13:43:01Z",
417 "example-event:event": {
418 "event-class": "fault",
419 "reporting-entity": {
420 "card": "Ethernet0"
421 },
422 "severity": "major"
423 }
424 }
425 }
427 5.6. The "anyxml" Data Node
429 An anyxml instance is encoded as a JSON name/value pair. The value
430 MUST satisfy I-JSON constraints.
432 Example: For the anyxml definition
434 anyxml bar;
436 the following is a valid JSON-encoded instance:
438 "bar": [true, null, true]
440 5.7. Metadata Objects
442 Apart from instances of YANG data nodes, a JSON document MAY contain
443 special object members whose name starts with the "@" character
444 (COMMERCIAL AT). Such members are used for special purposes such as
445 encoding metadata [I-D.ietf-netmod-yang-metadata]. Exact syntax and
446 semantics of such members are outside the scope of this document.
448 6. Representing YANG Data Types in JSON Values
450 The type of the JSON value in an instance of the leaf or leaf-list
451 data node depends on the type of that data node as specified in the
452 following subsections.
454 6.1. Numeric Types
456 A value of the types "int8", "int16", "int32", "uint8", "uint16" and
457 "uint32" is represented as a JSON number.
459 A value of the "int64", "uint64" or "decimal64" type is represented
460 as a JSON string whose content is the lexical representation of the
461 corresponding YANG type as specified in sections 9.2.1 and 9.3.1 of
462 [I-D.ietf-netmod-rfc6020bis].
464 For example, if the type of the leaf "foo" in Section 5.1 was
465 "uint64" instead of "uint8", the instance would have to be encoded as
467 "foo": "123"
469 The special handling of 64-bit numbers follows from the I-JSON
470 recommendation to encode numbers exceeding the IEEE 754-2008 double
471 precision range as strings, see sec. 2.2 in [RFC7493].
473 6.2. The "string" Type
475 A "string" value is represented as a JSON string, subject to JSON
476 string encoding rules.
478 6.3. The "boolean" Type
480 A "boolean" value is represented as the corresponding JSON literal
481 name "true" or "false".
483 6.4. The "enumeration" Type
485 An "enumeration" value is represented as a JSON string - one of the
486 names assigned by "enum" statements in YANG.
488 The representation is identical to the lexical representation of the
489 "enumeration" type in XML, see sec. 9.6 in
490 [I-D.ietf-netmod-rfc6020bis].
492 6.5. The "bits" Type
494 A "bits" value is represented as a JSON string - a space-separated
495 sequence of names of bits that are set. The permitted bit names are
496 assigned by "bit" statements in YANG.
498 The representation is identical to the lexical representation of the
499 "bits" type, see sec. 9.7 in [I-D.ietf-netmod-rfc6020bis].
501 6.6. The "binary" Type
503 A "binary" value is represented as a JSON string - base64-encoding of
504 arbitrary binary data.
506 The representation is identical to the lexical representation of the
507 "binary" type in XML, see sec. 9.8 in [I-D.ietf-netmod-rfc6020bis].
509 6.7. The "leafref" Type
511 A "leafref" value is represented using the same rules as the type of
512 the leaf to which the leafref value refers.
514 6.8. The "identityref" Type
516 An "identityref" value is represented as a string - the name of an
517 identity. If the identity is defined in another module than the leaf
518 node containing the identityref value, the namespace-qualified form
519 (Section 4) MUST be used. Otherwise, both the simple and namespace-
520 qualified forms are permitted.
522 For example, consider the following schematic module:
524 module example-mod {
525 ...
526 import ietf-interfaces {
527 prefix if;
528 }
529 import iana-if-type {
530 prefix ianaift;
531 }
532 ...
533 leaf type {
534 type identityref {
535 base "if:interface-type";
536 }
537 }
538 }
540 A valid instance of the "type" leaf is then encoded as follows:
542 "type": "iana-if-type:ethernetCsmacd"
544 The namespace identifier "iana-if-type" must be present in this case
545 because the "ethernetCsmacd" identity is not defined in the same
546 module as the "type" leaf.
548 6.9. The "empty" Type
550 An "empty" value is represented as "[null]", i.e., an array with the
551 "null" literal being its only element. For the purposes of this
552 document, "[null]" is considered an atomic scalar value.
554 This encoding of the "empty" type was chosen instead of using simply
555 "null" in order to facilitate the use of empty leafs in common
556 programming languages where the "null" value of a member is treated
557 as if the member is not present.
559 Example: For the leaf definition
561 leaf foo {
562 type empty;
563 }
565 a valid instance is
567 "foo": [null]
569 6.10. The "union" Type
571 A value of the "union" type is encoded as the value of any of the
572 member types.
574 When validating a value of the "union" type, the type information
575 conveyed by the JSON encoding MUST also be taken into account. JSON
576 syntax thus provides additional means for resolving union member type
577 that are not available in XML encoding.
579 For example, consider the following YANG definition:
581 leaf bar {
582 type union {
583 type uint16;
584 type string;
585 }
586 }
588 In RESTCONF [I-D.ietf-netconf-restconf], it is possible to set the
589 value of "bar" in the following way when using the "application/
590 yang.data+xml" media type:
592 13.5
594 because the value may be interpreted as a string, i.e., the second
595 member type of the union. When using the "application/
596 yang.data+json" media type, however, this is an error:
598 "bar": 13.5
600 In this case, the JSON encoding indicates the value is supposed to be
601 a number rather than a string, and it is not a valid "uint16" value.
603 Conversely, the value of
604 "bar": "1"
606 is to be interpreted as a string.
608 6.11. The "instance-identifier" Type
610 An "instance-identifier" value is encoded as a string that is
611 analogical to the lexical representation in XML encoding, see
612 sec. 9.13.3 in [I-D.ietf-netmod-rfc6020bis]. However, the encoding
613 of namespaces in instance-identifier values follows the rules stated
614 in Section 4, namely:
616 o The leftmost (top-level) data node name is always in the
617 namespace-qualified form.
619 o Any subsequent data node name is in the namespace-qualified form
620 if the node is defined in another module than its parent node, and
621 the simple form is used otherwise. This rule also holds for node
622 names appearing in predicates.
624 For example,
626 /ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ip
628 is a valid instance-identifer value because the data nodes
629 "interfaces", "interface" and "name" are defined in the module "ietf-
630 interfaces", whereas "ipv4" and "ip" are defined in "ietf-ip".
632 7. I-JSON Compliance
634 I-JSON [RFC7493] is a restricted profile of JSON that guarantees
635 maximum interoperability for protocols that use JSON in their
636 messages, no matter what JSON encoders/decoders are used in protocol
637 implementations. The encoding defined in this document therefore
638 observes the I-JSON requirements and recommendations as closely as
639 possible.
641 In particular, the following properties are guaranteed:
643 o Character encoding is UTF-8.
645 o Member names within the same JSON object are always unique.
647 o The order of JSON object members is never relied upon.
649 o Numbers of any type supported by YANG can be exchanged reliably.
650 See Section 6.1 for details.
652 The JSON encoding defined in this document deviates from I-JSON only
653 in the representation of the "binary" type. In order to remain
654 compatible with XML encoding, the base64 encoding scheme is used
655 (Section 6.6), whilst I-JSON recommends base64url instead.
657 8. Security Considerations
659 This document defines an alternative encoding for data modeled in the
660 YANG data modeling language. As such, it doesn't contribute any new
661 security issues beyond those discussed in sec. 16 of
662 [I-D.ietf-netmod-rfc6020bis].
664 JSON processing is rather different from XML, and JSON parsers may
665 thus suffer from other types of vulnerabilities than their XML
666 counterparts. To minimize these new security risks, software on the
667 receiving side SHOULD reject all messages that do not comply to the
668 rules of this document and reply with an appropriate error message to
669 the sender.
671 9. Acknowledgments
673 The author wishes to thank Andy Bierman, Martin Bjorklund, Dean
674 Bogdanovic, Balazs Lengyel, Juergen Schoenwaelder and Phil Shafer for
675 their helpful comments and suggestions.
677 10. References
679 10.1. Normative References
681 [I-D.ietf-netmod-rfc6020bis]
682 Bjorklund, M., "The YANG 1.1 Data Modeling Language",
683 draft-ietf-netmod-rfc6020bis-11 (work in progress),
684 February 2016.
686 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
687 Requirement Levels", BCP 14, RFC 2119,
688 DOI 10.17487/RFC2119, March 1997,
689 .
691 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
692 Specifications: ABNF", STD 68, RFC 5234,
693 DOI 10.17487/RFC5234, January 2008,
694 .
696 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
697 and A. Bierman, Ed., "Network Configuration Protocol
698 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011,
699 .
701 [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
702 Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March
703 2014, .
705 [RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493,
706 DOI 10.17487/RFC7493, March 2015,
707 .
709 10.2. Informative References
711 [I-D.ietf-netconf-restconf]
712 Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF
713 Protocol", draft-ietf-netconf-restconf-09 (work in
714 progress), December 2015.
716 [I-D.ietf-netmod-yang-metadata]
717 Lhotka, L., "Defining and Using Metadata with YANG",
718 draft-ietf-netmod-yang-metadata-03 (work in progress),
719 January 2016.
721 [RFC7223] Bjorklund, M., "A YANG Data Model for Interface
722 Management", RFC 7223, DOI 10.17487/RFC7223, May 2014,
723 .
725 [W3C.REC-xml-20081126]
726 Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and
727 F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth
728 Edition)", World Wide Web Consortium Recommendation REC-
729 xml-20081126, November 2008,
730 .
732 Appendix A. A Complete Example
734 The JSON document shown below represents the same data as the reply
735 to the NETCONF request appearing in Appendix D of [RFC7223].
736 The data model is a combination of two YANG modules: "ietf-
737 interfaces" and "ex-vlan" (the latter is an example module from
738 Appendix C of [RFC7223]). The "if-mib" feature defined in the "ietf-
739 interfaces" module is supported.
741 {
742 "ietf-interfaces:interfaces": {
743 "interface": [
744 {
745 "name": "eth0",
746 "type": "iana-if-type:ethernetCsmacd",
747 "enabled": false
748 },
749 {
750 "name": "eth1",
751 "type": "iana-if-type:ethernetCsmacd",
752 "enabled": true,
753 "ex-vlan:vlan-tagging": true
754 },
755 {
756 "name": "eth1.10",
757 "type": "iana-if-type:l2vlan",
758 "enabled": true,
759 "ex-vlan:base-interface": "eth1",
760 "ex-vlan:vlan-id": 10
761 },
762 {
763 "name": "lo1",
764 "type": "iana-if-type:softwareLoopback",
765 "enabled": true
766 }
767 ]
768 },
769 "ietf-interfaces:interfaces-state": {
770 "interface": [
771 {
772 "name": "eth0",
773 "type": "iana-if-type:ethernetCsmacd",
774 "admin-status": "down",
775 "oper-status": "down",
776 "if-index": 2,
777 "phys-address": "00:01:02:03:04:05",
778 "statistics": {
779 "discontinuity-time": "2013-04-01T03:00:00+00:00"
780 }
781 },
782 {
783 "name": "eth1",
784 "type": "iana-if-type:ethernetCsmacd",
785 "admin-status": "up",
786 "oper-status": "up",
787 "if-index": 7,
788 "phys-address": "00:01:02:03:04:06",
789 "higher-layer-if": [
790 "eth1.10"
791 ],
792 "statistics": {
793 "discontinuity-time": "2013-04-01T03:00:00+00:00"
794 }
795 },
796 {
797 "name": "eth1.10",
798 "type": "iana-if-type:l2vlan",
799 "admin-status": "up",
800 "oper-status": "up",
801 "if-index": 9,
802 "lower-layer-if": [
803 "eth1"
804 ],
805 "statistics": {
806 "discontinuity-time": "2013-04-01T03:00:00+00:00"
807 }
808 },
809 {
810 "name": "eth2",
811 "type": "iana-if-type:ethernetCsmacd",
812 "admin-status": "down",
813 "oper-status": "down",
814 "if-index": 8,
815 "phys-address": "00:01:02:03:04:07",
816 "statistics": {
817 "discontinuity-time": "2013-04-01T03:00:00+00:00"
818 }
819 },
820 {
821 "name": "lo1",
822 "type": "iana-if-type:softwareLoopback",
823 "admin-status": "up",
824 "oper-status": "up",
825 "if-index": 1,
826 "statistics": {
827 "discontinuity-time": "2013-04-01T03:00:00+00:00"
828 }
829 }
830 ]
831 }
832 }
834 Appendix B. Change Log
836 RFC Editor: Remove this section upon publication as an RFC.
838 B.1. Changes Between Revisions -07 and -08
840 o Changed the names of example modules so that they start with
841 "example-".
843 B.2. Changes Between Revisions -06 and -07
845 o General permit on object members whose names start with "@".
847 B.3. Changes Between Revisions -05 and -06
849 o More text and a new example about resolving union-type values.
851 B.4. Changes Between Revisions -04 and -05
853 o Removed section "Validation of JSON-encoded Instance Data" and
854 other text about XML-JSON mapping.
856 o Added section "Properties of the JSON Encoding".
858 B.5. Changes Between Revisions -03 and -04
860 o I-D.ietf-netmod-rfc6020bis is used as a normative reference
861 instead of RFC 6020.
863 o Removed noncharacters as an I-JSON issue because it doesn't exist
864 in YANG 1.1.
866 o Section about anydata encoding was added.
868 o Require I-JSON for anyxml encoding.
870 o Use ABNF for defining qualified name.
872 B.6. Changes Between Revisions -02 and -03
874 o Namespace encoding is defined without using RFC 2119 keywords.
876 o Specification for anyxml nodes was extended and clarified.
878 o Text about ordering of list entries was corrected.
880 B.7. Changes Between Revisions -01 and -02
882 o Encoding of namespaces in instance-identifiers was changed.
884 o Text specifying the order of array elements in leaf-list and list
885 instances was added.
887 B.8. Changes Between Revisions -00 and -01
889 o Metadata encoding was moved to a separate I-D, draft-lhotka-
890 netmod-yang-metadata.
892 o JSON encoding is now defined directly rather than via XML-JSON
893 mapping.
895 o The rules for namespace encoding has changed. This affect both
896 node instance names and instance-identifiers.
898 o I-JSON-related changes. The most significant is the string
899 encoding of 64-bit numbers.
901 o When validating union type, the partial type info present in JSON
902 encoding is taken into account.
904 o Added section about I-JSON compliance.
906 o Updated the example in appendix.
908 o Wrote Security Considerations.
910 o Removed IANA Considerations as there are none.
912 Author's Address
914 Ladislav Lhotka
915 CZ.NIC
917 Email: lhotka@nic.cz