X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=blobdiff_plain;f=ntsimulator%2Fsrc%2Fntsimulator-manager%2Fsimulator-operations.c;h=f734307030ed6b54d5fd3ce957f5763558ff7f91;hp=5f55f4e6e471bd28bd9f9ec4d78614a7dd9508c4;hb=610985b805c2b5c730bbc247ccbf76dd624792d0;hpb=a19f893a70c03dee9312e1208301d079409d84ac diff --git a/ntsimulator/src/ntsimulator-manager/simulator-operations.c b/ntsimulator/src/ntsimulator-manager/simulator-operations.c index 5f55f4e..f734307 100644 --- a/ntsimulator/src/ntsimulator-manager/simulator-operations.c +++ b/ntsimulator/src/ntsimulator-manager/simulator-operations.c @@ -1076,7 +1076,7 @@ char* get_docker_container_resource_stats(device_stack_t *theStack) return NULL; /* return with exit code indicating success. */ } -int notification_delay_period_changed(int period) +int notification_delay_period_changed(sr_val_t *val, size_t count) { char *stringConfiguration = readConfigFileInString(); @@ -1110,15 +1110,49 @@ int notification_delay_period_changed(int period) } cJSON *faultNotifDelay = cJSON_GetObjectItemCaseSensitive(notifConfig, "fault-notification-delay-period"); - if (!cJSON_IsNumber(faultNotifDelay)) + if (!cJSON_IsArray(faultNotifDelay)) { - printf("Configuration JSON is not as expected: fault-notification-delay-period is not an object"); + printf("Configuration JSON is not as expected: fault-notification-delay-period is not an array."); cJSON_Delete(jsonConfig); return SR_ERR_OPERATION_FAILED; } - //we set the value of the fault-notification-delay-period object - cJSON_SetNumberValue(faultNotifDelay, period); + cJSON_DeleteItemFromObject(notifConfig, "fault-notification-delay-period"); + + faultNotifDelay = NULL; + + faultNotifDelay = cJSON_CreateArray(); + if (faultNotifDelay == NULL) + { + cJSON_Delete(jsonConfig); + return SR_ERR_OPERATION_FAILED; + } + cJSON_AddItemToObject(notifConfig, "fault-notification-delay-period", faultNotifDelay); + + if (val != NULL && count > 0) + { + cJSON *arrayEntry = NULL; + for (size_t i=0; i