Re: [core] YANG to CBOR mapping version 1

Michel Veillette <Michel.Veillette@trilliantinc.com> Fri, 15 July 2016 20:33 UTC

Return-Path: <Michel.Veillette@trilliantinc.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 90D9612DDCF for <core@ietfa.amsl.com>; Fri, 15 Jul 2016 13:33:19 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.921
X-Spam-Level:
X-Spam-Status: No, score=-1.921 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_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=trilliant.onmicrosoft.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 INbDG5JJpDkJ for <core@ietfa.amsl.com>; Fri, 15 Jul 2016 13:33:17 -0700 (PDT)
Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0090.outbound.protection.outlook.com [104.47.32.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1D7EE12DDCA for <core@ietf.org>; Fri, 15 Jul 2016 13:33:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Trilliant.onmicrosoft.com; s=selector1-trilliantinc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=PrjNZs6UNtggyE9EB9sSc9TTVxtLBTEYQGj7kuCpUmY=; b=ZuIzkvNoPB9omd/4xhxDdtMQlGXsXwyHnLWvUvJhYfzsUG70PWgZurs3ec6ODgK0wbodt/x3dCdDSTdpSAQkBkip1lkIshE7NOAjxuION87r0KOaKUIHPirRIXv0TfDtRv5aVa0dP4nt4przHN9cgI0o4g9jGidPV1owzzFa5rE=
Received: from BLUPR06MB1763.namprd06.prod.outlook.com (10.162.224.149) by BLUPR06MB1761.namprd06.prod.outlook.com (10.162.224.147) with Microsoft SMTP Server (TLS) id 15.1.539.14; Fri, 15 Jul 2016 20:33:15 +0000
Received: from BLUPR06MB1763.namprd06.prod.outlook.com ([10.162.224.149]) by BLUPR06MB1763.namprd06.prod.outlook.com ([10.162.224.149]) with mapi id 15.01.0539.019; Fri, 15 Jul 2016 20:33:15 +0000
From: Michel Veillette <Michel.Veillette@trilliantinc.com>
To: Andy Bierman <andy@yumaworks.com>
Thread-Topic: [core] YANG to CBOR mapping version 1
Thread-Index: AQHR1qK2U/a50X7m60OAxt73Sipz+qAOmnXwgAYAFQCAAAGjAIAAD30AgAAvp4CAABES0IAAFf2AgAT4ItCAAAN8AIAAAg0g
Date: Fri, 15 Jul 2016 20:33:15 +0000
Message-ID: <BLUPR06MB176397EE3F1287CF61D51DF5FE330@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> <CABCOCHQ4kyrWKSHkGG2yqA-ZzrJpf1Y_vUy_gvqE_YmKj8AVLA@mail.gmail.com>
In-Reply-To: <CABCOCHQ4kyrWKSHkGG2yqA-ZzrJpf1Y_vUy_gvqE_YmKj8AVLA@mail.gmail.com>
Accept-Language: fr-CA, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michel.Veillette@trilliantinc.com;
x-originating-ip: [207.96.192.122]
x-ms-office365-filtering-correlation-id: 5e535ee2-4e11-470e-d2c9-08d3acef3f99
x-microsoft-exchange-diagnostics: 1; BLUPR06MB1761; 6:HxTfrSvoHKwQBVrLB8hl4Vxwb5NPHO16AzpSd6A+umTRmhwWbpp3ITiVKId2jnW6KkTLY7+RxDenJVyiKFqu930i2WmyzHzRJb/rfs+CXiVjCg15btxDtph8dDAe2O4GtBnoAqm6mfJKJfhJp0sG4d6ozm//Ezj99j6Yhi+fNzzro/n5G09kQAj/rzkoalUnO5AxoB48ExhfdbrxMgwzbG/9yylYjfYQRrOGTF74lgE6JvdyLPNnVI+Et/pRkfBt61HmRlQJoLcUaf1MMmoIeXo3YWNvIc8ukxlcqYqcwhM=; 5:JUbWXfI+1vxzZgsJY1N5duD/wXqxPO2q+WAXYAzFFPsWJhWOS0l0a7A7+9+sfcwpytmzKEIUsN4CstYA88nzGIXeRG6mk73V6VuyGtNoDSPoRTrKsWMfog/ymCHEMQj9VrNDvgpDjzhNsE5XpBCY3A==; 24:SDU6EiFRXoRLiU/Dr4o+HyuEtM/GTlPht2wqYywiKAJamsKzI17hHoSVqLxNPJYaRwBDhWf0X48uzsVQO12z6bgxoRBdhILq5q3jN9kbWXg=; 7:Owcy38pdtK6rP2uiHL4gPENAqdzvrRs6f/aWYJGdZtC1G5R7xeiQTl9I9QtcHkDCZ70Y1qy3soWN9FUu84d7tdqnbbhMgQ8uCN+/zIFMVAT+S0tZeaAgEzaSr3Nq6tokXaxn/ZaUNVfuJssokrb6ZSGC6ZKEOkzBH480NUCPzbPpKc0QhENGLsupIEsOjaO8gfi4Fx2ZKRkOZZo4ptgl2KZlRODGnXdlMQJMHtAAFxZdoM0rFZwLSI8q2hMVLOV5
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR06MB1761;
x-microsoft-antispam-prvs: <BLUPR06MB1761D3C55701A52E487F2550FE330@BLUPR06MB1761.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(158342451672863)(100405760836317)(21748063052155);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BLUPR06MB1761; BCL:0; PCL:0; RULEID:; SRVR:BLUPR06MB1761;
x-forefront-prvs: 00046D390F
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916002)(24454002)(189002)(199003)(51444003)(377454003)(81166006)(6116002)(93886004)(2900100001)(2906002)(8936002)(92566002)(81156014)(2950100001)(99286002)(76576001)(50986999)(3280700002)(74316002)(3846002)(5002640100001)(3660700001)(19300405004)(790700001)(16236675004)(102836003)(4326007)(586003)(7906003)(87936001)(19580395003)(122556002)(66066001)(8676002)(7736002)(5003600100003)(68736007)(10400500002)(106116001)(101416001)(106356001)(19625215002)(11100500001)(9686002)(86362001)(7696003)(110136002)(77096005)(54356999)(33656002)(189998001)(105586002)(19617315012)(19580405001)(7846002)(97736004)(76176999)(19609705001)(15975445007); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR06MB1761; H:BLUPR06MB1763.namprd06.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en;
received-spf: None (protection.outlook.com: trilliantinc.com does not designate permitted sender hosts)
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_BLUPR06MB176397EE3F1287CF61D51DF5FE330BLUPR06MB1763namp_"
MIME-Version: 1.0
X-OriginatorOrg: trilliantinc.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Jul 2016 20:33:15.1516 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR06MB1761
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/P7OzToTR7zwwsfQE6QZrbLJynAc>
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:33:19 -0000

