CORD-2034 use onos username/password from ONOSService
Change-Id: I59351262508aadbad02c8add2b0a7b759e40ab46
(cherry picked from commit 2d849271197c5c0bab279ca2b9db42670259e0f7)
diff --git a/xos/synchronizer/steps/sync_onosapp.py b/xos/synchronizer/steps/sync_onosapp.py
index 3471c36..759dc67 100644
--- a/xos/synchronizer/steps/sync_onosapp.py
+++ b/xos/synchronizer/steps/sync_onosapp.py
@@ -59,14 +59,7 @@
return None
def get_onos_service(self, o):
- if not o.owner:
- return None
-
- onoses = ONOSService.objects.filter(id=o.owner.id)
- if not onoses:
- return None
-
- return onoses[0]
+ return o.owner.leaf_model
def is_no_container(self, o):
return self.get_onos_service(o).no_container
@@ -209,6 +202,8 @@
fields["rest_configs"] = o.rest_configs
fields["component_configs"] = o.component_configs
fields["rest_hostname"] = onos.rest_hostname
+ fields["rest_username"] = onos.rest_username
+ fields["rest_password"] = onos.rest_password
fields["rest_port"] = onos.rest_port
if o.dependencies:
diff --git a/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml b/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml
index 68c5f62..3c572d7 100644
--- a/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml
+++ b/xos/synchronizer/steps/sync_onosapp_nocontainer.yaml
@@ -43,8 +43,8 @@
uri:
url: "http://{{ rest_hostname }}:{{ rest_port }}/{{ '{{' }} item.endpoint {{ '}}' }}"
body: "{{ '{{' }} item.body | to_json {{ '}}' }}"
- user: onos
- password: rocks
+ user: {{ rest_username }}
+ password: {{ rest_password }}
body_format: json
method: POST
status_code: 200, 409