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

Michael Rehder <Michael.Rehder@Amdocs.com> Thu, 11 October 2018 18:14 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 7D725130EA7 for <netmod@ietfa.amsl.com>; Thu, 11 Oct 2018 11:14:44 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.788
X-Spam-Level:
X-Spam-Status: No, score=-1.788 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, T_DKIM_INVALID=0.01, URIBL_BLOCKED=0.001] 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 zfsp5ZM7Cb17 for <netmod@ietfa.amsl.com>; Thu, 11 Oct 2018 11:14:41 -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 D83871200D7 for <netmod@ietf.org>; Thu, 11 Oct 2018 11:14:39 -0700 (PDT)
Received: from unknown (HELO ILHFDAGDRFE1.corp.amdocs.com) ([10.224.0.130]) by ilmail02.corp.amdocs.com with ESMTP; 11 Oct 2018 21:14:37 +0300
Received: from ILRNAEXCHCAS02.corp.amdocs.com (10.232.216.232) by ILHFDAGDRFE1 (10.237.240.44) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 11 Oct 2018 21:14:35 +0300
Received: from ILRNAEXCHCAS01.corp.amdocs.com (10.232.216.231) 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; Thu, 11 Oct 2018 21:14:35 +0300
Received: from ILRNAEXCHEDGE02.corp.amdocs.com (10.233.34.168) by ILRNAEXCHCAS01.corp.amdocs.com (10.232.216.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.845.34 via Frontend Transport; Thu, 11 Oct 2018 21:14:35 +0300
Received: from EUR04-DB3-obe.outbound.protection.outlook.com (192.168.34.8) by msgedge.amdocs.com (192.168.34.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.1.845.34; Thu, 11 Oct 2018 21:14:34 +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=mA/sV7i2zluqlEJ2KVv0Sr5lMLC2R7yZ/3MJja2D/V8=; b=CLm4lR2ZNptxHDxmG2UIeFpbzJ3spjNfzD9fQHl9QVcYPDsir0Zww5gAnTmOPcJkf2ipL8kAiby7PeJiTzTRuQWwRNOtnLOKHJM5blHkKjTbcysc98Vf9tq6+6xMX21zNTEpZn973eVMVEf/5zeVT97hu+zoPip4zTua6nTpeA8=
Received: from DB6PR06MB4085.eurprd06.prod.outlook.com (10.168.22.154) by DB6PR06MB3894.eurprd06.prod.outlook.com (10.168.21.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1228.23; Thu, 11 Oct 2018 18:14:31 +0000
Received: from DB6PR06MB4085.eurprd06.prod.outlook.com ([fe80::e01f:4549:decc:b707]) by DB6PR06MB4085.eurprd06.prod.outlook.com ([fe80::e01f:4549:decc:b707%3]) with mapi id 15.20.1228.020; Thu, 11 Oct 2018 18:14:31 +0000
From: Michael Rehder <Michael.Rehder@Amdocs.com>
To: Andy Bierman <andy@yumaworks.com>
CC: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, "Walker, Jason (Jason_Walker2@comcast.com)" <Jason_Walker2@comcast.com>, "netmod@ietf.org" <netmod@ietf.org>
Thread-Topic: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object
Thread-Index: AdRf+I5wQXpIeuYeT8uFcZ4kUETNSAArOyOAAAESuDAAATBXgAAAIxIgAAXi54AAAG/FwAAAei6AAAKI+5AALiXBgAAAKEBg
Date: Thu, 11 Oct 2018 18:14:31 +0000
Message-ID: <DB6PR06MB408599478F23AD524F2840BCE7E10@DB6PR06MB4085.eurprd06.prod.outlook.com>
References: <AM0PR06MB4083426FA0F1D3F6515F2ECFE7E70@AM0PR06MB4083.eurprd06.prod.outlook.com> <87zhvlvpts.fsf@nic.cz> <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>
In-Reply-To: <CABCOCHRR92w3ouFmi6igg+AN=TM7BKfnaMiweOPxq_t9WTvvyg@mail.gmail.com>
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: [192.95.160.116]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; DB6PR06MB3894; 6:0Enh//t4IJXJnI1FhIBdBK9sue7mQiV7LsrxwA6lPpuOvhSqL3nuvduozLhWqc3baBOx/BoBzuietBheRcOIaWO0u2SRdmSP24D4n13Ezeyx+UxV/veLUlDgoj7FHW5Ve04u1LZ7oLdsyYWdV5ZZi/Mulr0w9uo/AtNyTqjoJkE9N+J1c4w6iokQejyfG4jaTtTlS8eFYnBzvMV8Gwg7/ZMwDM7AVKM4gmutWeoG5yNVGd6cEJ2BNq8BWI9cC2W3eLttUTIo2As+LunoXPYLq5i4hKynvEEKuJv4o4TuFhE8xkyBYCrk8bbspKGv1vMHA4bsIEnHOK27AlPnNJN2FeODrtL+og+z6a6fgUfCoRF32vacFAvO2RVO640/vxdUXZ7D3ql8pbnalh054RHVwhueGkyDM7xbYmErsnWWP3NgKvoOtgcadsSQ48hH/eMD/UR82kD2n3cU1sfX8PiO0w==; 5:ClD/+BBL1/x1Mx/YBKDvJGItwuPqzC/mYhQAxOaZGWHqNocRvq2QpKmgSzWCX4WPvjskqFA3Rl/tSO44gd9LaCNUQkpbjq5atq+6fEhEKOlPBbswSd7Elw5aKGmybxzx9cMdHRLdXbSEig9kipTjz7sjaE3jXGviH0/7L7sXPqA=; 7:QbHgFMAIUwMgRuYYNyBa8bkD5zaZrx9FgkqJO28DZSxIy8ZRTs+ws/sep0Lp/lrDO6zf/PX5AAZGk65SM4MC52AaaO8og0OwuKPcigbFbKwRSsc2ehub8SVDsE4QvFuJpWZZ799h+qxSfU75sKTf4OwDHgKfLYXsHOG2d3qB4vljEbSdMFyviGK0+LHxz8vk67LHGRug8pRbITiaQPfNSuepVBjM9WjJWvCqKOwVgamgeFT/tdFexrp6Su1lgkav
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-correlation-id: fb255749-7b1c-435d-6014-08d62fa56439
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:DB6PR06MB3894;
x-ms-traffictypediagnostic: DB6PR06MB3894:
x-microsoft-antispam-prvs: <DB6PR06MB3894C812D0249FD719DAFFD7E7E10@DB6PR06MB3894.eurprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(166566539817055)(62221491112393)(131327999870524)(95692535739014)(17755550239193)(21748063052155)(28532068793085)(190501279198761)(227612066756510)(106180626270275);
x-ms-exchange-senderadcheck: 1
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(3002001)(93006095)(93001095)(10201501046)(149066)(150057)(6041310)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051); SRVR:DB6PR06MB3894; BCL:0; PCL:0; RULEID:; SRVR:DB6PR06MB3894;
x-forefront-prvs: 08220FA8D6
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(39860400002)(346002)(366004)(376002)(396003)(136003)(51444003)(13464003)(189003)(199004)(11346002)(105586002)(66066001)(53546011)(6506007)(25786009)(4326008)(97736004)(186003)(7696005)(6436002)(5660300001)(6916009)(54896002)(236005)(9686003)(54906003)(2906002)(229853002)(6306002)(55016002)(86362001)(486006)(71200400001)(26005)(99286004)(476003)(71190400001)(76176011)(446003)(316002)(93886005)(4744004)(74316002)(7736002)(68736007)(114624004)(6116002)(3846002)(790700001)(33656002)(256004)(14444005)(102836004)(478600001)(19609705001)(5250100002)(53936002)(6246003)(53946003)(72206003)(966005)(106356001)(14454004)(81166006)(8676002)(606006)(2900100001)(81156014)(8936002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR06MB3894; H:DB6PR06MB4085.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: V9+/S5nUowFeYDoZFJGWBshFAri15x6HIERh0lt6ropYqW1mzJXjo6beL3elVv4MSoz8FCK7ECLEKHEuTS2bKu3of6JHKDc0pbSTaUlgRxOKuGCL6D43Rl3ULbbf+rxn8rJ5lvzWizJZNygl4aA1HmgMTNYGLqTCyRVBQvZwSO42J7wqzaIgiQ9Cj8DIkn02ud3XOsDYt+2sU3iOf9pJXTTwBmL0tl1cUXjJfdr62aO2Uq0Byziidu/yIBtANf/UeKR30L83GBYCdJJFc40K5ENV1l752hY+Kdyw5mBwQ1nq5oyKTXQXdr8GnBdVANp/TwKysX3zMKy+yb9qwz2NUWISS7PGhN8hAHIUaUSGv0U=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_DB6PR06MB408599478F23AD524F2840BCE7E10DB6PR06MB4085eurp_"
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: fb255749-7b1c-435d-6014-08d62fa56439
X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2018 18:14:31.6157 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: c8eca3ca-1276-46d5-9d9d-a0f2a028920f
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR06MB3894
X-OriginatorOrg: amdocs.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/b5fLeh9FR61lOLIomEhwIUiUflo>
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: Thu, 11 Oct 2018 18:14:45 -0000

There is no specific text - the text just says it is “conditional”.
However the implementation forces it optional:

-          The RNG file makes it optional (I’m not actually running this for various reasons so I’m just interpreting the file generated – maybe I misunderstand RNG)

-          Schematron doesn’t check for its existence (like it does for a mandatory choice case)

Thanks
Mike

From: Andy Bierman [mailto:andy@yumaworks.com]
Sent: Thursday, October 11, 2018 2:06 PM
To: Michael Rehder <Michael.Rehder@Amdocs.com>
Cc: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>; Walker, Jason (Jason_Walker2@comcast.com) <Jason_Walker2@comcast.com>; netmod@ietf.org
Subject: Re: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object



On Thu, Oct 11, 2018 at 11:00 AM, Michael Rehder <Michael.Rehder@amdocs.com<mailto:Michael.Rehder@amdocs.com>> wrote:
I think the wording is relevant - something can be conditional but still required.
It should be clarified that elements become implicitly “mandatory false” when a “when” statement is used.

I would like to see an enhancement to YANG to control this behavior, to allow the mandatory status to be enforced.
That is, support also “conditionally required” instead of only the current “conditionally optional”.



  leaf foo {
     when "../some-other-node = 5";
     type int32;
     mandatory true;
 }


This leaf is mandatory if the when-expr is true.
Where is the text in 7950 that says this mandatory true is ignored if when-stmt is present?



Thanks
Mike

Andy



From: Andy Bierman [mailto:andy@yumaworks.com<mailto:andy@yumaworks.com>]
Sent: Wednesday, October 10, 2018 2:52 PM
To: Michael Rehder <Michael.Rehder@Amdocs.com<mailto:Michael.Rehder@Amdocs.com>>
Cc: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de<mailto:j.schoenwaelder@jacobs-university.de>>; Walker, Jason (Jason_Walker2@comcast.com<mailto:Jason_Walker2@comcast.com>) <Jason_Walker2@comcast.com<mailto:Jason_Walker2@comcast.com>>; netmod@ietf.org<mailto:netmod@ietf.org>
Subject: Re: [netmod] WHEN statement within mandatory objects doesn't ensure presence of the mandatory object



On Wed, Oct 10, 2018 at 11:44 AM, Michael Rehder <Michael.Rehder@amdocs.com<mailto:Michael.Rehder@amdocs.com>> wrote:
Sure.

I think the RFC is unclear since it seems that the semantics are consistent in the back-end checks.
One can read the RFC and not notice by its absence that the when clause doesn't require anything to be present.

     The "when" statement makes its parent data definition statement conditional.
Should be
    The "when" statement makes its parent data definition statement conditional and optional.

This is not correct.

Step 1) if-feature makes the schema node conditional

Step 2) when-stmt makes instances of the schema-node conditional

Step 3) YANG validation applies to instances of data nodes (or the YANG default value if applicable)

