Subject: [netmod] FW: Comments on draft-ietf-netconf-keystore-07

From: Kent Watsen <[email-masked]>
Date: Fri, 7 Dec 2018 17:41:17 +0000

YANG experts,

Why are action/notification statements not allowed under a case statement?  Yes, it’s simple to assert, but was it considered, in such cases, to instead allow them to attach/bind to the closest legal ancestor?  Would it make sense?

Nit: It would’ve been helpful if the “Since a” paragraphs quoted below referenced sections 7.1.1 (The module's Substatements) and 7.9.2.1 (The case's Substatements)...

PS: Neither `pyang` nor `yanglint` catch this misuse.

Kent // contributor

On 12/6/18, 5:39 AM, "Dhanapal, Ramkumar (Nokia - IN/Chennai)" <[email-masked]<mailto:[email-masked]>> wrote:

Hi Kent,
We see the following definition in draft-ietf-netconf-keystore-07.

grouping local-or-keystore-end-entity-cert-with-key-grouping {
       description
         "A grouping that expands to allow an end-entity certificate
          (and its associated private key) to be either stored locally,
         within the using data model, or be a reference to a specific
          certificate in the keystore.";
       choice local-or-keystore {
         mandatory true;
         case local {
           if-feature "local-keys-supported";
           uses ct:asymmetric-key-pair-grouping;
           uses ct:end-entity-cert-grouping;
         }
         case keystore {
           if-feature "keystore-supported";
           leaf reference {
             type ks:asymmetric-key-certificate-ref;
             description
               "A reference to a specific certificate, and its
                associated private key, stored in the keystore.";
           }
         }
         description
           "A choice between an inlined definition and a definition
            that exists in the keystore.";
       }
     }

In ct:asymmetric-key-pair-grouping, 2 actions are defined.
In ct:end-entity-cert-grouping, 1 notification is defined.

But w.r.t. RFC7950 references below, looks like it is not okay to have either actions or notifications in “case” statements.

https://tools.ietf.org/html/rfc7950#section-7.15<https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc7950-23section-2D7.15&d=DwMFAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=9zkP0xnJUvZGJ9EPoOH7Yhqn2gsBYaGTvjISlaJdcZo&m=5MdSdliP9J3hgvGhkGCct2XcKpZ02-EvBh7-1XguBpc&s=UNvfZFjpmFaI7esgjHxrocBZttgjQ5vyfn2E_TkrxFo&e=>

        Since an action cannot be defined at the top level of a module or in

        a "case" statement, it is an error if a grouping that contains an

        action at the top of its node hierarchy is used at the top level of a

        module or in a case definition

https://tools.ietf.org/html/rfc7950#section-7.16<https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc7950-23section-2D7.16&d=DwMFAg&c=HAkYuh63rsuhr6Scbfh0UjBXeMK-ndb3voDTXcWzoCI&r=9zkP0xnJUvZGJ9EPoOH7Yhqn2gsBYaGTvjISlaJdcZo&m=5MdSdliP9J3hgvGhkGCct2XcKpZ02-EvBh7-1XguBpc&s=rQNBqLPet_vEb3FYg0E01BhnxdNQ0u21b4frMZ6WodM&e=>

        Since a notification cannot be defined in a "case" statement, it is

        an error if a grouping that contains a notification at the top of its

        node hierarchy is used in a case definition.

Can you please check and provide your feedback? Or Am I missing something here?

Thanks & Regards,

Ramkumar

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 10 Dec 2018 11:13:50 +0100 (CET)

Kent Watsen <[email-masked]> wrote:
> YANG experts,
> 
> Why are action/notification statements not allowed under a case
> statement?  Yes, it’s simple to assert, but was it considered, in such
> cases, to instead allow them to attach/bind to the closest legal
> ancestor?  Would it make sense?

There are some corner cases that don't make sense, e.g.:

  choice a {
    case b {
      action foo;
    }
    ...
  }

So we would have to say that the case must have at least some other
node as well, e.g.:

  choice a {
    case b {
      leaf bar {
        type string;
      }
      action foo;
    }
    ...
  }

But the semantics are not quite clear, imo.

> Nit: It would’ve been helpful if the “Since a” paragraphs quoted below
> referenced sections 7.1.1 (The module's Substatements) and 7.9.2.1
> (The case's Substatements)...
> 

Thanks, now fixed in pyang.

/martin

> 
> Kent // contributor
> 
> 
> On 12/6/18, 5:39 AM, "Dhanapal, Ramkumar (Nokia - IN/Chennai)"
> <[email-masked]<mailto:[email-masked]>>
> wrote:
> 
> Hi Kent,
> But w.r.t. RFC7950 references below, looks like it is not okay to have
> either actions or notifications in “case” statements.
>