Re: [yang-doctors] Identities vs enums

"Rob Wilton (rwilton)" <rwilton@cisco.com> Thu, 29 August 2019 12:00 UTC

Return-Path: <rwilton@cisco.com>
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 DF28A1200F1 for <yang-doctors@ietfa.amsl.com>; Thu, 29 Aug 2019 05:00:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.501
X-Spam-Level:
X-Spam-Status: No, score=-14.501 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com header.b=ll3mA3Fk; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=kc1RtHvc
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 aqX8PnHsOKPw for <yang-doctors@ietfa.amsl.com>; Thu, 29 Aug 2019 05:00:42 -0700 (PDT)
Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 652E71200E9 for <yang-doctors@ietf.org>; Thu, 29 Aug 2019 05:00:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=4285; q=dns/txt; s=iport; t=1567080042; x=1568289642; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=6HTWw3i/qapJ+3J31fDT7LH2pTaflKWkyEZyHFgBL1o=; b=ll3mA3FkL5deABuVUs/owakjsldQyioOBRkPxUcEnFAyZfRG1Tg3rCSZ tk0sDTLQvwQfFNlB9tDfK3emPxJ0gm27ZmIgfFt1Y1HhbNwoxdHRMvP34 SnAwTW7BRltVibffHvC5upWMCM2Vw8+GKwjIWnsDN7xZcWN/Hq4/SLQ0D 0=;
IronPort-PHdr: 9a23:zeojYRe75D+PW9+LdQzV5sQmlGMj4e+mNxMJ6pchl7NFe7ii+JKnJkHE+PFxlwGRD57D5adCjOzb++D7VGoM7IzJkUhKcYcEFnpnwd4TgxRmBceEDUPhK/u/dTM7GNhFUndu/mqwNg5eH8OtL1A=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AGAADivWdd/5BdJa1cBgMZAQEBAQEBAQEBAQEBBwEBAQEBAYFTBAEBAQEBCwGBRFADbVYgBAsqCodeA4RShh+CXJdqgS6BJANUCQEBAQwBARgLCgIBAYQ/AoJZIzQJDgIDCAEBBAEBAQIBBgRthS4MhUoBAQEBAgEBARAoBgEBLAsBCwICAgEIDgIBBAEBAR4QGwwLHQgBAQQOBQgagwGBagMODwECDJ8JAoE4iGGCJYJ8AQEFhQoYghYDBgWBLwGLdhiBQD+BV4JMPoJhAQGBNywfJoJ2ggQilGKXJwkCgh6LMkOId5hdpiQCBAIEBQIOAQEFgVA4gVhwFTuCbIJCg3IzhGGFP3KBKY0RAYEiAQE
X-IronPort-AV: E=Sophos;i="5.64,442,1559520000"; d="scan'208";a="622698596"
Received: from rcdn-core-8.cisco.com ([173.37.93.144]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 29 Aug 2019 12:00:41 +0000
Received: from XCH-RCD-017.cisco.com (xch-rcd-017.cisco.com [173.37.102.27]) by rcdn-core-8.cisco.com (8.15.2/8.15.2) with ESMTPS id x7TC0fDm028810 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 29 Aug 2019 12:00:41 GMT
Received: from xhs-rcd-002.cisco.com (173.37.227.247) by XCH-RCD-017.cisco.com (173.37.102.27) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 29 Aug 2019 07:00:40 -0500
Received: from xhs-rtp-001.cisco.com (64.101.210.228) by xhs-rcd-002.cisco.com (173.37.227.247) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 29 Aug 2019 07:00:40 -0500
Received: from NAM03-BY2-obe.outbound.protection.outlook.com (64.101.32.56) by xhs-rtp-001.cisco.com (64.101.210.228) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 29 Aug 2019 08:00:40 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d+BjgkMMPVAHoi0mQkcgWlrH26y7ftIWuUdi58LhJQO8PZbru3kQNBhWk2s2Zfec5yHedD5Zergu8FQ5cM4wHkmo2VgL23nKLzrjb2bfENG6/YLjGEgcvrRuaaZeTjAiF1l+EJX3zi1Znp/GYBhTE21MqTx75lQSQjmABb0o/TLe3gZVmU5uO87WY/Ot3e/IRjSv3gjvuoKsallb+EPeYzJ0QGZ8SsJTw2UebJ2PBuFHt5YRvhvjM0urFYpsxphod176YgYuhdz9rrj5Lr7aw7o8suwByESkIJvy3/QvbZ5r9NhXDej3lFv6gUE3Wcfyj0pEaJ87mk9JOC/NHTzDEg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=faQRBcXVjdj9e+PSH7p5+eaFiEX/kgTXxV5Uh5WWB+w=; b=iivKNxEKEcpwZgdryib6cxGZiJQ9hSrMqukGrC2yp9b8wgRoXk4xkFQg094H3Yz0AnJ46440jNrU5Ben0UcqV8UvSauY1SHWUqkePlwTEVgSaUFmLLgX9FRCQYsTN6txRwWyVoYTfF2Q9TFcdyb5468EUvAl/PlPrR4rXWvo36qXFsYTkOFwQaY9oPesGNaKZqGc+oVJUjb5Irt4/wODshY+/SOhGhBY0tkgtRWXppKy/C6xCAg7/MX4zRPCcE1copnoVfUIrEFWWBM1kCrobXIJeU/lZx3Umy5lSbaGDmT++ROPqVRkIvyQUHq/Y2xFPdbvRldQR60TlCmBuMSJBg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=faQRBcXVjdj9e+PSH7p5+eaFiEX/kgTXxV5Uh5WWB+w=; b=kc1RtHvch6wFxGva4anXafLcYwGC40ohx1THj5me9uS1jsTn6ruAp6EfM1u5g6+dp8D+fLc/RJVXQDweQhcUig1AJJb30L/DfYNyv3T5KCeeeNPwziacCNywLITnsz0bnuA5ExR9rJh88Ou5zfosRgaB7+oZrCG6E/jcL58iMaY=
Received: from MN2PR11MB4366.namprd11.prod.outlook.com (52.135.38.209) by MN2PR11MB3807.namprd11.prod.outlook.com (20.178.254.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Thu, 29 Aug 2019 12:00:38 +0000
Received: from MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::6db3:f4c:467b:30f6]) by MN2PR11MB4366.namprd11.prod.outlook.com ([fe80::6db3:f4c:467b:30f6%7]) with mapi id 15.20.2220.013; Thu, 29 Aug 2019 12:00:38 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
CC: YANG Doctors <yang-doctors@ietf.org>
Thread-Topic: [yang-doctors] Identities vs enums
Thread-Index: AdVeUoj6Gm62w2r9QP2N1RJZSFrmWQABWqoAAAIBguA=
Date: Thu, 29 Aug 2019 12:00:38 +0000
Message-ID: <MN2PR11MB4366B337E1F8EF8BAA3DDB82B5A20@MN2PR11MB4366.namprd11.prod.outlook.com>
References: <MN2PR11MB4366B7D24FF907FE8E0802E9B5A20@MN2PR11MB4366.namprd11.prod.outlook.com> <20190829105312.764zyxjbxbvzmaic@anna.jacobs.jacobs-university.de>
In-Reply-To: <20190829105312.764zyxjbxbvzmaic@anna.jacobs.jacobs-university.de>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=rwilton@cisco.com;
x-originating-ip: [173.38.220.59]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 83120b76-2e69-401f-08fc-08d72c7881e8
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:MN2PR11MB3807;
x-ms-traffictypediagnostic: MN2PR11MB3807:
x-ms-exchange-purlcount: 2
x-microsoft-antispam-prvs: <MN2PR11MB380794160C78130FB1E7832AB5A20@MN2PR11MB3807.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 0144B30E41
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(39860400002)(136003)(346002)(366004)(396003)(189003)(199004)(13464003)(26005)(229853002)(8936002)(7736002)(102836004)(6436002)(52536014)(81166006)(81156014)(53546011)(186003)(6306002)(74316002)(9686003)(6506007)(6246003)(64756008)(316002)(76176011)(3846002)(5660300002)(66556008)(6916009)(66446008)(66476007)(305945005)(66066001)(66946007)(7696005)(53936002)(4326008)(8676002)(25786009)(2906002)(86362001)(99286004)(76116006)(478600001)(6116002)(476003)(71190400001)(71200400001)(486006)(33656002)(446003)(14454004)(256004)(11346002)(966005)(14444005)(55016002); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR11MB3807; H:MN2PR11MB4366.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: /MJ48ZqghsKq1ju9LKtnRJ09xTmPbvcpFDX5eVTDJnDrCpiKtBlEkmWNYwSoJ/GlRIckCnglROdcXhVLYbBqMPVTrFvqp88BjabM1eSNlMMm6JXSz6d+uWYphAHo36/aRisiQnoCOjjmDYW20aOskPhFeB82xlSiUSQhjmcUgTc2Nskupj1Kbxg8ZmH+V1my2wIfcpkML1UwqgqNTOaKb61TQwWR7UWHa1L5eSdnS47jm9sHLOahhAfsUK84oHuMXEaab3eGC5GyB4YWMw5MXI+zLuPfqOQe901+l1p/RkvhxcKYiGuAujzgVSvFnaNT1UGtpgcWUsQQq8sBtr7YP0v8pLug+SktxsGMeYt2qrkrxYwWorO5uel63krw0e2O2EB1LWwjKB+LjwMEnGBLa5ZIvRb7c6HuSW82u8eIFiA=
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: 83120b76-2e69-401f-08fc-08d72c7881e8
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2019 12:00:38.2050 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: Bb5zLDis9iDLJFRIXjl/sMfL7y9wrqNH1wue6voFCRuJ/Dtgn8tgSFcd7VP/uucO7zEsTrlmc+kwoeZAp4TIVg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3807
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.37.102.27, xch-rcd-017.cisco.com
X-Outbound-Node: rcdn-core-8.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/A202XPRyvxs4UZYGPsX3I9tFl4s>
Subject: Re: [yang-doctors] Identities vs enums
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.29
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, 29 Aug 2019 12:00:45 -0000

