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
_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod