One question about the leaf-list min-elements usage

Hi,
I define a container as below, I have placed the leaflist-element.fxs to the confd/etc/confd/, but when start up the confd/bin/confd, it couldn’t be started and always report the error.

# /root/confd/bin/confd
CDB boot error: Init transaction failed to validate: too few /leaflist-element:aa/ipv4-remote-end-points-rec, 0 configured, at least 1 must be configured

In my opinion, when edit-config one XML file for the container and don’t contain the leaf-list ipv4-remote-end-points-rec, the error could be reported, the step is just startup the server, why the error is reported?

#cat leaflist-element.yang
module leaflist-element {
        namespace "http://test/leaflist/element";
        prefix leaflist-element;

        container aa {
                leaf ip-type {
                     type string;
                }
                leaf-list ipv4-remote-end-points-rec {
                   //     when "../ip-type = 'ipv4'";
                        min-elements 1;
                        max-elements 10;
                        type string;
                }
                leaf-list ipv6-remote-end-points-rec {
                     //   when "../ip-type = 'ipv6'";
                        min-elements 1;
                        max-elements 10;
                        type string;
                }
        }

}

Based on the above question, I have another new question.

  1. There are two new yang files
# cat leaflist-element.yang 
module leaflist-element {
        yang-version 1.1;
        namespace "http://test/leaflist/element";
        prefix leaflist-element;

        container aa {
                leaf ip-type {
                     type string;
                }
                leaf-list ipv4-remote-end-points-rec {
                        min-elements 1;
                        max-elements 10;
                        type string;
                }
                leaf-list ipv6-remote-end-points-rec {
                        min-elements 1;
                        max-elements 10;
                        type string;
                }
        }

}
# cat test-list-key.yang
module test-list-key {
        namespace "http://test/list/key";
        prefix list-key;

        container cc {
                list multikey {
                        key "a b";
                        leaf a {
                                type string;
                        }
                        leaf b {
                                type string;
                        }
                }
        }
}
  1. The XML is focus on the test-list-key.yang
# cat list-key.xml
<cc xmlns="http://test/list/key">
        <multikey>
                <a>1</a>
                <b>2</b>
        </multikey>
</cc>
  1. My question is: when edit-config the list-key.xml, whether the error-message missing mandatory container /aa: should be reported?

When you have min-elements then you need to have instance during validation, as container aa always exists (it is non presence container). Try to make container aa in a way it is presence container. But then your data model would be changed.

Hi @mnovak,
Thanks very much for the response. I got it.