X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fsrc%2Fntsimulator-manager%2Fsimulator-operations.c;h=f734307030ed6b54d5fd3ce957f5763558ff7f91;hb=610985b805c2b5c730bbc247ccbf76dd624792d0;hp=2ff4207c47c6488738ac884268b923f2306e7c94;hpb=1f1479ff8ce3a268acb7b70a32bb789d859a915b;p=sim%2Fo1-interface.git diff --git a/ntsimulator/src/ntsimulator-manager/simulator-operations.c b/ntsimulator/src/ntsimulator-manager/simulator-operations.c index 2ff4207..f734307 100644 --- a/ntsimulator/src/ntsimulator-manager/simulator-operations.c +++ b/ntsimulator/src/ntsimulator-manager/simulator-operations.c @@ -908,6 +908,12 @@ int stop_device(device_stack_t *theStack) printf("Could not kill and remove docker container with uuid=\"%s\"\n", last_id); } + rc = removeDeviceEntryFromStatusFile(last_id); + if (rc != SR_ERR_OK) + { + printf("Could not remove entry from status file for uuid=\"%s\"\n", last_id); + } + pop_device(theStack); return SR_ERR_OK; @@ -1070,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(); @@ -1104,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