ConfD User Community

How to add the support of the leaf-list to the 5-c-stats example?


#1

Hi,

I have implemented my Yang based on 5-c-stats example.
But I have a requirement to add the leaf-list also in my model.

I see that i don’t get any callback in get_next() api if there is “leaf-list” used, but if the “list” is used then i get the callback in get_next api().
How can i achieve that?

Can you please help me in implementing the leaf-list?

Sample Yang:-

container arpentries {
    config false;
    tailf:callpoint arpe;
      leaf ip {
        type inet:ip-address;
      }
      leaf ifname {
        type string;
      }
      leaf-list sample {
          type string;
      }
}

#2

Hello,

The leaf-list request is serviced via get_elem() callback.

(leaf-list is type definition of one specific leaf, The get-next() is invoked for list keys only…)

The confd_value_t data of type C_LIST represents this.

Thus, you’ll need macros like CONFD_SET_LIST() / CONFD_GET_LIST(), CONFD_GET_LISTSIZE()when working with the data in C application…

best regards,
Joseph

ps: Theoretically, if you have one of the keys of some “list” with the type leaf-list - you will of course need to build proper value of this leaf-list inside the get-next() callback…
This is not the case of your model - there are no lists, so get-elem() only is affected…


Leaf list creation