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

Qin Wu <bill.wu@huawei.com> Tue, 25 June 2019 00:55 UTC

Return-Path: <bill.wu@huawei.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 42EAB12004D for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 17:55:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.199
X-Spam-Level:
X-Spam-Status: No, score=-4.199 tagged_above=-999 required=5 tests=[BAD_ENC_HEADER=0.001, BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26a6QwM28lAU for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 17:55:10 -0700 (PDT)
Received: from huawei.com (lhrrgout.huawei.com [185.176.76.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 64F8D12001E for <netmod@ietf.org>; Mon, 24 Jun 2019 17:55:10 -0700 (PDT)
Received: from lhreml709-cah.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 8C4C1C1BF226805194FC; Tue, 25 Jun 2019 01:55:08 +0100 (IST)
Received: from lhreml709-chm.china.huawei.com (10.201.108.58) by lhreml709-cah.china.huawei.com (10.201.108.32) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 25 Jun 2019 01:55:07 +0100
Received: from lhreml709-chm.china.huawei.com (10.201.108.58) by lhreml709-chm.china.huawei.com (10.201.108.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 25 Jun 2019 01:55:08 +0100
Received: from NKGEML413-HUB.china.huawei.com (10.98.56.74) by lhreml709-chm.china.huawei.com (10.201.108.58) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA_P256) id 15.1.1713.5 via Frontend Transport; Tue, 25 Jun 2019 01:55:07 +0100
Received: from NKGEML513-MBX.china.huawei.com ([169.254.1.66]) by NKGEML413-HUB.china.huawei.com ([10.98.56.74]) with mapi id 14.03.0415.000; Tue, 25 Jun 2019 08:55:04 +0800
From: Qin Wu <bill.wu@huawei.com>
To: Michal Vaško <mvasko@cesnet.cz>, "Rob Wilton (rwilton)" <rwilton@cisco.com>
CC: netmod <netmod@ietf.org>
Thread-Topic: [netmod] ?==?utf-8?q? mandatory choice with non-presence container case
Thread-Index: AdUq72LdChSf+6wTQUWLa8icsfeI1w==
Date: Tue, 25 Jun 2019 00:55:04 +0000
Message-ID: <B8F9A780D330094D99AF023C5877DABAA49ABD2A@nkgeml513-mbx.china.huawei.com>
Accept-Language: zh-CN, en-US
Content-Language: zh-CN
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.134.31.203]
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-CFilter-Loop: Reflected
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/ToIga0h1CPW739Zq4DYb52K-GDQ>
Subject: Re: [netmod] ?==?utf-8?q? mandatory choice with non-presence container case
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 25 Jun 2019 00:55:15 -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:netmod-bounces@ietf.org] 代表 Michal Va?ko
发送时间: 2019年6月25日 1:01
收件人: Rob Wilton (rwilton) <rwilton@cisco.com>
抄送: netmod <netmod@ietf.org>
主题: 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)" <rwilton@cisco.com> 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 <netmod-bounces@ietf.org> On Behalf Of Michal Vaško
> > Sent: 24 June 2019 17:39
> > To: netmod <netmod@ietf.org>
> > 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
> > netmod@ietf.org
> > https://www.ietf.org/mailman/listinfo/netmod
 
 

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