JSON Encoding of Data Modeled with YANG
draft-ietf-netmod-yang-json-00

The information below is for an old version of the document
Document Type Active Internet-Draft (netmod WG)
Last updated 2014-04-22
Stream IETF
Intended RFC status (None)
Formats pdf htmlized bibtex
Reviews
Stream WG state WG Document
Document shepherd None
IESG IESG state I-D Exists
Consensus Boilerplate Unknown
Telechat date
Responsible AD (None)
Send notices to (None)
NETMOD                                                         L. Lhotka
Internet-Draft                                                    CZ.NIC
Intended status: Standards Track                          April 21, 2014
Expires: October 23, 2014

                JSON Encoding of Data Modeled with YANG
                     draft-ietf-netmod-yang-json-00

Abstract

   This document defines rules for representing configuration and state
   data defined using YANG as JSON text.  It does so by specifying a
   procedure for translating the subset of YANG-compatible XML documents
   to JSON text, and vice versa.  A JSON encoding of XML attributes is
   also defined so as to allow for including metadata in JSON documents.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on October 23, 2014.

Copyright Notice

   Copyright (c) 2014 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                  Expires October 23, 2014                [Page 1]
Internet-Draft         JSON Encoding of YANG Data             April 2014

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Terminology and Notation  . . . . . . . . . . . . . . . . . .   4
   3.  Specification of the Translation Procedure  . . . . . . . . .   5
     3.1.  Names and Namespaces  . . . . . . . . . . . . . . . . . .   6
     3.2.  Mapping XML Elements to JSON Objects  . . . . . . . . . .   8
       3.2.1.  The "leaf" Data Node  . . . . . . . . . . . . . . . .   8
       3.2.2.  The "container" Data Node . . . . . . . . . . . . . .   8
       3.2.3.  The "leaf-list" Data Node . . . . . . . . . . . . . .   9
       3.2.4.  The "list" Data Node  . . . . . . . . . . . . . . . .   9
       3.2.5.  The "anyxml" Data Node  . . . . . . . . . . . . . . .  10
     3.3.  Mapping YANG Datatypes to JSON Values . . . . . . . . . .  11
       3.3.1.  Numeric Datatypes . . . . . . . . . . . . . . . . . .  11
       3.3.2.  The "string" Type . . . . . . . . . . . . . . . . . .  11
       3.3.3.  The "boolean" Type  . . . . . . . . . . . . . . . . .  11
       3.3.4.  The "enumeration" Type  . . . . . . . . . . . . . . .  11
       3.3.5.  The "bits" Type . . . . . . . . . . . . . . . . . . .  12
       3.3.6.  The "binary" Type . . . . . . . . . . . . . . . . . .  12
       3.3.7.  The "leafref" Type  . . . . . . . . . . . . . . . . .  12
       3.3.8.  The "identityref" Type  . . . . . . . . . . . . . . .  12
       3.3.9.  The "empty" Type  . . . . . . . . . . . . . . . . . .  12
       3.3.10. The "union" Type  . . . . . . . . . . . . . . . . . .  13
       3.3.11. The "instance-identifier" Type  . . . . . . . . . . .  13
   4.  Encoding Metadata in JSON . . . . . . . . . . . . . . . . . .  14
   5.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  16
   6.  Security Considerations . . . . . . . . . . . . . . . . . . .  16
   7.  Acknowledgments . . . . . . . . . . . . . . . . . . . . . . .  17
   8.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  17
     8.1.  Normative References  . . . . . . . . . . . . . . . . . .  17
     8.2.  Informative References  . . . . . . . . . . . . . . . . .  17
   Appendix A.  A Complete Example . . . . . . . . . . . . . . . . .  18
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .  20

1.  Introduction

   The aim of this document is define rules for representing
   configuration and state data defined using the YANG data modeling
   language [RFC6020] as JavaScript Object Notation (JSON)
   text [RFC7159].  The result can be potentially applied in two
   different ways:

   1.  JSON may be used instead of the standard XML [XML] encoding in
       the context of the NETCONF protocol [RFC6241] and/or with
Show full document text