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

Andy Bierman <andy@yumaworks.com> Mon, 24 June 2019 17:11 UTC

Return-Path: <andy@yumaworks.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 E64DE12068A for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 10:11:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAD_ENC_HEADER=0.001, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.com
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 vQGiTYFhrsP8 for <netmod@ietfa.amsl.com>; Mon, 24 Jun 2019 10:11:53 -0700 (PDT)
Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id E98C912016A for <netmod@ietf.org>; Mon, 24 Jun 2019 10:11:52 -0700 (PDT)
Received: by mail-lj1-x230.google.com with SMTP id p17so13385324ljg.1 for <netmod@ietf.org>; Mon, 24 Jun 2019 10:11:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1xeU2QkelHcuXzvZev+DiSTIQcv9hsHw/10tzncRFUA=; b=mutxh4g0xzDfhoqI+5jCEHaCzg2TPuW92Wzyppajhr9q9lTUxy9NgUOEL382Qa1UIn xDtWSMCPC6JSp2LbCpU1dkudaN/lK5pqE7+p9s1T/4bhCuWIJwVcrXKeyUWA38fjWpgP ZVVQSkWg5ncO6aQmKCph2SkVuRcGC65OoTGbgMepXEFN9BXuC6HrGbvbBh5wh8CWtIzj unw6pjLvJHQAXWgjBdeqopcrZbE92n7Uxk/E0i568j7w7aCd/laHmnuzuCCDM/GcApmU glsAVK9V4ycJyGGPrSDMixSKxM7AzAAIjNcBS5nY6R+iFT5ghceciErmTStlhbDy2/pj 8cbA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1xeU2QkelHcuXzvZev+DiSTIQcv9hsHw/10tzncRFUA=; b=O45u42BxAi2V7SgP1+miX3/ARBMz1IhfAS03zJcVNeFPW3MvIKLHworT432Q/AzjWT TjU6zITGcRgPjKtgOmP5HfIBhoRaLVtrE5Kuxq67aB8kezbGntFSZtjhcoSypibG05Jg wMSyVp7WIBKaq0gc54eDG7cxehUKPkujOGOOAuQevi6cDsKumbqmd4GGUTyXpt3VT1oD hAqG2tQWJ7laxPOasD20AVeWKJMAGB9eY68kg62fP5fWBz5QlFXIFxB1qyeIgaXhYIqU mVGfSE6ATOcE+C6yhT/j99zuEVO9OaIWLRrRN90S5GpMXWEkL04og+CCtl3+n+9Dwae0 6E3Q==
X-Gm-Message-State: APjAAAVXH69EEd6v9MMhvGfrVZaaflFdDjeuWNkvymLaGvNAPGXwK7d/ bIXBN6s55ADoM/tg+Cbj62jPmLJMlJ3xX2g77Drdkg==
X-Google-Smtp-Source: APXvYqz7YdBKxXYgTDJqM4QSkjA3fGKpP5TAVU02b3bsxXtWUfB2I3JkdDO8+9tBrnJNRgpkxKYo6MNkcLiQWJQ1HaU=
X-Received: by 2002:a2e:b0ea:: with SMTP id h10mr20276023ljl.50.1561396310953; Mon, 24 Jun 2019 10:11:50 -0700 (PDT)
MIME-Version: 1.0
References: <BYAPR11MB263111549D604096368CC2ABB5E00@BYAPR11MB2631.namprd11.prod.outlook.com> <7797-5d110200-71-35dfff00@18550405>
In-Reply-To: <7797-5d110200-71-35dfff00@18550405>
From: Andy Bierman <andy@yumaworks.com>
Date: Mon, 24 Jun 2019 10:11:39 -0700
Message-ID: <CABCOCHSYeRCsSKsNSEWeifX3Dpm80KawdioZSJua6jF3-R+f7w@mail.gmail.com>
To: Michal Vaško <mvasko@cesnet.cz>
Cc: "Rob Wilton (rwilton)" <rwilton@cisco.com>, netmod <netmod@ietf.org>
Content-Type: multipart/alternative; boundary="00000000000077fabf058c14e897"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/kQfVecAgIheLEL7s_4U2G3JwoWw>
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: Mon, 24 Jun 2019 17:11:56 -0000

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.

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
>