On Fri, Oct 12, 2018 at 9:08 AM, Michael Rehder <michael.reh...@amdocs.com>
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)
>
>
>


Implementation of the when-stmt is complicated, especially if the server is
expected to be fast.
RFC 7950 has many more details than RFC 6020 about implementation of this
statement,
but it is still difficult.

The schema dictates what can be in the instance documents. The when-stmt
modifies the
schema based on what is in the instance document.  Even the default value
goes away if the
when-stmt is false (as it should). I would be very surprised if static
document validation tools could handle that.

YANG validation is already heavyweight and complex to implement.
Allowing designers to pick and choose when which constraints are active,
would make much more complex.



> Thanks
>
> Mike
>

Andy


>
>
> *From:* Robert Wilton [mailto:rwil...@cisco.com]
> *Sent:* Friday, October 12, 2018 12:06 PM
> *To:* Michael Rehder <michael.reh...@amdocs.com>
> *Cc:* Andy Bierman <a...@yumaworks.com>; Walker, Jason (
> jason_walk...@comcast.com) <jason_walk...@comcast.com>; netmod@ietf.org
> *Subject:* Re: [netmod] WHEN statement within mandatory objects doesn't
> ensure presence of the mandatory object
>
>
>
> Hi Mike,
>
>
>
> On 11/10/2018 19:05, Andy Bierman wrote:
>
>
>
>
>
> On Thu, Oct 11, 2018 at 11:00 AM, Michael Rehder <
> michael.reh...@amdocs.com> wrote:
>
> I think the wording is relevant - something can be conditional but still
> required.
>
> Yes, but I think that this is already expressed by a node that has both a
> when condition and mandatory statement.
>
>
> container a {
>
>   container x {
>
>     when "some condition";
>
>     leaf foo {
>
>       mandatory true;
>
>     }
>
>     leaf bar {
>
>       ...
>
>     }
>
>   }
>
>   container y {
>
>     leaf baz {
>
>       mandatory true;
>
>     }
>
>     leaf tee {
>
>       ...
>
>     }
>
>   }
>
> }
>
>
>
> a/x/foo is conditional (due to when) but required (if the when condition is 
> met).
>
> a/x/bar is conditional (due to when) but optional (if the when condition is 
> met).
>
> a/y/baz is unconditional but required.
>
> a/y/tee is unconditional but optional.
>
>
>
>
>
> It should be clarified that elements become implicitly “mandatory false”
> when a “when” statement is used.
>
> But they don't.
>
>
>
>
> 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”.
>
> I'm trying to understand what this would even mean.
>
> Taking your original example, but with "enforce-mandatory-status":
>
>          leaf AssignmentMechanism {
>
>             type enumeration {
>
>               enum "DHCP";
>
>               enum "Static";
>
>             }
>
>             mandatory true;
>
>             description "The address assignment mechanism.";
>
>           }
>
>           list IPAddresses {
>
>             when "../AssignmentMechanism = 'Static'" {
>
>               enforce-mandatory-status;
>
>             }  key Address;
>
>             min-elements 1;
>
>
>
>             leaf Address {
>
>               type capit:IPv4Address;
>
>               description "An ipv4 address.";
>
>             }
>
>            }
>
>
> So this means that list IPaddresses must have at least one element
> regardless of whether the when condition holds.  I.e. no matter whether the
> assignment is DHCP or Static there must always be at least one 1 address
> configured.  But I don't understand what this actually means - it seems
> like a contradiction.  What am I missing?  Please can you give a concrete
> example (in YANG) of what behaviour you are looking for.
>
> Thanks,
> Rob
>
> *“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

Reply via email to