[netmod] Implicit case statementa

Kent Watsen <kent+ietf@watsen.net> Thu, 13 February 2020 14:48 UTC

Return-Path: <010001703f060085-7c6a3183-7f9f-4706-9be3-f64d9ea40fca-000000@amazonses.watsen.net>
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 EEDB61200E0 for <netmod@ietfa.amsl.com>; Thu, 13 Feb 2020 06:48:46 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.897
X-Spam-Level:
X-Spam-Status: No, score=-1.897 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=amazonses.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 zUqB863ZMPB6 for <netmod@ietfa.amsl.com>; Thu, 13 Feb 2020 06:48:45 -0800 (PST)
Received: from a48-90.smtp-out.amazonses.com (a48-90.smtp-out.amazonses.com [54.240.48.90]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 70448120013 for <netmod@ietf.org>; Thu, 13 Feb 2020 06:48:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1581605324; h=From:Content-Type:Mime-Version:Subject:Message-Id:Date:To:Feedback-ID; bh=++ZT58T4XsQ0J3/2Cg23SjXzmrSeQcxewrzJhNxhTx4=; b=LY7m2xqMkA2l1ktyJJWrexdQGa5eJxjBLC5td6VAGUtw1/4uwx7FRkpX8mazxyJG 19GU3eLK9UhP+2CHfjmccHQKbx340fxPTXJc7110Lcm9XZedMWxh6VxPKeigQLwe9Ew gdJZ2ziBvlRDbO5bmghPsufGLVC/+IRfwBVsuzKM=
From: Kent Watsen <kent+ietf@watsen.net>
Content-Type: multipart/alternative; boundary="Apple-Mail=_5B0C9715-7FEE-4B7D-9A60-E724908E8C65"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\))
Message-ID: <010001703f060085-7c6a3183-7f9f-4706-9be3-f64d9ea40fca-000000@email.amazonses.com>
Date: Thu, 13 Feb 2020 14:48:42 +0000
To: "netmod@ietf.org" <netmod@ietf.org>
X-Mailer: Apple Mail (2.3445.104.11)
X-SES-Outgoing: 2020.02.13-54.240.48.90
Feedback-ID: 1.us-east-1.DKmIRZFhhsBhtmFMNikgwZUWVrODEw9qVcPhqJEI2DA=:AmazonSES
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/wuABRCCVn9L1U-gpmuopZWpyy38>
Subject: [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: Thu, 13 Feb 2020 14:48:47 -0000

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