X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=blobdiff_plain;f=ntsimulator%2Fsrc%2Fo-ran-notifications%2Fo-ran-notifications.c;h=a46ae042d31206594c3c6abb5b5b654f3290375d;hp=230fad26bdc949da572725faedfbd94d1ecc56e9;hb=610985b805c2b5c730bbc247ccbf76dd624792d0;hpb=a19f893a70c03dee9312e1208301d079409d84ac diff --git a/ntsimulator/src/o-ran-notifications/o-ran-notifications.c b/ntsimulator/src/o-ran-notifications/o-ran-notifications.c index 230fad2..a46ae04 100644 --- a/ntsimulator/src/o-ran-notifications/o-ran-notifications.c +++ b/ntsimulator/src/o-ran-notifications/o-ran-notifications.c @@ -389,27 +389,44 @@ main(int argc, char **argv) signal(SIGINT, sigint_handler); signal(SIGPIPE, SIG_IGN); - while (!exit_application) { - notification_delay_period = getFaultNotificationDelayPeriodFromConfigJson(); + int notif_delay[100], count = 0; - if (notification_delay_period > 0) + rc = getFaultNotificationDelayPeriodFromConfigJson(notif_delay, &count); + if (rc != SR_ERR_OK) { - send_dummy_notif(session); + printf("Could not get fault notification delay period."); + sleep(1); + continue; + } - sleep(notification_delay_period); + if (count > 1) + { + for (int i = 0; i < count; ++i) + { + sleep(notif_delay[i]); + send_dummy_notif(session); + } } - else + else if (count == 1) { - sleep(1); - // reset the counters when the notifciation delay period is switched back to 0 - netconf_alarm_counter.normal = netconf_alarm_counter.warning = \ - netconf_alarm_counter.minor = netconf_alarm_counter.major = \ - netconf_alarm_counter.critical = 0; - - ves_alarm_counter.normal = ves_alarm_counter.warning = \ - ves_alarm_counter.minor = ves_alarm_counter.major = \ - ves_alarm_counter.critical = 0; + if (notif_delay[0] > 0) + { + sleep(notif_delay[0]); + send_dummy_notif(session); + } + else + { + sleep(1); + // reset the counters when the notifciation delay period is switched back to 0 + netconf_alarm_counter.normal = netconf_alarm_counter.warning = \ + netconf_alarm_counter.minor = netconf_alarm_counter.major = \ + netconf_alarm_counter.critical = 0; + + ves_alarm_counter.normal = ves_alarm_counter.warning = \ + ves_alarm_counter.minor = ves_alarm_counter.major = \ + ves_alarm_counter.critical = 0; + } } }