Hi,
For one thing, it should be ../a-list since a-list is not a child of foo. Also - if foo is not configured and has no default value, then any must expressions in foo are not evaluated because it is not part of the "accessible tree". (I tested this in ConfD) Apart from these issues, yes it will behave as you expect - it will fail if a-list contains no entries. must "count(a-list) > 1"; is not equivalent since it requires at least two entries. However, you can more simply add a min-elements 1; statement to a-list to achieve the same goal - no XPath required. ________________________________ From: netmod <[email protected]> on behalf of Sterne, Jason (Nokia - CA/Ottawa) <[email protected]> Sent: Wednesday, 28 March 2018 1:10 p.m. To: [email protected] Subject: [netmod] YANG 'must' Xpaths, predicates and wildcards Hi all, I'm pretty sure that this xpath (e.g. in a must statement) isn't correct: (A) ../container-a/list-b[name=*]/some-leaf and should just be this instead: (B) ../container-a/list-b/some-leaf Or is the * an allowable wildcard for a key value in a predicate ? I also had a question about whether the following "must" correctly checks that at least one entry exists in a-list. container c1 { leaf foo { must "a-list"; type uint16; } list a-list { key "entry"; leaf entry { type uint16; } leaf another-entry { type uint32; } } } I think I could also replace that must with the following: must "count(a-list) > 1"; but does must "a-list"; achieve the same thing ? Rgds, Jason
_______________________________________________ netmod mailing list [email protected] https://www.ietf.org/mailman/listinfo/netmod
