How to browse a leaf-list?

I m looking to get the last values set in my leaf-list i supose i need to use CONFD_GET_LIST and CONFD_GET_LISTSIZE. But i don’t really know how it’s work. Do you have an exemple.
In my leaf-list my type is an INT32.
In my case i do that :
conf t
add 7
add 32
i whant do get the value 7 first and the value 32 after. How i m suppose to do that ?
Thanks a lot


this depends on your actual yang model, and what “ordering” do you specify for your leaf-list.

Please see “leaf-list” statement, and corresponding ordering information in e.g.:

If ordering matters for your implementation, you will need to have “ordered-by user” sub-statement on your leaf-list element.
ConfD will yield the leaf-list array in required order then, depending on the yang model/order done when creating the leaf-list contents…

(CONFD_GET_LIST will give you array of values, order by confd internally depending on how you created it before…)

best regards,

that’s my yang model and i add some value like ts 4, ts 8, but i don’t know how to get the value with CONFD_GET_LIST.
leaf-list ts {
type uint8{
range 1…31;
tailf:info “timeslots value”;

I’m not sure what you mean. The macros that you stated are correct, you can use CONFD_GET_LISTSIZE() to get number of elements in leaf-list, and CONFD_GET_LIST() to get appropriately ordered array of confd_value_t that holds the values…

val_from_confd = ...  // get value from somewhere (MAAPI/CDB...)

unsigned int count = CONFD_GET_LISTSIZE(&val_from_confd); 
confd_value_t * values = CONFD_GET_LIST(&val_from_confd);

int i;
for (i = 0; i < count; i++) {
        // do my stuff with leaf-list element...
        confd_pp_value(some_buffer, BUFF_SIZE, &values[i]);