Re: [core] YANG to CBOR mapping

Michel Veillette <Michel.Veillette@trilliantinc.com> Thu, 19 November 2015 15:36 UTC

Return-Path: <Michel.Veillette@trilliantinc.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 120B11B2BA2 for <core@ietfa.amsl.com>; Thu, 19 Nov 2015 07:36:20 -0800 (PST)
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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=unavailable
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 G-rvyDxNdFW8 for <core@ietfa.amsl.com>; Thu, 19 Nov 2015 07:36:08 -0800 (PST)
Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0129.outbound.protection.outlook.com [207.46.100.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4321B1B2B9A for <core@ietf.org>; Thu, 19 Nov 2015 07:35:42 -0800 (PST)
Received: from BLUPR06MB1763.namprd06.prod.outlook.com (10.162.224.149) by BLUPR06MB1762.namprd06.prod.outlook.com (10.162.224.148) with Microsoft SMTP Server (TLS) id 15.1.325.17; Thu, 19 Nov 2015 15:35:40 +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.0325.019; Thu, 19 Nov 2015 15:35:41 +0000
From: Michel Veillette <Michel.Veillette@trilliantinc.com>
To: Carsten Bormann <cabo@tzi.org>
Thread-Topic: [core] YANG to CBOR mapping
Thread-Index: AQHRIrFRDohJFilcHkWMJpxQ90rIt56jTpSAgAAgjICAAAlmEA==
Date: Thu, 19 Nov 2015 15:35:40 +0000
Message-ID: <BLUPR06MB176314C8C0AE3EEBF4099E3AFE1B0@BLUPR06MB1763.namprd06.prod.outlook.com>
References: <02d2efc9e66b090dd7b7932ae4e749cd@xs4all.nl> <BLUPR06MB1763C6BBEEE42279A79A8F30FE1B0@BLUPR06MB1763.namprd06.prod.outlook.com> <564DE2C1.50205@tzi.org>
In-Reply-To: <564DE2C1.50205@tzi.org>
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: [24.225.215.88]
x-microsoft-exchange-diagnostics: 1; BLUPR06MB1762; 5:QvIlUqvm4yiHicEP0KfMzCh5VZmVdD7+dr4WD4zn5fNPedMG4iAHiHPGlooRGEv44FtQN3gsPpHZYu/m+SaokNYFfFuUcHCIcmjK82LErVP6lKquGCdfs/Mi4YK9f7AcPJzBId2Ev1Pl5ORb1nl54g==; 24:wEVafnZJPUB9ZSWj7nQm7+HZQdQs/1ai2hDRlCTEJ69K03PuZqu1QQtGfR53+gmKBC5C8PQHOXQkbPHqlHW5Z1hw9OWpPlOLKp/FvJaV1x8=; 20:OtSf3j92RF0D7TWXpx+2LcRFrs3kub8wNBMXsx2fvhoJtfmKnZkrwgprBIF2bg3UKWxgyTCtthRe0tRf7UFePA==
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR06MB1762;
x-microsoft-antispam-prvs: <BLUPR06MB1762FD0F562B510BC04DB254FE1B0@BLUPR06MB1762.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(256376046250027);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001); SRVR:BLUPR06MB1762; BCL:0; PCL:0; RULEID:; SRVR:BLUPR06MB1762;
x-forefront-prvs: 07658B8EA3
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(377454003)(51444003)(13464003)(106356001)(97736004)(189998001)(105586002)(106116001)(99286002)(40100003)(19580395003)(5007970100001)(66066001)(86362001)(110136002)(81156007)(5004730100002)(5001960100002)(19580405001)(5002640100001)(586003)(122556002)(5003600100002)(10400500002)(5008740100001)(74316001)(87936001)(2900100001)(77096005)(102836003)(2950100001)(50986999)(76576001)(54356999)(76176999)(6116002)(33656002)(101416001)(3846002)(92566002); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR06MB1762; 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:23
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-OriginatorOrg: trilliantinc.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2015 15:35:40.7031 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR06MB1762
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/m80aXMC6hBwzKDlj6YG_0AKKCS4>
Cc: Core <core@ietf.org>, "lhotka@nic.cz" <lhotka@nic.cz>
Subject: Re: [core] YANG to CBOR mapping
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.15
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: Thu, 19 Nov 2015 15:36:20 -0000

Hi Carson

I already sent an email about the reasons why we need to define a direct mapping (YANG -> CBOR) instead of a two step mapping (YANG -> JSON -> CBOR). I hope the reasons provided are satisfactory to you.

It's important to note and realize that the actual CoMI draft already don't comply with draft-ietf-netmod-yang-json (e.g. list mapping)
The implement of bits using a CBOR byte string won’t also be aligned with draft-ietf-netmod-yang-json
Defining a two step mapping (YANG -> JSON -> CBOR) make things more complex and might not produce the most efficient encoding.

This doesn't means we design this from starch.
The draft-ietf-netmod-yang-json draft is used as a template to defined the (YANG -> CBOR) mapping.

Thanks for your comment about decimal64 and the typo.

Regrads

Michel

-----Original Message-----
From: Carsten Bormann [mailto:cabo@tzi.org] 
Sent: November-19-15 9:55 AM
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
Cc: consultancy@vanderstok.org; Core <core@ietf.org>; lhotka@nic.cz
Subject: Re: [core] YANG to CBOR mapping

Hi Michel,

I'm not Peter, but:

{ "hat": "chair", "message": "
We get to do COMI in CoRE (we hope -- the charter is still in process) because we have promised to work closely with the relevant network management groups.  This means we'll need good reasons to deviate from what NETMOD etc. already have agreed to do.
"}

So I think that Peter's reminder to stay close to draft-ietf-netmod-yang-json -- unless we do need to deviate -- is quite germane.

(If I were designing this from scratch, I would ask myself whether we shouldn't stay closer to the schemaless roots of JSON, e.g. by exposing the exponent in the representation data and not just in the YANG schema.
 But that is a discussion that maybe should be had in NETMOD, if at all.)

I think the specific observation about decimal64 is that it is based on signed integers as the mantissae, so we need to allow negative numbers in CBOR as well as unsigned ones.

To contrast this to a place where we may want to deviate, doing "bits"
as an (unsigned) integer sounds right (at least until we need more than
64 of them in one "bits" item).  This runs into the same numbering issues we have with the intra-module names, though.

Grüße, Carsten

PS.: Typo:
   Leafs of type binary MUST be encoded using a CBOR byte string data
   item (major type 0).
(CBOR byte strings are major type 2.)