Consider a case where we’ve set up a CDB subscription using cdb_subscribe() to a path in the YANG tree that contains a leaf-list:
leaf-list my_list {
type string;
max-elements 4;
default "abc";
default "def";
}
When we’ve polled the subscription socket for changes, we may want to examine the changes in a user defined function that we pass to cdb_diff_iterate().
static enum cdb_iter_ret
diff_iterate (confd_hkeypath_t *kp,
enum cdb_iter_op op,
confd_value_t *oldv,
confd_value_t *newv,
void *state)
{
switch (op) {
case MOP_CREATED:
case MOP_DELETED:
/* Values may have been added to - or removed from leaf-list */
// ..
break;
// ..
}
return ITER_CONTINUE;
}
However this method does not take default list values into account. So if I for example add “123” to the list, I’ll receive a MOP_CREATED event for “123” but no MOP_DELETED event for “abc” and “def”. Similarly if I remove “123” again, I will get a MOP_DELETED event for “123” but no MOP_CREATED event for “abc” and “def”. Also both oldv and newv are NULL.
If I change an ordinary leaf, I’ll get a MOP_VALUE_SET no matter if I set a new value or remove it (and thus restore the default value) and both oldv and newv are containing values that make sense.
Is this the expected behavior, or is this something that is fixed in later releases? Currently we’re on ConfD 6.6.1.