Subject: [netmod] Implicit case statementa

From: Kent Watsen <[email-masked]>
Date: Thu, 13 Feb 2020 14:48:42 +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

---

From: "Rob Wilton (rwilton)" <[email-masked]>
Date: Fri, 14 Feb 2020 10:14:32 +0000

My interpretation matches the one that Martin gives in https://github.com/mbj4668/pyang/issues/559

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 <[email-masked]> On Behalf Of Kent Watsen
Sent: 13 February 2020 14:49
To: [email-masked]
Subject: [netmod] Implicit case statementa

RFC 7950 says:

Kent // contributor

---

From: tom petch <[email-masked]>
Date: Fri, 14 Feb 2020 11:48:28 +0000

_____________________________________
From: netmod <[email-masked]> on behalf of Rob Wilton (rwilton) <[email-masked]>
Sent: 14 February 2020 10:14
To: Kent Watsen; [email-masked]
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

    choice test {
      container foo {

is equivalent to:

    choice test {
      case foo {
        container foo {

Thanks,
Rob

RFC 7950 says:

Kent // contributor

---

From: Kent Watsen <[email-masked]>
Date: Mon, 17 Feb 2020 22:42:30 +0000

A YANG-Next issue has been created to track a fix for this issue:

https://github.com/netmod-wg/yang-next/issues/103 <https://github.com/netmod-wg/yang-next/issues/103>

Kent

> On Feb 14, 2020, at 6:48 AM, tom petch <[email-masked]> wrote:
>