Hi Juergen,

Thanks.  Comments inline ...

> -----Original Message-----
> From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
> Sent: 29 August 2019 11:53
> To: Rob Wilton (rwilton) <rwilton@cisco.com>
> Cc: YANG Doctors <yang-doctors@ietf.org>
> Subject: Re: [yang-doctors] Identities vs enums
> 
> A few comments:
> 
> - Enums can be extended. RFC 7950 section 11:
> 
>    o  An "enumeration" type may have new enums added, provided the old
>       enums's values do not change.  Note that inserting a new enum
>       before an existing enum or reordering existing enums will result
>       in new values for the existing enums, unless they have explicit
>       values assigned to them.
 
But this only helps if you use the enum for a new leaf.  I.e. an implementation cannot add extra enum values into an existing leaf, without a "deviate replace" on the "type".

> 
>   It is important to not change the order and advisable to assign
>   explicit numeric values.
> 
> - Moving definitions into another module means that one has to use
>   module prefixes.
> 
> - All identities defined in a module share the same identifier
>   namespace. Using the same identifier in other namespaces should not
>   be a problem. See RFC 7950 section 6.2.1.
> 
>    o  All identity names defined in a module and its submodules share
>       the same identity identifier namespace.
> 
> - The decision whether an enum or an identity is appropriate should be
>   based on whether it is necessary to support future name allocations
>   that can made outside of the module, i.e., without updating the
>   module. This is where identities shine. But then they also have
>   issues since there is currently no standard way yet to define
>   subsets of identities, e.g., the subset of identities supported or
>   required by an implementation.

