From: Alex Stancu Date: Fri, 29 Oct 2021 12:28:42 +0000 (+0300) Subject: Make CallHome address different that the SDN Controller RESTCONF address. X-Git-Tag: 1.5.0~15 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=sim%2Fo1-interface.git;a=commitdiff_plain;h=f379349d310d61b27d2c0bf7334d2268cc8f42e2 Make CallHome address different that the SDN Controller RESTCONF address. Issue-ID: SIM-82 Change-Id: I9371b3df894c0e7ef2dbfd5e4d9a8bdb1823cf1b Signed-off-by: Alex Stancu --- diff --git a/docs/overview.rst b/docs/overview.rst index c389809..5ff4b6e 100644 --- a/docs/overview.rst +++ b/docs/overview.rst @@ -88,6 +88,7 @@ The purpose of the NTS Manager is to ease the utilization of the NTS framework. | +--rw controller-protocol? enumeration | +--rw controller-ip? inet:ip-address | +--rw controller-port? inet:port-number + | +--rw controller-netconf-call-home-ip? inet:ip-address | +--rw controller-netconf-call-home-port? inet:port-number | +--rw controller-username? string | +--rw controller-password? string @@ -140,6 +141,7 @@ Under **simulation** there are 3 configuration containers and a couple of statis - **controller-protocol** - SDN controller protocol (http/https) - **controller-ip** - the IP address of the ODL based SDN controller where the simulated devices can be mounted. Both IPv4 and IPv6 are supported - **controller-port** - the port of the ODL based SDN controller + - **controller-netconf-call-home-ip** - the IP address of the ODL based SDN controller where the simulated devices can Call Home via the NETCONF Call Home feature. - **controller-netconf-call-home-port** - the NETCONF Call Home port of the ODL based SDN controller - **controller-username** - the username to be used when connecting to the ODL based SDN controller - **controller-password** - the password to be used when connecting to the ODL based SDN controller @@ -252,6 +254,7 @@ The NTS network function represents the actual simulated device. +--rw sdn-controller | +--rw controller-ip? inet:ip-address | +--rw controller-port? inet:port-number + | +--rw controller-netconf-call-home-ip? inet:ip-address | +--rw controller-netconf-call-home-port? inet:port-number | +--rw controller-username? string | +--rw controller-password? string @@ -517,6 +520,7 @@ Below all the available enviroment variables are listed. Please note that if a v - **SDN_CONTROLLER_PROTOCOL** - protocol used for communication with the SDN controller (http or https, defaults to https) - **SDN_CONTROLLER_IP** - SDN controller IP address - **SDN_CONTROLLER_PORT** - SDN controller port +- **SDN_CONTROLLER_CALLHOME_IP** - SDN controller IP address for NETCONF call-home - **SDN_CONTROLLER_CALLHOME_PORT** - SDN controller port for NETCONF call-home - **SDN_CONTROLLER_USERNAME** - SDN controller username - **SDN_CONTROLLER_PASSWORD** - SDN controller password diff --git a/ntsimulator/.env b/ntsimulator/.env index 44ca67d..ca09877 100644 --- a/ntsimulator/.env +++ b/ntsimulator/.env @@ -1,6 +1,6 @@ DOCKER_REPO=o-ran-sc/ NTS_MANAGER_PORT=8300 -NTS_BUILD_VERSION=1.3.2 +NTS_BUILD_VERSION=1.3.7 IPv6_ENABLED=false SSH_CONNECTIONS=1 @@ -13,11 +13,12 @@ NTS_HOST_TRANSFER_FTP_BASE_PORT=2000 NTS_HOST_TRANSFER_SFTP_BASE_PORT=2000 NTS_NF_MOUNT_POINT_ADDRESSING_METHOD=host-mapping -NTS_NF_STANDALONE_START_FEATURES="datastore-populate ves-heartbeat ves-file-ready ves-pnf-registration web-cut-through" +NTS_NF_STANDALONE_START_FEATURES="datastore-populate ves-heartbeat ves-file-ready ves-pnf-registration web-cut-through netconf-call-home" SDN_CONTROLLER_PROTOCOL=http SDN_CONTROLLER_IP=172.40.0.21 SDN_CONTROLLER_PORT=8181 +SDN_CONTROLLER_CALLHOME_IP=172.40.0.22 SDN_CONTROLLER_CALLHOME_PORT=6666 SDN_CONTROLLER_USERNAME=admin SDN_CONTROLLER_PASSWORD=admin diff --git a/ntsimulator/deploy/base/yang/nts-common.yang b/ntsimulator/deploy/base/yang/nts-common.yang index 960aea8..69ac506 100644 --- a/ntsimulator/deploy/base/yang/nts-common.yang +++ b/ntsimulator/deploy/base/yang/nts-common.yang @@ -18,6 +18,12 @@ module nts-common { description "This module contains common yang definitions YANG definitions for the Network Topology Simulator."; + revision 2021-10-29 { + description + "Added separete SDN Controller IP address for NETCONF Call Home."; + reference + "O-RAN-SC SIM project"; + } revision 2021-06-08 { description "Moved NTS_PROTOCOL_TYPE_BASE identities from nts-manager."; @@ -337,6 +343,11 @@ module nts-common { description "The port exposed by the SDN Controller."; } + leaf controller-netconf-call-home-ip { + type inet:host; + description + "The IP address of the SDN Controller for the NETCONF Call Home connection."; + } leaf controller-netconf-call-home-port { type inet:port-number; description diff --git a/ntsimulator/deploy/blank/container-tag.yaml b/ntsimulator/deploy/blank/container-tag.yaml index 05ecadb..6809e94 100644 --- a/ntsimulator/deploy/blank/container-tag.yaml +++ b/ntsimulator/deploy/blank/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.6 \ No newline at end of file +tag: 1.3.7 \ 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 05ecadb..6809e94 100644 --- a/ntsimulator/deploy/nts-manager/container-tag.yaml +++ b/ntsimulator/deploy/nts-manager/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.6 \ No newline at end of file +tag: 1.3.7 \ 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 05ecadb..6809e94 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.6 \ No newline at end of file +tag: 1.3.7 \ 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 05ecadb..6809e94 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.6 \ No newline at end of file +tag: 1.3.7 \ 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 05ecadb..6809e94 100644 --- a/ntsimulator/deploy/o-ran/container-tag.yaml +++ b/ntsimulator/deploy/o-ran/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.6 \ No newline at end of file +tag: 1.3.7 \ No newline at end of file diff --git a/ntsimulator/deploy/smo-nts-ng-topology-server/container-tag.yaml b/ntsimulator/deploy/smo-nts-ng-topology-server/container-tag.yaml index 05ecadb..6809e94 100644 --- a/ntsimulator/deploy/smo-nts-ng-topology-server/container-tag.yaml +++ b/ntsimulator/deploy/smo-nts-ng-topology-server/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.6 \ No newline at end of file +tag: 1.3.7 \ 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 05ecadb..6809e94 100644 --- a/ntsimulator/deploy/x-ran/container-tag.yaml +++ b/ntsimulator/deploy/x-ran/container-tag.yaml @@ -1,2 +1,2 @@ --- -tag: 1.3.6 \ No newline at end of file +tag: 1.3.7 \ No newline at end of file diff --git a/ntsimulator/docker-compose.yaml b/ntsimulator/docker-compose.yaml index f11f0eb..ecec6b6 100644 --- a/ntsimulator/docker-compose.yaml +++ b/ntsimulator/docker-compose.yaml @@ -25,6 +25,7 @@ services: SDN_CONTROLLER_PROTOCOL: ${SDN_CONTROLLER_PROTOCOL} SDN_CONTROLLER_IP: ${SDN_CONTROLLER_IP} SDN_CONTROLLER_PORT: ${SDN_CONTROLLER_PORT} + SDN_CONTROLLER_CALLHOME_IP: ${SDN_CONTROLLER_CALLHOME_IP} SDN_CONTROLLER_CALLHOME_PORT: ${SDN_CONTROLLER_CALLHOME_PORT} SDN_CONTROLLER_USERNAME: ${SDN_CONTROLLER_USERNAME} SDN_CONTROLLER_PASSWORD: ${SDN_CONTROLLER_PASSWORD} @@ -65,6 +66,7 @@ services: SDN_CONTROLLER_PROTOCOL: ${SDN_CONTROLLER_PROTOCOL} SDN_CONTROLLER_IP: ${SDN_CONTROLLER_IP} SDN_CONTROLLER_PORT: ${SDN_CONTROLLER_PORT} + SDN_CONTROLLER_CALLHOME_IP: ${SDN_CONTROLLER_CALLHOME_IP} SDN_CONTROLLER_CALLHOME_PORT: ${SDN_CONTROLLER_CALLHOME_PORT} SDN_CONTROLLER_USERNAME: ${SDN_CONTROLLER_USERNAME} SDN_CONTROLLER_PASSWORD: ${SDN_CONTROLLER_PASSWORD} @@ -106,6 +108,7 @@ services: SDN_CONTROLLER_PROTOCOL: ${SDN_CONTROLLER_PROTOCOL} SDN_CONTROLLER_IP: ${SDN_CONTROLLER_IP} SDN_CONTROLLER_PORT: ${SDN_CONTROLLER_PORT} + SDN_CONTROLLER_CALLHOME_IP: ${SDN_CONTROLLER_CALLHOME_IP} SDN_CONTROLLER_CALLHOME_PORT: ${SDN_CONTROLLER_CALLHOME_PORT} SDN_CONTROLLER_USERNAME: ${SDN_CONTROLLER_USERNAME} SDN_CONTROLLER_PASSWORD: ${SDN_CONTROLLER_PASSWORD} diff --git a/ntsimulator/ntsim-ng/core/framework.c b/ntsimulator/ntsim-ng/core/framework.c index 131243d..1458476 100644 --- a/ntsimulator/ntsim-ng/core/framework.c +++ b/ntsimulator/ntsim-ng/core/framework.c @@ -307,6 +307,7 @@ static int framework_env_init(void) { framework_environment.sdn_controller.protocol = getenv(ENV_VAR_SDN_CONTROLLER_IP) ? strdup(getenv(ENV_VAR_SDN_CONTROLLER_PROTOCOL)) : strdup("https"); framework_environment.sdn_controller.ip = getenv(ENV_VAR_SDN_CONTROLLER_IP) ? strdup(getenv(ENV_VAR_SDN_CONTROLLER_IP)) : strdup("127.0.0.1"); framework_environment.sdn_controller.port = get_int_from_string_with_default(getenv(ENV_VAR_SDN_CONTROLLER_PORT), 8181); + framework_environment.sdn_controller.callhome_ip = getenv(ENV_VAR_SDN_CONTROLLER_CALLHOME_IP) ? strdup(getenv(ENV_VAR_SDN_CONTROLLER_CALLHOME_IP)) : strdup("127.0.0.1"); 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"); @@ -411,6 +412,7 @@ static int framework_env_init(void) { log_add_verbose(2, "[framework-env] sdn_controller.protocol = %s\n", framework_environment.sdn_controller.protocol); log_add_verbose(2, "[framework-env] sdn_controller.ip = %s\n", framework_environment.sdn_controller.ip); log_add_verbose(2, "[framework-env] sdn_controller.port = %d\n", framework_environment.sdn_controller.port); + log_add_verbose(2, "[framework-env] sdn_controller.callhome_ip = %s\n", framework_environment.sdn_controller.callhome_ip); 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); @@ -815,6 +817,7 @@ void framework_free(void) { free(framework_environment.host.ip); free(framework_environment.sdn_controller.protocol); free(framework_environment.sdn_controller.ip); + free(framework_environment.sdn_controller.callhome_ip); free(framework_environment.sdn_controller.username); free(framework_environment.sdn_controller.password); free(framework_environment.ves_endpoint.common_header_version); diff --git a/ntsimulator/ntsim-ng/core/framework.h b/ntsimulator/ntsim-ng/core/framework.h index b4fe3df..0c21791 100644 --- a/ntsimulator/ntsim-ng/core/framework.h +++ b/ntsimulator/ntsim-ng/core/framework.h @@ -49,6 +49,7 @@ #define ENV_VAR_SDN_CONTROLLER_PROTOCOL "SDN_CONTROLLER_PROTOCOL" #define ENV_VAR_SDN_CONTROLLER_IP "SDN_CONTROLLER_IP" #define ENV_VAR_SDN_CONTROLLER_PORT "SDN_CONTROLLER_PORT" +#define ENV_VAR_SDN_CONTROLLER_CALLHOME_IP "SDN_CONTROLLER_CALLHOME_IP" #define ENV_VAR_SDN_CONTROLLER_CALLHOME_PORT "SDN_CONTROLLER_CALLHOME_PORT" #define ENV_VAR_SDN_CONTROLLER_USERNAME "SDN_CONTROLLER_USERNAME" #define ENV_VAR_SDN_CONTROLLER_PASSWORD "SDN_CONTROLLER_PASSWORD" @@ -124,6 +125,7 @@ typedef struct { char *protocol; char *ip; uint16_t port; + char *callhome_ip; uint16_t callhome_port; char *username; char *password; diff --git a/ntsimulator/ntsim-ng/features/netconf_call_home/netconf_call_home.c b/ntsimulator/ntsim-ng/features/netconf_call_home/netconf_call_home.c index 59b2e58..d17a23e 100644 --- a/ntsimulator/ntsim-ng/features/netconf_call_home/netconf_call_home.c +++ b/ntsimulator/ntsim-ng/features/netconf_call_home/netconf_call_home.c @@ -137,7 +137,7 @@ static int create_ssh_callhome_endpoint(sr_session_ctx_t *current_session, struc return NTS_ERR_FAILED; } - char *controller_ip = strdup(controller->ip); + char *controller_ip = strdup(controller->nc_callhome_ip); uint16_t controller_callhome_port = controller->nc_callhome_port; controller_details_free(controller); @@ -236,7 +236,7 @@ static int create_tls_callhome_endpoint(sr_session_ctx_t *current_session, struc return NTS_ERR_FAILED; } - char *controller_ip = strdup(controller->ip); + char *controller_ip = strdup(controller->nc_callhome_ip); uint16_t controller_callhome_port = controller->nc_callhome_port; controller_details_free(controller); diff --git a/ntsimulator/ntsim-ng/utils/nts_utils.c b/ntsimulator/ntsim-ng/utils/nts_utils.c index 49c3346..92fac83 100644 --- a/ntsimulator/ntsim-ng/utils/nts_utils.c +++ b/ntsimulator/ntsim-ng/utils/nts_utils.c @@ -390,6 +390,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 +411,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 +441,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 +461,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 +597,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); diff --git a/ntsimulator/ntsim-ng/utils/nts_utils.h b/ntsimulator/ntsim-ng/utils/nts_utils.h index e986884..4369b79 100644 --- a/ntsimulator/ntsim-ng/utils/nts_utils.h +++ b/ntsimulator/ntsim-ng/utils/nts_utils.h @@ -41,6 +41,7 @@ typedef struct { typedef struct { char *ip; uint16_t port; + char *nc_callhome_ip; uint16_t nc_callhome_port; char *username; char *password;