}
// 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);
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;
}
}
}
- 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);