Re: [netmod] attributes in draft-lhotka-netmod-yang-json
Andy Bierman <andy@yumaworks.com> Wed, 26 March 2014 16:06 UTC
Return-Path: <andy@yumaworks.com>
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 0C1261A017D for <netmod@ietfa.amsl.com>; Wed, 26 Mar 2014 09:06:11 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] 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 iTfcSMbHoQxr for <netmod@ietfa.amsl.com>; Wed, 26 Mar 2014 09:06:07 -0700 (PDT)
Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com [209.85.216.181]) by ietfa.amsl.com (Postfix) with ESMTP id 89B951A00E3 for <netmod@ietf.org>; Wed, 26 Mar 2014 09:06:07 -0700 (PDT)
Received: by mail-qc0-f181.google.com with SMTP id e9so2833721qcy.12 for <netmod@ietf.org>; Wed, 26 Mar 2014 09:06:05 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=76wsjWorhDsZjUxXXcwD+cfOchWy7St9AovznXNbdBg=; b=Biifu+bSvla3DzpMzWc1BHsfrtai0+H6LKG/rZM9oTfrsg2BSuvmRnaFZBYM4lIWNZ 6YZccOxZi5FHduCrMlxxBxImBTz/h10ZKq8aE3mi/ZDguG7NtcFnYeoyuP7s4NbLp52e 9jrp36zzZLFZyDDzTo5qHdSFVoIEgJR3eHVlRubboEzWcyWMWslIo+2t3O57ZowmT6Qc kWKpnd+Upxvs66aE+NrIp0gFpPwFgEbqv6UpoQAlPTCa+N9B6X8kGZim6tOkv/xfAjfY V6BelPs6iPWkXI6i6EGJ7T4QapFFbEelk8K/TGBJ0wt4WCxZ1OPLjr+YPdv9fxXA1yXI QJtA==
X-Gm-Message-State: ALoCoQlENIYrNuaj5IZa2/2n4nFh9d+ZsGmYoC0UsWoFBK6CNuTxGMODneMRVz68Y/oAv8IcDfrv
MIME-Version: 1.0
X-Received: by 10.140.27.193 with SMTP id 59mr85586809qgx.18.1395849965670; Wed, 26 Mar 2014 09:06:05 -0700 (PDT)
Received: by 10.140.104.194 with HTTP; Wed, 26 Mar 2014 09:06:05 -0700 (PDT)
In-Reply-To: <20140326.165113.591253176749495826.mbj@tail-f.com>
References: <6F6EF691-5134-4243-B25D-96C54760741C@nic.cz> <20140326.161220.1907816882803386580.mbj@tail-f.com> <CABCOCHQ4KYXU94jRSaAsenEn-mK2k7b+1Uv4Yg_AmcatqtDBUg@mail.gmail.com> <20140326.165113.591253176749495826.mbj@tail-f.com>
Date: Wed, 26 Mar 2014 09:06:05 -0700
Message-ID: <CABCOCHQxAmSNJWMOPV8MBmwX3mLSetB3J6+XvML2YSWXHahSVA@mail.gmail.com>
From: Andy Bierman <andy@yumaworks.com>
To: Martin Bjorklund <mbj@tail-f.com>
Content-Type: multipart/alternative; boundary="001a11c1233a5d27db04f584a5d4"
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/1D1ZbM9i1s_LOdzsc-cWVubNaNU
Cc: "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] attributes in draft-lhotka-netmod-yang-json
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: Wed, 26 Mar 2014 16:06:11 -0000
On Wed, Mar 26, 2014 at 8:51 AM, Martin Bjorklund <mbj@tail-f.com> wrote: > Andy Bierman <andy@yumaworks.com> wrote: > > On Wed, Mar 26, 2014 at 8:12 AM, Martin Bjorklund <mbj@tail-f.com> > wrote: > > > > > Ladislav Lhotka <lhotka@nic.cz> wrote: > > > > > > > > On 26 Mar 2014, at 15:43, Andy Bierman <andy@yumaworks.com> wrote: > > > > > > > > > > > > > > > > > > > > > > > > On Wed, Mar 26, 2014 at 7:27 AM, Martin Bjorklund <mbj@tail-f.com> > > > > > wrote: > > > > > Andy Bierman <andy@yumaworks.com> wrote: > > > > > > On Wed, Mar 26, 2014 at 7:10 AM, Ladislav Lhotka <lhotka@nic.cz> > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > On 26 Mar 2014, at 14:57, Martin Bjorklund <mbj@tail-f.com> > wrote: > > > > > > > > > > > > > > > Ladislav Lhotka <lhotka@nic.cz> wrote: > > > > > > > >> Martin Bjorklund <mbj@tail-f.com> writes: > > > > > > > >> > > > > > > > >>> Hi, > > > > > > > >>> > > > > > > > >>> Here's yet another attempt to handle attributes in JSON, > > > without > > > > > > > >>> changing the encoding for the case that there are no > attributes > > > > > > > >>> present. > > > > > > > >>> > > > > > > > >>> In all examples, the attributes "inactive" and "etag" are > > > present. > > > > > > > >>> > > > > > > > >>> Attributes are encoded differently depending on the type of > > > object: > > > > > > > >>> > > > > > > > >>> > > > > > > > >>> leaf > > > > > > > >>> ---- > > > > > > > >>> > > > > > > > >>> Encode the attributes as a sibling to the leaf. > > > > > > > >>> > > > > > > > >>> > > > > > > > >>> leaf foo { > > > > > > > >>> type string; > > > > > > > >>> } > > > > > > > >>> > > > > > > > >>> "foo": "some value"; > > > > > > > >>> "@foo": { > > > > > > > >>> "inactive": true, > > > > > > > >>> "etag": "..."; > > > > > > > >>> } > > > > > > > >>> > > > > > > > >>> > > > > > > > >>> list instance > > > > > > > >>> ------------- > > > > > > > >>> > > > > > > > >>> Encode the attributes within the list instance. > > > > > > > >>> > > > > > > > >>> > > > > > > > >>> list bar { > > > > > > > >>> key name; > > > > > > > >>> leaf name { > > > > > > > >>> type string; > > > > > > > >>> } > > > > > > > >>> ... > > > > > > > >>> } > > > > > > > >>> > > > > > > > >>> "bar": [ > > > > > > > >>> { > > > > > > > >>> "@bar": { > > > > > > > >>> "inactive": true, > > > > > > > >>> "etag": "..." > > > > > > > >>> } > > > > > > > >>> "name": "instance name"; > > > > > > > >>> }] > > > > > > > >>> > > > > > > > >> > > > > > > > >> This could be ambiguous: > > > > > > > >> > > > > > > > >> list bar { > > > > > > > >> key name; > > > > > > > >> leaf name { ... } > > > > > > > >> leaf bar { ... } > > > > > > > >> } > > > > > > > >> > > > > > > > >> Then you don't know whether the attributes belong to the > list > > > entry > > > > > > > >> or to the contained leaf. > > > > > > > > > > > > > > > > Right. Then we use "@@bar" for the list / container > attributes. > > > > > > > > > > > > > > OK, then this scheme is fine with me. > > > > > > > > > > > > > > > > > > > > Looks more complicated than other solution proposals. > > > > > > > > > > Do we agree that we don't want different encodings for values if > there > > > > > are attributes or not? I.e., if my code works when no attributes > are > > > > > present, it should also work if there are attributes? > > > > > > > > I am not sure even your encoding satisfies this requirement. At least > > > > your code has to be instructed to ignore the attribute stuff. > > > > > > In general, I think robust code would ignore unknown fields. > > > > > > > > Not if the normal encoding is painful to use. > > > > > The use attributes is going to be rare. > > > > > I want the expected "plain" encoding when there are no attributes. > > > > > Code that generates JSON and does not care about attributes > > > > > must not be rendered useless because the JSON is specially encoded > > > > > in RESTCONF. We want to leverage wide knowledge of JSON, > > > > > not invent our own incompatible version of it. > > > > > > > > This is my preference, too. > > > > > > > > This is not a preference. It is critical that plain JSON code > > that knows how to deal with plain data structures does not break. > > > > Well, of course. But I don't think anyone has proposed something that > > > is not valid json. > > > > > > > > > > That is not the point. A normal JSON tool is going to generate or expect > > "foo":"bar" for a simple leaf, or "foo":[1, 2, 3] for a simple array, > for > > example. > > > > The encoding for the data nodes MUST be exactly > > the same as the YANG-to-JSON draft now, if no attributes are used. > > This is exactly my point! > > > Only a client that knows about attributes will need to associate an > > attribute > > with its parent data node. > > Yes! > > > This must be easy to do. > > As easy as possible. IMO this falls into the category of "possible to > do". The normal case must be easy to do. > > > Other clients should be able to ignore attributes. > > Yes! > > > A server must reject messages with unknown attributes. > > > > I agree that no proposal is satisfactory for leaf or leaf-list nodes. > > My proposal satifies all these properties, except "easy to do > attributes". > > Yes -- there are corner cases to detect (like array given for @foo, but foo is a leaf). The most annoying part is parsing @foo first, and holding onto the data until foo is found (if it exists - another error to detect is @foo but no foo). I guess this is OK. NACM does not provide any control over access to attributes, which is good. We cannot have NACM filter out a leaf-list value but not filter out the attributes for the associated leaf-list instance. > > /martin > Andy
- [netmod] attributes in draft-lhotka-netmod-yang-j… Dean Bogdanovic
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Ladislav Lhotka
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Martin Bjorklund
- Re: [netmod] attributes in draft-lhotka-netmod-ya… Andy Bierman