Allow getting service via any endpoint
[functest.git] / functest / opnfv_tests / openstack / vmtp / vmtp.py
index 3462ec0..d102f64 100644 (file)
@@ -104,10 +104,10 @@ class Vmtp(singlevm.VmReady2):
         if not os.path.exists(self.res_dir):
             os.makedirs(self.res_dir)
         cmd = ['vmtp', '-sc']
-        output = subprocess.check_output(cmd)
+        output = subprocess.check_output(cmd).decode("utf-8")
         self.__logger.info("%s\n%s", " ".join(cmd), output)
         with open(self.config, "w+") as conf:
-            vmtp_conf = yaml.load(output)
+            vmtp_conf = yaml.full_load(output)
             vmtp_conf["private_key_file"] = self.privkey_filename
             vmtp_conf["public_key_file"] = self.pubkey_filename
             vmtp_conf["image_name"] = str(self.image.name)
@@ -125,6 +125,7 @@ class Vmtp(singlevm.VmReady2):
             conf.write(yaml.dump(vmtp_conf))
 
     def run_vmtp(self):
+        # pylint: disable=unexpected-keyword-arg
         """Run Vmtp and generate charts
 
         Raises: Exception on error
@@ -135,6 +136,8 @@ class Vmtp(singlevm.VmReady2):
             OS_USERNAME=self.project.user.name,
             OS_PROJECT_NAME=self.project.project.name,
             OS_PROJECT_ID=self.project.project.id,
+            OS_PROJECT_DOMAIN_NAME=self.project.domain.name,
+            OS_USER_DOMAIN_NAME=self.project.domain.name,
             OS_PASSWORD=self.project.password)
         if not new_env["OS_AUTH_URL"].endswith(('v3', 'v3/')):
             new_env["OS_AUTH_URL"] = "{}/v3".format(new_env["OS_AUTH_URL"])
@@ -146,11 +149,12 @@ class Vmtp(singlevm.VmReady2):
         cmd = ['vmtp', '-d', '--json', '{}/vmtp.json'.format(self.res_dir),
                '-c', self.config]
         output = subprocess.check_output(
-            cmd, stderr=subprocess.STDOUT, env=new_env)
+            cmd, stderr=subprocess.STDOUT, env=new_env).decode("utf-8")
         self.__logger.info("%s\n%s", " ".join(cmd), output)
         cmd = ['vmtp_genchart', '-c', '{}/vmtp.html'.format(self.res_dir),
                '{}/vmtp.json'.format(self.res_dir)]
-        output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+        output = subprocess.check_output(
+            cmd, stderr=subprocess.STDOUT).decode("utf-8")
         self.__logger.info("%s\n%s", " ".join(cmd), output)
         with open('{}/vmtp.json'.format(self.res_dir), 'r') as res_file:
             self.details = json.load(res_file)
@@ -179,7 +183,8 @@ class Vmtp(singlevm.VmReady2):
             status = testcase.TestCase.EX_OK
         except subprocess.CalledProcessError as cpe:
             self.__logger.error(
-                "Exception when calling %s\n%s", cpe.cmd, cpe.output)
+                "Exception when calling %s\n%s", cpe.cmd,
+                cpe.output.decode("utf-8"))
             self.result = 0
         except Exception:  # pylint: disable=broad-except
             self.__logger.exception("Cannot run vmtp")