Below is an example of the yang file i am using:
must "../utility[utility-name]/utility-name = util-a-enum"
error-message "The util-a-enum must be specified for this utility";
What needs to happen is that if util-a-config-type is configured as a utility, the utility-name should read util-a-enum. A similar thing needs to happen for util-b-config, etc.
However, the must statement in util-a-config is unable to find utility-name, and the commit fails. I have tried various paths and none worked.
- How should the xpath be specified in this must statement?
- What debug information can I use to understand how confd evaluates the must statement, so I can figure out the xpath by myself?
If you have something like this:
$ pyang -f tree utilities.yang
| +--rw utility* [utility-name]
| +--rw utility-name utility-enumeration
| +--rw util-a-config
your must() expression here
| +--rw some-util-config
| +--rw some-util? string
$ confd_cli -u admin -C
admin connected from 127.0.0.1
# devtools true
Entering configuration mode terminal
# utilities utility util-a-enum util-a-config some-util-config some-util test
Current submode path:
utilities utility util-a-enum
# xpath must "current()/utility-name = 'util-a-enum'"
I.e. your must expression could be something like
must "current()/../utility-name = 'util-a-enum'"
And as @waitai replied to you some time ago:
Thank you for your reply!
I did use the XPath trace log, but it has so much information that I couldn’t make heads or tails of it.
As for the ‘devtools’ option in the CLI: my CLI does not have this command. I believe we are using confd 3.7.1.
I will try your proposal and let you know.
Could you tell me how to use devtools in version 3.7.1?
Upgrade to ConfD 6.3 or later, or do something like what @jlawitzke recommended to you some time ago.