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

Michal Vaško <mvasko@cesnet.cz> Mon, 24 June 2019 17:15 UTC

Return-Path: <mvasko@cesnet.cz>
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 DE24612068D for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 10:15:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.998
X-Spam-Level:
X-Spam-Status: No, score=-1.998 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cesnet.cz
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 v1U9GhFG9omi for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 10:15:21 -0700 (PDT)
Received: from kalendar.cesnet.cz (kalendar.cesnet.cz [78.128.211.34]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 570EE120694 for <netmod@ietf.org>; Mon, 24 Jun 2019 10:15:21 -0700 (PDT)
Received: by kalendar.cesnet.cz (Postfix, from userid 999) id 8AD34601AE; Mon, 24 Jun 2019 19:15:18 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=kalendar; t=1561396518; bh=77Uoac2sLLhSysKziFi+biUuLkEiNVvp4z2QwYXKh4A=; h=In-Reply-To:From:Date:Cc:To:Subject; b=Ju89/oqYJ5HJ3UGBZXpI4En2+n1hh8pMzfh9XqNri/Rtc1IIRiNKoP5pTl9yVawzy LyC/vRgkaG1bKjTksIDSYW3VVPGKeTlJCtn6U6zKzGT+te/8HYMr5XazF71a00ek7c yAMpchgYpzsEHQ3SKoh5xuJKRT/rmVJLaP6NpPfo=
Content-Type: text/plain; charset="utf-8"
In-Reply-To: <CABCOCHSYeRCsSKsNSEWeifX3Dpm80KawdioZSJua6jF3-R+f7w@mail.gmail.com>
From: =?utf-8?q?Michal_Va=C5=A1ko?= <mvasko@cesnet.cz>
X-Forward: 88.101.100.176
Date: Mon, 24 Jun 2019 19:15:18 +0200
Cc: =?utf-8?q?Rob_Wilton_=28rwilton=29?= <rwilton@cisco.com>, "netmod" <netmod@ietf.org>
To: "Andy Bierman" <andy@yumaworks.com>
MIME-Version: 1.0
Message-ID: <ad3-5d110500-55-63a2bc80@40796557>
User-Agent: SOGoMail 2.3.23
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/pZDlQLYItZSLsRd3frwQbzCM134>
Subject: Re: [netmod] =?utf-8?b?Pz09P3V0Zi04P3E/ID89PT91dGYtOD9xPyA/PSAgbWFu?= =?utf-8?q?datory_choice_with_non-presence_container_cas?=
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: Mon, 24 Jun 2019 17:15:24 -0000

Hi Andy,

On Monday, June 24, 2019 19:11 CEST, Andy Bierman <andy@yumaworks.com> wrote: 
 
> On Mon, Jun 24, 2019 at 10:01 AM Michal Vaško <mvasko@cesnet.cz> wrote:
> 
> > 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.
> >
> >
> No.  See sec. 7.5.7
> 
>    If a non-presence container does not have any child nodes, the
>    container may or may not be present in the XML encoding.
> 
> 
> Just because your retrieval does not contain the NP-container, that does
> not mean the
> NP-container was not present in the server for the mandatory-stmt
> validation.

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.

Michal

> 
> Regards,
> > Michal
> >
> >
> Andy
> 
> 
> > 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
> >