Move username and password into the data model
Change-Id: Iab1d4dd3acdc6b08c81a256b146e9652c9b75481
diff --git a/xos/models/venb.xproto b/xos/models/venb.xproto
index 413edea..e021cc7 100644
--- a/xos/models/venb.xproto
+++ b/xos/models/venb.xproto
@@ -3,6 +3,8 @@
message VENBService (Service){
option verbose_name = "Virtual eNodeB Service";
+ required string login_user = 1 [help_text = "vENB VM login user", default = "cfguser", max_length = 32, content_type = "stripped", null = False, db_index = False, blank = False];
+ required string login_password = 2 [help_text = "vENB VM login password", default = "cfguser", max_length = 32, content_type = "stripped", null = False, db_index = False, blank = False];
}
message VENBServiceInstance (TenantWithContainer){
diff --git a/xos/synchronizer/steps/roles/ts_config/tasks/main.yaml b/xos/synchronizer/steps/roles/ts_config/tasks/main.yaml
index 4374fe9..776e6a5 100644
--- a/xos/synchronizer/steps/roles/ts_config/tasks/main.yaml
+++ b/xos/synchronizer/steps/roles/ts_config/tasks/main.yaml
@@ -13,10 +13,9 @@
# limitations under the License.
---
-# Should be in the data model, not hardcoded here...
- name: Set SSH password
set_fact:
- ansible_ssh_pass: cfguser
+ ansible_ssh_pass: "{{ password }}"
- name: check flat_network interface
shell: ifconfig | grep -B1 "inet addr:{{ ts_ip }}" | awk '$1!="inet" && $1!="--" {print $1}'
diff --git a/xos/synchronizer/steps/sync_venbserviceinstance.py b/xos/synchronizer/steps/sync_venbserviceinstance.py
index 3e4a107..2e30ecd 100644
--- a/xos/synchronizer/steps/sync_venbserviceinstance.py
+++ b/xos/synchronizer/steps/sync_venbserviceinstance.py
@@ -35,11 +35,24 @@
def __init__(self, *args, **kwargs):
super(SyncVENBServiceInstance, self).__init__(*args, **kwargs)
+ def get_service(self, o):
+ if not o.owner:
+ return None
+
+ service = VENBService.objects.filter(id=o.owner.id)
+
+ if not service:
+ return None
+
+ return service[0]
+
def get_extra_attributes(self, o):
fields = {}
fields['flat_ip'] = self.get_ip_address('flat_network', VENBServiceInstance, 'get_venb_flat_ip')
-
+ service = self.get_service(o)
+ fields['login_user'] = service.login_user
+ fields['login_password'] = service.login_password
return fields
def get_ip_address(self, network_name, service_instance, parameter):
diff --git a/xos/synchronizer/steps/venbserviceinstance_playbook.yaml b/xos/synchronizer/steps/venbserviceinstance_playbook.yaml
index 61f2c90..298d1ad 100644
--- a/xos/synchronizer/steps/venbserviceinstance_playbook.yaml
+++ b/xos/synchronizer/steps/venbserviceinstance_playbook.yaml
@@ -16,7 +16,7 @@
- hosts: {{ instance_name }}
gather_facts: False
connection: ssh
- user: cfguser
+ user: {{ login_user }}
vars:
- ts_ip: {{ flat_ip }}
- ts_mask: "255.255.255.0"
@@ -24,6 +24,7 @@
- ts_host_name: "{{ instance_name }}"
- tas_ip: "103.0.0.100"
- ntp_ip: "193.0.0.222"
+ - password: "{{ login_password }}"
roles:
- ts_config