Subject: [netmod] choice mandatory case mandatory

From: tom petch <[email-masked]>
Date: Fri, 1 May 2020 09:36:57 +0000

given
rpc tunnels
  input
    container tunnel
      choice filter
         mandatory true
         case all
           leaf all
           mandatory true
          case one
              leaf justone
what does mandatory do?  I could understand one mandatory or three mandatory but struggle to see the point of two.
Something like this is in draft-ietf-teas-yang-te

---

From: Martin Björklund <[email-masked]>
Date: Fri, 01 May 2020 12:52:14 +0200 (CEST)

>          mandatory true

This means that some node from some case must be present.

>            mandatory true

I assume that this mandatory is inside "leaf all".  This means that if
this case is selected (i.e., at least some node from the case is
present), then this leaf must be present as well.

>           case one
>               leaf justone
> what does mandatory do?  I could understand one mandatory or three
> mandatory but struggle to see the point of two.

You need to look at complete model for the choice to see if it makes
sense or not.

> Something like this is in draft-ietf-teas-yang-te

/martin

---

From: tom petch <[email-masked]>
Date: Fri, 1 May 2020 11:14:00 +0000

From: Martin Björklund <[email-masked]>
Sent: 01 May 2020 11:52

<tp>
Thanks for that.
Yes, what I give is the entire RPC as far as data nodes go (which I meant to mention) so it seems to me that the second mandatory is not needed unless the expectation is that the first case will be augmented with other nodes which then need not be present.   The aim is to either act on one or act on all of a list, tunnels in this case, which is quite common in routing YANG modules but I have not seen this pattern before and wondered what I was missing.  I think the answer is nothing!

Tom Petch

/martin