X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=blobdiff_plain;f=ntsimulator%2Fntsim-ng%2Futils%2Fnts_utils.c;h=60fa0157d72294374d327e257bce008123b22cd0;hp=b3c7d5d8c276c0b3c095fbe8ff9baac20bac4299;hb=3bbf9d8a3c81afebcffb2b926cef219336dd53d6;hpb=312a154cc4d60a09596fba8fd1259345e048cdc2 diff --git a/ntsimulator/ntsim-ng/utils/nts_utils.c b/ntsimulator/ntsim-ng/utils/nts_utils.c index b3c7d5d..60fa015 100644 --- a/ntsimulator/ntsim-ng/utils/nts_utils.c +++ b/ntsimulator/ntsim-ng/utils/nts_utils.c @@ -26,7 +26,17 @@ #include #include -#define MOUNT_POINT_ADDRESSING_METHOD_SCHEMA_XPATH "/nts-network-function:simulation/network-function/mount-point-addressing-method" +#define NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH "/nts-manager:simulation/sdn-controller" +#define NTS_NF_SDN_CONTROLLER_CONFIG_XPATH "/nts-network-function:simulation/sdn-controller" +#define NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH "/nts-manager:simulation/ves-endpoint" +#define NTS_NF_VES_ENDPOINT_CONFIG_XPATH "/nts-network-function:simulation/ves-endpoint" + +#define NTS_NETWORK_FUNCTION_FTYPE_SCHEMA_XPATH "/nts-network-function:simulation/network-function/function-type" +#define NTS_NETWORK_FUNCTION_MPAM_SCHEMA_XPATH "/nts-network-function:simulation/network-function/mount-point-addressing-method" +#define NTS_NETWORK_FUNCTION_FAULT_GENERATION_SCHEMA_XPATH "/nts-network-function:simulation/network-function/fault-generation" +#define NTS_NETWORK_FUNCTION_NETCONF_SCHEMA_XPATH "/nts-network-function:simulation/network-function/netconf" +#define NTS_NETWORK_FUNCTION_VES_SCHEMA_XPATH "/nts-network-function:simulation/network-function/ves" + cJSON* ves_create_common_event_header(const char *domain, const char *event_type, const char *source_name, const char *priority, int seq_id) { assert(domain); @@ -39,26 +49,26 @@ cJSON* ves_create_common_event_header(const char *domain, const char *event_type asprintf(&eventId, "%s-%d", event_type, seq_id); if(eventId == 0) { - log_error("asprintf failed"); + log_error("asprintf failed\n"); return 0; } cJSON *common_event_header = cJSON_CreateObject(); if(common_event_header == 0) { - log_error("could not create JSON object"); + log_error("could not create JSON object\n"); free(eventId); return 0; } if(cJSON_AddStringToObject(common_event_header, "domain", domain) == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); free(eventId); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "eventId", eventId) == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); free(eventId); cJSON_Delete(common_event_header); return 0; @@ -67,85 +77,85 @@ cJSON* ves_create_common_event_header(const char *domain, const char *event_type free(eventId); if(cJSON_AddStringToObject(common_event_header, "eventName", event_type) == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddNumberToObject(common_event_header, "sequence", (double)(seq_id)) == 0) { - log_error("cJSON AddNumberToObject error"); + log_error("cJSON AddNumberToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "priority", priority) == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "reportingEntityId", "") == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "reportingEntityName", source_name) == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "sourceId", "") == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "sourceName", source_name) == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddNumberToObject(common_event_header, "startEpochMicrosec", (double)(useconds)) == 0) { - log_error("cJSON AddNumberToObject error"); + log_error("cJSON AddNumberToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddNumberToObject(common_event_header, "lastEpochMicrosec", (double)(useconds)) == 0) { - log_error("cJSON AddNumberToObject error"); + log_error("cJSON AddNumberToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "nfNamingCode", "sdn controller") == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "nfVendorName", "sdn") == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "timeZoneOffset", "+00:00") == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } if(cJSON_AddStringToObject(common_event_header, "version", "4.1") == 0) { - log_error("cJSON AddStringToObject error"); + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } - if(cJSON_AddStringToObject(common_event_header, "vesEventListenerVersion", "7.2") == 0) { - log_error("cJSON AddStringToObject error"); + if(cJSON_AddStringToObject(common_event_header, "vesEventListenerVersion", framework_environment.ves_endpoint.common_header_version) == 0) { + log_error("cJSON AddStringToObject error\n"); cJSON_Delete(common_event_header); return 0; } @@ -163,14 +173,14 @@ nts_mount_point_addressing_method_t nts_mount_point_addressing_method_get(sr_ses if(current_session == 0) { rc = sr_session_start(session_connection, SR_DS_RUNNING, ¤t_session); if(rc != SR_ERR_OK) { - log_error("could not start sysrepo session"); + log_error("could not start sysrepo session\n"); return ret; } session_started = true; } sr_val_t *value = 0; - rc = sr_get_item(session_running, MOUNT_POINT_ADDRESSING_METHOD_SCHEMA_XPATH, 0, &value); + rc = sr_get_item(session_running, NTS_NETWORK_FUNCTION_MPAM_SCHEMA_XPATH, 0, &value); if(rc == SR_ERR_OK) { if(strcmp(value->data.enum_val, "host-mapping") == 0) { ret = HOST_MAPPING; @@ -184,7 +194,7 @@ nts_mount_point_addressing_method_t nts_mount_point_addressing_method_get(sr_ses if(session_started) { rc = sr_session_stop(current_session); if(rc != SR_ERR_OK) { - log_error("could not stop sysrepo session"); + log_error("could not stop sysrepo session\n"); return ret; } } @@ -201,7 +211,7 @@ ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { if(current_session == 0) { rc = sr_session_start(session_connection, SR_DS_RUNNING, ¤t_session); if(rc != SR_ERR_OK) { - log_error("could not start sysrepo session"); + log_error("could not start sysrepo session\n"); return 0; } session_started = true; @@ -210,7 +220,7 @@ ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { struct lyd_node *data = 0; char *xpath_to_get; - if(framework_arguments.manager) { + if(framework_arguments.nts_mode == NTS_MODE_MANAGER) { xpath_to_get = "/nts-manager:simulation/ves-endpoint"; } else { @@ -229,7 +239,7 @@ ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { if(session_started) { rc = sr_session_stop(current_session); if(rc != SR_ERR_OK) { - log_error("could not stop sysrepo session"); + log_error("could not stop sysrepo session\n"); lyd_free(data); return 0; } @@ -243,7 +253,7 @@ ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { ves_details_t *ret = (ves_details_t *)malloc(sizeof(ves_details_t)); if(!ret) { - log_error("malloc failed"); + log_error("malloc failed\n"); lyd_free(data); return 0; } @@ -280,7 +290,14 @@ ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { } lyd_free(data); - asprintf(&ret->url, "%s://%s:%d/eventListener/v7", ret->protocol, ret->ip, ret->port); + if (strstr(ret->ip, ":")) { + // IPv6 address + asprintf(&ret->url, "%s://[%s]:%d/eventListener/v7", ret->protocol, ret->ip, ret->port); + } + else { + asprintf(&ret->url, "%s://%s:%d/eventListener/v7", ret->protocol, ret->ip, ret->port); + } + if((ret->protocol == 0) || (ret->ip == 0) || (ret->auth_method == 0) || (ret->username == 0) || (ret->password == 0) || (ret->url == 0)) { free(ret->protocol); free(ret->ip); @@ -317,7 +334,7 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) if(current_session == 0) { rc = sr_session_start(session_connection, SR_DS_RUNNING, ¤t_session); if(rc != SR_ERR_OK) { - log_error("could not start sysrepo session"); + log_error("could not start sysrepo session\n"); return 0; } session_started = true; @@ -326,7 +343,7 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) struct lyd_node *data = 0; char *xpath_to_get; - if(framework_arguments.manager) { + if(framework_arguments.nts_mode == NTS_MODE_MANAGER) { xpath_to_get = "/nts-manager:simulation/sdn-controller"; } else { @@ -345,7 +362,7 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) if(session_started) { rc = sr_session_stop(current_session); if(rc != SR_ERR_OK) { - log_error("could not stop sysrepo session"); + log_error("could not stop sysrepo session\n"); lyd_free(data); return 0; } @@ -359,7 +376,7 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) controller_details_t *ret = (controller_details_t *)malloc(sizeof(controller_details_t)); if(!ret) { - log_error("malloc failed"); + log_error("malloc failed\n"); lyd_free(data); return 0; } @@ -372,14 +389,16 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) ret->username = 0; ret->password = 0; - ret->protocol = strdup("http"); ret->auth_method = strdup("basic"); struct lyd_node *chd = 0; LY_TREE_FOR(data->child, chd) { const char *val = ((const struct lyd_node_leaf_list *)chd)->value_str; - if(strcmp(chd->schema->name, "controller-ip") == 0) { + if(strcmp(chd->schema->name, "controller-protocol") == 0) { + ret->protocol = strdup(val); + } + else if(strcmp(chd->schema->name, "controller-ip") == 0) { ret->ip = strdup(val); } else if(strcmp(chd->schema->name, "controller-port") == 0) { @@ -397,7 +416,14 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) } lyd_free(data); - asprintf(&ret->base_url, "%s://%s:%d", ret->protocol, ret->ip, ret->port); + if (strstr(ret->ip, ":")) { + // IPv6 address + asprintf(&ret->base_url, "%s://[%s]:%d", ret->protocol, ret->ip, ret->port); + } + else { + asprintf(&ret->base_url, "%s://%s:%d", ret->protocol, ret->ip, ret->port); + } + if((ret->protocol == 0) || (ret->ip == 0) || (ret->auth_method == 0) || (ret->username == 0) || (ret->password == 0) || (ret->base_url == 0)) { free(ret->protocol); free(ret->ip); @@ -423,3 +449,305 @@ void controller_details_free(controller_details_t *instance) { free(instance->password); free(instance); } + +int nts_vercmp(const char *ver1, const char *ver2) { + assert(ver1); + assert(ver2); + + int i = 0; + int v1 = 0, v2 = 0, v3 = 0; + while(ver1[i] && (ver1[i] != '.')) { + v1 *= 10; + v1 += ver1[i] - '0'; + i++; + } + + if(ver1[i]) { + i++; + while(ver1[i] && (ver1[i] != '.')) { + v2 *= 10; + v2 += ver1[i] - '0'; + i++; + } + + if(ver1[i]) { + i++; + while(ver1[i] && (ver1[i] != '.')) { + v3 *= 10; + v3 += ver1[i] - '0'; + i++; + } + } + } + + + int V1 = 0, V2 = 0, V3 = 0; + i = 0; + while(ver2[i] && (ver2[i] != '.')) { + V1 *= 10; + V1 += ver2[i] - '0'; + i++; + } + + if(ver2[i]) { + i++; + while(ver2[i] && (ver2[i] != '.')) { + V2 *= 10; + V2 += ver2[i] - '0'; + i++; + } + + if(ver2[i]) { + i++; + while(ver2[i] && (ver2[i] != '.')) { + V3 *= 10; + V3 += ver2[i] - '0'; + i++; + } + } + } + + if(v1 < V1) { + return -1; + } + else if(v1 > V1) { + return 1; + } + + if(v2 < V2) { + return -1; + } + else if(v2 > V2) { + return 1; + } + + if(v3 < V3) { + return -1; + } + else if(v3 > V3) { + return 1; + } + + return 0; +} + +int nts_utils_populate_info(sr_session_ctx_t *current_session, const char *function_type) { + assert(current_session); + assert(function_type); + + bool manager = (strcmp(function_type, "NTS_FUNCTION_TYPE_MANAGER") == 0); + + int rc; + char int_to_str[30]; + //setup sdn-controller defaults + if(strlen(framework_environment.sdn_controller.protocol)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-protocol", (const char*)framework_environment.sdn_controller.protocol, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-protocol", (const char*)framework_environment.sdn_controller.protocol, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(strlen(framework_environment.sdn_controller.ip)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-ip", (const char*)framework_environment.sdn_controller.ip, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-ip", (const char*)framework_environment.sdn_controller.ip, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + sprintf(int_to_str, "%d", framework_environment.sdn_controller.port); + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-port", (const char*)int_to_str, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-port", (const char*)int_to_str, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + sprintf(int_to_str, "%d", framework_environment.sdn_controller.callhome_port); + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-netconf-call-home-port", (const char*)int_to_str, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-netconf-call-home-port", (const char*)int_to_str, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + if(strlen(framework_environment.sdn_controller.username)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-username", (const char*)framework_environment.sdn_controller.username, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-username", (const char*)framework_environment.sdn_controller.username, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(strlen(framework_environment.sdn_controller.password)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-password", (const char*)framework_environment.sdn_controller.password, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-password", (const char*)framework_environment.sdn_controller.password, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + //setup ves-endpoint details + if(strlen(framework_environment.ves_endpoint.protocol)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-protocol", (const char*)framework_environment.ves_endpoint.protocol, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-protocol", (const char*)framework_environment.ves_endpoint.protocol, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(strlen(framework_environment.ves_endpoint.ip)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-ip", (const char*)framework_environment.ves_endpoint.ip, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-ip", (const char*)framework_environment.ves_endpoint.ip, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + sprintf(int_to_str, "%d", framework_environment.ves_endpoint.port); + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-port", (const char*)int_to_str, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-port", (const char*)int_to_str, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + if(strlen(framework_environment.ves_endpoint.auth_method)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-auth-method", (const char*)framework_environment.ves_endpoint.auth_method, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-auth-method", (const char*)framework_environment.ves_endpoint.auth_method, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(strlen(framework_environment.ves_endpoint.username)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-username", (const char*)framework_environment.ves_endpoint.username, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-username", (const char*)framework_environment.ves_endpoint.username, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(strlen(framework_environment.ves_endpoint.password)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-password", (const char*)framework_environment.ves_endpoint.password, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-password", (const char*)framework_environment.ves_endpoint.password, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(strlen(framework_environment.ves_endpoint.certificate)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-certificate", (const char*)framework_environment.ves_endpoint.certificate, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_VES_ENDPOINT_CONFIG_XPATH"/ves-endpoint-certificate", (const char*)framework_environment.ves_endpoint.certificate, 0, 0); + } + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + if(manager == false) { + //presence containers + rc = sr_set_item_str(current_session, NTS_NETWORK_FUNCTION_FAULT_GENERATION_SCHEMA_XPATH, 0, 0, 0); + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + rc = sr_set_item_str(current_session, NTS_NETWORK_FUNCTION_NETCONF_SCHEMA_XPATH, 0, 0, 0); + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + rc = sr_set_item_str(current_session, NTS_NETWORK_FUNCTION_VES_SCHEMA_XPATH, 0, 0, 0); + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + } + + //also set the network-function module for easy identifying the function type + rc = sr_set_item_str(current_session, NTS_NETWORK_FUNCTION_FTYPE_SCHEMA_XPATH, function_type, 0, 0); + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + //mount-point-addressing-method + rc = sr_set_item_str(current_session, NTS_NETWORK_FUNCTION_MPAM_SCHEMA_XPATH, "docker-mapping", 0, 0); + if(rc != SR_ERR_OK) { + log_error("sr_set_item_str failed\n"); + return NTS_ERR_FAILED; + } + + //apply all changes + rc = sr_apply_changes(current_session, 0, 0); + if(rc != SR_ERR_OK) { + log_error("sr_apply_changes failed: %s\n", sr_strerror(rc)); + return NTS_ERR_FAILED; + } + + return NTS_ERR_OK; +}