"Sterne, Jason (Nokia - CA/Ottawa)" <[email protected]> writes:

> Hi all,
>
> I saw some recent questions about 'when' statements. I had another one 
> related to evaluating 'when' statements that involve leafs that don't 
> currently have a value at all.
>
> leaf foo {
>     type enumeration {
>         enum val1;
>         enum val2;
>     }
> }
>
> leaf bar {
>     when "../foo != 'val2'";
>     type uint8;
> }
>
> Notice that foo does not have a default statement. So if no manager has set 
> leaf foo, it doesn't exist in the config.
>
> In that case, does the "when" statement evaluate to 'true'  (i.e. leaf bar is 
> allowed to have a value) ?
>
> i.e. assuming leaf foo is not set at all, is this accepted?
> <bar>23</bar>
>
> Or is there something special here because of the non-existence of leaf foo?
>
> If the "when" evaluates to 'false', then does the following "when" evaluate 
> differently than the one above?
>     when "not(../foo = 'val2')";

Indeed it does. If the "foo" instance doesn't exist, then this expression 
evaluates to true.

Lada

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

-- 
Ladislav Lhotka 
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67

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

Reply via email to