Must statement to make lists mutually exclusive in a contaniner

i’m trying the following ‘must’ statement. I want to block configuring elements in both of the lists together.
At a time either of the lists must be configured. I added a must statement as shown below, but it doesn’t
work. Is the statement wrong?

container test {
list one {
key one_leaf_1;
leaf one_leaf_1 {
type string;
leaf one_leaf_2 {
type string;

list two  {
    key two_leaf_1;

    leaf two_leaf_1 {
        type string;
    leaf two_leaf_2 {
        type string;

must "('one/one_leaf_1' and 'two/two_leaf_1')" {
    error-message "cannot configure list one and two together";



Why you need a must here ?. Can’t we do with choice ?. With choice case you are sure that only one would be configurable.

Balaji Kamal Kannadassan

list_one is already present and i’m adding list_two now. For compatibility reasons i cannot change the container. nevertheless, is the must statement wrong?

Try something like:

$ confd_cli -u admin -C
# devtools true
# config
(config)# show full-configuration test
% No entries found.
(config)# xpath must "not(/test/one/one_leaf_1 and /test/two/two_leaf_1)"
(config)# test one hello
(config)# test two hello
(config)# top
(config)# xpath must "not(/test/one/one_leaf_1 and /test/two/two_leaf_1)"

must "not(one/one_leaf_1 and two/two_leaf_1)"
may be the statement you are looking for.

Or if you meant to not allow any list-entries in one list if there are list entries in the other you can use something like:
must "not(one and two)"

You will also find that enabling the xpath trace log in confd.conf will be helpful to make sure your xpath expressions are performing well and are doing what you intend them to do: