How to know type of the leaf?

Hi All,

I have a requirement where I need to check the type of the leaf and then set the value in cdb according to the type of leaf using maapi_set_elem2().
This is required because we changed the type of the leaf from integer to string after some releases and now need to have this flexibility in code so that after upgrade or downgrade the correct data should be populated with the correct type in cdb.

Any help, suggestion or guidance would be appreciated.

Thanks!

hello,

try looking into ConfD library’s:

  • header files - $CONFD_DIR/include/confd_lib.h
  • or man page - man confd_lib_lib

and check on so called “CS nodes”…

Specifically struct confd_cs_node, and it’s field struct confd_cs_node_info info;.
There are methods in the confd_lib api that you can use to retrieve information on specified nodes of data model, and check for details that you need…
e.g.:
confd_find_cs_node() to get the node info, and then node->info.shallow_type for leaf type, etc.

Thanks for your reply, I will try this out.