Re: [core] YANG to CBOR mapping version 1

Alexander Pelov <a@ackl.io> Tue, 12 July 2016 10:04 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 7888A12D783 for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 03:04:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.62
X-Spam-Level:
X-Spam-Status: No, score=-2.62 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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 xSHS6cjhPKxH for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 03:04:09 -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 92AF912D773 for <core@ietf.org>; Tue, 12 Jul 2016 03:04:09 -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 A0984A80D9; Tue, 12 Jul 2016 12:04:06 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
From: Alexander Pelov <a@ackl.io>
In-Reply-To: <aba83b0a6b9794f74ddfcb9706eba6d1@xs4all.nl>
Date: Tue, 12 Jul 2016 12:04:06 +0200
Content-Transfer-Encoding: quoted-printable
Message-Id: <BB0DCC21-3198-4BA2-81ED-5A73724E1367@ackl.io>
References: <1ed9a5d16aca7d13412259e94afc1aa2@xs4all.nl> <BLUPR06MB17639739570760661AEC32C3FE3C0@BLUPR06MB1763.namprd06.prod.outlook.com> <aba83b0a6b9794f74ddfcb9706eba6d1@xs4all.nl>
To: consultancy@vanderstok.org
X-Mailer: Apple Mail (2.3124)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/Qk7GrrWrKWxUC-ekx2SN-nHMJOE>
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 10:04:12 -0000

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