Re: [netmod] attributes in draft-lhotka-netmod-yang-json

Martin Bjorklund <mbj@tail-f.com> Thu, 20 March 2014 15:36 UTC

Return-Path: <mbj@tail-f.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 1CBAF1A0750 for <netmod@ietfa.amsl.com>; Thu, 20 Mar 2014 08:36:50 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.448
X-Spam-Level:
X-Spam-Status: No, score=-2.448 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.547, 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 wA8t8gwWBvBj for <netmod@ietfa.amsl.com>; Thu, 20 Mar 2014 08:36:47 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [109.74.15.94]) by ietfa.amsl.com (Postfix) with ESMTP id 6AA1E1A06D2 for <netmod@ietf.org>; Thu, 20 Mar 2014 08:36:47 -0700 (PDT)
Received: from localhost (s193-12-74-81.cust.tele2.se [193.12.74.81]) by mail.tail-f.com (Postfix) with ESMTPSA id 77ED539407C; Thu, 20 Mar 2014 16:36:37 +0100 (CET)
Date: Thu, 20 Mar 2014 16:36:36 +0100
Message-Id: <20140320.163636.376501686.mbj@tail-f.com>
To: andy@yumaworks.com
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <CABCOCHT3AJR0u=-GV1eM8geL-F2j7HSBsw0uBb1DYDvZio6eCA@mail.gmail.com>
References: <3FADE5E8-88AC-4FD0-A2F6-72F408FAFFC4@juniper.net> <20140320.150426.496532825.mbj@tail-f.com> <CABCOCHT3AJR0u=-GV1eM8geL-F2j7HSBsw0uBb1DYDvZio6eCA@mail.gmail.com>
X-Mailer: Mew version 6.5 on Emacs 23.4 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/OWkur0bOLSE4R58NOBJBaftN4nY
Cc: 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: Thu, 20 Mar 2014 15:36:50 -0000

Andy Bierman <andy@yumaworks.com> wrote:
> On Thu, Mar 20, 2014 at 7:04 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
> 
> > Dean Bogdanovic <deanb@juniper.net> wrote:
> > > Hi,
> > >
> > > In draft yang leaf node is defined as name value pair in json
> > >
> > > If it would be represented, as an object then we can assign attributes
> > to it.
> > >
> > > Example
> > > "host-name" {
> > >    "data" : "router",
> > >       "attributes" : { "protect" : protect}
> > > }
> > >
> > > We need attributes for several things, so lets try to figure out how to
> > enable
> > > them.
> >
> > I agree that the lack of attributes is a problem with the JSON
> > mapping.
> >
> > The problem with your solution is that it adds noise to the normal
> > case where there are no attributes.  We're using another encoding:
> >
> >    "host-name": "router",
> >    "@host-name": {
> >        "protect": "protect",
> >        ...
> >     }
> >
> > Yep, not very elegant...
> >
> >
> This is how RESTCONF encodes these attributes in a leaf:
> (see sec. 3.4.1)
> 
>    "host-name" : {
>        "@protect" : "protect",
>        "host-name" : "router"
>    }

So this means that RESTCONF does not follow the JSON mapping
document.

If we can avoid that it would be ... good.

> Lada says that this is a YANG to JSON mapping and YANG has no attributes,
> so the attribute encoding is in RESTCONF.  I think it would be better
> if there was 1 mapping, instead of a different mapping in each protocol
> that uses this JSON encoding of YANG data.

+1  I think the JSON mapping document should define how meta data are
encoded, if the protocol supports meta data.

> I do not think YANG needs to model attributes!

+1

> The protocol may need to use them to tag data with meta-data.

Yes.


/martin