diff options
Diffstat (limited to 'functest/opnfv_tests')
9 files changed, 55 insertions, 44 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index 2ae6817d..8970a5c0 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -13,6 +13,7 @@ from __future__ import division import json import logging import os +import pkg_resources import re import subprocess import time @@ -38,12 +39,14 @@ class RallyBase(testcase.OSGCTestCase): GLANCE_IMAGE_FORMAT = CONST.__getattribute__('openstack_image_disk_format') FLAVOR_NAME = "m1.tiny" - RALLY_DIR = os.path.join( - CONST.__getattribute__('dir_repo_functest'), - CONST.__getattribute__('dir_rally')) - RALLY_SCENARIO_DIR = os.path.join(RALLY_DIR, "scenario") - TEMPLATE_DIR = os.path.join(RALLY_SCENARIO_DIR, "templates") - SUPPORT_DIR = os.path.join(RALLY_SCENARIO_DIR, "support") + RALLY_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally') + RALLY_SCENARIO_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally/scenario') + TEMPLATE_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally/scenario/templates') + SUPPORT_DIR = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/rally/scenario/support') USERS_AMOUNT = 2 TENANTS_AMOUNT = 3 ITERATIONS_AMOUNT = 10 diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index b2a21533..30d1cf08 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -12,6 +12,7 @@ from __future__ import division import argparse import logging import os +import pkg_resources import re import sys import subprocess @@ -33,13 +34,16 @@ class RefstackClient(testcase.OSGCTestCase): if "case_name" not in kwargs: kwargs["case_name"] = "refstack_defcore" super(RefstackClient, self).__init__(**kwargs) - self.FUNCTEST_TEST = CONST.__getattribute__('dir_functest_test') - self.CONF_PATH = CONST.__getattribute__('refstack_tempest_conf_path') - self.DEFCORE_LIST = CONST.__getattribute__('refstack_defcore_list') + self.CONF_PATH = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') + self.FUNCTEST_TEST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests') + self.DEFCORE_LIST = 'openstack/refstack_client/defcore.txt' self.confpath = os.path.join(self.FUNCTEST_TEST, self.CONF_PATH) - self.defcorelist = os.path.join(self.FUNCTEST_TEST, - self.DEFCORE_LIST) + self.defcorelist = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt') def source_venv(self): @@ -202,9 +206,13 @@ class RefstackClient(testcase.OSGCTestCase): class RefstackClientParser(object): def __init__(self): - self.FUNCTEST_TEST = CONST.__getattribute__('dir_functest_test') - self.CONF_PATH = CONST.__getattribute__('refstack_tempest_conf_path') - self.DEFCORE_LIST = CONST.__getattribute__('refstack_defcore_list') + self.FUNCTEST_TEST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests') + self.CONF_PATH = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') + self.DEFCORE_LIST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/refstack_client/defcore.txt') self.confpath = os.path.join(self.FUNCTEST_TEST, self.CONF_PATH) self.defcorelist = os.path.join(self.FUNCTEST_TEST, diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py index fbaad589..5d429e7c 100755 --- a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py +++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py @@ -6,7 +6,7 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 import logging -import os +import pkg_resources from functest.opnfv_tests.openstack.tempest import conf_utils from functest.utils import openstack_utils @@ -24,9 +24,9 @@ class TempestConf(object): self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id() self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir( self.VERIFIER_ID, self.DEPLOYMENT_ID) - self.confpath = os.path.join( - CONST.__getattribute__('dir_functest_test'), - CONST.__getattribute__('refstack_tempest_conf_path')) + self.confpath = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') def generate_tempestconf(self): try: diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 4eb5661e..fa8f00fc 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -10,6 +10,7 @@ import ConfigParser import logging import os +import pkg_resources import re import shutil import subprocess @@ -21,19 +22,18 @@ import functest.utils.openstack_utils as os_utils IMAGE_ID_ALT = None FLAVOR_ID_ALT = None -REPO_PATH = CONST.__getattribute__('dir_repo_functest') GLANCE_IMAGE_PATH = os.path.join( CONST.__getattribute__('dir_functest_images'), CONST.__getattribute__('openstack_image_file_name')) -TEMPEST_TEST_LIST_DIR = CONST.__getattribute__('dir_tempest_cases') TEMPEST_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), 'tempest') -TEMPEST_CUSTOM = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, - 'test_list.txt') -TEMPEST_BLACKLIST = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, - 'blacklist.txt') -TEMPEST_DEFCORE = os.path.join(REPO_PATH, TEMPEST_TEST_LIST_DIR, - 'defcore_req.txt') +TEMPEST_CUSTOM = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/tempest/custom_tests/test_list.txt') +TEMPEST_BLACKLIST = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.txt') +TEMPEST_DEFCORE = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt') TEMPEST_RAW_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_raw_list.txt') TEMPEST_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_list.txt') REFSTACK_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), @@ -253,9 +253,9 @@ def configure_tempest_defcore(deployment_dir, img_flavor_dict): with open(conf_file, 'wb') as config_file: config.write(config_file) - confpath = os.path.join( - CONST.__getattribute__('dir_functest_test'), - CONST.__getattribute__('refstack_tempest_conf_path')) + confpath = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') shutil.copyfile(conf_file, confpath) diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 856d5f22..71460676 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -10,6 +10,7 @@ from datetime import datetime import logging import os +import pkg_resources import time import uuid @@ -37,7 +38,8 @@ class VPingBase(testcase.OSGCTestCase): self.logger = logging.getLogger(self.__class__.__name__) - self.functest_repo = CONST.__getattribute__('dir_repo_functest') + self.functest_repo = pkg_resources.resource_filename( + 'functest', '..') self.guid = '' if CONST.__getattribute__('vping_unique_names'): self.guid = '-' + str(uuid.uuid4()) @@ -45,8 +47,6 @@ class VPingBase(testcase.OSGCTestCase): self.os_creds = openstack_tests.get_credentials( os_env_file=CONST.__getattribute__('openstack_creds')) - self.repo = CONST.__getattribute__('dir_vping') - self.creators = list() self.image_creator = None self.network_creator = None diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index 6ac0d676..1f663307 100755 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -8,7 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 import argparse -import os +import pkg_resources from scp import SCPClient import sys import time @@ -156,8 +156,8 @@ class VPingSSH(vping_base.VPingBase): """ self.logger.info("Trying to transfer ping.sh") scp = SCPClient(ssh.get_transport()) - local_path = self.functest_repo + "/" + self.repo - ping_script = os.path.join(local_path, "ping.sh") + ping_script = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/openstack/vping/ping.sh') try: scp.put(ping_script, "~/") except: diff --git a/functest/opnfv_tests/sdn/onos/onos.py b/functest/opnfv_tests/sdn/onos/onos.py index adcb4166..08ba4da3 100644 --- a/functest/opnfv_tests/sdn/onos/onos.py +++ b/functest/opnfv_tests/sdn/onos/onos.py @@ -9,6 +9,7 @@ import logging import os +import pkg_resources import re import subprocess import shutil @@ -27,8 +28,8 @@ class OnosBase(testcase.TestCase): onos_sfc_image_path = os.path.join( CONST.__getattribute__('dir_functest_images'), CONST.__getattribute__('onos_sfc_image_file_name')) - onos_sfc_path = os.path.join(CONST.__getattribute__('dir_repo_functest'), - CONST.__getattribute__('dir_onos_sfc')) + onos_sfc_path = pkg_resources.resource_filename( + 'functest', 'opnfv_tests/sdn/onos/sfc') installer_type = CONST.__getattribute__('INSTALLER_TYPE') logger = logging.getLogger(__name__) diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py index a645dfb2..c1a35be3 100644 --- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py +++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py @@ -9,6 +9,7 @@ import json import logging import os +import pkg_resources import shutil import requests @@ -27,10 +28,8 @@ class ClearwaterOnBoardingBase(vnf.VnfOnBoarding): def __init__(self, **kwargs): self.logger = logging.getLogger(__name__) super(ClearwaterOnBoardingBase, self).__init__(**kwargs) - self.case_dir = os.path.join( - CONST.__getattribute__('dir_functest_test'), - 'vnf', - 'ims') + 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.case_name) diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py index a5d2a922..207d6a67 100755 --- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py +++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py @@ -10,6 +10,7 @@ import json import logging import os +import pkg_resources import socket import sys import time @@ -76,9 +77,8 @@ class ImsVnf(vnf.VnfOnBoarding): self.ob_port = "8080" self.ob_ip = "localhost" self.ob_instance_id = "" - self.case_dir = os.path.join( - CONST.__getattribute__('dir_functest_test'), - 'vnf/ims/') + 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.ob_projectid = "" |