Re: [netmod] yang-json document
Ladislav Lhotka <lhotka@nic.cz> Fri, 06 February 2015 12:18 UTC
Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0C3FC1A0263 for <netmod@ietfa.amsl.com>; Fri, 6 Feb 2015 04:18:54 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qXjAbNEEP2VY for <netmod@ietfa.amsl.com>; Fri, 6 Feb 2015 04:18:51 -0800 (PST)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 6F9FF1A001B for <netmod@ietf.org>; Fri, 6 Feb 2015 04:18:51 -0800 (PST)
Received: from localhost (unknown [195.113.220.110]) by trail.lhotka.name (Postfix) with ESMTPSA id AAF3B1CC0248; Fri, 6 Feb 2015 13:18:50 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Andy Bierman <andy@yumaworks.com>, Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <CABCOCHRH-21xtxjG5MPM6Xib7BoYdGp6ag04FeZZ0SzvZOXUvg@mail.gmail.com>
References: <20150205.135210.818152609244122122.mbj@tail-f.com> <15CBB080-9288-4881-8F28-DE1A24279820@nic.cz> <CABCOCHQ03Owgo5Zb-jcenDNGqT1_gRazbSG+LUU_Pi7NpNDArA@mail.gmail.com> <20150205.214557.720578496688087827.mbj@tail-f.com> <CABCOCHRH-21xtxjG5MPM6Xib7BoYdGp6ag04FeZZ0SzvZOXUvg@mail.gmail.com>
User-Agent: Notmuch/0.18.1 (http://notmuchmail.org) Emacs/24.4.51.2 (x86_64-apple-darwin14.0.0)
Date: Fri, 06 Feb 2015 13:18:52 +0100
Message-ID: <m2siejxmfn.fsf@birdie.labs.nic.cz>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/mdW8IHNR5Uer9xqrLbliHrQAsA0>
Cc: "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] yang-json document
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 06 Feb 2015 12:18:54 -0000
Andy Bierman <andy@yumaworks.com> writes: > On Thu, Feb 5, 2015 at 12:45 PM, Martin Bjorklund <mbj@tail-f.com> wrote: >> Andy Bierman <andy@yumaworks.com> wrote: >>> On Thu, Feb 5, 2015 at 5:49 AM, Ladislav Lhotka <lhotka@nic.cz> wrote: >>> > >>> >> On 05 Feb 2015, at 13:52, Martin Bjorklund <mbj@tail-f.com> wrote: >>> >> >>> >> Ladislav Lhotka <lhotka@nic.cz> wrote: >>> >>> Hi, >>> >>> >>> >>> $SUBJ is already several months late, so I think we should proceed >>> >>> towards delivering it. I checked my mail archive since the -02 >>> >>> revision, >>> >>> and it seems two issues need to be resolved: >>> >>> >>> >>> 1. Andy objected to making redundant namespace prefixes illegal. I >>> >>> propose the following change to 4th paragraph in sec. 4 (SHOULD NOT >>> >>> instead of MUST NOT): >>> >>> >>> >>> OLD >>> >>> >>> >>> Names with namespace identifiers in the form shown in Figure 1 MUST >>> >>> be used for all top-level YANG data nodes, and also for all nodes >>> >>> whose parent node belongs to a different namespace. Otherwise, names >>> >>> with namespace identifiers MUST NOT be used. >>> >>> >>> >>> NEW >>> >>> >>> >>> Names with namespace identifiers in the form shown in Figure 1 MUST >>> >>> be used for all top-level YANG data nodes, and also for all nodes >>> >>> whose parent node belongs to a different namespace. Otherwise, names >>> >>> with namespace identifiers SHOULD NOT be used. >>> >> >>> >> I don't think this is a good idea. The reason is that it complicates >>> >> both client and server code. An implementation cannot write code like >>> >> this: >>> >> >>> >> name = interface['name'] >>> >> mtu = interface['mtu'] >>> >> >>> >> instead we have to look for both 'name' and 'ietf-interfaces:name': >>> >> >>> >> if 'name' in interface: >>> >> name = interface['name'] >>> >> else >>> >> name = interface['ietf-interfaces:name'] >>> >> >>> >> >>> >> One single deterministic encoding is simpler everywhere and less >>> >> error-prone. >>> > >>> > I agree with you, this again makes standard JSON parsers (that give >>> > you a pointer to the parsed structure) considerably less useful. >>> > >>> >>> Customers are not following this rule and they never will. >>> They avoid the problem by avoiding local-name conflicts >>> in the first place. It is not user-friendly or CLI-friendly >>> to allow sibling nodes to have the same local name. >>> These are not open systems so controlling the module set >>> is not a problem. >> >> But this is *another* issue. Neither of the alternatives support this >> use case. >> >>> >>> 2. anyxml encoding: although it is a misnomer, I propose to keep the >>> >>> current definition (sec. 5.5), i.e. allow any valid JSON value in >>> >>> JSON-encoded anyxml instances. I also think the text makes it >>> >>> sufficiently clear that no standard mapping between XML- and >>> >>> JSON-encoded instances is defined. >>> >> >>> >> Ok. >>> >> >>> >>> I am not so sure ignoring XML is OK. >> >> So how would you encode an arbitrary XML snippet (which is what anyxml >> is) in JSON? I know you want to restrict anyxml, but that is simply >> not how it is defined in 6020. For now we have to live with that. >> > > No -- the description-stmts for the anyxml nodes in YANG Patch > specify the limitations and an implementation of ietf-yang-patch > MUST support what it says. If other individual YANG modules > want to constrain anyxml in specific ways, they can do that. > We can specify what an implementation of a particular module MUST > accept. Exactly! I think most, if not all, uses of anyxml and anydata will assume some specific syntax and semantics (that needs to be explained in the description). But this may also include a sensible, perhaps non-trivial, way for mapping XML to JSON and back. And if there is no sensible mapping, it is IMO also acceptable that certain uses of anyxml will only be possible in XML encoding. The point really is that there needn't be any common rules for all uses of anyxml, except that it has to be well-formed for the given encoding. > > XML has simple nodes which are empty and those which are not empty. > > XML non-empty simple node <--> JSON string > XML empty node <--> JSON null > XML complex node <--> JSON object > > No requirement to send arrays, boolean, or numbers, but MAY send, > and MUST accept. No requirement to preserve JSON type info. > Must preserve xmlns and other attributes if QName or XPath content found. > No XML PIs or mixed content allowed. > IMO this will make XML <--> JSON translation work. > > > >>> There should be a warning that the JSON encoding the >>> sender picks is not "sticky". The receiver MAY change it >>> to something else, such that if the original sender retrieves >>> a new copy from the server, the JSON types might have changed. >>> >>> It is only safe to use the common features between XML and JSON. >> >> Right, and you get this from anydata! >> > > Not as Lada defined his YANG to JSON mapping. So far, anydata isn't covered at all. Lada > > >> >> /martin > > > Andy -- Ladislav Lhotka, CZ.NIC Labs PGP Key ID: E74E8C0C
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Juergen Schoenwaelder
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Randy Presuhn
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Juergen Schoenwaelder
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Juergen Schoenwaelder
- Re: [netmod] yang-json document Juergen Schoenwaelder
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Randy Presuhn
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Juergen Schoenwaelder
- Re: [netmod] [Ladislav Lhotka] Re: yang-json docu… Andy Bierman
- Re: [netmod] [Ladislav Lhotka] Re: yang-json docu… Martin Bjorklund
- Re: [netmod] [Ladislav Lhotka] Re: yang-json docu… Andy Bierman
- [netmod] [Ladislav Lhotka] Re: yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Juergen Schoenwaelder
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Phil Shafer
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] [Ladislav Lhotka] Re: yang-json docu… Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Martin Bjorklund
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] [Ladislav Lhotka] Re: yang-json docu… Phil Shafer
- Re: [netmod] [Ladislav Lhotka] Re: yang-json docu… Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Andy Bierman
- Re: [netmod] yang-json document Ladislav Lhotka
- Re: [netmod] yang-json document Ladislav Lhotka