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

"Rob Wilton (rwilton)" <rwilton@cisco.com> Tue, 25 June 2019 13:49 UTC

Return-Path: <rwilton@cisco.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 AC4C812008D for <netmod@ietfa.amsl.com>; Tue, 25 Jun 2019 06:49:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.499
X-Spam-Level:
X-Spam-Status: No, score=-14.499 tagged_above=-999 required=5 tests=[BAD_ENC_HEADER=0.001, BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com header.b=FIymUCGG; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=osiamUwV
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 nQ2EnLg1Q1uL for <netmod@ietfa.amsl.com>; Tue, 25 Jun 2019 06:49:13 -0700 (PDT)
Received: from rcdn-iport-7.cisco.com (rcdn-iport-7.cisco.com [173.37.86.78]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 92C6712003F for <netmod@ietf.org>; Tue, 25 Jun 2019 06:49:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=12678; q=dns/txt; s=iport; t=1561470553; x=1562680153; h=from:to:subject:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version; bh=ODK+mamVhQX6JB6x12op99ldXwwkqD/y2Ge/Yu738k8=; b=FIymUCGGpHlrH36r0cg2tdEOqbocl9M9i3O5Q+ZDlvaH8cxXQPTy/Iok ApZp6DyMxgrZhGKaFVdZZjJjlkzmgTsETCUQTqe2sJYcB4GOl2E47sH6k 6T8U/Lgstd9OX4MxeX0cq1uR4fMhbWGDzd7Tbqz91mjiLLuk2JU6mpeS1 4=;
IronPort-PHdr: =?us-ascii?q?9a23=3Aub/0OxVxIYm0R1Q6H8gOn4ZtE/nV8LGuZFwc94?= =?us-ascii?q?YnhrRSc6+q45XlOgnF6O5wiEPSA92J8OpK3uzRta2oGXcN55qMqjgjSNRNTF?= =?us-ascii?q?dE7KdehAk8GIiAAEz/IuTtankgA8VGSFhj13q6KkNSXs35Yg6arw=3D=3D?=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AeAADdJBJd/49dJa0iQxkBAQEBAQE?= =?us-ascii?q?BAQEBAQEHAQEBAQEBgVYBAQEBAQELAYFDUANqVSAECygKhAyDRwOOYUyCD5c?= =?us-ascii?q?4glIDVAkBAQEMAQEYCwoCAQGDRTVGAheCXiM3Bg4BAwEBBAEBAgEFbYo3DIV?= =?us-ascii?q?KAQEBAQIBAQEQEREMAQEsDAsEAgEIEQQBAQECAiYCAgIlCxUICAIEARIIGoM?= =?us-ascii?q?BgWoDDg8BAgyaBAKBOIhfcYExgnkBAQWBNgKDSBiCEQMGgQwoAYtdF4FAP4F?= =?us-ascii?q?Xgkw+gmEBAQIBgSoeGAUQI4JQMoImi3yCWIcglCQJAoIVhlCNNpdOjSiHNY9?= =?us-ascii?q?ZAgQCBAUCDgEBBYFmIoFYcBU7gmyCQVGDH4UUhT9yAQGBJ4wiK4EEAYEgAQE?=
X-IronPort-AV: E=Sophos;i="5.63,416,1557187200"; d="scan'208";a="576909128"
Received: from rcdn-core-7.cisco.com ([173.37.93.143]) by rcdn-iport-7.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 25 Jun 2019 13:49:12 +0000
Received: from XCH-RCD-001.cisco.com (xch-rcd-001.cisco.com [173.37.102.11]) by rcdn-core-7.cisco.com (8.15.2/8.15.2) with ESMTPS id x5PDnC2x004504 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 25 Jun 2019 13:49:12 GMT
Received: from xhs-aln-003.cisco.com (173.37.135.120) by XCH-RCD-001.cisco.com (173.37.102.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 25 Jun 2019 08:49:11 -0500
Received: from xhs-aln-003.cisco.com (173.37.135.120) by xhs-aln-003.cisco.com (173.37.135.120) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 25 Jun 2019 08:49:11 -0500
Received: from NAM01-SN1-obe.outbound.protection.outlook.com (173.37.151.57) by xhs-aln-003.cisco.com (173.37.135.120) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 25 Jun 2019 08:49:11 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ODK+mamVhQX6JB6x12op99ldXwwkqD/y2Ge/Yu738k8=; b=osiamUwVEbuhHoiDOHiIuw2SsUne2Z2NBwXQLcLoeXtM79zj4VpfK+fH/7zdp/tEWMEV61znV/Wuf9p1OaQghHp/T3FofRbpWVuFTW30ypjDUltQvc/EQPgYv93aJeBloImW94QRTIeno6OU1i7B99qI0laY4P9QH6nZPtgfq5M=
Received: from BYAPR11MB2631.namprd11.prod.outlook.com (52.135.227.28) by BYAPR11MB3767.namprd11.prod.outlook.com (20.178.238.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Tue, 25 Jun 2019 13:49:10 +0000
Received: from BYAPR11MB2631.namprd11.prod.outlook.com ([fe80::ed99:b6a8:d6fb:5045]) by BYAPR11MB2631.namprd11.prod.outlook.com ([fe80::ed99:b6a8:d6fb:5045%4]) with mapi id 15.20.2008.017; Tue, 25 Jun 2019 13:49:10 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Ladislav Lhotka <lhotka@nic.cz>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] ?= ?==?utf-8?q? mandatory choice with non-presence container cas
Thread-Index: AQHVK1gFgQ5kUQYZeEyzTjzwclJSSqasYFpA
Date: Tue, 25 Jun 2019 13:49:10 +0000
Message-ID: <BYAPR11MB2631B1B25C323764194E7855B5E30@BYAPR11MB2631.namprd11.prod.outlook.com>
References: <BYAPR11MB263192DBFAA0F634DBCF0A85B5E30@BYAPR11MB2631.namprd11.prod.outlook.com> <791d-5d120380-25-51599d00@91535824> <20190625.135902.1021903277794682233.mbj@tail-f.com> <41409287f28be0e30e4bc29ef44f755434f6567f.camel@nic.cz>
In-Reply-To: <41409287f28be0e30e4bc29ef44f755434f6567f.camel@nic.cz>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=rwilton@cisco.com;
x-originating-ip: [173.38.220.41]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: fa15530a-ff4b-410d-fde9-08d6f973e695
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BYAPR11MB3767;
x-ms-traffictypediagnostic: BYAPR11MB3767:
x-ms-exchange-purlcount: 3
x-microsoft-antispam-prvs: <BYAPR11MB37677BC130AA176FB6EAF47EB5E30@BYAPR11MB3767.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:9508;
x-forefront-prvs: 0079056367
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39860400002)(396003)(136003)(189003)(199004)(51444003)(13464003)(305945005)(2906002)(33656002)(76176011)(7736002)(66574012)(74316002)(26005)(110136005)(53546011)(7696005)(99286004)(66476007)(66946007)(52536014)(6506007)(102836004)(71200400001)(71190400001)(52036007)(478600001)(2501003)(66556008)(66446008)(64756008)(14454004)(53936002)(966005)(256004)(186003)(316002)(5660300002)(81166006)(86362001)(6436002)(229853002)(8936002)(446003)(6246003)(476003)(9686003)(6306002)(55016002)(66066001)(76116006)(68736007)(486006)(11346002)(25786009)(81156014)(8676002)(6116002)(3846002)(73956011)(14444005); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR11MB3767; H:BYAPR11MB2631.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: Ne/YQVh5IMxUAI0ZbUFrKWjhjmwSeKsff72LaAL1zxJbM5p88xbL06GNxkX+pz1Iyya+YbIr5RbKFmebMnxJ4UAIrRYiXN0nSJQqCb5iynEDuyxSg0aYIpxIT+EZv09RNgrWRMrdH0aIQpX9hXKBySKTwS2bJZIkgOPFPct/avoC237PLpF6ADLt2kYfARGJmJ6FSTnL5SliBfEMizt9SRlpy8rz6mpotUgwH0dT1q+B9Orv1aUdfwBqnfWD3HFkoWP4AsBZBHSwF5poT4CsF+UgfpvcyHwB16hzyR1/c8Wzlq/b6LhyuGUl3lBHn9WetNp3/M4q0RWU2jQCjcnrV/zm9SzwLP9Kdl7VSg3lRZ1q2bqAel2WypF1Ky0S/zcYTGQe22u67Nh0U38ueBdQGkt4meUK4wLDFHxcr++bE8Q=
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: fa15530a-ff4b-410d-fde9-08d6f973e695
X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 13:49:10.3759 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: rwilton@cisco.com
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3767
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.37.102.11, xch-rcd-001.cisco.com
X-Outbound-Node: rcdn-core-7.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/Bm162NUVgcovufTLOk3xd72sFKo>
Subject: Re: [netmod] ?= ?==?utf-8?q? mandatory 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: Tue, 25 Jun 2019 13:49:17 -0000


> -----Original Message-----
> From: netmod <netmod-bounces@ietf.org> On Behalf Of Ladislav Lhotka
> Sent: 25 June 2019 14:14
> To: netmod@ietf.org
> Subject: Re: [netmod] ?= ?==?utf-8?q? mandatory choice with non-presence
> container cas
> 
> On Tue, 2019-06-25 at 13:59 +0200, Martin Bjorklund wrote:
> > Michal Vaško <mvasko@cesnet.cz> wrote:
> > > Hi Rob,
> > > actually, I have used model with the container TOP just for
> > > simplification, I have encountered the issue while implementing
> > > ietf-ssh-server model from its current draft. I have created the
> > > container "users" [1] without any "user" list instances. Now, you
> > > may argue that this is still not a valid use-case because there are
> > > no users but I only tried to satisfy the condition.
> >
> > Yes, I think that this list (user) should have a "min-elements 1".  I
> > think that matches the i ntent.
> 
> Interestingly, the "users" container actually becomes a P-container: its
> presence indicates that the corresponding case is selected.

I don't think that this makes it a P-container.



 It might make
> sense for an admin to select this case even before any users are
> configured.

Sure, the "users" container could have been marked as having presence in the YANG model.


> 
> This example also exposes the drawback of the XML representation - it
> cannot distinguish between an empty list and nothing. In JSON, the
> problems of this thread could potentially be circumvented by configuring
> 
> "users" : {
>     "user" : [
>     ]
> }

I don't think that an empty list "exists" in a configuration datastore, i.e. I don't think that it should impart any meaning, in that regard is seems somewhat like an NP-container.

Thanks,
Rob


> 
> Lada
> 
> >
> > /martin
> >
> >
> >
> > > There are some users
> > > on the system but they are generated into the configuration
> > > on-demand when operational data is requested.
> > >
> > > Regards,
> > > Michal
> > >
> > > [1]
> > > https://tools.ietf.org/html/draft-ietf-netconf-ssh-client-server-14#
> > > page-22
> > >
> > > On Tuesday, June 25, 2019 11:08 CEST, "Rob Wilton (rwilton)"
> > > <rwilton@cisco.com> wrote:
> > >
> > > > Hi Michal,
> > > >
> > > > It is not the printing of the data that makes it valid/invalid.
> > > >
> > > > I don't think that your input data was ever valid, because
> > > > "container C" doesn't satisfy the mandatory statement because it
> > > > isn't a real data node in the tree - it is instantiated when
> > > > required and may be deleted when it is no longer required.
> > > >
> > > > I.e. your model has been designed such that it can never be
> satisfied.
> > > >
> > > >
> > > > If your model was instead:
> > > >
> > > > container TOP {
> > > >   leaf L {
> > > >     type empty;
> > > >   }
> > > >   choice A {
> > > >     mandatory true;
> > > >     container C {
> > > >       leaf L2 {
> > > >         type empty;
> > > >       }
> > > >     }
> > > >   }
> > > > }
> > > >
> > > >
> > > > Then this data is valid:
> > > >
> > > > <TOP>
> > > >   <L/>
> > > >   <C>
> > > >    <L2/>
> > > >   </C>
> > > > </TOP>
> > > >
> > > >
> > > > But this data is not:
> > > >
> > > > <TOP>
> > > >   <L/>
> > > > </TOP>
> > > >
> > > >
> > > > Nor is this, which is directly equivalent to the one above,
> > > > because the <C/> container doesn't really exist if it doesn't have
> > > > a child node present.
> > > >
> > > > <TOP>
> > > >   <L/>
> > > >   <C/>
> > > > </TOP>
> > > >
> > > > Thanks,
> > > > Rob
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: Michal Vaško <mvasko@cesnet.cz>
> > > > > Sent: 24 June 2019 18:15
> > > > > To: Andy Bierman <andy@yumaworks.com>
> > > > > Cc: Rob Wilton (rwilton) <rwilton@cisco.com>om>; netmod
> > > > > <netmod@ietf.org>
> > > > > Subject: Re: [netmod] ?= mandatory choice with non-presence
> > > > > container cas
> > > > >
> > > > > 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
> > > > > > >
> > >
> > >
> > >
> > > _______________________________________________
> > > 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
> --
> Ladislav Lhotka
> Head, CZ.NIC Labs
> PGP Key ID: 0xB8F92B08A9F76C67
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod