Subject: [netmod] Default choice case with only empty leaf - Is this allowed ?

From: "Beauville, Yves (Nokia - BE/Antwerp)" <[email-masked]>
Date: Tue, 5 Nov 2019 09:07:19 +0000

Hello,

In the example provided in section 7.9.3 of RFC7950, is it legal to 
redefine the default case like below?

      container transfer {
        choice how {
          default manual;     // redefined
          case interval {
            leaf interval {
              type uint16;
              units minutes;
              default 30;
            }
          }
          case daily {
            leaf daily {
              type empty;
            }
            leaf time-of-day {
              type string;
              units 24-hour-clock;
              default "01.00";
            }
          }
          case manual {
            leaf manual {
              type empty;
            }
          }
        }
      }

What is expected to happen when an <edit-config> request creates the 
'transfer' container without providing any data for the choice 'how'?

Since an empty leaf conveys information by its presence or absence, and 
cannot have a default value, is it correct to assume that the 'manual' 
leaf will be present, even though it was not explicitly created by the 
<edit-config> request?

Can someone clarify?

Yves

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 05 Nov 2019 11:14:12 +0100 (CET)

Hi,

>           default manual;     // redefined

Section 7.9.3 says:

   The default case is only important when considering the "default"
   statements of nodes under the cases (i.e., default values of leafs
   and leaf-lists, and default cases of nested choices).  The default
   values and nested default cases under the default case are used if
   none of the nodes under any of the cases are present.

So, yes it is legal, but doesn't mean anything.

> 'transfer' container without providing any data for the choice 'how'?

The behaviour is the same as if you didn't have the default statement
in the choice.

> leaf will be present, even though it was not explicitly created by the 

No.

> Can someone clarify?

/martin