Re: [netmod] Implicit case statementa

tom petch <ietfc@btconnect.com> Fri, 14 February 2020 11:48 UTC

Return-Path: <ietfc@btconnect.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 F231B120828 for <netmod@ietfa.amsl.com>; Fri, 14 Feb 2020 03:48:33 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=btconnect.onmicrosoft.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 XFs0xi9XAPTi for <netmod@ietfa.amsl.com>; Fri, 14 Feb 2020 03:48:31 -0800 (PST)
Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10121.outbound.protection.outlook.com [40.107.1.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1C4D5120826 for <netmod@ietf.org>; Fri, 14 Feb 2020 03:48:30 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bNewq/51CZ/svR6tf1HHJsx7PE30TWL/In7IzU/nSW7RcZm/C044GtVVEZ5bjfA+vQv/oxfenrxClqsQyPHOEhrfasiPV1NVTmQw6J0MkK6od05P1ZACufqjiFGc75ADS5PtOMNAxXWr8vKw7Tv5x3HO51PyewqCIxUlKn9J35mNfoTasc1O9ipTlFI66tdDIHRsCJVnbj/h01IPhi/Zy9JFJ80FND3Y8jViLgBGrr6zJJbrfwmYTEaWl45FL022dKm4Cx9RMiH/i/Z+duEQDJ6FbJniajTaaBD4CItTaHQFmciA+1OiXJScIzs8VOc1fmBxjILGTQeAmAW0u+w4wg==
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=MrJ5GW5D6Wt+Ky/N0bquAy+YFTlhhwsevQ4nSLQnCHE=; b=kHFgJIi8wiPODwS9UY8XFvaXnUKsrIIdnflPZMZJH8QXZOFYASccONcUWn1vTip7b0amXnz1j8GK+oUkeRvdzmj4oakMd8Kok3iHUTHwGrlHUn+re/XyLswTcIjr1y6VMR8znbPPlSt8P2+ntl0uUwptEWC/w6x97MKQf++6wmEo/mMlYXxpqdzX8lY5QI5c4HVvdMJKHojj9X6yYmJBpH1ugk662WumA0F53aTvpNDhnxy6HBZej6qKx7DfL3qSkArAWVj4BBr8c/fn5sLhDKfZZaE7PZ8/Wz5xYhWHrZBcbi3yuPbMpnc1MrVxrBb2e3eAyKapSJcRX0S9vQt1ow==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=btconnect.com; dmarc=pass action=none header.from=btconnect.com; dkim=pass header.d=btconnect.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btconnect.onmicrosoft.com; s=selector2-btconnect-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MrJ5GW5D6Wt+Ky/N0bquAy+YFTlhhwsevQ4nSLQnCHE=; b=hjkw4ogbe3K/PyJljyeqXDIMfNstvkdOID2O4GqhWbAH2wcB+E1ULvR+hdOD91vFTOoGOhgCivLhhpxFQGh1Uvka6d95DD5CbR+4676k0gXUiorLYqBeUZ8iMq56Vvm1+NxeQcuvl2JN8foMf/JZ2n37vQQKwo4zbTqKrXl1AhA=
Received: from DB7PR07MB5657.eurprd07.prod.outlook.com (20.178.85.222) by DB7PR07MB5878.eurprd07.prod.outlook.com (20.177.193.160) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2750.6; Fri, 14 Feb 2020 11:48:28 +0000
Received: from DB7PR07MB5657.eurprd07.prod.outlook.com ([fe80::450e:a4e2:e88e:dbcb]) by DB7PR07MB5657.eurprd07.prod.outlook.com ([fe80::450e:a4e2:e88e:dbcb%6]) with mapi id 15.20.2729.025; Fri, 14 Feb 2020 11:48:28 +0000
From: tom petch <ietfc@btconnect.com>
To: "Rob Wilton (rwilton)" <rwilton@cisco.com>, Kent Watsen <kent+ietf@watsen.net>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] Implicit case statementa
Thread-Index: AQHV4ny3XCoYjRDKO020fs6RcjJz/qgaeh8AgAAYKvM=
Date: Fri, 14 Feb 2020 11:48:28 +0000
Message-ID: <DB7PR07MB5657DBD01CC9E421E8CB3C56A0150@DB7PR07MB5657.eurprd07.prod.outlook.com>
References: <010001703f060085-7c6a3183-7f9f-4706-9be3-f64d9ea40fca-000000@email.amazonses.com>, <MN2PR11MB4366EB460639F018FAE197C7B5150@MN2PR11MB4366.namprd11.prod.outlook.com>
In-Reply-To: <MN2PR11MB4366EB460639F018FAE197C7B5150@MN2PR11MB4366.namprd11.prod.outlook.com>
Accept-Language: en-GB, en-US
Content-Language: en-GB
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=ietfc@btconnect.com;
x-originating-ip: [81.131.229.19]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 849a6299-a603-4762-d303-08d7b143ce7a
x-ms-traffictypediagnostic: DB7PR07MB5878:
x-microsoft-antispam-prvs: <DB7PR07MB5878338F4C6C8BA9B04321D1A0150@DB7PR07MB5878.eurprd07.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-forefront-prvs: 03137AC81E
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(396003)(366004)(136003)(39860400002)(376002)(189003)(199004)(71200400001)(33656002)(186003)(81156014)(81166006)(91956017)(5660300002)(52536014)(86362001)(26005)(7696005)(2906002)(966005)(55016002)(9686003)(66476007)(8936002)(66556008)(316002)(76116006)(110136005)(53546011)(6506007)(66946007)(64756008)(66446008)(478600001)(8676002); DIR:OUT; SFP:1102; SCL:1; SRVR:DB7PR07MB5878; H:DB7PR07MB5657.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:0;
received-spf: None (protection.outlook.com: btconnect.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: pNg/kO+Z+9tyN5YXPjnctQQ/eyRuLyS+PYqok+wMdMCvBQ5/gax9GoN1UjOgdv7dwoP6o6/cTV6t5u4kRGbwx+1HHMUTKUJbrQK4h45xGHtUbU85IEdUlRObLENbYLbSy3z3C8qXD8OxLiLeFGPgkm1AwD08Q3l4Zn+xQ0cmyBU2RvOSXz0F74FirEWr6BhTD5HuEqVPuWTByzbrHTjMF0trTOqTovcJkORE3x3W2A/d7+Ia7mjbusKyGtY+/pZuz2+dUjzwZf9yuLeK4TJtxlr5U8E82ZFb6/f+nDFDhpl4xKkrm2+C7Wy3E78vR6zA0vp88gNUVwsFQyk8HkyLCFxUjfewvNXhbDZz/f7jetB1ocvczEiZUhm/lTzUfrefEjIIUkXvXg6+k3YaPq3JBI8CtDzL3jx7CBI0Gmm11V+icXvmfcviojk3q+b1httb6Yl7GGym2wcsDeIzLGm5KebRjiS/maPLHvKF0ZBxIBsF7aqMFvAAMO/yTlbowY5R/B4Ck8sAbXnRnlP5cBd80Q==
x-ms-exchange-antispam-messagedata: 4HcAkExPzaDJJd0RbeRAb1Do0DteuDhSUotFwnVgjIO0SNx1fAHVPJtKuuPTm/us85l+5Y7A9DxaDcv/s+joOvIMez8FUUgHQK1WSFmEnewTSFNCbXzVDScnN+axPfaUEFmzW6I8X6s4MpuJ7+kp2A==
x-ms-exchange-transport-forked: True
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: btconnect.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 849a6299-a603-4762-d303-08d7b143ce7a
X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Feb 2020 11:48:28.0745 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: cf8853ed-96e5-465b-9185-806bfe185e30
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: C8ix9NNDNJyAXZFq7yseHGiLrt5qXIm4EWz94S03rEXS5fqqAdlnKP/E+1ZaBOefPi9fTrXo3KlkTdMOIc/zMw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR07MB5878
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/hSdJdOIr7-SnvXvGeFQf6h2D8Yk>
Subject: Re: [netmod] Implicit case statementa
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, 14 Feb 2020 11:48:34 -0000

_____________________________________
From: netmod <netmod-bounces@ietf.org> on behalf of Rob Wilton (rwilton) <rwilton@cisco.com>
Sent: 14 February 2020 10:14
To: Kent Watsen; netmod@ietf.org
My interpretation matches the one that Martin gives in https://github.com/mbj4668/pyang/issues/559

<tp>

I was looking at 
draft-boydseda- ipfix-psamp-bulk-data-yang-model
and see nine choice statements of which six have no case, two have a single case and one has multiple case.  The single case have a note to the effect that they may be augmented, the others have no note.  The no case do have multiple container or leaf statements.  It does make me curious.

Tom Petch


I.e. the short hand notation …

    choice test {
      container foo {
        if-feature disabled-feature;
          ...
      }
    }

is equivalent to:

    choice test {
      case foo {
        container foo {
          if-feature disabled-feature;
            ...
        }
      }
    }

Filing an issue in YANG.Next to clarify, or further discuss, this seems helpful to me.

Thanks,
Rob


From: netmod <netmod-bounces@ietf.org> On Behalf Of Kent Watsen
Sent: 13 February 2020 14:49
To: netmod@ietf.org
Subject: [netmod] Implicit case statementa


RFC 7950 says:

   As a shorthand, the "case" statement can be omitted if the branch

   contains a single "anydata", "anyxml", "choice", "container", "leaf",

   "list", or "leaf-list" statement.  In this case, the case node still

   exists in the schema tree, and its identifier is the same as the

   identifier of the child node.

This seems clear, albeit incomplete, as inconsistencies [1] exist amongst `pyang`and `yanglint` (I did not test with `yangson`) in how the “if-feature” statement is handled, though I imagine other statements (e.g., “when”) may also fall into this discussion as well.

Ultimately, the question is what Errata and/or YANG-next issue should be filed.   I’m okay either way, so long as it’s clear and can be implemented consistently across tooling.

In the meanwhile, I recommend module designers avoid using the shorthand notation, as there are no known issues with the “longhand” notation.

[1] https://github.com/mbj4668/pyang/issues/559

Kent // contributor