Set leaf to its default value using MAAPI

Hi all,

I see that maapi_delete() can be used only to delete lists, presence containers, etc. It can’t be used to set leafs to their default values.

I read about C_DEFAULT in the documentation and then tried to do the following:

    confd_value_t value;

    memset(&value, 0, sizeof(value));
    value.type = C_DEFAULT;
    if (maapi_set_elem(maapi_sock, tid, &value, xpath) != CONFD_OK) {
            ...
    }

Unfortunately it didn’t work, maapi_set_elem() returned this error: expected type uint8, got unknown.

With that said, what would be the preferable way to set a leaf to its default value using MAAPI (if at all possible)?

Hello,

“man confd_lib_maapi” excerpt:

   int maapi_delete(int sock, int thandle, const char *fmt, ...);

   Delete an existing list entry, a presence container, or an optional leaf and all its
   children (if any) from the data tree.

Mini test on my side in e.g. transformation example where MAAPI is utilized shows it behaves as expected, maapi_delete() on leaf element resolves in default value being set.

You’re right. The documentation is quite clear about it but for some reason I misunderstood it before. Thanks for you help!