JSON Encoding of Data Modeled with YANG
RFC 7951
Document | Type | RFC - Proposed Standard (August 2016; No errata) | |
---|---|---|---|
Author | Ladislav Lhotka | ||
Last updated | 2016-08-31 | ||
Stream | IETF | ||
Formats | plain text html pdf htmlized bibtex | ||
Reviews | |||
Stream | WG state | Submitted to IESG for Publication | |
Document shepherd | Kent Watsen | ||
Shepherd write-up | Show (last changed 2016-02-23) | ||
IESG | IESG state | RFC 7951 (Proposed Standard) | |
Action Holders |
(None)
|
||
Consensus Boilerplate | Yes | ||
Telechat date | |||
Responsible AD | BenoƮt Claise | ||
Send notices to | (None) | ||
IANA | IANA review state | Version Changed - Review Needed | |
IANA action state | No IANA Actions |
Internet Engineering Task Force (IETF) L. Lhotka Request for Comments: 7951 CZ.NIC Category: Standards Track August 2016 ISSN: 2070-1721 JSON Encoding of Data Modeled with YANG Abstract This document defines encoding rules for representing configuration data, state data, parameters of Remote Procedure Call (RPC) operations or actions, and notifications defined using YANG as JavaScript Object Notation (JSON) text. Status of This Memo This is an Internet Standards Track document. This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841. Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7951. Copyright Notice Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Lhotka Standards Track [Page 1] RFC 7951 JSON Encoding of YANG Data August 2016 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology and Notation . . . . . . . . . . . . . . . . . . 3 3. Properties of the JSON Encoding . . . . . . . . . . . . . . . 4 4. Names and Namespaces . . . . . . . . . . . . . . . . . . . . 5 5. Encoding of YANG Data Node Instances . . . . . . . . . . . . 7 5.1. The "leaf" Data Node . . . . . . . . . . . . . . . . . . 7 5.2. The "container" Data Node . . . . . . . . . . . . . . . . 8 5.3. The "leaf-list" Data Node . . . . . . . . . . . . . . . . 8 5.4. The "list" Data Node . . . . . . . . . . . . . . . . . . 9 5.5. The "anydata" Data Node . . . . . . . . . . . . . . . . . 9 5.6. The "anyxml" Data Node . . . . . . . . . . . . . . . . . 10 5.7. Metadata Objects . . . . . . . . . . . . . . . . . . . . 11 6. Representing YANG Data Types in JSON Values . . . . . . . . . 11 6.1. Numeric Types . . . . . . . . . . . . . . . . . . . . . . 11 6.2. The "string" Type . . . . . . . . . . . . . . . . . . . . 11 6.3. The "boolean" Type . . . . . . . . . . . . . . . . . . . 11 6.4. The "enumeration" Type . . . . . . . . . . . . . . . . . 12 6.5. The "bits" Type . . . . . . . . . . . . . . . . . . . . . 12 6.6. The "binary" Type . . . . . . . . . . . . . . . . . . . . 12 6.7. The "leafref" Type . . . . . . . . . . . . . . . . . . . 12 6.8. The "identityref" Type . . . . . . . . . . . . . . . . . 12 6.9. The "empty" Type . . . . . . . . . . . . . . . . . . . . 13 6.10. The "union" Type . . . . . . . . . . . . . . . . . . . . 14 6.11. The "instance-identifier" Type . . . . . . . . . . . . . 15 7. I-JSON Compliance . . . . . . . . . . . . . . . . . . . . . . 15 8. Security Considerations . . . . . . . . . . . . . . . . . . . 16 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 16 9.1. Normative References . . . . . . . . . . . . . . . . . . 16 9.2. Informative References . . . . . . . . . . . . . . . . . 17 Appendix A. A Complete Example . . . . . . . . . . . . . . . . . 18 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 20 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20 Lhotka Standards Track [Page 2] RFC 7951 JSON Encoding of YANG Data August 2016 1. Introduction The Network Configuration Protocol (NETCONF) [RFC6241] uses XML [XML] for encoding data in its Content Layer. Other management protocols might want to use other encodings while still benefiting from using YANG [RFC7950] as the data modeling language. For example, the RESTCONF protocol [RESTCONF] supports two encodings: XML (media type "application/yang.data+xml") and JavaScript Object Notation (JSON) (media type "application/yang.data+json"). The specification of the YANG 1.1 data modeling language [RFC7950]Show full document text