From: Alex Stancu Date: Thu, 14 Oct 2021 17:22:07 +0000 (+0300) Subject: Add SDN Controller and VES Collector addressing via a hostname instead of an IP. X-Git-Tag: 1.5.0~17 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=commitdiff_plain;h=e85f9a6771693aa11baee5cd48df871da2583f6a Add SDN Controller and VES Collector addressing via a hostname instead of an IP. Issue-ID: SIM-77 Change-Id: I8eb27c70cac1d36314dd375096a6d8adbe28052a Signed-off-by: Alex Stancu --- diff --git a/ntsimulator/deploy/blank/container-tag.yaml b/ntsimulator/deploy/blank/container-tag.yaml index b21c92a..05ecadb 100644 --- a/ntsimulator/deploy/blank/container-tag.yaml +++ b/ntsimulator/deploy/blank/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.5 \ No newline at end of file +tag: 1.3.6 \ No newline at end of file diff --git a/ntsimulator/deploy/nts-manager/container-tag.yaml b/ntsimulator/deploy/nts-manager/container-tag.yaml index b21c92a..05ecadb 100644 --- a/ntsimulator/deploy/nts-manager/container-tag.yaml +++ b/ntsimulator/deploy/nts-manager/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.5 \ No newline at end of file +tag: 1.3.6 \ No newline at end of file diff --git a/ntsimulator/deploy/o-ran-du/container-tag.yaml b/ntsimulator/deploy/o-ran-du/container-tag.yaml index b21c92a..05ecadb 100644 --- a/ntsimulator/deploy/o-ran-du/container-tag.yaml +++ b/ntsimulator/deploy/o-ran-du/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.5 \ No newline at end of file +tag: 1.3.6 \ No newline at end of file diff --git a/ntsimulator/deploy/o-ran-ru-fh/container-tag.yaml b/ntsimulator/deploy/o-ran-ru-fh/container-tag.yaml index b21c92a..05ecadb 100644 --- a/ntsimulator/deploy/o-ran-ru-fh/container-tag.yaml +++ b/ntsimulator/deploy/o-ran-ru-fh/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.5 \ No newline at end of file +tag: 1.3.6 \ No newline at end of file diff --git a/ntsimulator/deploy/o-ran/container-tag.yaml b/ntsimulator/deploy/o-ran/container-tag.yaml index b21c92a..05ecadb 100644 --- a/ntsimulator/deploy/o-ran/container-tag.yaml +++ b/ntsimulator/deploy/o-ran/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.5 \ No newline at end of file +tag: 1.3.6 \ No newline at end of file diff --git a/ntsimulator/deploy/x-ran/container-tag.yaml b/ntsimulator/deploy/x-ran/container-tag.yaml index b21c92a..05ecadb 100644 --- a/ntsimulator/deploy/x-ran/container-tag.yaml +++ b/ntsimulator/deploy/x-ran/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.5 \ No newline at end of file +tag: 1.3.6 \ No newline at end of file diff --git a/ntsimulator/ntsim-ng/core/framework.c b/ntsimulator/ntsim-ng/core/framework.c index 6d9ab48..131243d 100644 --- a/ntsimulator/ntsim-ng/core/framework.c +++ b/ntsimulator/ntsim-ng/core/framework.c @@ -310,6 +310,7 @@ static int framework_env_init(void) { framework_environment.sdn_controller.callhome_port = get_int_from_string_with_default(getenv(ENV_VAR_SDN_CONTROLLER_CALLHOME_PORT), 6666); framework_environment.sdn_controller.username = getenv(ENV_VAR_SDN_CONTROLLER_USERNAME) ? strdup(getenv(ENV_VAR_SDN_CONTROLLER_USERNAME)) : strdup("admin"); framework_environment.sdn_controller.password = getenv(ENV_VAR_SDN_CONTROLLER_PASSWORD) ? strdup(getenv(ENV_VAR_SDN_CONTROLLER_PASSWORD)) : strdup("admin"); + framework_environment.sdn_controller.port_absent = (getenv(ENV_VAR_SDN_CONTROLLER_PORT) == 0) ? true : false; framework_environment.ves_endpoint.common_header_version = getenv(ENV_VAR_VES_COMMON_HEADER_VERSION) ? strdup(getenv(ENV_VAR_VES_COMMON_HEADER_VERSION)) : strdup("7.2"); framework_environment.ves_endpoint.protocol = getenv(ENV_VAR_VES_ENDPOINT_PROTOCOL) ? strdup(getenv(ENV_VAR_VES_ENDPOINT_PROTOCOL)) : strdup("https"); @@ -319,6 +320,7 @@ static int framework_env_init(void) { framework_environment.ves_endpoint.username = getenv(ENV_VAR_VES_ENDPOINT_USERNAME) ? strdup(getenv(ENV_VAR_VES_ENDPOINT_USERNAME)) : strdup("admin"); framework_environment.ves_endpoint.password = getenv(ENV_VAR_VES_ENDPOINT_PASSWORD) ? strdup(getenv(ENV_VAR_VES_ENDPOINT_PASSWORD)) : strdup("admin"); framework_environment.ves_endpoint.certificate = getenv(ENV_VAR_VES_ENDPOINT_CERTIFICATE) ? strdup(getenv(ENV_VAR_VES_ENDPOINT_CERTIFICATE)) : strdup(""); + framework_environment.ves_endpoint.port_absent = (getenv(ENV_VAR_VES_ENDPOINT_PORT) == 0) ? true : false; log_add_verbose(2, "[framework-env] nts.manual = %d\n", framework_environment.nts.manual); log_add_verbose(2, "[framework-env] nts.version = %s\n", framework_environment.nts.version); @@ -412,6 +414,7 @@ static int framework_env_init(void) { log_add_verbose(2, "[framework-env] sdn_controller.callhome_port = %d\n", framework_environment.sdn_controller.callhome_port); log_add_verbose(2, "[framework-env] sdn_controller.username = %s\n", framework_environment.sdn_controller.username); log_add_verbose(2, "[framework-env] sdn_controller.password = %s\n", framework_environment.sdn_controller.password); + log_add_verbose(2, "[framework-env] sdn_controller.port_absent = %d\n", framework_environment.sdn_controller.port_absent); log_add_verbose(2, "[framework-env] ves_endpoint.common_header_version = %s\n", framework_environment.ves_endpoint.common_header_version); log_add_verbose(2, "[framework-env] ves_endpoint.protocol = %s\n", framework_environment.ves_endpoint.protocol); @@ -421,6 +424,7 @@ static int framework_env_init(void) { log_add_verbose(2, "[framework-env] ves_endpoint.username = %s\n", framework_environment.ves_endpoint.username); log_add_verbose(2, "[framework-env] ves_endpoint.password = %s\n", framework_environment.ves_endpoint.password); log_add_verbose(2, "[framework-env] ves_endpoint.certificate = %s\n", framework_environment.ves_endpoint.certificate); + log_add_verbose(2, "[framework-env] ves_endpoint.port_absent = %d\n", framework_environment.ves_endpoint.port_absent); log_add_verbose(2, "[framework-env] finished\n"); return NTS_ERR_OK; diff --git a/ntsimulator/ntsim-ng/core/framework.h b/ntsimulator/ntsim-ng/core/framework.h index fa791b8..b4fe3df 100644 --- a/ntsimulator/ntsim-ng/core/framework.h +++ b/ntsimulator/ntsim-ng/core/framework.h @@ -127,6 +127,7 @@ typedef struct { uint16_t callhome_port; char *username; char *password; + bool port_absent; } sdn_controller; struct { @@ -139,6 +140,7 @@ typedef struct { char *username; char *password; char *certificate; + bool port_absent; } ves_endpoint; } framework_environment_t; diff --git a/ntsimulator/ntsim-ng/utils/nts_utils.c b/ntsimulator/ntsim-ng/utils/nts_utils.c index 07d0b31..49c3346 100644 --- a/ntsimulator/ntsim-ng/utils/nts_utils.c +++ b/ntsimulator/ntsim-ng/utils/nts_utils.c @@ -293,7 +293,15 @@ ves_details_t *ves_endpoint_details_get(sr_session_ctx_t *current_session) { 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 (framework_environment.ves_endpoint.port_absent == true) { + // hostname addressing with port missing + asprintf(&ret->url, "%s://%s/eventListener/v7", ret->protocol, ret->ip); + } + else { + // normal addressing with IP and Port + 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)) { @@ -419,7 +427,14 @@ controller_details_t *controller_details_get(sr_session_ctx_t *current_session) 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 (framework_environment.sdn_controller.port_absent == true) { + // hostname without port addressing + asprintf(&ret->base_url, "%s://%s", ret->protocol, ret->ip); + } + else { + // normal IP and Port addressing + 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)) {