Re: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object
Ladislav Lhotka <lhotka@nic.cz> Wed, 10 October 2018 14:28 UTC
Return-Path: <lhotka@nic.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 ED217130E7D for <netmod@ietfa.amsl.com>; Wed, 10 Oct 2018 07:28:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] 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 etD6Zf_vlnXt for <netmod@ietfa.amsl.com>; Wed, 10 Oct 2018 07:28:19 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 183BD130DD9 for <netmod@ietf.org>; Wed, 10 Oct 2018 07:28:19 -0700 (PDT)
Received: by trail.lhotka.name (Postfix, from userid 109) id BD7521821139; Wed, 10 Oct 2018 16:35:59 +0200 (CEST)
Received: from localhost (unknown [195.113.220.121]) by trail.lhotka.name (Postfix) with ESMTPSA id 33C6D1821137; Wed, 10 Oct 2018 16:35:58 +0200 (CEST)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Michael Rehder <Michael.Rehder@Amdocs.com>, "netmod@ietf.org" <netmod@ietf.org>
In-Reply-To: <AM0PR06MB4083426FA0F1D3F6515F2ECFE7E70@AM0PR06MB4083.eurprd06.prod.outlook.com>
References: <AM0PR06MB4083426FA0F1D3F6515F2ECFE7E70@AM0PR06MB4083.eurprd06.prod.outlook.com>
Mail-Followup-To: Michael Rehder <Michael.Rehder@Amdocs.com>, "netmod\@ietf.org" <netmod@ietf.org>
Date: Wed, 10 Oct 2018 16:28:15 +0200
Message-ID: <87zhvlvpts.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/pgQH6fKCHPojWTx7SetbtmMbdn0>
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 14:28:22 -0000
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
- [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