Subject: Re: [netmod] ?= ?==?utf-8?q? mandatory choice with non-presence container cas

From: Christian Hopps <[email-masked]>
Date: Fri, 19 Jul 2019 07:27:52 -0400

> On Jun 25, 2019, at 3:58 AM, Martin Bjorklund <[email-masked]> wrote:
> 
> Ladislav Lhotka <[email-masked]> wrote:
>> Kent Watsen <[email-masked]> writes:
>> 
>>> Hi Michal,
>>>> I agree, but these valid data were correctly printed into invalid
>>>> data. I do not think printing is allowed to change the validity of
>>>> data.
>>> The NP-container text is unclear.
>> 
>> This issue IMO has more to do with the "mandatory" statement under
>> "choice". Similar problems can be caused by data nodes that depend on
>> "when". For example:
>> 
>> choice sel {
>>   madatory true;
>>   leaf foo {
>>       when "...";
>>       ...
>>   }
>>   leaf bar { ... }
>>   leaf baz { ... }
>> 
>> If "foo" exists in instance data but its when condition becomes false,
>> the server is expected to remove the "foo" instance, but what next?
>> The data becomes invalid, but the server can hardly include "bar" or
>> "baz" on its own.
> 
> Right, so that change (that would make the when condition false) will
> be rejected by the server, since the resulting config would be
> invalid.

This is subtle, I wonder if it is called out somewhere for YANG module implementers? Basically what the above means (assuming a module sw design) is that prior to *any change anywhere in the system* the server software (probably) needs to re-run validation on the entire resulting config to make sure that the config will still be valid, prior to making the change.

The sort of obvious place this would happen is having baseline software that does not know about (has no code written for) some new feature that is added later by the vendor/user. This new sw has some when's in it that refer back to the baseline sw.

Thanks,
Chris.

> 
> 
> /martin
> 
> 
> 
> 
>> 
>> Lada
>> 
>>> I'm unsure if you saw the thread in NETCONF, but I filed this issue
>>> over the weekend.  Please add to it, if only to include a link to this
>>> thread: https://github.com/netmod-wg/yang-next/issues/88. Thanks, Kent
>>> _______________________________________________ netmod mailing list
>>> [email-masked] https://www.ietf.org/mailman/listinfo/netmod
>> 
>> --
>> Ladislav Lhotka Head, CZ.NIC Labs PGP Key ID: 0xB8F92B08A9F76C67
>> 
>> _______________________________________________
>> netmod mailing list
>> [email-masked]
>> https://www.ietf.org/mailman/listinfo/netmod
>> 
> 
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod