Fix neutron auth issue 53/29153/1
authorboucherv <valentin.boucher@orange.com>
Tue, 21 Feb 2017 14:37:48 +0000 (15:37 +0100)
committerboucherv <valentin.boucher@orange.com>
Tue, 21 Feb 2017 14:37:48 +0000 (15:37 +0100)
Adding admin role to the new_user for the new tenant
It will fix this bug for other tests based on this class

JIRA: FUNCTEST-734

Change-Id: Ia3b8797fa391f528d24425a5b13c1b329cb992f4
Signed-off-by: boucherv <valentin.boucher@orange.com>
functest/core/vnf_base.py

index 07b64fd..9438dca 100644 (file)
@@ -111,9 +111,9 @@ class VnfOnBoardingBase(base.TestcaseBase):
         self.keystone_client = os_utils.get_keystone_client()
 
         self.logger.info("Prepare OpenStack plateform(create tenant and user)")
-        user_id = os_utils.get_user_id(self.keystone_client,
-                                       self.creds['username'])
-        if user_id == '':
+        admin_user_id = os_utils.get_user_id(self.keystone_client,
+                                             self.creds['username'])
+        if admin_user_id == '':
             self.step_failure("Failed to get id of " +
                               self.creds['username'])
 
@@ -133,7 +133,7 @@ class VnfOnBoardingBase(base.TestcaseBase):
             self.logger.error("Failed to get id for %s role" % role_name)
             self.step_failure("Failed to get role id of " + role_name)
 
-        if not os_utils.add_role_user(self.keystone_client, user_id,
+        if not os_utils.add_role_user(self.keystone_client, admin_user_id,
                                       role_id, tenant_id):
             self.logger.error("Failed to add %s on tenant" %
                               self.creds['username'])
@@ -149,6 +149,13 @@ class VnfOnBoardingBase(base.TestcaseBase):
             self.logger.error("Failed to create %s user" % self.tenant_name)
             self.step_failure("Failed to create user ")
 
+        if not os_utils.add_role_user(self.keystone_client, user_id,
+                                      role_id, tenant_id):
+            self.logger.error("Failed to add %s on tenant" %
+                              self.tenant_name)
+            self.step_failure("Failed to add %s on tenant" %
+                              self.tenant_name)
+
         self.logger.info("Update OpenStack creds informations")
         self.admin_creds = self.creds.copy()
         self.admin_creds.update({