Re: [core] YANG to CBOR mapping version 1

Michel Veillette <Michel.Veillette@trilliantinc.com> Tue, 12 July 2016 14:22 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 18C5E12D903 for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 07:22:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.902
X-Spam-Level:
X-Spam-Status: No, score=-1.902 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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 R-ajGMruVtWX for <core@ietfa.amsl.com>; Tue, 12 Jul 2016 07:22:36 -0700 (PDT)
Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0099.outbound.protection.outlook.com [104.47.41.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5741E12DE17 for <core@ietf.org>; Tue, 12 Jul 2016 06:33:23 -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=8PmsEt7B0Utld9yhZObc+Ps83+4RINfqfgti6GIqWWg=; b=AmCfg3Y1/gdIgXSVwaAlopVYC/4jgtnD21JYJg2H0GoRhLGIaut1hXXMlj+wu+wjYaYeWN0F+r5nxL4ZWvgz+L57icTGbTqkf4RUELjW5pZvGkLBQdNIVazmzXIIeagad1VZGSDi6cnZUjEiIJqqe0hkuBqodPAfU8RIrixcDpU=
Received: from BLUPR06MB1763.namprd06.prod.outlook.com (10.162.224.149) by BLUPR06MB1763.namprd06.prod.outlook.com (10.162.224.149) with Microsoft SMTP Server (TLS) id 15.1.539.14; Tue, 12 Jul 2016 13:33:21 +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; Tue, 12 Jul 2016 13:33:21 +0000
From: Michel Veillette <Michel.Veillette@trilliantinc.com>
To: "consultancy@vanderstok.org" <consultancy@vanderstok.org>
Thread-Topic: [core] YANG to CBOR mapping version 1
Thread-Index: AQHR1qK2U/a50X7m60OAxt73Sipz+qAOmnXwgAYAFQCAAC0uoA==
Date: Tue, 12 Jul 2016 13:33:20 +0000
Message-ID: <BLUPR06MB17636F6ED21D7B76C902848CFE300@BLUPR06MB1763.namprd06.prod.outlook.com>
References: <1ed9a5d16aca7d13412259e94afc1aa2@xs4all.nl> <BLUPR06MB17639739570760661AEC32C3FE3C0@BLUPR06MB1763.namprd06.prod.outlook.com> <aba83b0a6b9794f74ddfcb9706eba6d1@xs4all.nl>
In-Reply-To: <aba83b0a6b9794f74ddfcb9706eba6d1@xs4all.nl>
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: f9795d29-4e2e-4fbe-60c3-08d3aa5917b1
x-microsoft-exchange-diagnostics: 1; BLUPR06MB1763; 6:ROlGuFBqXMHvKFmS2K7Cv+KzFmU2DNb+RQsEnRrcBtR/BdIfi+NxYNbcnNQiLd+FumiGiVe8g4G5cZod3YD9ytjLzPFIJGJmm8iisCz72fLuSTBSejgIB3r971gWAGSPyUEmk8R6eZhQ9D1teH56d1LssfRrAaWQ5pHNykUH9WE7S1GubVwZxcW4QeThHWJJOZxUU4yKMpJrWWqmwv6TyP/SbynXq+FBq+7xrXFwz4ja/KBERHm9PLoige/HaGUS0k8bD4qQpEC8MZAep5xlH3ktYn9AzL/rMXN/QcJe9VI=; 5:skp7BPgV1urz4NUk8HxGVOLDZ0gAMfVzv6BFRXwUvi1dWUPbBzKCEjk6U2MG/kuw8N6S56br8RL+aw7A/2cJ/bwlkCrhhP6suzL27LHGZfgZW9RBueINg7dOEPaQX6XmPZ6xkiN1oGKWfQog8ILLGQ==; 24:P7PXAkwIYG2Ko00FNb0Y88yafeN6ckREEk2+S4DugKbu+nRSmqPiNmK1jNNbAQxTp8opjfvta9M2sR8QlviSJi4HczFYpi/fRE7ClG7AuaM=; 7:XMAG1keKd/OpY0/Pz5Blx7VM5nUZCl6bJVx3DChJifmifHwtjOAo4THEzGsxdoCHhEBuFWL3X1WPBzIROgnv/b6t5j0HzJH1ceEJrOG4ZDjgCnEX6TDEHn9dcUYpr1BjciiSIVlJjbFsGGUMXHqdksFGGo1SPBaFIgyo8lZ2wTVQmC5ejpgAEdGIFS9okpD3EhQbAUhrOtTi7a8kkjXer4J8iW63ShW5L4kxYhcayekYGekUm4tF+/Srl+QsRvA3
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR06MB1763;
x-microsoft-antispam-prvs: <BLUPR06MB176331FA63AE27C3D15CF182FE300@BLUPR06MB1763.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(100405760836317);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:BLUPR06MB1763; BCL:0; PCL:0; RULEID:; SRVR:BLUPR06MB1763;
x-forefront-prvs: 0001227049
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(377454003)(189002)(199003)(13464003)(8936002)(81156014)(81166006)(6116002)(3846002)(102836003)(10400500002)(110136002)(87936001)(86362001)(189998001)(50986999)(15975445007)(77096005)(76176999)(5002640100001)(3660700001)(54356999)(586003)(2900100001)(122556002)(97736004)(2950100001)(66066001)(2351001)(68736007)(92566002)(106356001)(106116001)(2906002)(33656002)(101416001)(11100500001)(4326007)(9686002)(7736002)(7696003)(5003600100003)(2501003)(8676002)(1730700003)(19580405001)(5640700001)(105586002)(99286002)(7846002)(74316002)(3280700002)(19580395003)(305945005)(76576001); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR06MB1763; 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: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: trilliantinc.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jul 2016 13:33:20.9628 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR06MB1763
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/3f_rXmmCpjCGHoRND43yCDcr_u4>
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:22:41 -0000

Hi Peter

Multiple aspects of YANG assume that the entities which serialize and de-serialize are schema aware.
This knowledge is used for example to apply default values where needed (see rfc6020bis section 7.6.1)
This knowledge is also used to perform all kings of validations
(range, pattern, length, min-elements, max-elements, must, when, if-feature)

The proposed mapping, as stated by https://tools.ietf.org/html/draft-ietf-core-yang-cbor-02#section-3
use this awareness to minimize the information transferred.

In the example

    leaf temperature {
      type decimal64 {
        fraction-digits 2;
        range "1 .. 3.14 | 10 | 20..max";
        units "°C";
      }
    }

This information is used to serialize 2.57 °C into a CBOR unsigned integer 257 (3bytes).
The same information is used to de-serialize to the CBOR unsigned integer 257 back to 2.57 °C

This encoding is less friendly to schema unaware debugging tools (e.g. wireshark).
If the group believe we need to be more friendly to such tools, we can adopt the CBOR tag 4 (Decimal fraction) as defined in RFC7049 section 2.4.3.
However, this encoding will require 6 bytes in the case of "2.57" which is more than the textual form.
This significant overhead is the main reason why peoples have agreed to adopt the current encoding.

Can you propose some texts to clarify this topic?

Regards,
Michel

-----Original Message-----
From: peter van der Stok [mailto:stokcons@xs4all.nl] 
Sent: Tuesday, July 12, 2016 5:58 AM
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
Cc: consultancy@vanderstok.org; Core <core@ietf.org>
Subject: RE: [core] YANG to CBOR mapping version 1

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>