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

Ladislav Lhotka <lhotka@nic.cz> Thu, 20 March 2014 22:32 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 C06A81A07F2 for <netmod@ietfa.amsl.com>; Thu, 20 Mar 2014 15:32:07 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.898
X-Spam-Level:
X-Spam-Status: No, score=-0.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HELO_EQ_CZ=0.445, HOST_EQ_CZ=0.904, MIME_8BIT_HEADER=0.3, RP_MATCHES_RCVD=-0.547] autolearn=no
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 zpAuua4DU8OR for <netmod@ietfa.amsl.com>; Thu, 20 Mar 2014 15:32:06 -0700 (PDT)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by ietfa.amsl.com (Postfix) with ESMTP id EB3761A077C for <netmod@ietf.org>; Thu, 20 Mar 2014 15:32:05 -0700 (PDT)
Received: from [172.29.2.202] (nat-5.bravonet.cz [77.48.224.5]) by mail.nic.cz (Postfix) with ESMTPSA id D6A5514011F; Thu, 20 Mar 2014 23:31:55 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nic.cz; s=default; t=1395354716; bh=KA7fp0aGM7Tdn/xFb9isdqf+MoQSluhG0503C7oQI2E=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=uzfA2Umd61nvXUnUK2yajocxxOsYMJYMcTn0WwYVh33xKEWhfvS2ZqFsTj8ocvWKI bquSgHL4fVSxYausiBm84nOhwyG1pPNiVeu7DqH78SBx1EfMeDoT+Eg0qcLauHGgpj i2nspGCGsYyjNjwONBoQ+S224GZldlQn2H/OgVNY=
Content-Type: text/plain; charset="windows-1252"
Mime-Version: 1.0 (Mac OS X Mail 7.2 \(1874\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <20140320.150426.496532825.mbj@tail-f.com>
Date: Thu, 20 Mar 2014 23:31:56 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <581E695D-7892-4CCE-9CF8-E534FD323F7F@nic.cz>
References: <3FADE5E8-88AC-4FD0-A2F6-72F408FAFFC4@juniper.net> <20140320.150426.496532825.mbj@tail-f.com>
To: Martin Björklund <mbj@tail-f.com>
X-Mailer: Apple Mail (2.1874)
X-Virus-Scanned: clamav-milter 0.97.8 at mail
X-Virus-Status: Clean
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/kBIio6WPL6e_7gcSm9adfTrYad0
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 22:32:08 -0000

On 20 Mar 2014, at 15:04, 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.

YANG doesn’t model XML attributes, so attributes are out of scope for the mapping. I’d be happy to provide decent place for attributes, but I don’t like Dean’s proposal - it just makes JSON text terribly messy.

> 
> 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…


But still much much better. As you say, it spoils only places where attributes are really needed. I am inclined to include this kind of attribute mapping in the draft, if we can reach a rough consensus on it.

Lada

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

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C