Re: [netmod] ACL draft defines ether-type as a string

Martin Bjorklund <mbj@tail-f.com> Mon, 14 August 2017 14:22 UTC

Return-Path: <mbj@tail-f.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 D48D213228D for <netmod@ietfa.amsl.com>; Mon, 14 Aug 2017 07:22:26 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_PASS=-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 4_l9dGyM1ojs for <netmod@ietfa.amsl.com>; Mon, 14 Aug 2017 07:22:24 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 679DF13234B for <netmod@ietf.org>; Mon, 14 Aug 2017 07:22:24 -0700 (PDT)
Received: from localhost (unknown [173.38.220.57]) by mail.tail-f.com (Postfix) with ESMTPSA id A26E01AE048A; Mon, 14 Aug 2017 16:22:22 +0200 (CEST)
Date: Mon, 14 Aug 2017 16:20:46 +0200
Message-Id: <20170814.162046.2238120211326349720.mbj@tail-f.com>
To: j.schoenwaelder@jacobs-university.de
Cc: Alex.Campbell@Aviatnet.com, netmod@ietf.org
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <20170719055038.GA19325@elstar.local>
References: <EC54089C-E8CD-4F7A-9B93-7FB228A66074@gmail.com> <1500416980342.21019@Aviatnet.com> <20170719055038.GA19325@elstar.local>
X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/J1bIKVCV2gw7VQWr0KannG00qJs>
Subject: Re: [netmod] ACL draft defines ether-type as a string
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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: Mon, 14 Aug 2017 14:22:27 -0000

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> It may even mean that they plan to change ether-type-0xXXXX to foo
> once 0xXXXX is allocated to foo, which would be a problem. It seems
> a union of a uint16 and an enum can be more robust.
> 
>  type union {
>    type uint16;
>    type enumeration {
>      enum ipv4 {
>        value 0x0800;
>        description
>          "Internet Protocol version 4 (IPv4)";
>        reference
>          "RFC 791: Internet Protocol"
>      }
>    }
>  }
> 
> A caveat is that the canonical representation of a uint16 is decimal
> (and YANG today has no way to control that), which may be a bit
> inconvenient here. Perhaps the description clause should overwrite
> this.

Actually, the lexical representation of a uint16 is decimal.  The
canonical representation is just a subset of this (leading 0s are
removed etc, see 9.2.2 of RFC 7950).  The description cannot change
the lexical representation.

So the only way to handle this today (if you need hex notation) is to
use a union between an enum and a string with a pattern for the hex
values (as in the ethertype-type below).


> There is probably also a need to remember implementors that the
> canonical representation of the union retains the notation, that is,
> if I write a numeric value (i.e., if I write '0x800' I get back the
> numeric value 2048 but if I write the enum value 'ipv4' I get back the
> enum 'ipv4' and not a numeric value.
> 
> I have also found a definition in [1] that uses a string with a
> pattern to match a different notation for ether type numeric values.
> 
>   typedef ethertype-type {
>     type string {
>       pattern '[0-9a-fA-F]{2}-[0-9a-fA-F]{2}';
>     }
>     description
>       "The EtherType value represented in the canonical order defined
>     	by IEEE 802. The canonical representation uses uppercase 
>     	characters.";
>     reference
>       "IEEE 802-2014 Clause 9.2";
>   }
> 


/martin


> While this may be more compliant to IEEE 802-2014 Clause 9.2, having
> some type that easily resolves to a number may be more desirable in
> practice.
> 
> [1] https://github.com/YangModels/yang/blob/master/standard/ieee/802.1/draft/ieee802-dot1q-types.yang
> 
> /js
> 
> PS: Writing definitions for seemingly simple types can be fun.
> 
> On Tue, Jul 18, 2017 at 10:29:40PM +0000, Alex Campbell wrote:
> > Doesn't this mean that if a new protocol is defined, then it won't be usable in ACLs until the server's data model is upgraded? (And with many devices, that is quite likely never)
> > 
> > 
> > ________________________________
> > From: netmod <netmod-bounces@ietf.org> on behalf of Mahesh Jethanandani <mjethanandani@gmail.com>
> > Sent: Tuesday, 18 July 2017 6:21 p.m.
> > To: NetMod WG
> > Subject: [netmod] ACL draft defines ether-type as a string
> > 
> > The issue of ether-type defined as a string was discussed with participants from IEEE in IETF. It was generally agreed that since ether-types are well known values, and centrally managed, that they be defined as enumerations. There was some clarification sought by IEEE on which values need to be published. It was suggested that ether-types that are either private or do not have a protocol identified would be named as ether-type-0xXXXX where 0xXXXX represents the value assigned. All the remaining ether-types will be defined as enums with the well known names.
> > 
> > As far as the impact of that on the ACL draft is concerned, it will be to remove all local definitions for ether-type from the draft, such as the one below and instead use the definition from IEEE, whenever that is done. It does however put a dependency on the IEEE model.
> > 
> > 
> >     leaf ether-type {
> >       type string {
> >         pattern '[0-9a-fA-F]{4}';
> >       }
> >       description
> >         "The Ethernet Type (or Length) value represented
> >          in the canonical order defined by IEEE 802.
> >          The canonical representation uses lowercase
> >          characters.
> > 
> >          Note: This is not the most ideal way to define
> >          ether-types. Ether-types are well known types
> >          and are registered with RAC in IEEE. So they
> >          should well defined types with values. For now
> >          this model is defining it as a string.
> > 
> > 
> >          There is a note out to IEEE that needs to be
> >          turned into a liaison statement asking them to
> >          define all ether-types for the industry to use.";
> >       reference
> >         "IEEE 802-2014 Clause 9.2";
> >     }
> >     reference
> >       "IEEE 802: IEEE Standard for Local and Metropolitan
> >        Area Networks: Overview and Architecture.";
> >   }
> > 
> > Mahesh Jethanandani
> > mjethanandani@gmail.com<mailto:mjethanandani@gmail.com>
> > 
> > 
> > 
> 
> > _______________________________________________
> > netmod mailing list
> > netmod@ietf.org
> > https://www.ietf.org/mailman/listinfo/netmod
> 
> 
> -- 
> 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/>
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>