summaryrefslogtreecommitdiffstats
path: root/doctor_tests/app_manager/sample.py
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2019-11-07 13:09:45 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2019-11-19 06:58:07 +0000
commita0528f67abe01f0bb4be3565cfef4fd049afa1fa (patch)
tree04b542e405e951067a8a65b09ce8a0e6ebf7e09b /doctor_tests/app_manager/sample.py
parente961ab783887a9c44d2a321df646f1c49f83b299 (diff)
Maintenance support for latest Fenix, python3 and Fuel
JIRA: DOCTOR-134 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com> Change-Id: I51a93637f30b0eece2075a8277616fb97a1b230e
Diffstat (limited to 'doctor_tests/app_manager/sample.py')
-rw-r--r--doctor_tests/app_manager/sample.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/doctor_tests/app_manager/sample.py b/doctor_tests/app_manager/sample.py
index a7bc4126..94049aa2 100644
--- a/doctor_tests/app_manager/sample.py
+++ b/doctor_tests/app_manager/sample.py
@@ -17,6 +17,7 @@ import requests
from doctor_tests.app_manager.base import BaseAppManager
from doctor_tests.identity_auth import get_identity_auth
from doctor_tests.identity_auth import get_session
+from doctor_tests.os_clients import neutron_client
from doctor_tests.os_clients import nova_client
@@ -56,12 +57,16 @@ class AppManager(Thread):
self.app_manager = app_manager
self.log = log
self.intance_ids = None
+ self.auth = get_identity_auth(project=self.conf.doctor_project)
+ self.session = get_session(auth=self.auth)
+ self.nova = nova_client(self.conf.nova_version,
+ self.session)
+ self.neutron = neutron_client(session=self.session)
self.headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'}
- self.auth = get_identity_auth(project=self.conf.doctor_project)
- self.nova = nova_client(self.conf.nova_version,
- get_session(auth=self.auth))
+ if self.conf.admin_tool.type == 'fenix':
+ self.headers['X-Auth-Token'] = self.session.get_token()
self.orig_number_of_instances = self.number_of_instances()
self.ha_instances = self.get_ha_instances()
self.floating_ip = None
@@ -85,7 +90,13 @@ class AppManager(Thread):
if instance.id != self.active_instance_id:
self.log.info('Switch over to: %s %s' % (instance.name,
instance.id))
- instance.add_floating_ip(self.floating_ip)
+ # Deprecated, need to use neutron instead
+ # instance.add_floating_ip(self.floating_ip)
+ port = self.neutron.list_ports(device_id=instance.id)['ports'][0]['id'] # noqa
+ floating_id = self.neutron.list_floatingips(floating_ip_address=self.floating_ip)['floatingips'][0]['id'] # noqa
+ self.neutron.update_floatingip(floating_id, {'floatingip': {'port_id': port}}) # noqa
+ # Have to update ha_instances as floating_ip changed
+ self.ha_instances = self.get_ha_instances()
self.active_instance_id = instance.id
break