aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/openstack/refstack_client/tempest_conf.py1
-rw-r--r--functest/opnfv_tests/openstack/tempest/conf_utils.py26
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py11
-rw-r--r--functest/opnfv_tests/sdn/odl/odl.py4
4 files changed, 24 insertions, 18 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
index 44d0a18b..73a2685c 100644
--- a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
+++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
@@ -38,6 +38,7 @@ class TempestConf(object):
use_custom_flavors=True)
conf_utils.configure_tempest_defcore(
self.deployment_dir,
+ network_name=resources.get("network_name"),
image_id=resources.get("image_id"),
flavor_id=resources.get("flavor_id"),
image_id_alt=resources.get("image_id_alt"),
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py
index 6b35b96e..efcbe7fd 100644
--- a/functest/opnfv_tests/openstack/tempest/conf_utils.py
+++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py
@@ -184,25 +184,27 @@ def backup_tempest_config(conf_file):
os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf'))
-def configure_tempest(deployment_dir, image_id=None, flavor_id=None,
- compute_cnt=None):
+def configure_tempest(deployment_dir, network_name=None, image_id=None,
+ flavor_id=None, compute_cnt=None):
"""
Calls rally verify and updates the generated tempest.conf with
given parameters
"""
conf_file = configure_verifier(deployment_dir)
- configure_tempest_update_params(conf_file, image_id, flavor_id,
- compute_cnt)
+ configure_tempest_update_params(conf_file, network_name, image_id,
+ flavor_id, compute_cnt)
-def configure_tempest_defcore(deployment_dir, image_id, flavor_id,
- image_id_alt, flavor_id_alt, tenant_id):
+def configure_tempest_defcore(deployment_dir, network_name, image_id,
+ flavor_id, image_id_alt, flavor_id_alt,
+ tenant_id):
# pylint: disable=too-many-arguments
"""
Add/update needed parameters into tempest.conf file
"""
conf_file = configure_verifier(deployment_dir)
- configure_tempest_update_params(conf_file, image_id, flavor_id)
+ configure_tempest_update_params(conf_file, network_name, image_id,
+ flavor_id)
LOGGER.debug("Updating selected tempest.conf parameters for defcore...")
config = ConfigParser.RawConfigParser()
@@ -266,18 +268,16 @@ def update_tempest_conf_file(conf_file, config):
config.write(config_file)
-def configure_tempest_update_params(tempest_conf_file, image_id=None,
- flavor_id=None, compute_cnt=1):
+def configure_tempest_update_params(tempest_conf_file, network_name=None,
+ image_id=None, flavor_id=None,
+ compute_cnt=1):
"""
Add/update needed parameters into tempest.conf file
"""
LOGGER.debug("Updating selected tempest.conf parameters...")
config = ConfigParser.RawConfigParser()
config.read(tempest_conf_file)
- config.set(
- 'compute',
- 'fixed_network_name',
- CONST.__getattribute__('tempest_private_net_name'))
+ config.set('compute', 'fixed_network_name', network_name)
config.set('compute', 'volume_device_name',
CONST.__getattribute__('tempest_volume_device_name'))
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index c5ad4ecb..01caf4ff 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -257,6 +257,7 @@ class TempestCommon(testcase.TestCase):
self.resources.os_creds)
conf_utils.configure_tempest(
self.deployment_dir,
+ network_name=resources.get("network_name"),
image_id=resources.get("image_id"),
flavor_id=resources.get("flavor_id"),
compute_cnt=compute_cnt)
@@ -380,10 +381,12 @@ class TempestResourcesManager(object):
tempest_segmentation_id = CONST.__getattribute__(
'tempest_segmentation_id')
+ tempest_net_name = CONST.__getattribute__(
+ 'tempest_private_net_name') + self.guid
+
network_creator = deploy_utils.create_network(
self.os_creds, NetworkConfig(
- name=CONST.__getattribute__(
- 'tempest_private_net_name') + self.guid,
+ name=tempest_net_name,
project_name=project_name,
network_type=tempest_network_type,
physical_network=tempest_physical_network,
@@ -397,6 +400,7 @@ class TempestResourcesManager(object):
if network_creator is None or network_creator.get_network() is None:
raise Exception("Failed to create private network")
self.creators.append(network_creator)
+ return tempest_net_name
def _create_image(self, name):
"""Create image for tests"""
@@ -433,6 +437,7 @@ class TempestResourcesManager(object):
create_project=False):
"""Create resources for Tempest test suite."""
result = {
+ 'tempest_net_name': None,
'image_id': None,
'image_id_alt': None,
'flavor_id': None,
@@ -449,7 +454,7 @@ class TempestResourcesManager(object):
result['tenant_id'] = result['project_id'] # for compatibility
LOGGER.debug("Creating private network for Tempest suite")
- self._create_network(project_name)
+ result['tempest_net_name'] = self._create_network(project_name)
LOGGER.debug("Creating image for Tempest suite")
image_name = CONST.__getattribute__('openstack_image_name') + self.guid
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 25cc758e..6af49ffa 100644
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -38,7 +38,7 @@ __author__ = "Cedric Ollivier <cedric.ollivier@orange.com>"
class ODLTests(robotframework.RobotFramework):
"""ODL test runner."""
- odl_test_repo = constants.CONST.__getattribute__('dir_repo_odl_test')
+ odl_test_repo = getattr(constants.CONST, 'dir_repo_odl_test')
neutron_suite_dir = os.path.join(
odl_test_repo, "csit/suites/openstack/neutron")
basic_suite_dir = os.path.join(
@@ -51,7 +51,7 @@ class ODLTests(robotframework.RobotFramework):
def __init__(self, **kwargs):
super(ODLTests, self).__init__(**kwargs)
self.res_dir = os.path.join(
- constants.CONST.__getattribute__('dir_results'), 'odl')
+ getattr(constants.CONST, 'dir_results'), 'odl')
self.xml_file = os.path.join(self.res_dir, 'output.xml')
@classmethod