Re: [core] YANG to CBOR mapping

Ladislav Lhotka <lhotka@nic.cz> Thu, 19 November 2015 10:37 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id BA46B1B31A6 for <core@ietfa.amsl.com>; Thu, 19 Nov 2015 02:37:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.236
X-Spam-Level:
X-Spam-Status: No, score=-1.236 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, RP_MATCHES_RCVD=-0.585] 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 7_qL_k1BDXbX for <core@ietfa.amsl.com>; Thu, 19 Nov 2015 02:37:31 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 659D81B31A1 for <core@ietf.org>; Thu, 19 Nov 2015 02:37:31 -0800 (PST)
Received: from [IPv6:2001:1488:fffe:6:ffff:ffff:ffff:22] (unknown [IPv6:2001:1488:fffe:6:ffff:ffff:ffff:22]) by mail.nic.cz (Postfix) with ESMTPSA id 0D433181B00; Thu, 19 Nov 2015 11:37:30 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nic.cz; s=default; t=1447929450; bh=YUxmJkd+/FYotlzXzE/ZDvUUKSXmBR6OViuasLzonGc=; h=From:Date:To; b=g1PDXTIsl0HG3hT4gsF5MBPcWZG8LyQD395q7vfVKUiut7+UdJcBnrfsKeorIOzhG ecjJ2TD9Ld/ocp84h9QkEDjzR9e+7DSiSS932sRrZ0l9kRf4znW4US/FRHXs6Qmhq3 GU54s3loUPxymUtkVmWJ9QBUzMPOQBLn5zJnhDYY=
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 9.1 \(3096.5\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <02d2efc9e66b090dd7b7932ae4e749cd@xs4all.nl>
Date: Thu, 19 Nov 2015 11:37:31 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <56C321F1-3905-489A-A398-4AEF1E768B68@nic.cz>
References: <02d2efc9e66b090dd7b7932ae4e749cd@xs4all.nl>
To: consultancy@vanderstok.org
X-Mailer: Apple Mail (2.3096.5)
X-Virus-Scanned: clamav-milter 0.98.7 at mail
X-Virus-Status: Clean
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/2PWKZXHYXxpZq5nwq3Mx89c5o5U>
X-Mailman-Approved-At: Thu, 19 Nov 2015 12:08:21 -0800
Cc: Core <core@ietf.org>
Subject: Re: [core] YANG to CBOR mapping
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 19 Nov 2015 10:37:32 -0000

> On 19 Nov 2015, at 11:00, peter van der Stok <stokcons@xs4all.nl> wrote:
> 
> Hi CoOL authors.
> 
> I have looked at your section 5, and see an enormous overlap with the CoMI section 6. Actually the two proposals are almost completely interoperable, with a few exceptions. Much of the CoMI proposal is based on the work of Ladislav Lhotka, described in draft-ietf-netmod-yang-json. CoMI refers to this draft and uses it extensively. In the CoOL draft the yang-json draft is ignored. That is a pity because you are redoing much of the work already done in the yang-json draft. In the CoMI draft we used the results of yang-json draft, exchanged the YANG name by the hash value, and passed it through the diagnostic JSON to CBOR translator. Quite a satisfactory and elegant solution.
> Below, I have summarized my comparison between CoMI YANG to CBOR and CoOL YANG to CBOR. Please check for omissions and mistakes.
> Differences concern Binary byte string and Bits. The CoMI choice of CBOR type is derived from yang-json, and I should like to hear the opinion of Ladislav on this aspect.

Isn't it just an error? The CoOL draft says:

   Leafs of type binary MUST be encoded using a CBOR byte string data
   item (major type 0).

However, RFC 7049 defines major type 0 as unsigned integer.

> Other differences concern decimal64, and int; but I expect that is an oversight in the CoOL draft.
> A major difference is the encoding of lists and list instances; I discuss that in a separate e_mail.
> Given the overlap of work and the need for the expertise of the netmod WG, I recommend that a YANG CBOR draft is submitted to the netmod wg and uses as much as possible the contents of yang-json draft. Alternatively, I can imagine that CBOR mapping is added to the yang-json draft if the author, Ladislav Lhotka, and the WGs agree with that.

As Juergen wrote in his reply, there are good reasons not to do that.

Lada

> 
> Greetings,
> 
> Peter
> ______________________________________________________________________________
> Comparison of draft veillette-core cool, denoted with CoOL
> With draft vanderstok-core-comi, denoted with CoMI
> And draft ietf-netmod-yang-json, denoted with yang-json
> Simple YANG type can be :
> Binary byte string:                   CoMI, major type 2;                         CoOL,  major type 0
> Bits:                                 CoMI, array of text;                        CoOL, major type 0
> Boolean:                              CoMI, major type 7 (20,21);                 CoOL, major type 7 (20,21)
> decimal64:                            CoMI, major type 0 (pos) and 1(neg);        CoOL major type 0
> empty:                                CoMI major type 7(22);                      CoOL major type 7(22)
> enumeration:                          CoMI, major type 0;                         CoOL major type 0
> identityref:                         CoMI, major type 3;                          CoOL major type 3
> int8, int16, int32, int64:           CoMI, major type 0 (pos) and 1(neg);         CoOL major type 0
> leafref:                             CoMI, follows leaf type;                     CoOL follows leaf type
> string:                              CoMI, major type 3,                          CoOL major type 3
> uint8, uint16, uint32, uint64:       CoMI, major type 0;                          CoOL major type 0
> 
> In netmod-yang-json draft  JSON objects are used:
> JSON object := { name: JSON object}, where name is a string. For CoMI and CoOL the name can be an integer which is valid for diagnostic JSON used for CBOR, giving:
> CBOR object := {integer: CBOR object}
> 
> Leaf:
> Yang-json,  Name : value, where name is the string identifier of the leaf, and value of Simple YANG type
> CoMI: major type 5 containing: uint64, value;      CoOL: not defined
> 
> Union:
> Yang-json,  use corresponding media type for type of value
> CoMI, use corresponding CBOR type; CoOL, use corresponding CBOR type
> 
> anyxml,
> YANG-json, value can be of any type.
> CoMI, not applicable; CoOL, can be any CBOR type
> 
> Anydate,
> Yang-json, follows container
> CoMI, not applicable,                           CoOL, not applicable
> 
> container,
> yang-json,	 name:  JSON object
> CoMI: major type 5;                             CoOL, major type 5
> 
> leaf-list
> yang-json, name: [ value 1, value 2,……]
> CoMI, major type 4,                             CoOL, major type 4
> 
> List
> Yang-json, name:[ JSON object1, JSON object2, ….]
> CoMI, major type 5 of major type 5,             CoOL, major type 4 of major type 5
> 
> 
> 
> -- 
> Peter van der Stok
> vanderstok consultancy
> mailto: consultancy@vanderstok.org
> 

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