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

Andy Bierman <andy@yumaworks.com> Fri, 08 May 2020 15:58 UTC

Return-Path: <andy@yumaworks.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id EF1BE3A0BD2 for <netmod@ietfa.amsl.com>; Fri, 8 May 2020 08:58:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.887
X-Spam-Level:
X-Spam-Status: No, score=-1.887 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, T_SPF_PERMERROR=0.01, URIBL_BLOCKED=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 dH2h_Lj8tXEb for <netmod@ietfa.amsl.com>; Fri, 8 May 2020 08:58:26 -0700 (PDT)
Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CC7583A0BBF for <netmod@ietf.org>; Fri, 8 May 2020 08:58:25 -0700 (PDT)
Received: by mail-yb1-xb34.google.com with SMTP id w19so1171693ybs.5 for <netmod@ietf.org>; Fri, 08 May 2020 08:58:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PHffSXQRoVbiTEf/OZNx55cgS877CFikbGJ8bJYg0ac=; b=ug1kx7L7NWo2uPXg/Npa7/Idbz5GeduuZ2J+KTPOq9Z7kBUWqANlTf+Ml+dTFinexp UYF5L9B0kBF3/3ViTzcxTEwxdwEqfAgYsdjrlYM/U9n88pO2icIRbqGxbqFMdMPlVdkL hkt8Fp0YbkwbZXrdDW4AzB3Q9RZfG65XzggG9ZxxoJwoWeCozcCUEFB88/uYPDBwx5jI 2qS2CwJhqbS3/hDg6fpukmfSKT53kFHohrs1dF4FVzgtupu8aaVOEVUMFity/k8BLVh9 I++u3DvmUKOsWis7U3QX9Szn/5B3nkARfVOOxRd5H4QX853APP0IhTMhfiwv2BezyOrU iz5g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PHffSXQRoVbiTEf/OZNx55cgS877CFikbGJ8bJYg0ac=; b=Id7YBvvHkgeqyPK8Hc1BnVBAW3Pwz1qZXek/Gy5zfdEn7Xc5Mvui/TfB5vRDlAovSs KqgxzKcJyqOOUeWvLlPCx2TIJ+Ud0iLIeSv3UYLNprcW2NW85U/l7OX1r9TOGGYPg4ED UCtPmbNpoBP2HGA2FsThRz9MKggYKk+P3Dk4V0OTQyifUA1IUQQevisEH62LP/kuWh3Z YP5Q9fPoumLfWsEDqXURZLqXfHQD6PAL9NJ6/6oKnnrDYwHTF26C4SoLkPiYLPo0NVNm Se0NvEMAx+jks10fhfuh69NuKDC9yhutyjC2WwhGO+urRt5LAh4C0T+NoamZcwfSvIOR JQEQ==
X-Gm-Message-State: AGi0PuYS/5V7Z63TP7czzxBg4Uj0bIewG9qlSnA6B5QSAOXuP2H3HrFs 5pYOVgGeOEwRa0NkDTVxe90DWLe8bqIh1NoaeZN1Yw==
X-Google-Smtp-Source: APiQypJhML78D9o3o0CRh4yTOkfvVR3WMJqeKYq5KKUr/kZhgbV5alqtuf6djLmNrMfC3e1HZ9ecvDZ8xzzj95+CCOE=
X-Received: by 2002:a25:ac92:: with SMTP id x18mr5718855ybi.59.1588953504716; Fri, 08 May 2020 08:58:24 -0700 (PDT)
MIME-Version: 1.0
References: <BY5PR11MB4355C26250C9CF46713C9956B5A40@BY5PR11MB4355.namprd11.prod.outlook.com> <D66596CE-7F5C-4562-89A4-48FCE96D0E18@tzi.org> <28486.1588785684@localhost> <CABCOCHRRDYDomEPctAHaHf+MxS2qXab1J4o=_LUEWcJ2=by5Ww@mail.gmail.com> <8F06BFE6-CE7C-4D10-AC61-24AAA2807E45@tzi.org> <CABCOCHRUCK_FpwSCnOOy8fBCX_HeAWQeFvJEyZy2hUL4L2WhrQ@mail.gmail.com>
In-Reply-To: <CABCOCHRUCK_FpwSCnOOy8fBCX_HeAWQeFvJEyZy2hUL4L2WhrQ@mail.gmail.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Fri, 08 May 2020 08:58:14 -0700
Message-ID: <CABCOCHQOWoPozsYOfVEDy_TYw-YF5H9TZ2eydcOpj-g2d3ysNQ@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: Michael Richardson <mcr+ietf@sandelman.ca>, "netmod@ietf.org" <netmod@ietf.org>, "core@ietf.org" <core@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000036b30b05a5251127"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/FvD_AgeazTXEmqZQ1Hn0zwenM0k>
Subject: Re: [netmod] [core] CBOR YANG encoding of union & bits [draft-ietf-core-yang-cbor-12]
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 08 May 2020 15:58:30 -0000

On Fri, May 8, 2020 at 8:51 AM Andy Bierman <andy@yumaworks.com> wrote:

>
>
> On Thu, May 7, 2020 at 11:22 PM Carsten Bormann <cabo@tzi.org> wrote:
>
>> On 2020-05-08, at 05:27, Andy Bierman <andy@yumaworks.com> wrote:
>> >
>> > Why is the bit position allowed to be a uint32 in YANG? Who knows, but
>> it has to be supported.
>>
>> If we think that is the way to go, I like Kio’s proposal over in the CBOR
>> list:
>> <https://mailarchive.ietf.org/arch/msg/cbor/3sZ4YfWLzmVVnNnQbttkovgjTP8>
>>
>>
>
> Yes -- this encoding should work well
>
>
>> We probably should arm that with some text that says (in nicer words)
>> that this is an emergency representation and implementations should not
>> invoke it for sane YANG models (with an operable definition of sane).
>>
>>
>
> Not sure what this means.
> Wouldn't this map approach be used all the time for a bits type?
> The "normal" case would be a small number of octets representing all the
> bits present
>  (e..g 0x7 for 3 bits : bit 0 to bit 2)
> This would simply be 1 map entry with {offset=0,length=1,value=0x7}
>
> The actual bitmap is conceptually constructed by starting with an array of
> zero bytes.
> Overlapping offsets are allowed. Duplicate offsets are allowed.
> There is no requirement to list offsets in ascending order.
> There is no canonical representation.
>
> Each map entry is added to the array using a "bit or" operator.
> After all map entries are processed the full bits value is known.
> This allows an implementation to encode bits serially (often done this way
> with YANG bit names)
>
> So the same bitset 0x7 could be sent different ways including:
>
>   { 0, 1, 0x1 }
>   { 0, 1, 0x2 }
>   { 0, 1, 0x4 }
>
> If the position is really bit 4 million (bit 1 in byte 500,000)
>
>   { 0, 500000, 0x1 }
>
>
oops: correction:  (bit 0 in byte 500000)

  { 500000, 1, 0x1 }


>
>
>> Grüße, Carsten
>>
>>
>
> Andy
>
>