ConfD User Community

Get_attr and get_elem


#1

Hi,

Please clarify the difference between get_attr and get_elem.
Till now we implemneted the get_elem callback and not get_attr.
I have read the guideline regarding this callback and I understand I can remove it, but I don’t understand why it is needed and if it is right to remove it.

Thanks
Inbal


#2

Hello,

get_elem() is for regular configuration elements and their values.

get_attrs() / set_attr() callbacks are required when ConfD has the “attributes” / metadata enabled.
Regular yang tree elements can be annotated with a bit of extras in run-time if needed.
This has to be explicitly enabled in ConfD configuration.
If you don’t have /confdConfig/enableAttributes turned on, you can safely set the callbacks to null…

For details see ConfD user guide, chapter 8 - Configuration Meta-Data.

jozef


#3

See the:

  • ConfD 6.4 UG Chapter 8. Configuration Meta-Data
  • confd.conf man page under /confdConfig/enableAttributes

Then see the confd_lib_dp man page. Search for the get_attrs() callback and this “note” section:

Note
It is very important to observe this distinction, i.e. to use confd_data_reply_not_found() when the node doesn’t exist, since ConfD may use get_attrs() as an existence check when attributes are enabled. (This avoids doing one callback request for existence check and another to collect the attributes.)