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

Andy Bierman <andy@yumaworks.com> Thu, 20 March 2014 15:26 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 374321A0759 for <netmod@ietfa.amsl.com>; Thu, 20 Mar 2014 08:26:12 -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 iu7NDJtPaTcG for <netmod@ietfa.amsl.com>; Thu, 20 Mar 2014 08:26:09 -0700 (PDT)
Received: from mail-qc0-f173.google.com (mail-qc0-f173.google.com [209.85.216.173]) by ietfa.amsl.com (Postfix) with ESMTP id 15ABC1A0750 for <netmod@ietf.org>; Thu, 20 Mar 2014 08:26:08 -0700 (PDT)
Received: by mail-qc0-f173.google.com with SMTP id r5so1143238qcx.4 for <netmod@ietf.org>; Thu, 20 Mar 2014 08:25:59 -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=g3vXF2IQA7KvvGCBeb7VRDWRdUC0NVqN5dpVy7Te6Vk=; b=E9y5EVvpvIUrRk/H4B4i5AKV63O1jaoAbLyIZpazP4ZSGnRTVRPnvsKFDCQBeJIkLI R4XOi6dbN3LZDQeY3chUUcBnGgT+io9VW8d0R9fiSJaf4gWyHUsBO+meTpPO8hI8APcr FnnVhKFdS8tj4n5Yh/S2z7xQSnFsOi5c0EzDLRBk6Yylgj3HOnbdPWQ0w1p4VxbjqB0J XIIjOJYcuTrihnAudgw8a7iIF5j8DA/0N+XRixkz+HIEQWesssLvoFy+LaHVWrhE7w1N kGa+QuZoYju5qim+y+FhiwfeTJcLRMYvuDDq5HyQZ6rRbn2HNz5Scpx2Gc99qfKz1y1s 9jIQ==
X-Gm-Message-State: ALoCoQlK3T9PQkdmuwirX/8XH963EQJxh8DjcntmzBUnahSTEhD9SqnuhzEL1h+pqOo/RtV2yNR8
MIME-Version: 1.0
X-Received: by 10.140.87.9 with SMTP id q9mr10020427qgd.94.1395329159837; Thu, 20 Mar 2014 08:25:59 -0700 (PDT)
Received: by 10.140.104.194 with HTTP; Thu, 20 Mar 2014 08:25:59 -0700 (PDT)
In-Reply-To: <20140320.150426.496532825.mbj@tail-f.com>
References: <3FADE5E8-88AC-4FD0-A2F6-72F408FAFFC4@juniper.net> <20140320.150426.496532825.mbj@tail-f.com>
Date: Thu, 20 Mar 2014 08:25:59 -0700
Message-ID: <CABCOCHT3AJR0u=-GV1eM8geL-F2j7HSBsw0uBb1DYDvZio6eCA@mail.gmail.com>
From: Andy Bierman <andy@yumaworks.com>
To: Martin Bjorklund <mbj@tail-f.com>
Content-Type: multipart/alternative; boundary="001a113a359ceb050e04f50b62cc"
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/d0YuDWGwAqfa4aNhMQeJIn4cQto
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: Thu, 20 Mar 2014 15:26:12 -0000

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"
   }

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.

I do not think YANG needs to model attributes!
The protocol may need to use them to tag data with meta-data.
We do not need to model some leafs as attributes and others
as child nodes in YANG data models.  Use RelaxNG instead
of YANG to do that.




> /martin
>
>
Andy


> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>