Re: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object

Ladislav Lhotka <lhotka@nic.cz> Wed, 17 October 2018 08:43 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 3BD87129AB8 for <netmod@ietfa.amsl.com>; Wed, 17 Oct 2018 01:43:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] 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 gxT5YpYoVZyk for <netmod@ietfa.amsl.com>; Wed, 17 Oct 2018 01:43:28 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 719DC128CF2 for <netmod@ietf.org>; Wed, 17 Oct 2018 01:43:28 -0700 (PDT)
Received: by trail.lhotka.name (Postfix, from userid 109) id 14DAB182113A; Wed, 17 Oct 2018 10:51:27 +0200 (CEST)
Received: from localhost (nat-2.nic.cz [217.31.205.2]) by trail.lhotka.name (Postfix) with ESMTPSA id 7392E1821137; Wed, 17 Oct 2018 10:51:24 +0200 (CEST)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Michael Rehder <Michael.Rehder@Amdocs.com>, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
Cc: "netmod@ietf.org" <netmod@ietf.org>
In-Reply-To: <AM0PR06MB4083C1601B887AEF73E616ADE7FE0@AM0PR06MB4083.eurprd06.prod.outlook.com>
References: <AM0PR06MB40833D8AED0744BB597394E7E7E00@AM0PR06MB4083.eurprd06.prod.outlook.com> <d322e012-2767-a045-767a-ddf57649f36e@cisco.com> <AM0PR06MB4083B172F2424F1EEF08CFA0E7E00@AM0PR06MB4083.eurprd06.prod.outlook.com> <20181010182529.rhbu56qx4ogpb3st@anna.jacobs.jacobs-university.de> <AM0PR06MB4083AB058834759ECEA3FEEEE7E00@AM0PR06MB4083.eurprd06.prod.outlook.com> <CABCOCHQKz-S2jcqeoJCtuG9U0DxOOw4musJz4DzwEtbCrEjqYA@mail.gmail.com> <DB6PR06MB4085D91F66023AC98122FEDFE7E10@DB6PR06MB4085.eurprd06.prod.outlook.com> <CABCOCHRR92w3ouFmi6igg+AN=TM7BKfnaMiweOPxq_t9WTvvyg@mail.gmail.com> <7308ac7c-aa29-8a3d-a79a-5c70b8d3f5ef@cisco.com> <AM0PR06MB40839FD87E10433E10B4377CE7E20@AM0PR06MB4083.eurprd06.prod.outlook.com> <20181013211943.mpumhw5pflgq5tf3@anna.jacobs.jacobs-university.de> <AM0PR06MB4083C1601B887AEF73E616ADE7FE0@AM0PR06MB4083.eurprd06.prod.outlook.com>
Mail-Followup-To: Michael Rehder <Michael.Rehder@Amdocs.com>, Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, "netmod\@ietf.org" <netmod@ietf.org>
Date: Wed, 17 Oct 2018 10:43:23 +0200
Message-ID: <87woqhhsk4.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/muGgrQQCIxPGbM9YBU3NCBcwGnk>
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, 17 Oct 2018 08:43:32 -0000

Michael Rehder <Michael.Rehder@Amdocs.com> writes:

> I've read rfc6110 and I didn't see any mention of "WHEN" on the
> mandatory status (section 9.1.1 Optional and Mandatory Nodes doesn't
> list it which seems a bit odd to me).

RFC 6110 was being prepared along with RFC 6020, and section 9.1.1 is
closely related to sec. 3.1 in 6020.

> The section on "WHEN" just mentions the xpath mapping, not anything
> about changing the mandatory status of the enclosing node.

If you take into account the DSDL validation procedure (Figure 2 in RFC
6110) then everything is IMO clear:

- Mandatory nodes (as defined in sec. 9.1.1) are not wrapped in
  <rng:optional> and thus are required during RELAX NG schema
  validation, no matter what any "when" expression says.

- Section 12.17 explains how when expressions are mapped to Schematron
  asserts. This means that if an instance node exists in the data and a
  when expression attached to the corresponding data node in YANG
  evaluates to false, Schematron will report a failed assert.

- Note that Schematron cannot by definition report absence of an
  instance based on the when expression attached to its data
  node: Schematron rules are only fired for elements that are present in
  the instance document. 

>
> I still think that the YANG RFC wording of "conditional" needs to indicate if the node is mandatory status is affected or not.
> Note that rfc6060 "3.1 Mandatory Nodes" doesn't mention "WHEN" (it
> does mention presence).

Perhaps this thread is just about misunderstanding of what "when" really
means, which is: Instances for which the "when" expression evaluates to
false must not be present.

It does NOT mean that instances for which the "when" expression
evaluates to true must be present.

Lada

>
> Thanks
> Mike
>> -----Original Message-----
>> From: Juergen Schoenwaelder [mailto:j.schoenwaelder@jacobs-university.de]
>> Sent: Saturday, October 13, 2018 5:20 PM
>> To: Michael Rehder <Michael.Rehder@Amdocs.com>
>> Cc: netmod@ietf.org
>> Subject: Re: [netmod] WHEN statement within mandatory objects doesn't
>> ensure presence of the mandatory object
>> 
>> On Fri, Oct 12, 2018 at 04:08:48PM +0000, Michael Rehder wrote:
>> 
>> > The mandatory statement in that case is ignored (I’ve pointed out the
>> > RNG and Schematron lack of enforcement).  WHEN trumps the mandatory
>> > status (via explicit mandatory or implicit mandatory via min-elements
>> > 1)
>> 
>> Has the RNG and Schematron been obtained following RFC 6110? If so, this may
>> be a problem with RFC 6110 but not with YANG itself. There are validators that
>> do not use RNG or Schematron.
>> 
>> /js
>> 
>> --
>> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
>> Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
>> Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>
> “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 mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67