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

From: Qin Wu <[email-masked]>
Date: Tue, 25 Jun 2019 00:55:04 +0000

Michal:
If my understanding is correct, mandatory true choice 'A' requires the presence of container 'C', 
But no presence container 'C' doesn't have any child node, therefore container 'C' will not be present,
which seems a little bit contradict. 

Quote the relevant text in RFC7950 as follows:
the following text in section 7.5.1
"
In the first style, the container has no meaning of its own, existing
only to contain child nodes.  In particular, the presence of the
container node with no child nodes is semantically equivalent to the
absence of the container node.
"
seems not consistent with the text in section 7.9.4
"
If "mandatory" is "true", at least one node from exactly one of the
choice's case branches MUST exist.
"
Let me know if this is root cause of the issue you raised.

-Qin
-----邮件原件-----
发件人: netmod [mailto:[email-masked]] 代表 Michal Va?ko
发送时间: 2019年6月25日 1:01
收件人: Rob Wilton (rwilton) <[email-masked]>
抄送: netmod <[email-masked]>
主题: Re: [netmod] ?==?utf-8?q? mandatory choice with non-presence container case

Hi Rob,
I think there is a problem in the RFC because using only allowed steps I got invalid data from initially valid data. That cannot be correct.

Regards,
Michal

On Monday, June 24, 2019 18:52 CEST, "Rob Wilton (rwilton)" <[email-masked]> wrote: 
 
> Hi Michal,
> 
> My thoughts:
> 
> According to 7.5.1:
> 
>    In the first style, the container has no meaning of its own, existing
>    only to contain child nodes.  In particular, the presence of the
>    container node with no child nodes is semantically equivalent to the
>    absence of the container node.  YANG calls this style a "non-presence
>    container".  This is the default style.
> 
> Hence your request (because the NP container does not have any children) is equivalent to:
> 
>  <TOP>
>    <L/>
>  </TOP>
> 
> which fails the "mandatory" check.
> 
> Thanks,
> Rob
> 
> 
> > -----Original Message-----
> > From: netmod <[email-masked]> On Behalf Of Michal Vaško
> > Sent: 24 June 2019 17:39
> > To: netmod <[email-masked]>
> > Subject: [netmod] mandatory choice with non-presence container case
> > 
> > Hi,
> > I have encountered a situation that I think is not covered by RFC 
> > 7950. My specific use-case was as follows.
> > 
> > model:
> > 
> > container TOP {
> >   leaf L {
> >     type empty;
> >   }
> >   choice A {
> >     mandatory true;
> >     container C;
> >   }
> > }
> > 
> > data:
> > 
> > <TOP>
> >   <L/>
> >   <C/>
> > </TOP>
> > 
> > Parsing was successful, but printing these data back to XML produced:
> > 
> > <TOP>
> >   <L/>
> > </TOP>
> > 
> > and parsing this correctly failed with missing mandatory choice. 
> > According to section 7.5.7 [1], I think the C container could be 
> > omitted but the whole situation does not seem correct. Thank you for any input.
> > 
> > Regards,
> > Michal
> > 
> > [1] https://tools.ietf.org/html/rfc7950#section-7.5.7
> > 
> > _______________________________________________
> > netmod mailing list
> > [email-masked]
> > https://www.ietf.org/mailman/listinfo/netmod

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