diff options
Diffstat (limited to 'functest/opnfv_tests/vnf/ims')
-rw-r--r-- | functest/opnfv_tests/vnf/ims/clearwater.py | 19 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/cloudify_ims.py | 4 | ||||
-rw-r--r-- | functest/opnfv_tests/vnf/ims/heat_ims.py | 4 |
3 files changed, 12 insertions, 15 deletions
diff --git a/functest/opnfv_tests/vnf/ims/clearwater.py b/functest/opnfv_tests/vnf/ims/clearwater.py index 64f0428b3..67128b11c 100644 --- a/functest/opnfv_tests/vnf/ims/clearwater.py +++ b/functest/opnfv_tests/vnf/ims/clearwater.py @@ -24,7 +24,7 @@ __author__ = ("Valentin Boucher <valentin.boucher@orange.com>, " "Helen Yao <helanyao@gmail.com>") -class ClearwaterTesting(object): +class ClearwaterTesting(): """vIMS clearwater base usable by several orchestrators""" def __init__(self, case_name, bono_ip, ellis_ip): @@ -91,8 +91,7 @@ class ClearwaterTesting(object): 'Account %s is created on Ellis\n%s', params.get('full_name'), account_res) return account_res - else: - raise Exception("Cannot create ellis account") + raise Exception("Cannot create ellis account") except Exception: # pylint: disable=broad-except self.logger.info( "try %s: cannot create ellis account", iloop + 1) @@ -110,8 +109,7 @@ class ClearwaterTesting(object): cookies = req.cookies self.logger.debug('cookies: %s', cookies) return cookies - else: - raise Exception('Failed to get cookies for Ellis') + raise Exception('Failed to get cookies for Ellis') except Exception: # pylint: disable=broad-except self.logger.info( "try %s: cannot get cookies for Ellis", iloop + 1) @@ -128,13 +126,12 @@ class ClearwaterTesting(object): self.logger.info( 'Calling number is created: %s', number_res) return number_res + if req and req.json(): + reason = req.json()['reason'] else: - if req and req.json(): - reason = req.json()['reason'] - else: - reason = req - self.logger.info("cannot create a number: %s", reason) - raise Exception('Failed to create a number') + reason = req + self.logger.info("cannot create a number: %s", reason) + raise Exception('Failed to create a number') except Exception: # pylint: disable=broad-except self.logger.info( "try %s: cannot create a number", iloop + 1) diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 0f6adf96a..d937cc052 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -103,7 +103,7 @@ class CloudifyIms(cloudify.Cloudify): def check_requirements(self): if env.get('NEW_USER_ROLE').lower() == "admin": - self.__logger.warn( + self.__logger.warning( "Defining NEW_USER_ROLE=admin will easily break the testcase " "because Cloudify doesn't manage tenancy (e.g. subnet " "overlapping)") @@ -250,7 +250,7 @@ class CloudifyIms(cloudify.Cloudify): self.result += vnf_test_rate / 3 * 100 if vnf_test_rate == 0: self.details['test_vnf'].update(status='FAIL') - return True if vnf_test_rate > 0 else False + return bool(vnf_test_rate > 0) def clean(self): """Clean created objects/functions.""" diff --git a/functest/opnfv_tests/vnf/ims/heat_ims.py b/functest/opnfv_tests/vnf/ims/heat_ims.py index 9ea9c5627..4edb2ddd9 100644 --- a/functest/opnfv_tests/vnf/ims/heat_ims.py +++ b/functest/opnfv_tests/vnf/ims/heat_ims.py @@ -162,7 +162,7 @@ class HeatIms(singlevm.VmReady2): server.public_v4, username=username, key_filename=self.key_filename, timeout=timeout) (_, stdout, _) = ssh.exec_command('sudo monit summary') - self.__logger.info("output:\n%s", stdout.read()) + self.__logger.info("output:\n%s", stdout.read().decode("utf-8")) ssh.close() def deploy_vnf(self): @@ -234,7 +234,7 @@ class HeatIms(singlevm.VmReady2): if vnf_test_rate == 0: self.details['test_vnf'].update(status='FAIL') self._monit() - return True if vnf_test_rate > 0 else False + return bool(vnf_test_rate > 0) def clean(self): """Clean created objects/functions.""" |