I want to configure either ‘one’ or ‘two’; the following must statements
are not working. If i remove the default values, then they are working
as intended. how do I get around this limitation?
leaf one {
type uint32;
default 100;
must “not(…/two)” {
error-message “one and two cannot be configured”
}
}
leaf two {
type uint32;
default 200;
must “not(…/one)” {
error-message “one and two cannot be configured”
}
The default statement implies existence of the leaf, assuming it’s parent node “exists”. This contradicts with “one or the other” that your must statements try to enforce…
For this scenario, maybe the choice statement can address this without need of musts?
Or if you want both leafs in the config you can do something like this:
leaf one {
type uint32;
default 100;
must ". = 100 or ../two = 200" {
error-message "one and two cannot be configured";
}
}
leaf two {
type uint32;
default 200;
}
}