Step 2 is only relevant if Step 1 is true or non-existent
Step 3 is only relevant if Step 2 is true or non-existent

Andy


I think there should be a more definite statement about this overriding any mandatory status of the parent data definition statement.
Like
     "Any mandatory status of the parent data definition statement (mandatory statement, min-element statement etc.) is overridden by this statement and made non-mandatory."

That would have made the side-effect of "when" on other declarations clearer.

Thanks
mike
> -----Original Message-----
> From: Juergen Schoenwaelder [mailto:j.schoenwaelder@jacobs-university.de<mailto:j.schoenwaelder@jacobs-university.de>]
> Sent: Wednesday, October 10, 2018 2:25 PM
> To: Michael Rehder <Michael.Rehder@Amdocs.com<mailto:Michael.Rehder@Amdocs.com>>
> Cc: Robert Wilton <rwilton@cisco.com<mailto:rwilton@cisco.com>>; Ladislav Lhotka <lhotka@nic.cz<mailto:lhotka@nic.cz>>;
> netmod@ietf.org<mailto:netmod@ietf.org>; Walker, Jason (Jason_Walker2@comcast.com<mailto:Jason_Walker2@comcast.com>)
> <Jason_Walker2@comcast.com<mailto:Jason_Walker2@comcast.com>>
> Subject: Re: [netmod] WHEN statement within mandatory objects doesn't
> ensure presence of the mandatory object
>
> Michael,
>
> what matters here is what the YANG specification (RFC 7950) says. Is there a
> reason to believe the IPAddresses list in your example can be absent or have no
> elements based on what RFC 7950 says? Or do we talk about a shortcoming of
> RFC 6110?
>
> /js
>
> On Wed, Oct 10, 2018 at 06:17:26PM +0000, Michael Rehder wrote:
> > If the list has a "when" clause the RNG file actually produces a "OneOrMore"
> which has a choice of <empty> or the list so it actually doesn't enforce the
> presence at least one row of the list (unless I'm mistaken in my reading).
> >               <oneOrMore>
> >                 <choice>
> >                   <empty/>
> >                   <element name="IPAddresses">
> >                     <element name="Address">
> >                       <ref name="types__IPv4Address"/>
> >                     </element>
> >                     <empty/>
> >                   </element>
> >                 </choice>
> >               </oneOrMore>
> >
> > A leaf/container would be a simpler example but would result in the same
> lack of enforcement of the mandatory status of an element with a "when"
> clause.
> >
> > This RNG seems consistent with the Schematron rules that "when" makes
> something optional.
> >
> >
> > I think a workaround would be choice with mandatory true and a when clause
> on the cases. This would ensure that at least one case is present since the
> mandatory clause implements a Schematron existence constraint.
> >
> > Thanks
> > Mike
> > > -----Original Message-----
> > > From: Robert Wilton [mailto:rwilton@cisco.com<mailto:rwilton@cisco.com>]
> > > Sent: Wednesday, October 10, 2018 11:33 AM
> > > To: Michael Rehder <Michael.Rehder@Amdocs.com<mailto:Michael.Rehder@Amdocs.com>>; Ladislav Lhotka
> > > <lhotka@nic.cz<mailto:lhotka@nic.cz>>; netmod@ietf.org<mailto:netmod@ietf.org>
> > > Cc: Walker, Jason (Jason_Walker2@comcast.com<mailto:Jason_Walker2@comcast.com>)
> > > <Jason_Walker2@comcast.com<mailto:Jason_Walker2@comcast.com>>
> > > Subject: Re: [netmod] WHEN statement within mandatory objects
> > > doesn't ensure presence of the mandatory object
> > >
> > > Hi Mike,
> > >
> > > I think that the YANG below already enforces what you want, or
> > > otherwise I don't follow your issue.
> > >
> > > The YANG below is valid in two cases:
> > >
> > > (1) AssignmentMechanism = DHCP, and IPAddresses is not present in
> > > the config (due to the when statement).
> > > (2) AssignmentMechanism = Static, IPAddresses exists and has at
> > > least one element (due to min-elements 1).
> > >
> > > Thanks,
> > > Rob
> > >
> > >
> > > On 10/10/2018 16:23, Michael Rehder wrote:
> > > > 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<mailto:lhotka@nic.cz>]
> > > >> Sent: Wednesday, October 10, 2018 10:28 AM
> > > >> To: Michael Rehder <Michael.Rehder@Amdocs.com<mailto:Michael.Rehder@Amdocs.com>>; netmod@ietf.org<mailto: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<mailto: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.htm
> > > >> l
> > > >>
> > > >> 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 mailing list
> > > > netmod@ietf.org<mailto:netmod@ietf.org>
> > > > https://www.ietf.org/mailman/listinfo/netmod
> >
> > “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<mailto:netmod@ietf.org>
> > https://www.ietf.org/mailman/listinfo/netmod
>
> --
> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany<https://maps.google.com/?q=Campus+Ring+1+%7C+28759+Bremen+%7C+Germany&entry=gmail&source=g>
> 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<mailto:netmod@ietf.org>
https://www.ietf.org/mailman/listinfo/netmod


“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”.

“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”.