CESNET/netopeer2

not able to send notification which has reference link

sukesh9995 opened this issue · 2 comments

Hi @michalvasko

I am getting this error when I try send notification which has a reference link.

sr_notif_send_tree failed EV ORIGIN: SHM event "oper get" ID 3 processing timed out.
sr_notif_send_tree failed EV ORIGIN: SHM event "oper get" ID 4 processing timed out.

yang tree looks like this

notifications:
+---n download-event
| +--ro file-name string
| +--ro status? enumeration
| +--ro error-message? string
+---n install-event
| +--ro slot-name? -> /software-inventory/software-slot/name
| +--ro status? enumeration
| +--ro error-message? string
+---n activation-event
+--ro slot-name? -> /software-inventory/software-slot/name
+--ro status? enumeration
+--ro return-code? uint8
+--ro error-message? string

download-even notifications works fine but install-even and activation-event throws error.

this is how I am sending the notification.
sr_val_t *notif = calloc(1, 2 * sizeof(sr_val_t));
notif[0].xpath = "/o-ran-software-management:install-event/slot-name";
notif[0].type = SR_STRING_T;
notif[0].data.string_val = strdup("SLOT0");
notif[1].xpath = "/o-ran-software-management:install-event/status";
notif[1].type = SR_STRING_T;
notif[1].data.string_val = strdup("COMPLETED");

if(sr_notif_send(sess, "/o-ran-software-management:install-event", notif, 2, 0, 0) != SR_ERR_OK)
{
    sr_session_get_error(sess, &err_info);
    printf("sr_notif_send_tree failed %s\n", err_info->err[0].message);
}

Before sending notification I am doing a get operation on /software-inventory.

get --filter-xpath /software-inventory
DATA

SLOT0 VALID false false READ_WRITE SLOT1 VALID false false READ_WRITE SLOT2 VALID false false READ_WRITE SLOT3 VALID false false READ_WRITE

Please let me know why i am getting error while sending notification.

Regards,
Sukesh

My guess is that you have a single thread (single subscriptions structure) handling both retrieving the state data and handling the notification. When you send the notification, these 2 events block each other and you get the timeout. Use 2 threads/subscription structures and it will work.

Thanks for the fast reply. Yes I am using single thread. Let me try 2 thread.