Hi Andy

The current solution consist of tagging decimal64 only when used in the context of a union.
Same for bits, enumeration, identityref and instance-identifier.
(https://tools.ietf.org/html/draft-ietf-core-yang-cbor-02#section-5.12)
With this solution, the 2 or 3 bytes overhead is present only in the context of a union.

If the group prefer to serialize decimal64 using decimal fractions
(https://tools.ietf.org/html/rfc7049#section-2.4.3)
The 3 bytes overhead will always be present.

I like the second approach but users of more constrained networks might prefer the current solution.

Regards,
Michel

From: Andy Bierman [mailto:andy@yumaworks.com]
Sent: Friday, July 15, 2016 4:16 PM
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
Cc: Alexander Pelov <a@ackl.io>; Core <core@ietf.org>
Subject: Re: [core] YANG to CBOR mapping version 1



On Fri, Jul 15, 2016 at 1:04 PM, Michel Veillette <Michel.Veillette@trilliantinc.com<mailto: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<mailto:a@ackl.io>]
Sent: Tuesday, July 12, 2016 12:10 PM
To: Michel Veillette <Michel.Veillette@trilliantinc.com<mailto:Michel.Veillette@trilliantinc.com>>
Cc: Carsten Bormann <cabo@tzi.org<mailto:cabo@tzi.org>>; Core <core@ietf.org<mailto: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<mailto: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] 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

_______________________________________________
core mailing list
core@ietf.org<mailto:core@ietf.org>
https://www.ietf.org/mailman/listinfo/core


_______________________________________________
core mailing list
core@ietf.org<mailto:core@ietf.org>
https://www.ietf.org/mailman/listinfo/core