As a variation to http://discuss.tail-f.com/t/how-to-add-the-support-of-the-get-object-callback-to-the-5-c-stats-example/142, following is the modified YANG model:
container arpentries {
config false;
tailf:callpoint arpe;
list arpe {
key "ip ifname";
max-elements 1024;
leaf ip {
type inet:ip-address;
}
leaf ifname {
type string;
}
container stat {
leaf hwaddr {
type string;
mandatory true;
}
leaf permanent {
type boolean;
mandatory true;
}
leaf published {
type boolean;
mandatory true;
}
}
}
}
The get_object( ) implementation will look like the following:
static int get_object(struct confd_trans_ctx *tctx,
confd_hkeypath_t *keypath)
{
confd_value_t v[6];
struct aentry *ae = find_ae(keypath, tctx->t_opaque, 0);
if (ae == NULL) {
confd_data_reply_not_found(tctx);
return CONFD_OK;
}
CONFD_SET_IPV4(&v[0], ae->ip4);
CONFD_SET_STR(&v[1], ae->iface);
CONFD_SET_XMLTAG(&v[2], arpe_stat, arpe__ns);
if (ae->hwaddr == NULL) {
CONFD_SET_NOEXISTS(&v[3]);
} else {
CONFD_SET_STR(&v[3], ae->hwaddr);
}
CONFD_SET_BOOL(&v[4], ae->perm);
CONFD_SET_BOOL(&v[5], ae->pub);
confd_data_reply_value_array(tctx, v, 6);
return CONFD_OK;
}
From the above code, you will notice that the XMLTAG element of the data_reply_value_array should be set to the name of the internal container. Refer to the description for confd_data_reply_value_array( ) in the confd_lib_dp section in Volume 3 of the ConfD man-pages for more information on how to work with containers within an object.