ConfD User Community

Tailf:sort-priority isn't apply


#1

Hello,

I have a container with a list and 2 leafs when i start my conf the priority isn’t set my group is after shutdown and i’m looking to execute group before shutdown. Can you explain why it doesn’t works ?
Thanks a lot

node
  shutdown <==== I want to execute shutdown after my list
  group 4
  group 5
  group 6
exit

 container group {
          list group-list {
             key group;
             leaf group {
                type uint32 {
                  range "0..60";
                }
                tailf:cli-drop-node-name;
             }
             leaf value {
                type uint8 {
                 range "0..30";
                 }
                tailf:sort-priority 2;
             }
             tailf:sort-priority 2;
             tailf:cli-drop-node-name;
             tailf:cli-sequence-commands;
             tailf:cli-suppress-mode;
          }
          tailf:sort-priority 2;
          tailf:cli-compact-syntax;
          tailf:cli-sequence-commands;
        }
      leaf shutdown {
          type boolean;
          tailf:sort-priority 3;
          tailf:cli-full-command;
          tailf:cli-show-with-default;
          tailf:cli-boolean-no;
          default true;
        }

#2

Are you referring to the order of the CDB subscriptions? In order to receive CDB subscriptions in your required order, you need to create different subscription points for group-list and shutdown and use the priority argument cdb_subscribe( ) or cdb_subscribe2( ) to specify the priority.


#3

That exactly what i want to do. Can you show me an example ?


#4

Hi,

Recommend taking a peak at the examples that come with ConfD. E.g.:

$ pwd
/Users/tailf/confd-6.2.1/examples.confd
$ find . -name "*.c" | xargs grep cdb_subscribe2
./cdb_subscription/twophase/twophase.c:    ret = cdb_subscribe2(ss, subtype, 0, prio, &sid, 0, argv[0]);

The source code for the confd_cmd and confd_load tools is sometimes helpful too:

$ pwd
/Users/tailf/confd-6.2.1/src/confd/tools
$ find . -name "*.c" | xargs grep cdb_subscribe2
./confd_cmd.c:    OK(cdb_subscribe2(cs, type, 0, prio, &id, 0, argv[0]));
./confd_cmd.c:    OK(cdb_subscribe2(cs, subtype, 0, prio, &id, 0, argv[1]));

#5

Thanks a lot, I have an other question, how to just change the order in confd when i show my CLI? There is a way to change the order in yang, to show my list before my leaf or container ?


#6

I get similar behavior with following yang:

    container sort-prio {

        list group-list {
            key group;
            leaf group {
                type uint8;
                tailf:sort-priority 1;
           }
            tailf:sort-priority 1;
        }

        leaf val {
            type uint8;
            tailf:sort-priority 3;
       }

       leaf val2 {
            type uint8;
            tailf:sort-priority 2;
       }
    }

The config:

config
sort-prio group-list 1
exit
sort-prio val 3 
sort-prio val2 2 
commit

Displayed config:

sort-prio val2 2
sort-prio val 3
sort-prio group-list 1

Asked ConfD developers for clarification. I will update this thread.


#7

It doesn’t works in my case, i don’t know why. I have also tailf:cli-suppress-mode statement.


#8

Even if i use sort-priority in every leaf my leaf is on the top and my list on the back. This beahvior isn’t seen with leaf-list. Priority is apply when i use leaf-list.


#9

Yes, I get similar behavior. Looks like tailf:sort-priority is not applied for list (or list is always with lowest priority). Let’s wait for response from ConfD developers.


#10

I have received response from ConfD developers. This seems to be an issue which will be fixed. tailf:sort-priority currently does not work correctly with list.


#11

Hi mnovak,

Can you please tell whether above discussed issue (i. e., tailf:sort-priority issue with list) has been resolved now?
Also, can this extension be used for web-ui or snmp configurations?

Thanks in advance!


#12

Hello. Seems like the issue was fixed in confd-6.4. Not sure how it behaves in webui or snmp, but as this is general extension (not related) to CLI, I would assume it can be used.


#13

Hi mnovak,

Thanks for the update!