summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/opnfv_tests/openstack/shaker/shaker.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/functest/opnfv_tests/openstack/shaker/shaker.py b/functest/opnfv_tests/openstack/shaker/shaker.py
index dfe1d9c98..097d9b2a7 100644
--- a/functest/opnfv_tests/openstack/shaker/shaker.py
+++ b/functest/opnfv_tests/openstack/shaker/shaker.py
@@ -39,6 +39,10 @@ class Shaker(singlevm.SingleVm2):
ssh_connect_loops = 12
create_server_timeout = 360
+ def __init__(self, **kwargs):
+ super(Shaker, self).__init__(**kwargs)
+ self.role = None
+
def prepare(self):
super(Shaker, self).prepare()
self.cloud.create_security_group_rule(
@@ -54,10 +58,18 @@ class Shaker(singlevm.SingleVm2):
assert self.ssh
endpoint = self.get_public_auth_url(self.orig_cloud)
self.__logger.debug("keystone endpoint: %s", endpoint)
+ if self.orig_cloud.get_role("admin"):
+ role_name = "admin"
+ elif self.orig_cloud.get_role("Admin"):
+ role_name = "Admin"
+ else:
+ raise Exception("Cannot detect neither admin nor Admin")
self.orig_cloud.grant_role(
- "admin", user=self.project.user.id,
+ role_name, user=self.project.user.id,
project=self.project.project.id,
domain=self.project.domain.id)
+ if not self.orig_cloud.get_role("heat_stack_owner"):
+ self.role = self.orig_cloud.create_role("heat_stack_owner")
self.orig_cloud.grant_role(
"heat_stack_owner", user=self.project.user.id,
project=self.project.project.id,
@@ -72,6 +84,9 @@ class Shaker(singlevm.SingleVm2):
'export OS_AUTH_URL={} && '
'export OS_USERNAME={} && '
'export OS_PROJECT_NAME={} && '
+ 'export OS_PROJECT_ID={} && '
+ 'unset OS_TENANT_NAME && '
+ 'unset OS_TENANT_ID && '
'export OS_PASSWORD={} && '
'{}'
'env && '
@@ -83,7 +98,7 @@ class Shaker(singlevm.SingleVm2):
'openstack/perf_l3_north_south '
'--report report.html --output report.json'.format(
endpoint, self.project.user.name, self.project.project.name,
- self.project.password,
+ self.project.project.id, self.project.password,
'export OS_CACERT=~/os_cacert && ' if os.environ.get(
'OS_CACERT') else '',
self.image.name, self.flavor.name,
@@ -99,3 +114,8 @@ class Shaker(singlevm.SingleVm2):
self.__logger.exception("cannot get report files")
return 1
return stdout.channel.recv_exit_status()
+
+ def clean(self):
+ super(Shaker, self).clean()
+ if self.role:
+ self.orig_cloud.delete_role(self.role.id)