Re: [yang-doctors] guideline for enum and value?

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Thu, 25 January 2018 08:37 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 323CF12D943 for <yang-doctors@ietfa.amsl.com>; Thu, 25 Jan 2018 00:37:57 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.909
X-Spam-Level:
X-Spam-Status: No, score=-1.909 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, T_RP_MATCHES_RCVD=-0.01, 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 1dEqVedEX2WO for <yang-doctors@ietfa.amsl.com>; Thu, 25 Jan 2018 00:37:55 -0800 (PST)
Received: from atlas5.jacobs-university.de (atlas5.jacobs-university.de [212.201.44.20]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7BA0812D868 for <yang-doctors@ietf.org>; Thu, 25 Jan 2018 00:37:55 -0800 (PST)
Received: from localhost (demetrius5.irc-it.jacobs-university.de [10.70.0.222]) by atlas5.jacobs-university.de (Postfix) with ESMTP id 4DCF5EC0; Thu, 25 Jan 2018 09:37:54 +0100 (CET)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from atlas5.jacobs-university.de ([10.70.0.217]) by localhost (demetrius5.jacobs-university.de [10.70.0.222]) (amavisd-new, port 10032) with ESMTP id YG9VqEu5bSZb; Thu, 25 Jan 2018 09:37:53 +0100 (CET)
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 atlas5.jacobs-university.de (Postfix) with ESMTPS; Thu, 25 Jan 2018 09:37:54 +0100 (CET)
Received: from localhost (demetrius2.jacobs-university.de [212.201.44.47]) by hermes.jacobs-university.de (Postfix) with ESMTP id 3792020149; Thu, 25 Jan 2018 09:37:54 +0100 (CET)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius2.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id kpgbs_hVL2kC; Thu, 25 Jan 2018 09:37:53 +0100 (CET)
Received: from elstar.local (unknown [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id CCEC020147; Thu, 25 Jan 2018 09:37:53 +0100 (CET)
Received: by elstar.local (Postfix, from userid 501) id 9FCCC422901F; Thu, 25 Jan 2018 09:37:53 +0100 (CET)
Date: Thu, 25 Jan 2018 09:37:53 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Benoit Claise <bclaise@cisco.com>
Cc: YANG Doctors <yang-doctors@ietf.org>
Message-ID: <20180125083753.kngg2f3zysxq4qbm@elstar.local>
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Mail-Followup-To: Benoit Claise <bclaise@cisco.com>, YANG Doctors <yang-doctors@ietf.org>
References: <c3d21c6e-8cc0-e109-4b81-278242d70071@cisco.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <c3d21c6e-8cc0-e109-4b81-278242d70071@cisco.com>
User-Agent: NeoMutt/20171215
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/X3rXCK0T4SZBOPWoJqqpuffz0BM>
Subject: Re: [yang-doctors] guideline for enum and value?
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Jan 2018 08:37:57 -0000

On Thu, Jan 25, 2018 at 09:18:27AM +0100, Benoit Claise wrote:
> Dear all,
> 
> Still busy with the RFC6087bis AD review, reviewing the enum sections now.
> 
> Do I recall correctly a guideline about not using "value" in enum?
> Something to be inserted in RFC6087bis? At least a pros and cons discussion?
>

I would rather say the opposite:

  YANG automatically assigns numeric values to enums if no values are
  specified. This automatic assignment requires that (a) the order of
  enums never changes and (b) additional enums are only appended but
  never prepended or inserted. This is subtle and using explicit value
  assignments, though more verbose, tends to be more robust when
  modules are revised.

Background:

Note that NETCONF and RESTCONF do not send the numeric values due to
the way the XML and JSON encodings are defined. But this may be
different for other encodings, the proposed CBOR encoding uses the
numeric value. Some implementations do support mappings to protocols
such as SNMP where numeric values are used.

We had a longer discussion about this when we talked about how we deal
with timezones, which change regularly and have no natural numeric
value. Algorithms to produce YANG enumerations from the timezone
databases are difficult if you want to have stable numeric values.

/js

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