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

2019-11-05 Thread Martin Bjorklund
Hi,

"Beauville, Yves (Nokia - BE/Antwerp)"  wrote:
> 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;
>     }
>   }
>     }
>   }

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.

> What is expected to happen when an  request creates the 
> '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.

> 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 
>  request?

No.

> Can someone clarify?



/martin

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod


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

2019-11-05 Thread Beauville, Yves (Nokia - BE/Antwerp)
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  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 
 request?

Can someone clarify?


Yves

___
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod