aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functest/odl-sfc/config.py
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-12-13 12:31:39 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2016-12-15 12:37:52 +0100
commitacf339f2840d0fe7a46187a0597704cf5b486214 (patch)
treede114d6482bcd7cfd9d057f756d8b6f8864911cb /tests/functest/odl-sfc/config.py
parent1350624dbcf49c27ae0333719c2d7dda86ca7b0e (diff)
Make SFC installable as a python module
New directory structure: <root>/sfc <root>/sfc/lib/ <root>/sfc/tests <root>/sfc/tests/functest JIRA: SFC-60 After installing sfc, the imports would be: import sfc.tests.functest.x import sfc.lib.x Change-Id: Ib15172239aefdef65056d6598210a1b28a4b2eff Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'tests/functest/odl-sfc/config.py')
-rw-r--r--tests/functest/odl-sfc/config.py75
1 files changed, 0 insertions, 75 deletions
diff --git a/tests/functest/odl-sfc/config.py b/tests/functest/odl-sfc/config.py
deleted file mode 100644
index 3b76e3bc..00000000
--- a/tests/functest/odl-sfc/config.py
+++ /dev/null
@@ -1,75 +0,0 @@
-import yaml
-import os
-
-import functest.utils.functest_logger as ft_logger
-import functest.utils.functest_utils as ft_utils
-import functest.utils.functest_constants as ft_constants
-
-logger = ft_logger.Logger("sfc_test_config").getLogger()
-
-
-class CommonConfig(object):
- """
- Common configuration parameters across testcases
- """
-
- def __init__(self):
- self.line_length = 30
- self.test_db = ft_utils.get_functest_config("results.test_db_url")
- self.repo_path = ft_constants.SFC_REPO_DIR
- self.sfc_test_dir = os.path.join(self.repo_path, "tests",
- "functest", "odl-sfc")
- self.vnfd_dir = os.path.join(self.sfc_test_dir, "vnfd-templates")
- self.functest_results_dir = os.path.join(
- ft_constants.FUNCTEST_RESULTS_DIR, "odl-sfc")
- self.config_file = os.path.join(self.sfc_test_dir, "config.yaml")
- self.fuel_master_ip = ft_utils.get_parameter_from_yaml(
- "defaults.fuel_master_ip", self.config_file)
- self.fuel_master_uname = ft_utils.get_parameter_from_yaml(
- "defaults.fuel_master_uname", self.config_file)
- self.fuel_master_passwd = ft_utils.get_parameter_from_yaml(
- "defaults.fuel_master_passwd", self.config_file)
- self.fuel_proxy = {
- 'ip': self.fuel_master_ip,
- 'username': self.fuel_master_uname,
- 'password': self.fuel_master_passwd
- }
- self.flavor = ft_utils.get_parameter_from_yaml(
- "defaults.flavor", self.config_file)
- self.ram_size_in_mb = ft_utils.get_parameter_from_yaml(
- "defaults.ram_size_in_mb", self.config_file)
- self.disk_size_in_gb = ft_utils.get_parameter_from_yaml(
- "defaults.disk_size_in_gb", self.config_file)
- self.vcpu_count = ft_utils.get_parameter_from_yaml(
- "defaults.vcpu_count", self.config_file)
- self.image_name = ft_utils.get_parameter_from_yaml(
- "defaults.image_name", self.config_file)
- self.image_file_name = ft_utils.get_parameter_from_yaml(
- "defaults.image_file_name", self.config_file)
- self.image_format = ft_utils.get_parameter_from_yaml(
- "defaults.image_format", self.config_file)
- self.url = ft_utils.get_parameter_from_yaml(
- "defaults.url", self.config_file)
- self.dir_functest_data = ft_utils.get_functest_config(
- "general.directories.dir_functest_data")
- self.image_path = os.path.join(
- self.dir_functest_data, self.image_file_name)
-
-
-class TestcaseConfig(object):
- """
- Configuration for a testcase.
- Parse config.yaml into a dict and create an object out of it.
- """
-
- def __init__(self, testcase):
- common_config = CommonConfig()
- test_config = None
- with open(common_config.config_file) as f:
- testcases_yaml = yaml.safe_load(f)
- test_config = testcases_yaml['testcases'].get(testcase, None)
- if test_config is None:
- logger.error('Test {0} configuration is not present in {1}'
- .format(testcase, common_config.config_file))
- # Update class fields with configuration variables dynamically
- self.__dict__.update(**test_config)