sr_free_val(val);
val = NULL;
- /* get the value from sysrepo, we do not care if the value did not change in our case */
- rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-ip", &val);
- if (rc != SR_ERR_OK) {
- goto sr_error;
- }
+ /* get the value from sysrepo, we do not care if the value did not change in our case */
+ rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-ip", &val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
- rc = ves_ip_changed(val->data.string_val);
- if (rc != SR_ERR_OK) {
- goto sr_error;
- }
+ rc = ves_ip_changed(val->data.string_val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
- sr_free_val(val);
- val = NULL;
+ sr_free_val(val);
+ val = NULL;
+
+ /* get the value from sysrepo, we do not care if the value did not change in our case */
+ rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-auth-method", &val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
+
+ rc = ves_auth_method_changed(val->data.enum_val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
+
+ sr_free_val(val);
+ val = NULL;
+
+ /* get the value from sysrepo, we do not care if the value did not change in our case */
+ rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-username", &val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
+
+ rc = ves_username_changed(val->data.string_val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
+
+ sr_free_val(val);
+ val = NULL;
+
+ /* get the value from sysrepo, we do not care if the value did not change in our case */
+ rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-password", &val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
+
+ rc = ves_password_changed(val->data.string_val);
+ if (rc != SR_ERR_OK) {
+ goto sr_error;
+ }
+
+ sr_free_val(val);
+ val = NULL;
/* get the value from sysrepo, we do not care if the value did not change in our case */
rc = sr_get_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-port", &val);
if (rc != SR_ERR_OK)
{
printf("Could not get Notification Counters for device with uuid=\"%s\"", current_device->device_id);
- }
+ }
+
+ char device_name[200];
+ sprintf(device_name, "%s-%d", getenv("CONTAINER_NAME"), current_device->device_number);
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "device-ip");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, device_name, "device-ip");
v[current_num_of_values - 1].type = SR_STRING_T;
v[current_num_of_values - 1].data.string_val = getenv("NTS_IP");
{
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "device-port");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, device_name, "device-port");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = current_device->netconf_port + i;
}
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "is-mounted");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, device_name, "is-mounted");
v[current_num_of_values - 1].type = SR_BOOL_T;
v[current_num_of_values - 1].data.bool_val = current_device->is_mounted;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, current_device->device_id, "operational-state");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/%s", xpath, device_name, "operational-state");
sr_val_build_str_data(&v[current_num_of_values - 1], SR_ENUM_T, "%s", operational_state);
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, current_device->device_id, "normal");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, device_name, "normal");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = vesCount.normal;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, current_device->device_id, "warning");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, device_name, "warning");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = vesCount.warning;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, current_device->device_id, "minor");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, device_name, "minor");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = vesCount.minor;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, current_device->device_id, "major");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, device_name, "major");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = vesCount.major;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, current_device->device_id, "critical");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/ves-notifications/%s", xpath, device_name, "critical");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = vesCount.critical;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, current_device->device_id, "normal");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, device_name, "normal");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = netconfCount.normal;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, current_device->device_id, "warning");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, device_name, "warning");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = netconfCount.warning;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, current_device->device_id, "minor");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, device_name, "minor");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = netconfCount.minor;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, current_device->device_id, "major");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, device_name, "major");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = netconfCount.major;
CREATE_NEW_VALUE(rc, v, current_num_of_values);
- sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, current_device->device_id, "critical");
+ sr_val_build_xpath(&v[current_num_of_values - 1], "%s[uuid='%s']/notification-count/netconf-notifications/%s", xpath, device_name, "critical");
v[current_num_of_values - 1].type = SR_UINT32_T;
v[current_num_of_values - 1].data.uint32_val = netconfCount.critical;
goto cleanup;
}
+ // setting the values that come in an ENV variable as defaults - ves-endpoint-auth-method
+
+ value = (const sr_val_t) { 0 };
+ value.type = SR_ENUM_T;
+ value.data.enum_val = getenv("VesEndpointAuthMethod");
+ rc = sr_set_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-auth-method",
+ &value, SR_EDIT_DEFAULT);
+ if (SR_ERR_OK != rc) {
+ printf("Error by sr_set_item: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ rc = ves_auth_method_changed(getenv("VesEndpointAuthMethod"));
+ if (SR_ERR_OK != rc) {
+ printf("Error by ves_auth_method_changed: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ //TODO only basic-auth implemented vor VES
+ if (strcmp(getenv("VesEndpointAuthMethod"), "basic-auth") == 0)
+ {
+ // setting the values that come in an ENV variable as defaults - ves-endpoint-usename
+
+ value = (const sr_val_t) { 0 };
+ value.type = SR_STRING_T;
+ value.data.string_val = getenv("VesEndpointUsername");
+ rc = sr_set_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-username",
+ &value, SR_EDIT_DEFAULT);
+ if (SR_ERR_OK != rc) {
+ printf("Error by sr_set_item: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ rc = ves_username_changed(getenv("VesEndpointUsername"));
+ if (SR_ERR_OK != rc) {
+ printf("Error by ves_username_changed: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ // setting the values that come in an ENV variable as defaults - ves-endpoint-password
+
+ value = (const sr_val_t) { 0 };
+ value.type = SR_STRING_T;
+ value.data.string_val = getenv("VesEndpointPassword");
+ rc = sr_set_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-endpoint-password",
+ &value, SR_EDIT_DEFAULT);
+ if (SR_ERR_OK != rc) {
+ printf("Error by sr_set_item: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ rc = ves_password_changed(getenv("VesEndpointPassword"));
+ if (SR_ERR_OK != rc) {
+ printf("Error by ves_password_changed: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+ }
+
+ // setting the values that come in an ENV variable as defaults - ves-registration
+
+ int vesRegistration = 1;
+
+ char *vesRegistrationString = getenv("VesRegistration");
+ if (vesRegistrationString != NULL)
+ {
+ if (strcmp(vesRegistrationString, "false") == 0)
+ {
+ vesRegistration = 0;
+ }
+ }
+
+ value = (const sr_val_t) { 0 };
+ value.type = SR_BOOL_T;
+ value.data.bool_val = vesRegistration;
+ rc = sr_set_item(session, "/network-topology-simulator:simulator-config/ves-endpoint-details/ves-registration",
+ &value, SR_EDIT_DEFAULT);
+ if (SR_ERR_OK != rc) {
+ printf("Error by sr_set_item: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
+ rc = ves_registration_changed(vesRegistration);
+ if (SR_ERR_OK != rc) {
+ printf("Error by ves_registration_changed: %s\n", sr_strerror(rc));
+ goto cleanup;
+ }
+
// setting the values that come in an ENV variable as defaults - ssh-connections
int sshConnections = getIntFromString(getenv("SshConnections"), 1);