X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fntsim-ng%2Futils%2Fnts_utils.c;h=d6c8a29fe11687ca6603d508b52d05e7daafae7d;hb=caec2fcb18e829420672509fe5e356b48d0c3840;hp=49c334610531023f9b362e01a23e586067385d3f;hpb=e85f9a6771693aa11baee5cd48df871da2583f6a;p=sim%2Fo1-interface.git diff --git a/ntsimulator/ntsim-ng/utils/nts_utils.c b/ntsimulator/ntsim-ng/utils/nts_utils.c index 49c3346..d6c8a29 100644 --- a/ntsimulator/ntsim-ng/utils/nts_utils.c +++ b/ntsimulator/ntsim-ng/utils/nts_utils.c @@ -201,7 +201,7 @@ nts_mount_point_addressing_method_t nts_mount_point_addressing_method_get(sr_ses } // checkAS authentication via certificate not supported yet -ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { +ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session, const char *custom_path) { assert_session(); int rc; @@ -218,11 +218,16 @@ 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.nts_mode == NTS_MODE_MANAGER) { - xpath_to_get = NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH; + if(custom_path == 0) { + if(framework_arguments.nts_mode == NTS_MODE_MANAGER) { + xpath_to_get = NTS_MANAGER_VES_ENDPOINT_CONFIG_XPATH; + } + else { + xpath_to_get = NTS_NF_VES_ENDPOINT_CONFIG_XPATH; + } } else { - xpath_to_get = NTS_NF_VES_ENDPOINT_CONFIG_XPATH; + xpath_to_get = (char *)custom_path; } rc = sr_get_subtree(current_session, xpath_to_get, 0, &data); @@ -390,6 +395,7 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) ret->protocol = 0; ret->ip = 0; ret->port = 0; + ret->nc_callhome_ip = 0; ret->nc_callhome_port = 0; ret->auth_method = 0; ret->username = 0; @@ -410,6 +416,9 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) else if(strcmp(chd->schema->name, "controller-port") == 0) { ret->port = ((const struct lyd_node_leaf_list *)chd)->value.uint16; } + else if(strcmp(chd->schema->name, "controller-netconf-call-home-ip") == 0) { + ret->nc_callhome_ip = strdup(val); + } else if(strcmp(chd->schema->name, "controller-netconf-call-home-port") == 0) { ret->nc_callhome_port = ((const struct lyd_node_leaf_list *)chd)->value.uint16; } @@ -437,9 +446,10 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) } } - if((ret->protocol == 0) || (ret->ip == 0) || (ret->auth_method == 0) || (ret->username == 0) || (ret->password == 0) || (ret->base_url == 0)) { + if((ret->protocol == 0) || (ret->ip == 0) || (ret->nc_callhome_ip == 0) || (ret->auth_method == 0) || (ret->username == 0) || (ret->password == 0) || (ret->base_url == 0)) { free(ret->protocol); free(ret->ip); + free(ret->nc_callhome_ip); free(ret->auth_method); free(ret->username); free(ret->password); @@ -456,6 +466,7 @@ void controller_details_free(controller_details_t *instance) { free(instance->protocol); free(instance->ip); + free(instance->nc_callhome_ip); free(instance->base_url); free(instance->auth_method); free(instance->username); @@ -591,6 +602,19 @@ int nts_utils_populate_info(sr_session_ctx_t *current_session, const char *funct return NTS_ERR_FAILED; } + if(strlen(framework_environment.sdn_controller.callhome_ip)) { + if(manager) { + rc = sr_set_item_str(current_session, NTS_MANAGER_SDN_CONTROLLER_CONFIG_XPATH"/controller-netconf-call-home-ip", (const char*)framework_environment.sdn_controller.callhome_ip, 0, 0); + } + else { + rc = sr_set_item_str(current_session, NTS_NF_SDN_CONTROLLER_CONFIG_XPATH"/controller-netconf-call-home-ip", (const char*)framework_environment.sdn_controller.callhome_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.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);