Re: [core] YANG to CBOR mapping version 1

Andy Bierman <andy@yumaworks.com> Fri, 15 July 2016 20:15 UTC

Return-Path: <andy@yumaworks.com>
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 A790812D0F6 for <core@ietfa.amsl.com>; Fri, 15 Jul 2016 13:15:36 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.6
X-Spam-Level:
X-Spam-Status: No, score=-2.6 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.com
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 fgas1IzpVc8s for <core@ietfa.amsl.com>; Fri, 15 Jul 2016 13:15:34 -0700 (PDT)
Received: from mail-vk0-x234.google.com (mail-vk0-x234.google.com [IPv6:2607:f8b0:400c:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C825D12D528 for <core@ietf.org>; Fri, 15 Jul 2016 13:15:33 -0700 (PDT)
Received: by mail-vk0-x234.google.com with SMTP id w127so111577315vkh.2 for <core@ietf.org>; Fri, 15 Jul 2016 13:15:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qPtztnST7KsFyMMKyDDLAcTPOZyhkj0h2Qw60PVHf0I=; b=vulamBF8gNaupkzjjY7QdDDKHl9b7+uugciyjb/X/WmJBSSBTXKWfEtWyvFOk15c79 A3ZXVY5eHzcU2S0+eanaDtv3Q+3pAcSB756KtvxykSg1gBYfDeaQxlFvMqW239n+fvjn q67M2L0LuqlD+f8GHPM5aISt6Fry5N5JdwjZr9rw83NHrfAs7KXIG9cnoj3RtHGYEkNP VM4E30DjgIXdOltHVkuI+FNqk8Iv8X8fdFf1cU0puDajW13jaiLcfNveUbj4enqLU0vS ZoSn5Ph9/cVEh/GFD/Bnpc/04CLdqwYeS5OR233hDj6mXeLKe+x85CHLxgaAr2opXQVO 9Zuw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qPtztnST7KsFyMMKyDDLAcTPOZyhkj0h2Qw60PVHf0I=; b=CJjOnUZHpfQdCMdFnUd7Kf2RxD09Yw2BBS+dJf2psuJYFG9l9VxRdM/AHUzV9hick/ FlxVZWHRjjmuGmdocXzs7jXkCDWDpa08HKiP2WeDGjU0cKIXMuznPuUCKpZiqI8guZC3 PDpe4IvZJCVeVwKhyMgqzTa5RUQrnaW1IO3w7zoMMVcJlG7NvrYf3UAeBdnsuEAi11OS Z6QlYx/adpCQjQ3nr6DfgUayWnXXspdrGHs/UgR9NakO0CPydWDg8X5EwJhI4TpbbO3e budAJjO0nrX+joBb6uWKGPyvngYxzaTvhIz1kopLtmu6UijsgymRoDJAFx0947Slzjkb g2GQ==
X-Gm-Message-State: ALyK8tKNruxgTSP7F9r5rsdNah0xriT/4bgQ1ZFpGQ/0u7R2N/1PZrHmWNqvvC1YXmN9qM7648j8GJc+Pl0HyQ==
X-Received: by 10.31.4.4 with SMTP id 4mr11830427vke.121.1468613732808; Fri, 15 Jul 2016 13:15:32 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.103.20.2 with HTTP; Fri, 15 Jul 2016 13:15:30 -0700 (PDT)
In-Reply-To: <BLUPR06MB1763100454D0C9CC0AB37353FE330@BLUPR06MB1763.namprd06.prod.outlook.com>
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> <B03E3803-76C5-4C0E-BF18-5324BAC64C03@ackl.io> <BLUPR06MB1763100454D0C9CC0AB37353FE330@BLUPR06MB1763.namprd06.prod.outlook.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Fri, 15 Jul 2016 13:15:30 -0700
Message-ID: <CABCOCHQ4kyrWKSHkGG2yqA-ZzrJpf1Y_vUy_gvqE_YmKj8AVLA@mail.gmail.com>
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
Content-Type: multipart/alternative; boundary="001a114298c8db519e0537b2473e"
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/dJdMJozUqVk7oVaq27DDYCs3Pww>
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: Fri, 15 Jul 2016 20:15:36 -0000

On Fri, Jul 15, 2016 at 1:04 PM, Michel Veillette <
Michel.Veillette@trilliantinc.com> wrote:

> Hi Alexander
>
>
>
> To simplify the implementation, I'll prefer to keep the same
> representation for decimal64 within or without a union (2.57 or 257)
>
> We simply need to select one.
>
> I'm find with either ones but LPWAN implementers might prefer the CBOR
> unsigned integer representation.
>
>
>


So how is this union supported with the 2nd option?
2.57 seems the obvious choice if robustness is a concern.


   leaf foo {
      type union {
         type decimal64 {
             fraction-digits 2;
          }
          type decimal64 {
             fraction-digits 4;
          }
      }
   }


Regards,
>
> Michel
>

Andy


>
>
> *From:* Alexander Pelov [mailto:a@ackl.io]
> *Sent:* Tuesday, July 12, 2016 12:10 PM
> *To:* Michel Veillette <Michel.Veillette@trilliantinc.com>
> *Cc:* Carsten Bormann <cabo@tzi.org>; Core <core@ietf.org>
> *Subject:* Re: [core] YANG to CBOR mapping version 1
>
>
>
> 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 <core-bounces@ietf.org>] *On
> Behalf Of *Alexander Pelov
> *Sent:* Tuesday, July 12, 2016 9:50 AM
> *To:* Carsten Bormann <cabo@tzi.org>
> *Cc:* Core <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> 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
>
>
>
> _______________________________________________
> core mailing list
> core@ietf.org
> https://www.ietf.org/mailman/listinfo/core
>
>