Re: [core] YANG to CBOR mapping version 1

Alexander Pelov <a@ackl.io> Tue, 12 July 2016 16:10 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 0B17112D16D for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 09:10:02 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 Mh4YR9nJADKo for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 09:10:00 -0700 (PDT)
Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [IPv6:2001:4b98:c:538::195]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 01C7A12B076 for <core@ietf.org>; Tue, 12 Jul 2016 09:10:00 -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 A7010A8100; Tue, 12 Jul 2016 18:09:55 +0200 (CEST)
Content-Type: multipart/alternative; boundary="Apple-Mail=_BEA24FC4-BF9B-44BD-8EE4-6D69642C2465"
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
From: Alexander Pelov <a@ackl.io>
In-Reply-To: <BLUPR06MB1763BF04E17F6CC4232F2EF5FE300@BLUPR06MB1763.namprd06.prod.outlook.com>
Date: Tue, 12 Jul 2016 18:09:53 +0200
Message-Id: <B03E3803-76C5-4C0E-BF18-5324BAC64C03@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> <68BC10EA-5978-4DF0-A380-7585597C7AE5@ackl.io> <BLUPR06MB1763BF04E17F6CC4232F2EF5FE300@BLUPR06MB1763.namprd06.prod.outlook.com>
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
X-Mailer: Apple Mail (2.3124)
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/_T5OrdCeifONSMyvKGBSDO5YTpo>
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 16:10:02 -0000

Hi Michel,

If there is a way to unambiguously differentiate between union and non-union, then we should use the most efficient representation. However, I get the impression that you can modify locally a module, which could change the type of a leaf from decimal to union.. which could then lead to confusion. 

One of the main issues we’re having is the possible mismatch between the module versions on a server and a client. How about this - 
1) we define a (lightweight) mechanism for ensuring the matching of the module versions
2) if matching, then use most efficient representation (e.g. encode 2.57 as 257)
3) if not matching, then use tags for all representations

How does this sound? 

Alexander
 

> Le 12 juil. 2016 à 16:57, Michel Veillette <Michel.Veillette@trilliantinc.com> a écrit :
> 
> Hi Alexander
>  
> I want to be sure of your answer.
> The CBOR tag 4 (Decimal fraction) require 3 bytes of overhead, see example for RFC 8049 section 2.4.3 bellow.
> This is the tag you are proposing?
> This tag will be used all the time (within the context of a union and without)?
>  
> C4             # Tag 4
>   82           # Array of length 2
>     21         # -2
>     19 0101    # unsigned(257)
>  
> Regards,
> Michel
>  
> From: core [mailto:core-bounces@ietf.org <mailto:core-bounces@ietf.org>] On Behalf Of Alexander Pelov
> Sent: Tuesday, July 12, 2016 9:50 AM
> To: Carsten Bormann <cabo@tzi.org <mailto:cabo@tzi.org>>
> Cc: Core <core@ietf.org <mailto:core@ietf.org>>
> Subject: Re: [core] YANG to CBOR mapping version 1
>  
> 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 <mailto: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 <mailto: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 <mailto:core@ietf.org> 
> https://www.ietf.org/mailman/listinfo/core <https://www.ietf.org/mailman/listinfo/core>
> 
> _______________________________________________ 
> core mailing list 
> core@ietf.org <mailto:core@ietf.org> 
> https://www.ietf.org/mailman/listinfo/core <https://www.ietf.org/mailman/listinfo/core>