aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/vnf/ims/cloudify_ims.py
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests/vnf/ims/cloudify_ims.py')
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index 38a40ed83..81e9b5ee9 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -21,7 +21,7 @@ import yaml
from functest.energy import energy
from functest.opnfv_tests.openstack.snaps import snaps_utils
import functest.opnfv_tests.vnf.ims.clearwater_ims_base as clearwater_ims_base
-from functest.utils.constants import CONST
+from functest.utils import config
from snaps.config.flavor import FlavorConfig
from snaps.config.image import ImageConfig
@@ -59,7 +59,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
# Retrieve the configuration
try:
self.config = getattr(
- CONST, 'vnf_{}_config'.format(self.case_name))
+ config.CONF, 'vnf_{}_config'.format(self.case_name))
except Exception:
raise Exception("VNF config file not found")
@@ -280,12 +280,12 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
scp = SCPClient(ssh.get_transport(), socket_timeout=15.0)
scp.put(kp_file, '~/')
cmd = "sudo cp ~/cloudify_ims.pem /etc/cloudify/"
- run_blocking_ssh_command(ssh, cmd)
+ self.run_blocking_ssh_command(ssh, cmd)
cmd = "sudo chmod 444 /etc/cloudify/cloudify_ims.pem"
- run_blocking_ssh_command(ssh, cmd)
+ self.run_blocking_ssh_command(ssh, cmd)
cmd = "sudo yum install -y gcc python-devel"
- run_blocking_ssh_command(ssh, cmd, "Unable to install packages \
- on manager")
+ self.run_blocking_ssh_command(
+ ssh, cmd, "Unable to install packages on manager")
self.details['orchestrator'].update(status='PASS', duration=duration)
@@ -399,7 +399,7 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
try:
cfy_client.executions.cancel(execution['id'],
force=True)
- except: # pylint: disable=broad-except
+ except Exception: # pylint: disable=broad-except
self.__logger.warn("Can't cancel the current exec")
execution = cfy_client.executions.start(
@@ -411,12 +411,22 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
wait_for_execution(cfy_client, execution, self.__logger)
cfy_client.deployments.delete(self.vnf['descriptor'].get('name'))
cfy_client.blueprints.delete(self.vnf['descriptor'].get('name'))
- except: # pylint: disable=broad-except
+ except Exception: # pylint: disable=broad-except
self.__logger.warn("Some issue during the undeployment ..")
self.__logger.warn("Tenant clean continue ..")
super(CloudifyIms, self).clean()
+ @staticmethod
+ def run_blocking_ssh_command(ssh, cmd,
+ error_msg="Unable to run this command"):
+ """Command to run ssh command with the exit status."""
+ _, stdout, stderr = ssh.exec_command(cmd)
+ CloudifyIms.__logger.debug("SSH %s stdout: %s", cmd, stdout.read())
+ if stdout.channel.recv_exit_status() != 0:
+ CloudifyIms.__logger.error("SSH %s stderr: %s", cmd, stderr.read())
+ raise Exception(error_msg)
+
@energy.enable_recording
def run(self, **kwargs):
"""Execute CloudifyIms test case."""
@@ -530,10 +540,3 @@ def sig_test_format(sig_test):
short_sig_test_result['skipped'] = nb_skipped
nb_test = nb_passed + nb_skipped
return (short_sig_test_result, nb_test)
-
-
-def run_blocking_ssh_command(ssh, cmd, error_msg="Unable to run this command"):
- """Command to run ssh command with the exit status."""
- stdin, stdout, stderr = ssh.exec_command(cmd)
- if stdout.channel.recv_exit_status() != 0:
- raise Exception(error_msg)