}
sr_val_t *value = 0;
- rc = sr_get_item(session_running, NTS_NF_NETWORK_FUNCTION_MPAM_SCHEMA_XPATH, 0, &value);
+ rc = sr_get_item(current_session, NTS_NF_NETWORK_FUNCTION_MPAM_SCHEMA_XPATH, 0, &value);
if(rc == SR_ERR_OK) {
if(strcmp(value->data.enum_val, "host-mapping") == 0) {
ret = HOST_MAPPING;
}
// 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;
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);
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)) {
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;
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;
}
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)) {
+ 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);
free(instance->protocol);
free(instance->ip);
+ free(instance->nc_callhome_ip);
free(instance->base_url);
free(instance->auth_method);
free(instance->username);
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);