Query regarding list and having leaves for the list


I need to implement below kind of CLI’s in YANG

ring 1 entrytime <int>
ring 1 forgettime <int>
ring 1 transittime <int>

ring value can be 1,2,3

I tried implementing this as a list with ring number as the key and with entrytime. forgettime, transittime as leaves.

But if we make ring number as key, “no ring 1” becomes a valid CLI in ConfD but I dont want this. “no” form should work for the entire CLI only, like “no ring 1 entrytime”

below is rough way I have modelled this.

container ring {
        list ring {
          key "ringnumber";
          leaf ringnumber {
            type uint8 {
              range "1..3";
          leaf entrytime  {
            type uint16 {
              range "0..65535";

Is there any better way to solve the problem.

Also for one of the leaves, I need to show only the “no” of the CLI in the running config and dont generate any CLI while setting the leaf (boolen leaf). How can this be done?


Just move tailf:cli-incomplete-no from the key leaf to the parent list (and tailf:cli-incomplete-command on the key leaf has no effect, as far as I can tell). Note that these annotations will cause that it will not be possible to remove ring entries, once an entry is created, it cannot be removed by a valid CLI command; so perhaps consider adding tailf:cli-delete-when-empty to the list.