summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py9
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_utils.py5
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_ssh.py10
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater_ims_base.py17
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py4
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims_perf.py4
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_clearwaterims.py8
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestra_openims.py8
-rw-r--r--functest/opnfv_tests/vnf/router/cloudify_vrouter.py4
-rw-r--r--functest/opnfv_tests/vnf/router/utilvnf.py9
-rw-r--r--functest/opnfv_tests/vnf/router/vrouter_base.py4
-rw-r--r--functest/utils/functest_utils.py5
12 files changed, 40 insertions, 47 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 216d9acf6..34d56f70a 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -38,13 +38,12 @@ class SnapsTestRunner(unit.Suite):
self.netconf_override = None
if hasattr(CONST, 'snaps_network_config'):
- self.netconf_override = CONST.__getattribute__(
- 'snaps_network_config')
+ self.netconf_override = getattr(CONST, 'snaps_network_config')
self.use_fip = (
- CONST.__getattribute__('snaps_use_floating_ips') == 'True')
+ getattr(CONST, 'snaps_use_floating_ips') == 'True')
self.use_keystone = (
- CONST.__getattribute__('snaps_use_keystone') == 'True')
+ getattr(CONST, 'snaps_use_keystone') == 'True')
scenario = env.get('DEPLOY_SCENARIO')
self.flavor_metadata = None
@@ -55,4 +54,4 @@ class SnapsTestRunner(unit.Suite):
self.image_metadata = None
if hasattr(CONST, 'snaps_images'):
- self.image_metadata = CONST.__getattribute__('snaps_images')
+ self.image_metadata = getattr(CONST, 'snaps_images')
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
index 59bd063c1..4b1c93524 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py
@@ -53,10 +53,9 @@ def get_credentials(proxy_settings_str=None, ssh_proxy_cmd=None):
"""
creds_override = None
if hasattr(CONST, 'snaps_os_creds_override'):
- creds_override = CONST.__getattribute__(
- 'snaps_os_creds_override')
+ creds_override = getattr(CONST, 'snaps_os_creds_override')
os_creds = openstack_tests.get_credentials(
- os_env_file=CONST.__getattribute__('env_file'),
+ os_env_file=getattr(CONST, 'env_file'),
proxy_settings_str=proxy_settings_str, ssh_proxy_cmd=ssh_proxy_cmd,
overrides=creds_override)
return os_creds
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index 57e177e5d..0964d8464 100644
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -42,11 +42,11 @@ class VPingSSH(vping_base.VPingBase):
kwargs["case_name"] = "vping_ssh"
super(VPingSSH, self).__init__(**kwargs)
- self.kp_name = CONST.__getattribute__('vping_keypair_name') + self.guid
- self.kp_priv_file = CONST.__getattribute__('vping_keypair_priv_file')
- self.kp_pub_file = CONST.__getattribute__('vping_keypair_pub_file')
- self.sg_name = CONST.__getattribute__('vping_sg_name') + self.guid
- self.sg_desc = CONST.__getattribute__('vping_sg_desc')
+ self.kp_name = getattr(CONST, 'vping_keypair_name') + self.guid
+ self.kp_priv_file = getattr(CONST, 'vping_keypair_priv_file')
+ self.kp_pub_file = getattr(CONST, 'vping_keypair_pub_file')
+ self.sg_name = getattr(CONST, 'vping_sg_name') + self.guid
+ self.sg_desc = getattr(CONST, 'vping_sg_desc')
@energy.enable_recording
def run(self, **kwargs):
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
index 8851f7a48..f3f2e1d7c 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 278328abf..a6b87ea35 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 6d7428043..72e1e447e 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 96b526a29..e1b7f3ab0 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 572eaa9a0..c35ec8c18 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
diff --git a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py
index a6740718a..829206d60 100644
--- a/functest/opnfv_tests/vnf/router/cloudify_vrouter.py
+++ b/functest/opnfv_tests/vnf/router/cloudify_vrouter.py
@@ -65,8 +65,8 @@ class CloudifyVrouter(vrouter_base.VrouterOnBoardingBase):
# 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/router/utilvnf.py b/functest/opnfv_tests/vnf/router/utilvnf.py
index 421cfe830..d18e9375c 100644
--- a/functest/opnfv_tests/vnf/router/utilvnf.py
+++ b/functest/opnfv_tests/vnf/router/utilvnf.py
@@ -55,10 +55,7 @@ class Utilvnf(object): # pylint: disable=too-many-instance-attributes
def __init__(self):
self.snaps_creds = ""
-
- data_dir = data_dir = CONST.__getattribute__('dir_router_data')
-
- self.vnf_data_dir = data_dir
+ self.vnf_data_dir = getattr(CONST, 'dir_router_data')
self.opnfv_vnf_data_dir = "opnfv-vnf-data/"
self.command_template_dir = "command_template/"
self.test_scenario_yaml = "test_scenario.yaml"
@@ -78,8 +75,8 @@ class Utilvnf(object): # pylint: disable=too-many-instance-attributes
case_dir = pkg_resources.resource_filename(
'functest', 'opnfv_tests/vnf/router')
- config_file_name = CONST.__getattribute__(
- 'vnf_{}_config'.format("vyos_vrouter"))
+ config_file_name = getattr(
+ CONST, 'vnf_{}_config'.format("vyos_vrouter"))
config_file = os.path.join(case_dir, config_file_name)
diff --git a/functest/opnfv_tests/vnf/router/vrouter_base.py b/functest/opnfv_tests/vnf/router/vrouter_base.py
index 0678313eb..84cd51e51 100644
--- a/functest/opnfv_tests/vnf/router/vrouter_base.py
+++ b/functest/opnfv_tests/vnf/router/vrouter_base.py
@@ -37,8 +37,8 @@ class VrouterOnBoardingBase(vnf.VnfOnBoarding):
super(VrouterOnBoardingBase, self).__init__(**kwargs)
self.case_dir = pkg_resources.resource_filename(
'functest', 'opnfv_tests/vnf/router')
- self.data_dir = CONST.__getattribute__('dir_router_data')
- self.result_dir = os.path.join(CONST.__getattribute__('dir_results'),
+ self.data_dir = getattr(CONST, 'dir_router_data')
+ self.result_dir = os.path.join(getattr(CONST, 'dir_results'),
self.case_name)
self.util = Utilvnf()
self.util_info = {}
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index b31b392d7..72c9d2076 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -157,14 +157,13 @@ def get_parameter_from_yaml(parameter, yfile):
def get_functest_config(parameter):
- yaml_ = constants.CONST.__getattribute__('CONFIG_FUNCTEST_YAML')
+ yaml_ = constants.Constants.CONFIG_FUNCTEST_YAML
return get_parameter_from_yaml(parameter, yaml_)
def get_functest_yaml():
# pylint: disable=bad-continuation
- with open(constants.CONST.__getattribute__(
- 'CONFIG_FUNCTEST_YAML')) as yaml_fd:
+ with open(constants.Constants.CONFIG_FUNCTEST_YAML) as yaml_fd:
functest_yaml = yaml.safe_load(yaml_fd)
return functest_yaml