Our yang file contains nested list as shown below:
list protocol{
key "name";
tailf:callpoint "get-oper";
leaf name; /* string type */
leaf description; /* string type */
list layer{
key "name";
tailf:callpoint "get-oper";
leaf name; /* string type */
leaf number; /* Uint32 type */
}
}
get_object() is implemented as below:
static int get_object(struct confd_trans_ctx *tctx,
confd_hkeypath_t *keypath)
{
if(CONFD_GET_XMLTAG(&(keypath->v[1][0])) == layer) {
confd_value_t v[2];
CONFD_SET_STR(&v[0], "ip");
CONFD_SET_INT32(&v[1], 3);
confd_data_reply_value_array(tctx, v, 2);
} else if(CONFD_GET_XMLTAG(&(keypath->v[1][0])) == protocol) {
confd_value_t v[4];
CONFD_SET_STR(&v[0], "ospf");
CONFD_SET_STR(&v[1], "routing protocol");
confd_data_reply_value_array(tctx, v, 2);
}
return CONFD_OK;
}
The below error is seen when the command is given from confd cli:
20-Feb-2017::17:21:28.435 ubuntu confd[3842]: devel-c get_next request for callpoint ‘get-oper’ path /protocol
20-Feb-2017::17:21:28.437 ubuntu confd[3842]: devel-c get_next succeeded for callpoint ‘get-oper’ path /protocol
20-Feb-2017::17:21:28.438 ubuntu confd[3842]: devel-c get_object request for callpoint ‘get-oper’ path /protocol{ospf}
20-Feb-2017::17:21:28.442 ubuntu confd[3842]: devel-c get_object succeeded for callpoint ‘get-oper’ path /protocol{ospf}
20-Feb-2017::17:21:28.442 ubuntu confd[3842]: devel-c bad get_object() return value: /protocol{ospf}/layer: Missing value
After that, the second list “layer” entries are added to get_object() and saw the below issue:
20-Feb-2017::17:21:28.435 ubuntu confd[3842]: devel-c get_next request for callpoint ‘get-oper’ path /protocol
20-Feb-2017::17:21:28.437 ubuntu confd[3842]: devel-c get_next succeeded for callpoint ‘get-oper’ path /protocol
20-Feb-2017::17:21:28.438 ubuntu confd[3842]: devel-c get_object request for callpoint ‘get-oper’ path /protocol{ospf}
20-Feb-2017::17:21:28.442 ubuntu confd[3842]: devel-c get_object succeeded for callpoint ‘get-oper’ path /protocol{ospf}
20-Feb-2017::17:21:28.442 ubuntu confd[3842]: devel-c bad get_object() return value: /protocol{ospf}/layer: Nested dynamic elements not allowed
static int get_object(struct confd_trans_ctx *tctx,
confd_hkeypath_t *keypath)
{
if(CONFD_GET_XMLTAG(&(keypath->v[1][0])) == layer) {
confd_value_t v[2];
CONFD_SET_STR(&v[0], "ip");
CONFD_SET_INT32(&v[1], 3);
confd_data_reply_value_array(tctx, v, 2);
} else if(CONFD_GET_XMLTAG(&(keypath->v[1][0])) == protocol) {
confd_value_t v[4];
CONFD_SET_STR(&v[0], "ospf");
CONFD_SET_STR(&v[1], "routing protocol");
CONFD_SET_STR(&v[2], "ip");
CONFD_SET_INT32(&v[3], 3);
confd_data_reply_value_array(tctx, v, 4);
}
return CONFD_OK;
}
Please let us know if the nested list is not supported for get_object().
Using confd-6.0.2 and the above yang and data provider code are the best approximation of original code.