[yang-doctors] usage of mandatory node in an optional choice

Andy Bierman <andy@yumaworks.com> Thu, 25 January 2018 22:21 UTC

Return-Path: <andy@yumaworks.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 EF4FE12EACD for <yang-doctors@ietfa.amsl.com>; Thu, 25 Jan 2018 14:21:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 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_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 Yu1LoR_02eLv for <yang-doctors@ietfa.amsl.com>; Thu, 25 Jan 2018 14:21:20 -0800 (PST)
Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4DC34129C6F for <yang-doctors@ietf.org>; Thu, 25 Jan 2018 14:21:20 -0800 (PST)
Received: by mail-lf0-x230.google.com with SMTP id w27so10568286lfd.6 for <yang-doctors@ietf.org>; Thu, 25 Jan 2018 14:21:20 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=MVERVrwqiV03aHfOYI4DR9USElr3c5OmwhD6JOHklpA=; b=GqRjlohTf9QPHHXqx4NTCzPsSnTItqwxfWmeASk0+/vbgC+ACI4WNcXp3y1ftZla1L ShMTuLrscQhi/iCXinDMYRzddwCrQY1BlVwj5moMM1LrAXxBt36bPPY0NCZuGVKaH1Zv g0klqob5h7vwlhDfGq258GiEoBQDzdCFql+QwI3PSC1SdDrWJqLS6MxuJALLDO8tWDDf Z7myx6cYeeP4x8Ce58VmZjX2Nt/aRpeIMjngddF5W2DzavefA3ot/GBVf+tLrFYzAWVP S467tQqOC8mmMdbi8CVXbQhVFCEHHlYrk7Ui9gRL5IiLegslD7nDsvEzL6fcX9miGCDy 7tUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=MVERVrwqiV03aHfOYI4DR9USElr3c5OmwhD6JOHklpA=; b=bloMzdmXBGTNxtmMorEifQl4rVdzzGb1Sa9j8m5cCekp8bM0KVc33KcZ9Xyasqg377 If8/x3LpgG0mfXFKRA0toteWAiEr2pwqaai6dTn4XP9gb0IBhukQQYXWLWZHRg+hU91H XD6jSReeE3unVxZ/7e+TVojqZVGoqt7fpWjQlWA87Rm+USXY5VjHjiSZgOCW3lK5UJ8R YdMX988n0cEtyfdm2DFU44GPLUpV5OdaCUG+BaTscOwZjC8TZ4TVI+vR2n3D61ggkXyh 75081QBEglpOZvpoI75DV0ANoriLjzKNkSXRi2I8Fd3AsSFTxcZt5NCcBmzh7nSISA+q p4kA==
X-Gm-Message-State: AKwxytctvl3zFaFW+yg0GODRMmcBSqVSbcML/XAP7D96tlMw6RBMr6Uu Eey8NrP1yhgJianWmaM76bf6U1N48grvff4k50cS1Ia/
X-Google-Smtp-Source: AH8x225ICx3bCczqvHM1vULqR1PZFvVop5gsIpxyq4mrCHx9ITO+kXaM3uDpAk6971UhahNnqi0XLQ1CPkXOhzNr2OE=
X-Received: by 10.25.149.143 with SMTP id x137mr7155561lfd.119.1516918878169; Thu, 25 Jan 2018 14:21:18 -0800 (PST)
MIME-Version: 1.0
Received: by 10.25.143.6 with HTTP; Thu, 25 Jan 2018 14:21:17 -0800 (PST)
From: Andy Bierman <andy@yumaworks.com>
Date: Thu, 25 Jan 2018 14:21:17 -0800
Message-ID: <CABCOCHRSrZQZBQqrRk7a4KfJT+_mp_n4reA7CEUaPfcCy6ypPQ@mail.gmail.com>
To: YANG Doctors <yang-doctors@ietf.org>
Content-Type: multipart/alternative; boundary="001a1147dcfee303760563a132c6"
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/he1bCtBvxx7IQJTRCM2zySuRvRI>
Subject: [yang-doctors] usage of mandatory node in an optional choice
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 22:21:23 -0000

Hi,

I am working on a bug in our server, and I noticed the NACM rule choice
is a bit odd -- why is leaf path within implied case "path" a mandatory
node?
Why does this node have mandatory=true and none of the other leafs have
that?

Is this 'path' leaf really mandatory, given that the choice is optional?
Perhaps this is future-proofing -- making sure if the case is augmented
that the path node is still provided?  (If so, then why not do all
short-case
definitions this way?)

IMO this usage of mandatory true should be avoided, or clarified, or both...

Andy


        choice rule-type {
            description
              "This choice matches if all leafs present in the rule
             match the request.  If no leafs are present, the
             choice matches all requests.";
            leaf rpc-name {
              type union {
                type matchall-string-type
<http://www.netconfcentral.org/modulereport/ietf-netconf-acm#matchall-string-type.109>;
                type string;
              }
              description
                "This leaf matches if it has the value '*' or if
                 its value equals the requested protocol operation
                 name.";
            }
            leaf notification-name {
              type union {
                type matchall-string-type
<http://www.netconfcentral.org/modulereport/ietf-netconf-acm#matchall-string-type.109>;
                type string;
              }
              description
                "This leaf matches if it has the value '*' or if its
                 value equals the requested notification name.";
            }
            leaf path {
              type node-instance-identifier
<http://www.netconfcentral.org/modulereport/ietf-netconf-acm#node-instance-identifier.175>;
              mandatory true;
              description
                "Data Node Instance Identifier associated with the
                 data node, action, or notification controlled by
                 this rule.

                 Configuration data or state data instance
                 identifiers start with a top-level data node.  A
                 complete instance identifier is required for this
                 type of path value.

                 The special value '/' refers to all possible
                 datastore contents.";
            }
          }  // choice rule-type