Re: [core] YANG to CBOR mapping

Carsten Bormann <cabo@tzi.org> Fri, 20 November 2015 13:13 UTC

Return-Path: <cabo@tzi.org>
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 716AC1A89F5 for <core@ietfa.amsl.com>; Fri, 20 Nov 2015 05:13:42 -0800 (PST)
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, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
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 CCQPjP_xnIkR for <core@ietfa.amsl.com>; Fri, 20 Nov 2015 05:13:40 -0800 (PST)
Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0F3D01A892F for <core@ietf.org>; Fri, 20 Nov 2015 05:13:40 -0800 (PST)
Received: from mfilter35-d.gandi.net (mfilter35-d.gandi.net [217.70.178.166]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 635ACA80F1; Fri, 20 Nov 2015 14:13:38 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at mfilter35-d.gandi.net
Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter35-d.gandi.net (mfilter35-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id MdExUAjlyDnb; Fri, 20 Nov 2015 14:13:36 +0100 (CET)
X-Originating-IP: 91.61.0.39
Received: from nar.fritz.box (p5B3D0027.dip0.t-ipconnect.de [91.61.0.39]) (Authenticated sender: cabo@cabo.im) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 0B36AA80D9; Fri, 20 Nov 2015 14:13:35 +0100 (CET)
Message-ID: <564F1C7E.5090904@tzi.org>
Date: Fri, 20 Nov 2015 14:13:34 +0100
From: Carsten Bormann <cabo@tzi.org>
User-Agent: Postbox 4.0.8 (Macintosh/20151105)
MIME-Version: 1.0
To: Ladislav Lhotka <lhotka@nic.cz>
References: <02d2efc9e66b090dd7b7932ae4e749cd@xs4all.nl> <BLUPR06MB1763C6BBEEE42279A79A8F30FE1B0@BLUPR06MB1763.namprd06.prod.outlook.com> <564DE2C1.50205@tzi.org> <20151119152734.GA3518@elstar.local> <4595D109-2EBC-4176-A65E-D4B075DD6CF0@nic.cz>
In-Reply-To: <4595D109-2EBC-4176-A65E-D4B075DD6CF0@nic.cz>
X-Enigmail-Version: 1.2.3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/twOPXZnvF2iyjlNmgGh48h_xxWc>
Cc: Core <core@ietf.org>
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: Fri, 20 Nov 2015 13:13:42 -0000

Ladislav Lhotka wrote:
>> On 19 Nov 2015, at 16:27, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
>>
>> On Thu, Nov 19, 2015 at 03:54:57PM +0100, Carsten Bormann wrote:
>>> 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.
>>>
>> I do not understand what "stay close to draft-ietf-netmod-yang-json"
>> means. I think this requires an explanation.

"-- unless we do need to deviate --"

>> To give you an example: draft-ietf-netmod-yang-json is following
>> I-JSON rules and one of them says that I-JSON numbers are limited in
>> precision. As a consequence, 64-bit numbers are I-JSON encoded as
>> strings for I-JSON compliance. I think CBOR does not require this
>> since it does not have this particular restriction. So do we now
>> continue to do this even though CBOR does not suffer from I-JSON
>> limitations?

No.  Here we clearly need to deviate to reduce unnecessary complexity.

>> I think my preference would be a clean mapping YANG to CBOR and not a
>> mapping YANG to I-JSON to CBOR that carries I-JSON restrictions over
>> to CBOR. The simple reason is that the longer the transformation
>> chain, the more arcane rules you accumulate.

I completely agree.  What I was trying to say was that the two mappings
should stay close, at least where the mappings can reasonably use the
common data model of JSON and CBOR.

The one place where we probably will have additional divergence is the
area of identifiers/selectors, where for COMI the CBOR mapping will need
to provide more flexibility.  Can we decouple this aspect from the other
elements of the YANG-CBOR mapping?  I hope so, but we haven't
demonstrated that yet.

> I agree, it isn't probably necessary to couple the CBOR mapping with JSON as defined in the yang-json draft. Some of the I-JSON restrictions are an ugly compromise, really, and you'd better avoid them. I believe a mapping between CBOR, JSON and XML encodings will be possible anyway.
> 
> Lada
> 
>> But then the CBOR spec has already JSON to CBOR translation rules so
>> YANG to I-JSON to CBOR is already defined somehow. 

... and the result of this two-step process might be useful as a
"default" mapping, which we use unless there is a reason to deviate.

>> Someone needs to
>> compile a list of cases where YANG to CBOR would be different from
>> YANG to JSON to CBOR before we can take an informed decision.

Indeed, and this is work that needs to be done very soon.

Do we need to build a formal design team for this work around the
extraction of the YANG-to-CBOR mapping from the COMI (and COOL) documents?

Grüße, Carsten