idnits 2.17.1 draft-ietf-netmod-yang-json-07.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 (January 28, 2016) is 3011 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 337 -- Looks like a reference, but probably isn't: '0' on line 337 == Outdated reference: A later version (-14) exists of draft-ietf-netmod-rfc6020bis-09 ** 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-02 -- 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 January 28, 2016 5 Expires: July 31, 2016 7 JSON Encoding of Data Modeled with YANG 8 draft-ietf-netmod-yang-json-07 10 Abstract 12 This document defines encoding rules for representing configuration, 13 state data, RPC operation or action input and output parameters, 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 July 31, 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 . . . . . . . . . . . . . . . . . . . . . . . . 2 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 -05 and -06 . . . . . . . . . . 18 84 B.2. Changes Between Revisions -05 and -06 . . . . . . . . . . 19 85 B.3. Changes Between Revisions -04 and -05 . . . . . . . . . . 19 86 B.4. Changes Between Revisions -03 and -04 . . . . . . . . . . 19 87 B.5. Changes Between Revisions -02 and -03 . . . . . . . . . . 19 88 B.6. Changes Between Revisions -01 and -02 . . . . . . . . . . 19 89 B.7. Changes Between Revisions -00 and -01 . . . . . . . . . . 19 90 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20 92 1. Introduction 94 The NETCONF protocol [RFC6241] uses XML [W3C.REC-xml-20081126] for 95 encoding data in its Content Layer. Other management protocols might 96 want to use other encodings while still benefiting from using YANG 97 [I-D.ietf-netmod-rfc6020bis] as the data modeling language. 99 For example, the RESTCONF protocol [I-D.ietf-netconf-restconf] 100 supports two encodings: XML (media type "application/yang.data+xml") 101 and JSON (media type "application/yang.data+json"). 103 The specification of YANG 1.1 data modelling language 104 [I-D.ietf-netmod-rfc6020bis] defines only XML encoding for data 105 instances, i.e., contents of configuration datastores, state data, 106 RPC operation or action input and output parameters, and event 107 notifications. The aim of this document is to define rules for 108 encoding the same data as JavaScript Object Notation (JSON) 109 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, 141 o list, 143 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. 159 Unlike XML element content, JSON values carry partial type 160 information (number, string, boolean). The JSON encoding is defined 161 so that this information is never in conflict with the data type of 162 the corresponding YANG leaf or leaf-list. 164 With the exception of anyxml and schema-less anydata nodes, it is 165 possible to map a JSON-encoded data tree to XML encoding as defined 166 in [I-D.ietf-netmod-rfc6020bis], and vice versa. However, such 167 conversions require the YANG data model to be available. 169 In order to achieve maximum interoperability while allowing 170 implementations to use a variety of existing JSON parsers, the JSON 171 encoding rules follow, as much as possible, the constraints of the 172 I-JSON restricted profile [RFC7493]. Section 7 discusses I-JSON 173 conformance in more detail. 175 4. Names and Namespaces 177 An object member name MUST be in one of the following forms: 179 o simple - identical to the identifier of the corresponding YANG 180 data node; 182 o namespace-qualified - the data node identifier is prefixed with 183 the name of the module in which the data node is defined, 184 separated from the data node identifier by the colon character 185 (":"). 187 The name of a module determines the namespace of all data node names 188 defined in that module. If a data node is defined in a submodule, 189 then the namespace-qualified member name uses the name of the main 190 module to which the submodule belongs. 192 ABNF syntax [RFC5234] of a member name is shown in Figure 1, where 193 the production for "identifier" is defined in sec. 13 of 194 [I-D.ietf-netmod-rfc6020bis]. 196 member-name = [identifier ":"] identifier 198 Figure 1: ABNF production for a JSON member name. 200 A namespace-qualified member name MUST be used for all members of a 201 top-level JSON object, and then also whenever the namespaces of the 202 data node and its parent node are different. In all other cases, the 203 simple form of the member name MUST be used. 205 For example, consider the following YANG module: 207 module foomod { 209 namespace "http://example.com/foomod"; 211 prefix "foo"; 213 container top { 214 leaf foo { 215 type uint8; 216 } 217 } 218 } 220 If the data model consists only of this module, then the following is 221 a valid JSON-encoded configuration: 223 { 224 "foomod:top": { 225 "foo": 54 226 } 227 } 229 Note that the member of the top-level object uses the namespace- 230 qualified name but the "foo" leaf doesn't because it is defined in 231 the same module as its parent container "top". 233 Now, assume the container "top" is augmented from another module, 234 "barmod": 236 module barmod { 238 namespace "http://example.com/barmod"; 240 prefix "bar"; 242 import foomod { 243 prefix "foo"; 244 } 246 augment "/foo:top" { 247 leaf bar { 248 type boolean; 249 } 250 } 251 } 253 A valid JSON-encoded configuration containing both leafs may then 254 look like this: 256 { 257 "foomod:top": { 258 "foo": 54, 259 "barmod:bar": true 260 } 261 } 263 The name of the "bar" leaf is prefixed with the namespace identifier 264 because its parent is defined in a different module. 266 Explicit namespace identifiers are sometimes needed when encoding 267 values of the "identityref" and "instances-identifier" types. The 268 same form of namespace-qualified name as defined above is then used. 269 See Sections 6.8 and 6.11 for details. 271 5. Encoding of YANG Data Node Instances 273 Every data node instance is encoded as a name/value pair where the 274 name is formed from the data node identifier using the rules of 275 Section 4. The value depends on the category of the data node as 276 explained in the following subsections. 278 Character encoding MUST be UTF-8. 280 5.1. The "leaf" Data Node 282 A leaf instance is encoded as a name/value pair where the value can 283 be a string, number, literal "true" or "false", or the special array 284 "[null]", depending on the type of the leaf (see Section 6 for the 285 type encoding rules). 287 Example: For the leaf node definition 289 leaf foo { 290 type uint8; 291 } 293 the following is a valid JSON-encoded instance: 295 "foo": 123 297 5.2. The "container" Data Node 299 A container instance is encoded as a name/object pair. The 300 container's child data nodes are encoded as members of the object. 302 Example: For the container definition 304 container bar { 305 leaf foo { 306 type uint8; 307 } 308 } 310 the following is a valid JSON-encoded instance: 312 "bar": { 313 "foo": 123 314 } 316 5.3. The "leaf-list" Data Node 318 A leaf-list is encoded as a name/array pair, and the array elements 319 are values of some scalar type, which can be a string, number, 320 literal "true" or "false", or the special array "[null]", depending 321 on the type of the leaf-list (see Section 6 for the type encoding 322 rules). 324 The ordering of array elements follows the same rules as the ordering 325 of XML elements representing leaf-list entries in the XML encoding. 326 Specifically, the "ordered-by" properties (sec. 7.7.7 in 327 [I-D.ietf-netmod-rfc6020bis]) MUST be observed. 329 Example: For the leaf-list definition 331 leaf-list foo { 332 type uint8; 333 } 335 the following is a valid JSON-encoded instance: 337 "foo": [123, 0] 339 5.4. The "list" Data Node 341 A list instance is encoded as a name/array pair, and the array 342 elements are JSON objects. 344 The ordering of array elements follows the same rules as the ordering 345 of XML elements representing list entries in the XML encoding. 346 Specifically, the "ordered-by" properties (sec. 7.7.7 in 347 [I-D.ietf-netmod-rfc6020bis]) MUST be observed. 349 Unlike the XML encoding, where list keys are required to precede any 350 other siblings within a list entry, and appear in the order specified 351 by the data model, the order of members in a JSON-encoded list entry 352 is arbitrary because JSON objects are fundamentally unordered 353 collections of members. 355 Example: For the list definition 357 list bar { 358 key foo; 359 leaf foo { 360 type uint8; 361 } 362 leaf baz { 363 type string; 364 } 365 } 367 the following is a valid JSON-encoded instance: 369 "bar": [ 370 { 371 "foo": 123, 372 "baz": "zig" 373 }, 374 { 375 "baz": "zag", 376 "foo": 0 377 } 378 ] 380 5.5. The "anydata" Data Node 382 Anydata data node serves as a container for an arbitrary set of nodes 383 that otherwise appear as normal YANG-modeled data. A data model for 384 anydata content may or may not be known at run time. In the latter 385 case, converting JSON-encoded instances to the XML encoding defined 386 in [I-D.ietf-netmod-rfc6020bis] may be impossible. 388 An anydata instance is encoded in the same way as a container, i.e., 389 as a value/object pair. The requirement that anydata content can be 390 modeled by YANG implies the following rules for the JSON text inside 391 the object: 393 o It is valid I-JSON [RFC7493]. 395 o All object member names satisfy the ABNF production in Figure 1. 397 o Any JSON array contains either only unique scalar values (as a 398 leaf-list, see Section 5.3), or only objects (as a list, see 399 Section 5.4). 401 o The "null" value is only allowed in the single-element array 402 "[null]" corresponding to the encoding of the "empty" type, see 403 Section 6.9. 405 Example: for the anydata definition 407 anydata data; 409 the following is a valid JSON-encoded instance: 411 "data": { 412 "ietf-notification:notification": { 413 "eventTime": "2014-07-29T13:43:01Z", 414 "example-event:event": { 415 "event-class": "fault", 416 "reporting-entity": { 417 "card": "Ethernet0" 418 }, 419 "severity": "major" 420 } 421 } 422 } 424 5.6. The "anyxml" Data Node 426 An anyxml instance is encoded as a JSON name/value pair. The value 427 MUST satisfy I-JSON constraints. 429 Example: For the anyxml definition 431 anyxml bar; 433 the following is a valid JSON-encoded instance: 435 "bar": [true, null, true] 437 5.7. Metadata Objects 439 Apart from instances of YANG data nodes, a JSON document MAY contain 440 special object members whose name starts with the "@" character 441 (COMMERCIAL AT). Such members are used for special purposes such as 442 encoding metadata [I-D.ietf-netmod-yang-metadata]. Exact syntax and 443 semantics of such members are outside the scope of this document. 445 6. Representing YANG Data Types in JSON Values 447 The type of the JSON value in an instance of the leaf or leaf-list 448 data node depends on the type of that data node as specified in the 449 following subsections. 451 6.1. Numeric Types 453 A value of the types "int8", "int16", "int32", "uint8", "uint16" and 454 "uint32" is represented as a JSON number. 456 A value of the "int64", "uint64" or "decimal64" type is represented 457 as a JSON string whose content is the lexical representation of the 458 corresponding YANG type as specified in sections 9.2.1 and 9.3.1 of 459 [I-D.ietf-netmod-rfc6020bis]. 461 For example, if the type of the leaf "foo" in Section 5.1 was 462 "uint64" instead of "uint8", the instance would have to be encoded as 464 "foo": "123" 466 The special handling of 64-bit numbers follows from the I-JSON 467 recommendation to encode numbers exceeding the IEEE 754-2008 double 468 precision range as strings, see sec. 2.2 in [RFC7493]. 470 6.2. The "string" Type 472 A "string" value is represented as a JSON string, subject to JSON 473 string encoding rules. 475 6.3. The "boolean" Type 477 A "boolean" value is represented as the corresponding JSON literal 478 name "true" or "false". 480 6.4. The "enumeration" Type 482 An "enumeration" value is represented as a JSON string - one of the 483 names assigned by "enum" statements in YANG. 485 The representation is identical to the lexical representation of the 486 "enumeration" type in XML, see sec. 9.6 in 487 [I-D.ietf-netmod-rfc6020bis]. 489 6.5. The "bits" Type 491 A "bits" value is represented as a JSON string - a space-separated 492 sequence of names of bits that are set. The permitted bit names are 493 assigned by "bit" statements in YANG. 495 The representation is identical to the lexical representation of the 496 "bits" type, see sec. 9.7 in [I-D.ietf-netmod-rfc6020bis]. 498 6.6. The "binary" Type 500 A "binary" value is represented as a JSON string - base64-encoding of 501 arbitrary binary data. 503 The representation is identical to the lexical representation of the 504 "binary" type in XML, see sec. 9.8 in [I-D.ietf-netmod-rfc6020bis]. 506 6.7. The "leafref" Type 508 A "leafref" value is represented using the same rules as the type of 509 the leaf to which the leafref value refers. 511 6.8. The "identityref" Type 513 An "identityref" value is represented as a string - the name of an 514 identity. If the identity is defined in another module than the leaf 515 node containing the identityref value, the namespace-qualified form 516 (Section 4) MUST be used. Otherwise, both the simple and namespace- 517 qualified forms are permitted. 519 For example, consider the following schematic module: 521 module exmod { 522 ... 523 import ietf-interfaces { 524 prefix if; 525 } 526 import iana-if-type { 527 prefix ianaift; 528 } 529 ... 530 leaf type { 531 type identityref { 532 base "if:interface-type"; 533 } 534 } 535 } 537 A valid instance of the "type" leaf is then encoded as follows: 539 "type": "iana-if-type:ethernetCsmacd" 541 The namespace identifier "iana-if-type" must be present in this case 542 because the "ethernetCsmacd" identity is not defined in the same 543 module as the "type" leaf. 545 6.9. The "empty" Type 547 An "empty" value is represented as "[null]", i.e., an array with the 548 "null" literal being its only element. For the purposes of this 549 document, "[null]" is considered an atomic scalar value. 551 This encoding of the "empty" type was chosen instead of using simply 552 "null" in order to facilitate the use of empty leafs in common 553 programming languages where the "null" value of a member is treated 554 as if the member is not present. 556 Example: For the leaf definition 558 leaf foo { 559 type empty; 560 } 562 a valid instance is 564 "foo": [null] 566 6.10. The "union" Type 568 A value of the "union" type is encoded as the value of any of the 569 member types. 571 When validating a value of the "union" type, the type information 572 conveyed by the JSON encoding MUST also be taken into account. JSON 573 syntax thus provides additional means for resolving union member type 574 that are not available in XML encoding. 576 For example, consider the following YANG definition: 578 leaf bar { 579 type union { 580 type uint16; 581 type string; 582 } 583 } 585 In RESTCONF [I-D.ietf-netconf-restconf], it is possible to set the 586 value of "bar" in the following way when using the "application/ 587 yang.data+xml" media type: 589 13.5 591 because the value may be interpreted as a string, i.e., the second 592 member type of the union. When using the "application/ 593 yang.data+json" media type, however, this is an error: 595 "bar": 13.5 597 In this case, the JSON encoding indicates the value is supposed to be 598 a number rather than a string, and it is not a valid "uint16" value. 600 Conversely, the value of 601 "bar": "1" 603 is to be interpreted as a string. 605 6.11. The "instance-identifier" Type 607 An "instance-identifier" value is encoded as a string that is 608 analogical to the lexical representation in XML encoding, see 609 sec. 9.13.3 in [I-D.ietf-netmod-rfc6020bis]. However, the encoding 610 of namespaces in instance-identifier values follows the rules stated 611 in Section 4, namely: 613 o The leftmost (top-level) data node name is always in the 614 namespace-qualified form. 616 o Any subsequent data node name is in the namespace-qualified form 617 if the node is defined in another module than its parent node, and 618 the simple form is used otherwise. This rule also holds for node 619 names appearing in predicates. 621 For example, 623 /ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/ip 625 is a valid instance-identifer value because the data nodes 626 "interfaces", "interface" and "name" are defined in the module "ietf- 627 interfaces", whereas "ipv4" and "ip" are defined in "ietf-ip". 629 7. I-JSON Compliance 631 I-JSON [RFC7493] is a restricted profile of JSON that guarantees 632 maximum interoperability for protocols that use JSON in their 633 messages, no matter what JSON encoders/decoders are used in protocol 634 implementations. The encoding defined in this document therefore 635 observes the I-JSON requirements and recommendations as closely as 636 possible. 638 In particular, the following properties are guaranteed: 640 o Character encoding is UTF-8. 642 o Member names within the same JSON object are always unique. 644 o The order of JSON object members is never relied upon. 646 o Numbers of any type supported by YANG can be exchanged reliably. 647 See Section 6.1 for details. 649 The JSON encoding defined in this document deviates from I-JSON only 650 in the representation of the "binary" type. In order to remain 651 compatible with XML encoding, the base64 encoding scheme is used 652 (Section 6.6), whilst I-JSON recommends base64url instead. 654 8. Security Considerations 656 This document defines an alternative encoding for data modeled in the 657 YANG data modeling language. As such, it doesn't contribute any new 658 security issues beyond those discussed in sec. 16 of 659 [I-D.ietf-netmod-rfc6020bis]. 661 JSON processing is rather different from XML, and JSON parsers may 662 thus suffer from other types of vulnerabilities than their XML 663 counterparts. To minimize these new security risks, software on the 664 receiving side SHOULD reject all messages that do not comply to the 665 rules of this document and reply with an appropriate error message to 666 the sender. 668 9. Acknowledgments 670 The author wishes to thank Andy Bierman, Martin Bjorklund, Dean 671 Bogdanovic, Balazs Lengyel, Juergen Schoenwaelder and Phil Shafer for 672 their helpful comments and suggestions. 674 10. References 676 10.1. Normative References 678 [I-D.ietf-netmod-rfc6020bis] 679 Bjorklund, M., "The YANG 1.1 Data Modeling Language", 680 draft-ietf-netmod-rfc6020bis-09 (work in progress), 681 December 2015. 683 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 684 Requirement Levels", BCP 14, RFC 2119, 685 DOI 10.17487/RFC2119, March 1997, 686 . 688 [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax 689 Specifications: ABNF", STD 68, RFC 5234, 690 DOI 10.17487/RFC5234, January 2008, 691 . 693 [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., 694 and A. Bierman, Ed., "Network Configuration Protocol 695 (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, 696 . 698 [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 699 Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March 700 2014, . 702 [RFC7493] Bray, T., Ed., "The I-JSON Message Format", RFC 7493, 703 DOI 10.17487/RFC7493, March 2015, 704 . 706 10.2. Informative References 708 [I-D.ietf-netconf-restconf] 709 Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF 710 Protocol", draft-ietf-netconf-restconf-09 (work in 711 progress), December 2015. 713 [I-D.ietf-netmod-yang-metadata] 714 Lhotka, L., "Defining and Using Metadata with YANG", 715 draft-ietf-netmod-yang-metadata-02 (work in progress), 716 September 2015. 718 [RFC7223] Bjorklund, M., "A YANG Data Model for Interface 719 Management", RFC 7223, DOI 10.17487/RFC7223, May 2014, 720 . 722 [W3C.REC-xml-20081126] 723 Bray, T., Paoli, J., Sperberg-McQueen, M., Maler, E., and 724 F. Yergeau, "Extensible Markup Language (XML) 1.0 (Fifth 725 Edition)", World Wide Web Consortium Recommendation REC- 726 xml-20081126, November 2008, 727 . 729 Appendix A. A Complete Example 731 The JSON document shown below represents the same data as the reply 732 to the NETCONF request appearing in Appendix D of [RFC7223]. 733 The data model is a combination of two YANG modules: "ietf- 734 interfaces" and "ex-vlan" (the latter is an example module from 735 Appendix C of [RFC7223]). The "if-mib" feature defined in the "ietf- 736 interfaces" module is considered to be active. 738 { 739 "ietf-interfaces:interfaces": { 740 "interface": [ 741 { 742 "name": "eth0", 743 "type": "iana-if-type:ethernetCsmacd", 744 "enabled": false 745 }, 746 { 747 "name": "eth1", 748 "type": "iana-if-type:ethernetCsmacd", 749 "enabled": true, 750 "ex-vlan:vlan-tagging": true 751 }, 752 { 753 "name": "eth1.10", 754 "type": "iana-if-type:l2vlan", 755 "enabled": true, 756 "ex-vlan:base-interface": "eth1", 757 "ex-vlan:vlan-id": 10 758 }, 759 { 760 "name": "lo1", 761 "type": "iana-if-type:softwareLoopback", 762 "enabled": true 763 } 764 ] 765 }, 766 "ietf-interfaces:interfaces-state": { 767 "interface": [ 768 { 769 "name": "eth0", 770 "type": "iana-if-type:ethernetCsmacd", 771 "admin-status": "down", 772 "oper-status": "down", 773 "if-index": 2, 774 "phys-address": "00:01:02:03:04:05", 775 "statistics": { 776 "discontinuity-time": "2013-04-01T03:00:00+00:00" 777 } 778 }, 779 { 780 "name": "eth1", 781 "type": "iana-if-type:ethernetCsmacd", 782 "admin-status": "up", 783 "oper-status": "up", 784 "if-index": 7, 785 "phys-address": "00:01:02:03:04:06", 786 "higher-layer-if": [ 787 "eth1.10" 788 ], 789 "statistics": { 790 "discontinuity-time": "2013-04-01T03:00:00+00:00" 791 } 792 }, 793 { 794 "name": "eth1.10", 795 "type": "iana-if-type:l2vlan", 796 "admin-status": "up", 797 "oper-status": "up", 798 "if-index": 9, 799 "lower-layer-if": [ 800 "eth1" 801 ], 802 "statistics": { 803 "discontinuity-time": "2013-04-01T03:00:00+00:00" 804 } 805 }, 806 { 807 "name": "eth2", 808 "type": "iana-if-type:ethernetCsmacd", 809 "admin-status": "down", 810 "oper-status": "down", 811 "if-index": 8, 812 "phys-address": "00:01:02:03:04:07", 813 "statistics": { 814 "discontinuity-time": "2013-04-01T03:00:00+00:00" 815 } 816 }, 817 { 818 "name": "lo1", 819 "type": "iana-if-type:softwareLoopback", 820 "admin-status": "up", 821 "oper-status": "up", 822 "if-index": 1, 823 "statistics": { 824 "discontinuity-time": "2013-04-01T03:00:00+00:00" 825 } 826 } 827 ] 828 } 829 } 831 Appendix B. Change Log 833 RFC Editor: Remove this section upon publication as an RFC. 835 B.1. Changes Between Revisions -05 and -06 837 o General permit on object members whose names start with "@". 839 B.2. Changes Between Revisions -05 and -06 841 o More text and a new example about resolving union-type values. 843 B.3. Changes Between Revisions -04 and -05 845 o Removed section "Validation of JSON-encoded Instance Data" and 846 other text about XML-JSON mapping. 848 o Added section "Properties of the JSON Encoding". 850 B.4. Changes Between Revisions -03 and -04 852 o I-D.ietf-netmod-rfc6020bis is used as a normative reference 853 instead of RFC 6020. 855 o Removed noncharacters as an I-JSON issue because it doesn't exist 856 in YANG 1.1. 858 o Section about anydata encoding was added. 860 o Require I-JSON for anyxml encoding. 862 o Use ABNF for defining qualified name. 864 B.5. Changes Between Revisions -02 and -03 866 o Namespace encoding is defined without using RFC 2119 keywords. 868 o Specification for anyxml nodes was extended and clarified. 870 o Text about ordering of list entries was corrected. 872 B.6. Changes Between Revisions -01 and -02 874 o Encoding of namespaces in instance-identifiers was changed. 876 o Text specifying the order of array elements in leaf-list and list 877 instances was added. 879 B.7. Changes Between Revisions -00 and -01 881 o Metadata encoding was moved to a separate I-D, draft-lhotka- 882 netmod-yang-metadata. 884 o JSON encoding is now defined directly rather than via XML-JSON 885 mapping. 887 o The rules for namespace encoding has changed. This affect both 888 node instance names and instance-identifiers. 890 o I-JSON-related changes. The most significant is the string 891 encoding of 64-bit numbers. 893 o When validating union type, the partial type info present in JSON 894 encoding is taken into account. 896 o Added section about I-JSON compliance. 898 o Updated the example in appendix. 900 o Wrote Security Considerations. 902 o Removed IANA Considerations as there are none. 904 Author's Address 906 Ladislav Lhotka 907 CZ.NIC 909 Email: lhotka@nic.cz