Re: [core] YANG to CBOR mapping version 1

Alexander Pelov <a@ackl.io> Tue, 12 July 2016 14:39 UTC

Return-Path: <a@ackl.io>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3270612D7B9 for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 07:39:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.619
X-Spam-Level:
X-Spam-Status: No, score=-2.619 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=ham autolearn_force=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 6tS6p90hEp04 for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 07:39:46 -0700 (PDT)
Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B749612DEC0 for <core@ietf.org>; Tue, 12 Jul 2016 06:50:13 -0700 (PDT)
Received: from [IPv6:2001:660:7301:3728:c991:5594:6177:ccd1] (unknown [IPv6:2001:660:7301:3728:c991:5594:6177:ccd1]) (Authenticated sender: alex@ackl.io) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id D6A1CA8133; Tue, 12 Jul 2016 15:50:11 +0200 (CEST)
Content-Type: multipart/alternative; boundary="Apple-Mail=_334A9642-3045-47F0-9E57-FA0B1599DD7A"
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
From: Alexander Pelov <a@ackl.io>
In-Reply-To: <30945651-d704-4b8a-9c4f-6a56a23daefb@roku>
Date: Tue, 12 Jul 2016 15:50:05 +0200
Message-Id: <68BC10EA-5978-4DF0-A380-7585597C7AE5@ackl.io>
References: <1ed9a5d16aca7d13412259e94afc1aa2@xs4all.nl> <BLUPR06MB17639739570760661AEC32C3FE3C0@BLUPR06MB1763.namprd06.prod.outlook.com> <aba83b0a6b9794f74ddfcb9706eba6d1@xs4all.nl> <BB0DCC21-3198-4BA2-81ED-5A73724E1367@ackl.io> <30945651-d704-4b8a-9c4f-6a56a23daefb@roku>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: Apple Mail (2.3124)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/y-YRVmMDZSgwK4RWCtJXvlL04D4>
Cc: Core <core@ietf.org>
Subject: Re: [core] YANG to CBOR mapping version 1
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.17
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: Tue, 12 Jul 2016 14:39:49 -0000

Hi Carsten,

Yes, you are right. I thought that we could keep this representation outside of unions. But of course, we need to balance the complexity of doing this. 

There could be a confusion if the server and the client have different versions of the same module (rare, but must be taken care of). Which is of course, the thing we’ve always tried to avoid.. So yeah, for the moment we could keep the CBOR decimal tag. 

Best,
Alexander

> Le 12 juil. 2016 à 12:59, Carsten Bormann <cabo@tzi.org> a écrit :
> 
> Hi Alexander,
> 
> This is right. However, I thought that in the discussion of unions we had arrived at encoding decimals as CBOR decimal fraction tags. But maybe I'm misremembering. 
> 
> Grüße, Carsten 
> 
> On 12 Jul 2016 12:04, Alexander Pelov wrote: 
> 
>> Dear Peter,
>> 
>> In this case you can infer the decimal point position from the YANG definition, e.g. the statement "fraction-digits 2;"
>> 
>> Which indicates that 257 represents the number 2.57. 2 represents 0.02, 50 represents 0.50, 1000 represents 10.00
>> 
>> I think that you are right that we should provide more examples to be clear on this point.
>> 
>> Best,
>> Alexander
>> 
>> 
>> 
>>> Le 12 juil. 2016 à 11:58, peter van der Stok <stokcons@xs4all.nl> a écrit :
>>> 
>>> Hi Michel,
>>> 
>>> I separated my answer into three parts to simplify the discussion.
>>> 
>>>> Section 5.3;
>>>> In the example, where do I find in the CBOR encoding that the fraction
>>>> is 2 digits?
>>>> [MV] The number of digits is not encoded. This information is
>>>> considered an unnecessary metadata
>>>> [MV] similar to "units", text of an enumeration, name of a flag within
>>>> bits. This was the consensus
>>>> [MV] of the group which is aligned with the statement in section 3 (In
>>>> order to minimize the size of
>>>> [MV] the encoded data, the proposed mapping avoid any unnecessary
>>>> meta-information beyond
>>>> [MV] those natively supported by CBOR.)
>>>> [MV] It might be worth it to raise this topic within a larger audience.
>>> 
>>> The following example shows the encoding of leaf 'my-decimal' set to
>>> 2.57.
>>> 
>>> Definition example from [RFC7317]:
>>> 
>>> leaf my-decimal {
>>> type decimal64 {
>>> fraction-digits 2;
>>> range "1 .. 3.14 | 10 | 20..max";
>>> }
>>> }
>>> 
>>> CBOR diagnostic notation: 257
>>> 
>>> <pvds>
>>> Should it not be pointed out more strongly that the yang to cbor conversion fails in this case?
>>> I don't see how a change from 2.57 or 257 represents loosing unnecessary meta information.
>>> Unless I completely miss the point of the example.
>>> </pvds>
>>> 
>>> _______________________________________________
>>> core mailing list
>>> core@ietf.org
>>> https://www.ietf.org/mailman/listinfo/core
>> 
>> _______________________________________________
>> core mailing list
>> core@ietf.org
>> https://www.ietf.org/mailman/listinfo/core
>> 
>>