ConfD User Community

Operational data lists without keys

Hello Team,
I wanted to implement an operational data list without any key value. I saw the confd userguide mention the possibility of this under section 7.11.
Can you please point me to any example code that I can refer to to implement this?
Other than exists_optional, what other callbacks do I need to register to? (I need to display only a single record entry in my show command)

Regards,
Saswat

Hi Saswat,

See the simple examples.confd/intro/8-c_stats_no_key example that implements only the minimum required callbacks:

  • get_elem()
  • get_next()
  • exists_optional()

If the list can be large and you are looking for the best possible performance, you may want to check out the more advanced DP performance demo that target optimal performance for large lists by implementing the following callbacks:

  • exists_optional()
  • get_case()
  • num_instances()
  • get_object()
  • find_next()
  • find_next_object()
  • set the CONFD_DAEMON_FLAG_BULK_GET_CONTAINER flag using confd_set_daemon_flags()

Note that you should not register the get_elem() and get_next() callbacks in the above setup that target performance for larger lists (only the callbacks registered by the demo should be implemented). get_case() is only required for handling YANG “choice” statements.

Regards

1 Like

I have a single entry in my list of 5 leaf nodes. Instead of registering the “get_elem” callback, can’t I register to some callback that can return all the leaf values in just one call?

I tried registering the “get_next” and “get_next_object” callbacks for this but confd throws this error.
I have confirmed that the types defined for the leaf nodes in yang and the types used in get_next_object are the same (uint64_t in this case)
Can you please suggest if I am missing anything?

This is the error log from confd dev logs:

22-Dec-2020::15:29:21.908 wan2 confd[1579]: devel-c get_next_object request for callpoint details path /packet-tracer:packet-capture/details
22-Dec-2020::15:29:21.909 wan2 confd[1579]: devel-c get_next_object succeeded for callpoint details path /packet-tracer:packet-capture/details
22-Dec-2020::15:29:21.909 wan2 confd[1579]: devel-c expected type int64, got uint64. for path /packet-tracer:packet-capture/details

In get_next_object callback, I am populating the confd_tag_value_t structure and using the confd_data_reply_next_object_tag_value_array(tctx, val, num_elems, -1);
I have verified that this callback is hit and there is no error thrown from this callback.