Hi,
I have a nested list without key as below:
I have created a callpoint for active-alarms.
Currently I am facing two issue:
1.get element is not getting called
2.nested list which is affected-objects also not getting called.
Both doesn’t have key.
I have followed 5-c_stats example. for the same.
If you can review the below code and find the issue then it will really be helpful.
int fm_status_get_elem(struct confd_trans_ctx *tctx, confd_hkeypath_t * kp)
{
confd_value_t v;
struct confd_datetime eventTime;
switch( CONFD_GET_XMLTAG(&kp->v[0][0]))
{
case o_ran_fm_fault_id:
{
alwaysLog("o_ran_fm_fault_id");
CONFD_SET_UINT16(&v,100);
confd_data_reply_value(tctx, &v);
}
break;
case o_ran_fm_fault_source:
{
alwaysLog("o_ran_fm_fault_source");
CONFD_SET_STR(&v,"SOURCE");
confd_data_reply_value(tctx, &v);
}
break;
case o_ran_fm_fault_severity:
{
alwaysLog("o_ran_fm_fault_severity");
CONFD_SET_ENUM_VALUE(&v,1);
confd_data_reply_value(tctx, &v);
}
break;
case o_ran_fm_is_cleared:
{
alwaysLog("o_ran_fm_is_cleared");
CONFD_SET_BOOL(&v,1);
confd_data_reply_value(tctx, &v);
}
break;
case o_ran_fm_fault_text:
{
alwaysLog("o_ran_fm_fault_text");
CONFD_SET_STR(&v,"TEXT");
confd_data_reply_value(tctx, &v);
}
break;
case o_ran_fm_event_time:
{
alwaysLog("o_ran_fm_event_time");
getdatetime(&eventTime);
CONFD_SET_DATETIME(&v,eventTime);
}
break;
}
return CONFD_OK;
}
Int fm_status_get_next(struct confd_trans_ctx *tctx,
confd_hkeypath_t * kp, long next)
{
confd_value_t v[2];
int pos;
alwaysLog("GET NEXT PRINT");
switch (CONFD_GET_XMLTAG(&kp->v[0][0])) {
case o_ran_fm_active_alarms:
alwaysLog("ACTIVE");
if (next == -1) { /* first call */
pos = 0;
} else {
pos = (int)next;
}
if (pos >= 6) { /* We have reached the end of the list*/
confd_data_reply_next_key(tctx, NULL, -1, -1);
return CONFD_OK;
}
CONFD_SET_UINT16(&v[0],11);
confd_data_reply_next_key(tctx, v,1, (long)(pos + 1));
break;
case o_ran_fm_affected_objects:
alwaysLog("OBJECT");
if (next == -1) { /* first call */
pos = 0;
confd_data_reply_next_key(tctx, v, 1, 1);
} else {
// pos = (int)next;
confd_data_reply_next_key(tctx, NULL, -1, -1);
}
break;
default:
return CONFD_ERR;
}
return CONFD_OK;
}
fm_status_get_next callback to get_next and fm_status_get_elem callback to get_elem
and get_next and passed to confd_register_trans_cb(dctx, &tcb) through tcb object.
Currently, only once the outer list i.e active-alarms of fm_status_get_next is printing.
Regards,
Biswajit