Re: [core] Comments on draft-ietf-core-yang-cbor-00

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Tue, 24 May 2016 12:40 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
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 B9F7212D69E for <core@ietfa.amsl.com>; Tue, 24 May 2016 05:40:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.626
X-Spam-Level:
X-Spam-Status: No, score=-5.626 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-1.426] autolearn=ham autolearn_force=no
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 RTyKgdVEWCEz for <core@ietfa.amsl.com>; Tue, 24 May 2016 05:40:43 -0700 (PDT)
Received: from atlas3.jacobs-university.de (atlas3.jacobs-university.de [212.201.44.18]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 0AA4D12D593 for <core@ietf.org>; Tue, 24 May 2016 05:40:43 -0700 (PDT)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas3.jacobs-university.de (Postfix) with ESMTP id C0BF6A85; Tue, 24 May 2016 14:40:41 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas3.jacobs-university.de ([10.70.0.220]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10030) with ESMTP id 7E74qjiNrWL9; Tue, 24 May 2016 14:40:33 +0200 (CEST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hermes.jacobs-university.de", Issuer "Jacobs University CA - G01" (verified OK)) by atlas3.jacobs-university.de (Postfix) with ESMTPS; Tue, 24 May 2016 14:40:41 +0200 (CEST)
Received: from localhost (demetrius3.jacobs-university.de [212.201.44.48]) by hermes.jacobs-university.de (Postfix) with ESMTP id EBB9B2005C; Tue, 24 May 2016 14:40:40 +0200 (CEST)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius3.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id YZ2N6Thf6udT; Tue, 24 May 2016 14:40:39 +0200 (CEST)
Received: from elstar.local (elstar.jacobs.jacobs-university.de [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id 88A0020051; Tue, 24 May 2016 14:40:39 +0200 (CEST)
Received: by elstar.local (Postfix, from userid 501) id 7CB813AF079E; Tue, 24 May 2016 14:40:39 +0200 (CEST)
Date: Tue, 24 May 2016 14:40:39 +0200
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Andy Bierman <andy@yumaworks.com>
Message-ID: <20160524124039.GC9897@elstar.local>
Mail-Followup-To: Andy Bierman <andy@yumaworks.com>, Carsten Bormann <cabo@tzi.org>, Core <core@ietf.org>
References: <CABCOCHRRACvVXx2S_hZm2TxbvP48aO4Q4REkh0LFjmHkMkZ1Vg@mail.gmail.com> <m2y473svm0.fsf@nic.cz> <57401CC2.2040002@tzi.org> <CABCOCHTSNZqB_rCZP0_R5-1iatTuvfH0Kfa4UK6kO+o+M810_w@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CABCOCHTSNZqB_rCZP0_R5-1iatTuvfH0Kfa4UK6kO+o+M810_w@mail.gmail.com>
User-Agent: Mutt/1.6.0 (2016-04-01)
Archived-At: <http://mailarchive.ietf.org/arch/msg/core/8qfS8bVKOpUtcZWXptaciRycuBw>
Cc: Core <core@ietf.org>
Subject: Re: [core] Comments on draft-ietf-core-yang-cbor-00
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
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, 24 May 2016 12:40:45 -0000

On Sat, May 21, 2016 at 08:29:33AM -0700, Andy Bierman wrote:
> 
> This is a legal union type even though in XML type 'int32' would never be
> used
> because 'string' would match everything.
> 
>  leaf foo {
>    type union {
>       type string;
>       type int32;
>    }
>  }
> 
> This is a problem for config nodes:
>    JSON/CBOR client sets { "foo" : 42 }
>    XML client reads back <foo>42</foo>
> 
> JSON (and CBOR) will send { "foo":42 }, not { "foo":"42" } if they intend to
> send the number, but XML cannot do the same.  There is no problem
> unless XML is being used in addition to JSON or CBOR.
> 
> Some solution choices:
> 
>   1 - do nothing and let XML and JSON/CBOR be broken together
>      (solution is do not use XML and JSON/CBOR together in the same server)
>   2 - force receiver to convert JSON/CBOR to a string for union type
> matching
>   3 - tag the data somehow so the receiver knows which union member type is
> being sent
>   4 - write YANG guidelines on how to design union types that will produce
> the same
>      match with all encoding schemes

I think 2 is the right short-term approach. It does not mean an
implementation has always to convert to a string but an implementation
needs to behave as if it has converted to a string.

> IMO CBOR has to solve the enumeration and bits issues with (3) but
> for the problem in general, just do (4)

Option 3 may be a long-term solution but this is non-trivial to work
out and to introduce with a backwards compability perspective in mind.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>