Re: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object
Michael Rehder <Michael.Rehder@Amdocs.com> Wed, 10 October 2018 15:23 UTC
Return-Path: <Michael.Rehder@amdocs.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 87534130F47 for <netmod@ietfa.amsl.com>; Wed, 10 Oct 2018 08:23:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.79
X-Spam-Level:
X-Spam-Status: No, score=-1.79 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, T_DKIM_INVALID=0.01] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=fail (1024-bit key) reason="fail (body has been altered)" header.d=amdocs.onmicrosoft.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 OUyz9LqmcYds for <netmod@ietfa.amsl.com>; Wed, 10 Oct 2018 08:23:37 -0700 (PDT)
Received: from mx3.amdocs.com (ramail2.amdocs.com [193.43.244.136]) (using TLSv1.2 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 84A09130E9A for <netmod@ietf.org>; Wed, 10 Oct 2018 08:23:35 -0700 (PDT)
Received: from unknown (HELO ILHFDAGDRFE2.corp.amdocs.com) ([10.224.0.130]) by ilmail02.corp.amdocs.com with ESMTP; 10 Oct 2018 18:23:31 +0300
Received: from ILRNAEXCHCAS02.corp.amdocs.com (10.232.216.232) by ILHFDAGDRFE2 (10.237.240.45) with Microsoft SMTP Server (TLS) id 14.3.399.0; Wed, 10 Oct 2018 18:23:31 +0300
Received: from ILRNAEXCHCAS02.corp.amdocs.com (10.232.216.232) by ILRNAEXCHCAS02.corp.amdocs.com (10.232.216.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.845.34; Wed, 10 Oct 2018 18:23:30 +0300
Received: from ILRNAEXCHEDGE01.corp.amdocs.com (10.233.34.167) by ILRNAEXCHCAS02.corp.amdocs.com (10.232.216.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.845.34 via Frontend Transport; Wed, 10 Oct 2018 18:23:30 +0300
Received: from EUR04-HE1-obe.outbound.protection.outlook.com (192.168.34.8) by msgedge.amdocs.com (192.168.34.211) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.845.34; Wed, 10 Oct 2018 18:23:29 +0300
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Amdocs.onmicrosoft.com; s=selector1-amdocs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5rWWCehGD4iMVEGCq42j59OoSJ1VqfbP5dMjAvuZ5UE=; b=HkpsxyTsMAvZZe5Ux2RfhTrejYVvfliEzLS9+DhS48Eh1pz7amZFcvxWoEH3845lxFA3VRTzkeUxjFVgLNikEGy5KtjPUOjSgxEBsfi922yY08nkZSGv2/Dlj5+ybaGaxi06/Hx1ugb79SwXCyWM/7imQr0wp/A79cpDmcYNeMA=
Received: from AM0PR06MB4083.eurprd06.prod.outlook.com (52.133.58.152) by AM0PR06MB4434.eurprd06.prod.outlook.com (20.176.214.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.28; Wed, 10 Oct 2018 15:23:27 +0000
Received: from AM0PR06MB4083.eurprd06.prod.outlook.com ([fe80::389e:ca21:ccc7:d6b1]) by AM0PR06MB4083.eurprd06.prod.outlook.com ([fe80::389e:ca21:ccc7:d6b1%3]) with mapi id 15.20.1207.024; Wed, 10 Oct 2018 15:23:27 +0000
From: Michael Rehder <Michael.Rehder@Amdocs.com>
To: Ladislav Lhotka <lhotka@nic.cz>, "netmod@ietf.org" <netmod@ietf.org>
CC: "Walker, Jason (Jason_Walker2@comcast.com)" <Jason_Walker2@comcast.com>
Thread-Topic: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object
Thread-Index: AdRf+I5wQXpIeuYeT8uFcZ4kUETNSAArOyOAAAESuDA=
Date: Wed, 10 Oct 2018 15:23:27 +0000
Message-ID: <AM0PR06MB40833D8AED0744BB597394E7E7E00@AM0PR06MB4083.eurprd06.prod.outlook.com>
References: <AM0PR06MB4083426FA0F1D3F6515F2ECFE7E70@AM0PR06MB4083.eurprd06.prod.outlook.com> <87zhvlvpts.fsf@nic.cz>
In-Reply-To: <87zhvlvpts.fsf@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=Michael.Rehder@Amdocs.com;
x-originating-ip: [185.139.140.77]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; AM0PR06MB4434; 6:8Tmk5lszjh7ucp4CQJ+1lXZViFHKIE3jiVBxwi06pUT0d6qF3czHkZQ5Pq8kXAFd36mRto9Ta1FUO880ODmzEA9qHgU4nqhH83H/uRT4LWWxIuHAOoqhBmBYLEdKfGGRW9CBgQzB6pnu+P7C9uU4DHneQp/zox2/NtfO6k9HxrwDoYz1/LyjVp74H+PvWoIH8wvoP8a/wYQNXMhm5oIp5qrj1aLUsJO9zWFg0SOrzkfDDaY4hdvE2G2JUeT6/5nuKn2pV7iWHUfUF2jhefcpNcGlqmAlCGyEyDNiHiwHuNrsZc16QCkoFr3Ysmnzur1/S7EgGt5TgrwcMTv/SpRLcVGct8wq3CdnJmZUz7nLvWycYdsJQxH35Yy3hmE6IA3nGk6o02oiHi2AtOvblKpbQG345abI7MT/RzpKengodMaGBxXf6VnbtjXtrN8t3WlcHNxkzYBrSPw2osAq41X7GQ==; 5:5/LdoQtKmyec9pDPt3eIgAiO8t+ldioSVcOcOH1Iw/YnO0Udluzv+vfIL8+W3OiReetfPefdCz5n15JK7S8mhfEJleu9Z/UtPqYMkmeqlFzazQZSBPUaHIhyz7ISG9NIIpyCdlMxy1QYTszeOYd3AG5Hm3UUEaPhY7P6Eed14PE=; 7:k4i44bnrYc9VRW4KE8qdXNO3Q3VyZXH9/aMCWlPklP1NY3K/MnC56SlnIWxNqEvZq0ieatvduZY7yDxX7sQd+ahPV2fFpICuktPjCM0yyMxAxi4REW3DbV4Q5b04oX4wbD0aqrbwL/NiF/I0zyJbJJKRHnl/qsvn4jaJfyda/BT0mikggFW7k5mIWX9NQk547CA4XW0IvPd/zKJZqtQnCDPo6ozvgWw5kklJ8pwePmxBvvl+Hhkd5S0Pr7zaG0dS
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: 89bf1bb8-118b-47c7-719a-08d62ec45419
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR06MB4434;
x-ms-traffictypediagnostic: AM0PR06MB4434:
x-microsoft-antispam-prvs: <AM0PR06MB4434DEDA13E96624C11EE958E7E00@AM0PR06MB4434.eurprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(131327999870524)(17755550239193)(166566539817055);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231355)(944501410)(52105095)(149066)(150057)(6041310)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991055); SRVR:AM0PR06MB4434; BCL:0; PCL:0; RULEID:; SRVR:AM0PR06MB4434;
x-forefront-prvs: 08213D42D3
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(376002)(366004)(136003)(346002)(396003)(189003)(199004)(51444003)(13464003)(53936002)(6306002)(9686003)(76176011)(2906002)(7696005)(305945005)(53546011)(6506007)(110136005)(102836004)(66066001)(99286004)(8676002)(3846002)(229853002)(55016002)(6116002)(71190400001)(68736007)(74316002)(71200400001)(7736002)(11346002)(478600001)(446003)(476003)(86362001)(8936002)(316002)(6436002)(81156014)(81166006)(186003)(72206003)(33656002)(966005)(2501003)(6246003)(5660300001)(2900100001)(4326008)(25786009)(114624004)(97736004)(486006)(26005)(105586002)(14454004)(106356001)(256004)(5250100002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR06MB4434; H:AM0PR06MB4083.eurprd06.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1;
received-spf: None (protection.outlook.com: Amdocs.com does not designate permitted sender hosts)
x-microsoft-antispam-message-info: DsF1TF0jqza4BvsAKpg4yP2/aK5dtDUjeTIXoHnHSf0RzGdFHXWoxma5y97x976eMaZ8NSq8hlXmI+og6gewyKwZiM99GCpXY+/r2CXGbv/LXI7i1TMKnRhypFPHBvpxmqrnICW+Odc1vGVIJ40zETITuyKuee9bs/YxtaIo5ydoliKLvxbebXDFqIzPIds6dUkThkYAqbpLdNMzLWSLZNxGsbRM+Ha1KIeXFpemoXmvgkWqgeLw3C5aSwmCiSGv6C+Ql6SML5b2BY4o5M3mH/0Xj0hBmcPblVLK8qKQ7NQdI4HhmYbw+daNaASDCPzJ+IZuMeI79siLFxdcRCRj6NOpXMMPxKF4nDGRHu7Nz3k=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: 89bf1bb8-118b-47c7-719a-08d62ec45419
X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Oct 2018 15:23:27.8456 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: c8eca3ca-1276-46d5-9d9d-a0f2a028920f
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR06MB4434
X-OriginatorOrg: amdocs.com
Content-Transfer-Encoding: base64
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/8Bne_bVYCMCjvmmdW0f3-NuCxW8>
Subject: Re: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object
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: Wed, 10 Oct 2018 15:23:40 -0000
Container "foo" would be mandatory if not for the "when" child element. With the "when" child element, the logic becomes "inverted" and the constraint is a negative one of "disallowed under certain condition". The UC is for enforcement in REST API payloads. For a practical example: leaf AssignmentMechanism { type enumeration { enum "DHCP"; enum "Static"; } mandatory true; description "The address assignment mechanism."; } list IPAddresses { when "../AssignmentMechanism = 'Static'"; key Address; min-elements 1; leaf Address { type capit:IPv4Address; description "An ipv4 address."; } } There is no way in the IPAddresses list to enforce that there is at least one IP Address when the assignment method is "Static". One could put a "must" on "AssignmentMechanism" to ensure at least one element of the IPAddresses list when "Static", but I don't see this as a good schema design, to have the controlling attribute check controlled attributes. I appreciate that this semantic can't be changed in YANG at this point. Could the "when" statement have a modifying child element to state that the mandatory status of the element is to be enforced? Like container foo { when "condition" { enforce-mandatory-status; } There is already back-end for existential checks for mandatory choice so this seems reasonably consistent to me. I appreciate there are existing issues for "when" but I don't see why this would make things any worse. In fact by promoting a better dependency "direction" between schema elements, think it could simplify things (so I naively think :) ). Thanks Mike > -----Original Message----- > From: Ladislav Lhotka [mailto:lhotka@nic.cz] > Sent: Wednesday, October 10, 2018 10:28 AM > To: Michael Rehder <Michael.Rehder@Amdocs.com>; netmod@ietf.org > Subject: Re: [netmod] WHEN statement within mandatory objects doesn't > ensure presence of the mandatory object > > Michael Rehder <Michael.Rehder@Amdocs.com> writes: > > > I have a question about “when” and mandatory objects. > > > > It seems to me that the implemented semantics of “when” are really > “optional when”, in that the enclosing object can be absent even though it is > mandatory and the “when” clause holds true. > > The RFC could be clearer about this. > > > > Example > > > > leaf color { > > enumeration { > > enum “blue”; > > enum “black”; > > } > > mandatory true; > > } > > container foo { > > when ../color = ‘blue’; > > etc. > > } > > > > “foo” is optional due to the presence of the “when” statement even > > though the object is mandatory (same is true for mandatory leaf, > > min-elements=1 list etc.). > > Maybe you intended to have, e.g., a "mandatory true" leaf inside "container > foo"? > > > This is considered valid XML for the above > > <color>blue</color> > > Yes, it is, under current YANG rules, no matter what "etc." stands for. Note that > evaluation of the XPath expression in this case (with "foo" missing) requires the > peculiar procedure of sec. 7.21.5 in RFC 7950. > > > > > In my view this makes conditionally variant schemas “loose” in their > > enforcement (some scenarios can use choice but it doesn’t cover > > everything). > > > > I think that mandatory should be respected for the enclosing objects > > of a “when” statement. That is, a mandatory object must be present > > when its “when” clause holds true and a Schematron statement should > > enforce that. > > In fact, this is one case where the DSDL mapping (RFC 6110) deviates from > YANG 1.0. Nodes that mandatory aren't enclosed in the RELAX NG <optional> > pattern, and are then required no matter what any "when" > statements say (because RELAX NG validation comes before Schematron). > > > > > What is the rationale behind the current YANG rules behavior, that the > > “when” Schematron mapping doesn’t check for presence of the enclosing > > mandatory object? > > FWIW, I have been repeatedly protesting against this behaviour but without > much luck. See for example > > https://www.ietf.org/mail-archive/web/netmod/current/msg14012.html > > As a result, "when" is the trickiest feature in YANG by far. > > Lada > > > > > thanks > > Mike Rehder > > -- > Ladislav Lhotka > Head, CZ.NIC Labs > PGP Key ID: 0xB8F92B08A9F76C67 “Amdocs’ email platform is based on a third-party, worldwide, cloud-based system. Any emails sent to Amdocs will be processed and stored using such system and are accessible by third party providers of such system on a limited basis. Your sending of emails to Amdocs evidences your consent to the use of such system and such processing, storing and access”.
- [netmod] WHEN statement within mandatory objects … Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Sterne, Jason (Nokia - CA/Ottawa)
- Re: [netmod] WHEN statement within mandatory obje… Ladislav Lhotka
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Robert Wilton
- Re: [netmod] WHEN statement within mandatory obje… Ladislav Lhotka
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Juergen Schoenwaelder
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Andy Bierman
- Re: [netmod] WHEN statement within mandatory obje… Ladislav Lhotka
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Andy Bierman
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Andy Bierman
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Robert Wilton
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Andy Bierman
- Re: [netmod] WHEN statement within mandatory obje… Robert Wilton
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Juergen Schoenwaelder
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Robert Wilton
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Robert Wilton
- Re: [netmod] WHEN statement within mandatory obje… Ladislav Lhotka
- Re: [netmod] WHEN statement within mandatory obje… Michael Rehder
- Re: [netmod] WHEN statement within mandatory obje… Andy Bierman
- Re: [netmod] WHEN statement within mandatory obje… Alex Campbell
- Re: [netmod] WHEN statement within mandatory obje… Andy Bierman
- Re: [netmod] WHEN statement within mandatory obje… Alex Campbell