clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
215 stars 72 forks source link

YANG mandatory statements within case nodes do not work #344

Closed olofhagsand closed 2 years ago

olofhagsand commented 2 years ago

While mandatory works for simple choice statements (eg choice c { mandatory true; ... ), they do not work in more complex combinations. As described in RFC 7950 Sec 7.9.4, if
if this ancestor is a case node, the constraint is enforced if any other node from the case exists. An example of this scenario is the following:

choice c {
  case ca {
     leaf ca1{
        type string;
        mandatory true;    <-----
     }
     leaf ca2{
        type string;
     }
  }
}

A special case of this is if "leaf ca1" is replaced with a "choice ca".