[Cbor] Fwd: [netmod] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]

Carsten Bormann <cabo@tzi.org> Wed, 06 May 2020 15:38 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 001D23A07F9 for <cbor@ietfa.amsl.com>; Wed, 6 May 2020 08:38:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] 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 In6-A-bHyLiE for <cbor@ietfa.amsl.com>; Wed, 6 May 2020 08:38:11 -0700 (PDT)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9A2393A0B3A for <cbor@ietf.org>; Wed, 6 May 2020 08:38:09 -0700 (PDT)
Received: from [172.16.42.112] (p548DCD70.dip0.t-ipconnect.de [84.141.205.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 49HLMg4yHDzyT3; Wed, 6 May 2020 17:38:07 +0200 (CEST)
From: Carsten Bormann <cabo@tzi.org>
Content-Type: multipart/alternative; boundary="Apple-Mail=_324EF250-0DD5-4D8B-974C-F0395C059D88"
X-Mao-Original-Outgoing-Id: 610472286.159918-f96bc53374e44f49e29b6f99f4027f72
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\))
Date: Wed, 06 May 2020 17:38:06 +0200
Message-Id: <6ACF0CA3-59C4-4CE1-9344-81B43C75BAF4@tzi.org>
References: <BY5PR11MB4355C26250C9CF46713C9956B5A40@BY5PR11MB4355.namprd11.prod.outlook.com>
To: cbor@ietf.org
X-Mailer: Apple Mail (2.3608.80.23.2.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/FkHOFgbGIyql6bzA6Bk1Rtmmdpo>
Subject: [Cbor] Fwd: [netmod] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 06 May 2020 15:38:17 -0000

JFYI: Interesting discussion in core/netmod about potentially needing to represent sparse bit sets.
Anything we (cbor WG) can contribute to that?

Grüße, Carsten


> Begin forwarded message:
> 
> From: "Rob Wilton \(rwilton\)" <rwilton=40cisco.com@dmarc.ietf.org>
> Subject: [netmod] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]
> Date: 2020-05-06 at 12:43:49 CEST
> To: "core@ietf.org" <core@ietf.org>, "netmod@ietf.org" <netmod@ietf.org>, "draft-ietf-core-yang-cbor@ietf.org" <draft-ietf-core-yang-cbor@ietf.org>
> Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/zaAtN5l8NuXUT1u3oj3qy9UG_m8>
> 
> Hi,
> 
> [Cross posting to Netmod for wider YANG expertise.]
> 
> I had a couple of questions on the CBOR YANG encoding of bits and unions (based on draft-ietf-core-yang-cbor-12).  Apologies if these have already been discussed/closed in the WGLC.
> 
> 1) Regarding the encoding of the bits datatype:
> [draft-ietf-core-yang-cbor-12, section 6.7]
> 
> The CBOR YANG encoding of the bits datatype is defined as a byte string encoding of a bitfield.  However, my concern here is that YANG bit positions are allowed to be up 2^32-1.
> 
> E.g. the following, pathologically bad, bits definition would seem to have a very inefficient encoding in CBOR:
> 
>   typedef alarm-state {
>     type bits {
>       bit unknown {
>         position 4000000000;
>       }
>       bit under-repair;
>       bit critical;
>       bit major;
>       bit minor;
>       bit warning;
>       bit indeterminate;
>     }
>   }
> 
> 
> How much should we be concerned about this pathological case?  Would it be reasonable for implementations to reject bitfields larger than a small set size (e.g. perhaps 256 bits)?
> 
> Or, if it is supported by the language then is it reasonable that implementation SHOULD support it?  In which case I think that we might need a second encoding of bits that supports this pathological case.  Perhaps an array of 'set' bit positions, or alternatively the union string encoding of bits could be used.
> 
> 
> 2) Regarding the encoding of unions:
> 
> I was questioning whether the special encoding of bits type within a union was required in CBOR [draft-ietf-core-yang-cbor-12, section 6.7].  Am I right to presume that this is to ensure that the CBOR encoding of unions is always at least as specific as XML?  If so, this seems like a reasonable design choice.  But that leads on to these general YANG questions:
> 
> Should the value encoding of a YANG union type behave the same way regardless of whether the encoding is XML/JSON/CBOR?  Or is it reasonable for there to be differences in the case of conflicting values?  Perhaps this is already answered by RFC 7951 that can behave differently from the XML encoding of unions.
> 
> Longer term, should YANG be looking for a discriminated-union type?  Or perhaps it would be sufficient for tooling to flag up potentially ambiguous union definitions, particularly those that may be encoding dependent.
> 
> 
> Regards,
> Rob
> 
> [As an individual contributor]
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod