diff options
author | Cedric Ollivier <cedric.ollivier@orange.com> | 2018-02-20 10:17:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-02-20 10:17:18 +0000 |
commit | 1a04979f3fff45117754653e20758d2ac6a02615 (patch) | |
tree | 001bd04d4370e232efb1a253ceb8e84ca5845a94 /functest/opnfv_tests/vnf/ims | |
parent | de3160230a010e5fd2aaf03630e31e807aeee34f (diff) | |
parent | edac6a883e0b80724140305258649b4891a2d14c (diff) |
Merge "Remove last CONST.__getattribute__()"
Diffstat (limited to 'functest/opnfv_tests/vnf/ims')
5 files changed, 20 insertions, 21 deletions
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py index 8851f7a4..f3f2e1d7 100644 --- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py +++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py @@ -9,12 +9,12 @@ import json import logging import os -import pkg_resources import shlex import shutil import subprocess import time +import pkg_resources import requests import functest.core.vnf as vnf @@ -33,10 +33,10 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): super(ClearwaterOnBoardingBase, self).__init__(**kwargs) self.case_dir = pkg_resources.resource_filename( 'functest', 'opnfv_tests/vnf/ims') - self.data_dir = CONST.__getattribute__('dir_ims_data') - self.result_dir = os.path.join(CONST.__getattribute__('dir_results'), + self.data_dir = getattr(CONST, 'dir_ims_data') + self.result_dir = os.path.join(getattr(CONST, 'dir_results'), self.case_name) - self.test_dir = CONST.__getattribute__('dir_repo_vims_test') + self.test_dir = getattr(CONST, 'dir_repo_vims_test') if not os.path.exists(self.data_dir): os.makedirs(self.data_dir) @@ -71,15 +71,14 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): self.logger.debug('Cookies: %s', cookies) number_url = 'http://{0}/accounts/{1}/numbers'.format( - ellis_ip, - params['email']) + ellis_ip, params['email']) self.logger.debug('Create 1st calling number on Ellis') i = 30 while rq.status_code != 200 and i > 0: try: number_res = self.create_ellis_number(number_url, cookies) break - except: + except Exception: # pylint: disable=broad-except if i == 1: raise Exception("Unable to create a number") self.logger.warn("Unable to create a number. Retry ..") @@ -154,12 +153,12 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): with open(tempFile) as f: vims_test_result = json.load(f) f.close() - except Exception: + except Exception: # pylint: disable=broad-except self.logger.error("Unable to retrieve test results") try: os.remove(tempFile) - except Exception: + except Exception: # pylint: disable=broad-except self.logger.error("Deleting file failed") return vims_test_result diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py index 278328ab..a6b87ea3 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py @@ -58,8 +58,8 @@ class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase): # Retrieve the configuration try: - self.config = CONST.__getattribute__( - 'vnf_{}_config'.format(self.case_name)) + self.config = getattr( + CONST, 'vnf_{}_config'.format(self.case_name)) except Exception: raise Exception("VNF config file not found") diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py index 6d742804..72e1e447 100644 --- a/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py +++ b/functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py @@ -57,8 +57,8 @@ class CloudifyImsPerf(cloudify_ims.CloudifyIms): # Retrieve the configuration try: - self.config = CONST.__getattribute__( - 'vnf_{}_config'.format(self.case_name)) + self.config = getattr( + CONST, 'vnf_{}_config'.format(self.case_name)) except Exception: raise Exception("VNF config file not found") diff --git a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py index 96b526a2..e1b7f3ab 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py @@ -150,14 +150,14 @@ class ClearwaterImsVnf(vnf.VnfOnBoarding): self.case_dir = pkg_resources.resource_filename( 'functest', 'opnfv_tests/vnf/ims/') - self.data_dir = CONST.__getattribute__('dir_ims_data') - self.test_dir = CONST.__getattribute__('dir_repo_vims_test') + self.data_dir = getattr(CONST, 'dir_ims_data') + self.test_dir = getattr(CONST, 'dir_repo_vims_test') self.created_resources = [] self.logger.info("%s VNF onboarding test starting", self.case_name) try: - self.config = CONST.__getattribute__( - 'vnf_{}_config'.format(self.case_name)) + self.config = getattr( + CONST, 'vnf_{}_config'.format(self.case_name)) except BaseException: raise Exception("Orchestra VNF config file not found") diff --git a/functest/opnfv_tests/vnf/ims/orchestra_openims.py b/functest/opnfv_tests/vnf/ims/orchestra_openims.py index 572eaa9a..c35ec8c1 100644 --- a/functest/opnfv_tests/vnf/ims/orchestra_openims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_openims.py @@ -151,14 +151,14 @@ class OpenImsVnf(vnf.VnfOnBoarding): self.case_dir = pkg_resources.resource_filename( 'functest', 'opnfv_tests/vnf/ims/') - self.data_dir = CONST.__getattribute__('dir_ims_data') - self.test_dir = CONST.__getattribute__('dir_repo_vims_test') + self.data_dir = getattr(CONST, 'dir_ims_data') + self.test_dir = getattr(CONST, 'dir_repo_vims_test') self.created_resources = [] self.logger.info("%s VNF onboarding test starting", self.case_name) try: - self.config = CONST.__getattribute__( - 'vnf_{}_config'.format(self.case_name)) + self.config = getattr( + CONST, 'vnf_{}_config'.format(self.case_name)) except BaseException: raise Exception("Orchestra VNF config file not found") config_file = self.case_dir + self.config |