vlvassilev / yuma123

The yuma123 repository
Other
24 stars 28 forks source link

alarm-notification not working for identityref #149

Open srilchan81 opened 5 months ago

srilchan81 commented 5 months ago

Hi Vassilev,

Request to respond to this query and provide sample code.

We are trying to implement RFC 8632 alarm-notification using ietf-alarms.yang While filling the alarm fields (sample below ) , we could see that resource got filled but alarm-type-id is not filled.

alarm resource code sample :

void agt_sys_send_alarm_notification (const ses_cb_t scb) { agt_not_msg_t not; obj_template_t netconf_alarm_notification_obj; val_value_t leafval; status_t res;

if (LOGDEBUG) {
    log_debug("\nagt_sys: generating <alarm-notification> "
              "notification");
}

netconf_alarm_notification_obj =
    ncx_find_object(ietf_alarms_mod,
                    "alarm-notification");
assert(netconf_alarm_notification_obj);
not = agt_not_new_notification(netconf_alarm_notification_obj);
if (!not) {
    log_error("\nError: malloc failed; cannot "
              "send <alarm-notification>");
    return;
}
leafval = agt_make_leaf(netconf_alarm_notification_obj,"resource",
                        (const xmlChar *)"/ietf-interfaces:interfaces/interface[name='uplink_port_intf']",

&res); assert(leafval); agt_not_add_to_payload(not, leafval); } output

Incoming notification: notification { eventTime 2024-05-29T12:12:38Z alarm-notification { resource /ietf-interfaces:interfaces/interface[name='uplink_port_intf'] } }

alarm-type-id: code sample / Create a val_idref_t structure / val_idref_t leaf; memset(&leaf, 0, sizeof(val_idref_t)); leaf.identity = NULL;

res = val_parse_idref (obj_get_typdef(netconf_alarm_notification_obj), (const xmlChar *)"al:alarm-identity", &leaf.nsid, &leaf.name, &leaf.identity);

/* Call agt_make_idref_leaf */
leafval = agt_make_idref_leaf(netconf_alarm_notification_obj, (const xmlChar *)"alarm-type-id", &leaf, &res);

assert(leafval);
agt_not_add_to_payload(not, leafval);

output mgr_not: got invalid notification on session 1 (invalid value)

pls suggest if something is missed for identityref ? we need to get the alarm-type-id to be filled in alarm-notification as specified in RFC .

thanks Srilekha