Any difference between an empty list and an list not presence?

Hi ConfD supports,
In the example intro/1-2-3-start-query-model of ConfD User Guide, here is the configuration before deleting:

admin@C00006605% show dhcp
shared-networks {
    shared-network n1;

No configuration found after running command delete dhcp shared-networks shared-network n1:

admin@C00006605% show configuration dhcp
No entries found.
[ok][2022-01-29 13:36:15]

Here is the yang file:

  container dhcp {
    leaf default-lease-time {
      type xs:duration;
      default PT600S;
    leaf max-lease-time {
      type xs:duration;
      default PT7200S;
    leaf log-facility {
      type loglevel;
      default local7;
    container subnets {
      uses subnet;
    container shared-networks {
      list shared-network {
        key name;
        max-elements 1024;
        leaf name {
          type string;
        container subnets {
          uses subnet;

The container dhcp and shared-networks is a non-presence container, but the list shared-network has no presence or non-presence attribute. My question is:

In the implementation of CDB, the empty list is deleted when deleting the last entry of the list.
Do you think is there any difference between empty list and an list not present in configuration?
Any reason or standard choosing this implementation?


Imho not a choice, but following the standard - list statement

presence concept is defined only for container in RFC, and there is no similar concept for the list nodes…

Hi @josephm
Thank you for your reply. But I am afraid there is no clear descriptions in the standard you mentioned whether to delete the empty list when deleting the last entry of a list.
For example, suppose the list is [“a”]. If we delete the unique entry “a”, then the list becomes empty, which is []. Should we also delete the empty list?

There are two levels in relation to data model:

  • abstract data model schema
  • actual data/configuration state ​

list is defined only for former, just like non-presence container, or choice/case statements.
It does not have definition of “existence” or “absence” in the actual data state anywhere in RFC… There is no “deletion” of list being done in the CLI → you are actually deleting “all the list entries”, not list per se.

If the device data model needs to model difference between “empty list” and “no list” on the data level, you may need e.g. to combine presence container with list inside.

1 Like

This assumes that there is a definition/differentiation of empty/non-empty list on RFC level, which is unfortunately not true. :frowning:
If ConfD did implement this “narrowing down the rules defined in RFC”, it could lead to conflicts with other YANG RFC tools/dameons, that would not implement the detail in same manner…

Difference on data level can be mapped e.g. as described in my previous comment.

If it’s about specific need for CLI output, there are various tailf_yang_cli_extensions annotations that modify how data model displays in CLI. This can help to finetune to end-user needs, e.g. showing “empty list” when no entries are present. This behavior is however specific to CLI only, and other northbound APIs like RESTCONF or NETCONF are not affected…

1 Like