Subject: [netmod] new YANG 1.1 issue: allow choice in case

From: Andy Bierman <[email-masked]>
Date: Fri, 28 Mar 2014 09:00:56 -0700

Hi,

A case-stmt is not allowed to have a choice-stmt as a child.
However, it is allowed to have a use-stmt. and the grouping
is allowed to have a choice-stmt in it.

grouping FOO {
  choice foo {
    leaf A { type string; }
    leaf B { type string; }
  }
}

 choice top {
   case one {
      uses FOO;   // now legal
   }
   case two {
     choice foo2 {    // now illegal
       leaf A2 { type string; }
       leaf B2 { type string; }
    }
  }
}

Even though the case with a nested choice be flattened into
N objects instead, this may be undesirable for readability
or augment purposes.

Proposal: allow choice-stmt to be a child of case-stmt.

Andy

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 28 Mar 2014 17:56:42 +0100

> is allowed to have a choice-stmt in it.

I agree, this is probably an omission.

Speaking about choice, I encountered the following use case for making the choice’s default statement work for cases that are empty leafs.

choice destination {
  default broadcast;
  container destination-host {
    leaf address { … }
  }
  leaf broadcast {
    type empty;
  }
}

Lada

> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 28 Mar 2014 18:28:00 +0100 (CET)

> A case-stmt is not allowed to have a choice-stmt as a child.

Yes it can.  Section 7.9.2.1 lists choice as substatement to case, and
the grammar allows it as well.

/martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 28 Mar 2014 18:50:34 +0100

> the grammar allows it as well.

Oh yes, choice is only not allowed as a short-case-stmt - it could be, but it is I guess not a big deal.

Lada

---

From: Andy Bierman <[email-masked]>
Date: Fri, 28 Mar 2014 11:02:23 -0700

> it is I guess not a big deal.
You are right -- that's what I meant.  It is not allowed in the short form.
There does not seem to be any reason it could be used in the short form.

 Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Sat, 29 Mar 2014 13:19:20 +0100 (CET)

> There does not seem to be any reason it could be used in the short form.

Agreed.  Added as Y29.

/martin