Yes.  I'm questioning (for a future version of YANG) whether enums should have somewhat similar flexibility as identities (yes, I appreciate that there are value/name collision concerns).

Thanks,
Rob


> 
> /js
> 
> On Thu, Aug 29, 2019 at 10:24:59AM +0000, Rob Wilton (rwilton) wrote:
> > I doubt that this is the first time that this has come up ...
> >
> > draft-ietf-netmod-intf-ext-yang-07, defines 3 identities (along with a
> base identity) for loopback configuration: "loopback-internal", "loopback-
> line" and "loopback-connector".
> >
> > One of the reviewers is complaining that the "loopback-" prefix in the
> identity is redundant and noisy.  I.e. he doesn't like having to write
> loopback='loopback-internal', and would like to be able to write
> loopback='internal' instead.
> >
> > His main suggestion is to move these loopback (or perhaps just the
> identities) to a separate YANG module so that they don't need to define a
> "loopback-" prefix.
> >
> > There seem to be some choices here:
> >
> > (1) Keep with identities with a "loopback-" prefix.  This causes
> loopback='loopback-internal'
> >
> > (2) Keep with identities, but loose the common prefix, i.e. the
> identities become "internal", "line", "connector".  Given the size of the
> module, the likelihood of an identity naming clash in future seems quite
> small, but they are somewhat generic terms.
> > (3) Use shorter identity names, but also put them in a separate types
> module (as requested by the reviewer).
> > (4) Use an enum rather than identities.  Although this has the potential
> issue that the enum cannot be extended (which I'm wondering if this is
> something that we should consider changing in the hypothetical YANG Next).
> >
> > Personally, I'm toying with changing to 4 or perhaps 2.  I'm not keen on
> 3.
> >
> > Any thoughts or opinions from the YANG doctors?
> >
> > Thanks,
> > Rob
> >
> 
> > _______________________________________________
> > yang-doctors mailing list
> > yang-doctors@ietf.org
> > https://www.ietf.org/mailman/listinfo/yang-doctors
> 
> 
> --
> 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/>