On 12/10/2018 17:08, Michael Rehder wrote:

The mandatory statement in that case is ignored (I’ve pointed out the RNG and Schematron lack of enforcement).

OK, I'm not familiar with RNG and Schematron.

WHEN trumps the mandatory status (via explicit mandatory or implicit mandatory via min-elements 1)

So I think that you are asking for mandatory to trump a when condition.  Can you provide a concrete example where this is required, or even useful?

A solution here, that doesn't require any changes in the YANG language, would be to just move the when condition, down to each of the child nodes that are not marked as mandatory.

But, sorry, at the moment I'm still at a loss to see how where this would actually be useful.

Thanks,
Rob

Thanks

Mike

*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 <mailto: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