Delete-when-empty not function as expected

Dear Sir/Madam,

I have a yang model with the following format:

    container hw-module {
      description
      ...
      list switch {
        description
           "Switch in the system";
          tailf:cli-suppress-mode;
          tailf:cli-incomplete-command;
          tailf:cli-delete-when-empty;
          key "switch-number";
          leaf switch-number {
            description
              "Switch number in the Stack (Refer to show switch CLI)";
            tailf:cli-incomplete-command;
            type uint8 {
              range "1..8";
            }
          }
          ...
          container auto-off {
            description "Auto off for power savings";
            leaf led {
              tailf:cli-full-command;
              description "Automatically turns off front panel port LEDs";
              type empty;
            }
          }
        }
     }



First I added the following config successfully:

hw-module switch 1 auto-off led

But when removing the config using netconf delete operation, residual/incomplete entries were observed:

hw-module switch 1

I did added “cli-delete-when-empty” tailf annotation under list switch. But the “hw-module switch 1” xpath didn’t get deleted.

The following are the netconf request send to device:

<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
  <hw-module>
    <switch>
      <switch-number>1</switch-number>
      <auto-off>
        <led operation="delete"/>
      </auto-off>
    </switch>
  </hw-module>
</native>

However, when I test this on the nesd-plus project and there is no other configuration under “hw-module switch 1”, issuing the “no” command for auto-off led generates the following XML:

sjc-ads-8387(config)# no hw-module switch 1 auto-off led
sjc-ads-8387(config)# show configuration | display xml

<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
  <hw-module>
    <switch operation="delete">
      <switch-number>1</switch-number>
    </switch>
  </hw-module>
</native>

The “hw-module switch 1” configuration was successfully removed when the NETCONF request targeted the switch level. However, when the deletion request was sent at the “auto-off led” level, the configuration became empty, but the “switch” list itself was not removed. Can anyone help me understand why this is happening? Is there a way to resolve this issue?

Thanks,

Christine.

can anyone comments on above question. Is this an expected behavior?