diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-09-07 22:13:42 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2016-09-08 10:45:45 +0800 |
commit | 55d301a2622ff5b63d431b9272caa68224d53843 (patch) | |
tree | b540f05ba3ed45e15260ee7131ce90dc93af753d /testcases/Controllers/ONOS | |
parent | 227afb8285b8f178987a7d6eb1d28a74201a5d1b (diff) |
make use of functest_utils.get_parameter_from_yaml
JIRA: FUNCTEST-463
Change-Id: I1d54a65c5bfa2542f2fd3a2e408967641e6e4ac9
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testcases/Controllers/ONOS')
-rw-r--r-- | testcases/Controllers/ONOS/Teston/adapters/foundation.py | 54 | ||||
-rwxr-xr-x | testcases/Controllers/ONOS/Teston/onosfunctest.py | 42 |
2 files changed, 44 insertions, 52 deletions
diff --git a/testcases/Controllers/ONOS/Teston/adapters/foundation.py b/testcases/Controllers/ONOS/Teston/adapters/foundation.py index 90eb1449..5c42c35e 100644 --- a/testcases/Controllers/ONOS/Teston/adapters/foundation.py +++ b/testcases/Controllers/ONOS/Teston/adapters/foundation.py @@ -16,7 +16,6 @@ import logging import os import re import time -import yaml import functest.utils.functest_utils as ft_utils @@ -55,35 +54,30 @@ class foundation: """ Get Default Parameters value """ - with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f: - functest_yaml = yaml.safe_load(f) - - self.Result_DB = str(functest_yaml.get("results").get("test_db_url")) - self.masterusername = str(functest_yaml.get("ONOS").get("general"). - get('onosbench_username')) - self.masterpassword = str(functest_yaml.get("ONOS").get("general"). - get("onosbench_password")) - self.agentusername = str(functest_yaml.get("ONOS").get("general"). - get("onoscli_username")) - self.agentpassword = str(functest_yaml.get("ONOS").get("general"). - get("onoscli_password")) - self.runtimeout = functest_yaml.get("ONOS").get("general").get( - "runtimeout") - self.OCT = str(functest_yaml.get("ONOS").get("environment").get("OCT")) - self.OC1 = str(functest_yaml.get("ONOS").get("environment").get("OC1")) - self.OC2 = str(functest_yaml.get("ONOS").get("environment").get("OC2")) - self.OC3 = str(functest_yaml.get("ONOS").get("environment").get("OC3")) - self.OCN = str(functest_yaml.get("ONOS").get("environment").get("OCN")) - self.OCN2 = str(functest_yaml.get("ONOS"). - get("environment").get("OCN2")) - self.installer_master = str(functest_yaml.get("ONOS"). - get("environment").get("installer_master")) - self.installer_master_username = str(functest_yaml.get("ONOS"). - get("environment"). - get("installer_master_username")) - self.installer_master_password = str(functest_yaml.get("ONOS"). - get("environment"). - get("installer_master_password")) + self.Result_DB = str( + ft_utils.get_functest_config('results.test_db_url')) + self.masterusername = str( + ft_utils.get_functest_config('ONOS.general.onosbench_username')) + self.masterpassword = str( + ft_utils.get_functest_config('ONOS.general.onosbench_password')) + self.agentusername = str( + ft_utils.get_functest_config('ONOS.general.onoscli_username')) + self.agentpassword = str( + ft_utils.get_functest_config('ONOS.general.onoscli_password')) + self.runtimeout = \ + ft_utils.get_functest_config('ONOS.general.runtimeout') + self.OCT = str(ft_utils.get_functest_config('ONOS.environment.OCT')) + self.OC1 = str(ft_utils.get_functest_config('ONOS.environment.OC1')) + self.OC2 = str(ft_utils.get_functest_config('ONOS.environment.OC2')) + self.OC3 = str(ft_utils.get_functest_config('ONOS.environment.OC3')) + self.OCN = str(ft_utils.get_functest_config('ONOS.environment.OCN')) + self.OCN2 = str(ft_utils.get_functest_config('ONOS.environment.OCN2')) + self.installer_master = str( + ft_utils.get_functest_config('ONOS.environment.installer_master')) + self.installer_master_username = str(ft_utils.get_functest_config( + 'ONOS.environment.installer_master_username')) + self.installer_master_password = str(ft_utils.get_functest_config( + 'ONOS.environment.installer_master_password')) self.hosts = [self.OC1, self.OCN, self.OCN2] self.localhost = self.OCT diff --git a/testcases/Controllers/ONOS/Teston/onosfunctest.py b/testcases/Controllers/ONOS/Teston/onosfunctest.py index a5c225ed..c8045fd1 100755 --- a/testcases/Controllers/ONOS/Teston/onosfunctest.py +++ b/testcases/Controllers/ONOS/Teston/onosfunctest.py @@ -23,7 +23,7 @@ import argparse from neutronclient.v2_0 import client as neutronclient import functest.utils.functest_logger as ft_logger -import functest.utils.functest_utils as functest_utils +import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as openstack_utils parser = argparse.ArgumentParser() @@ -35,12 +35,11 @@ args = parser.parse_args() logger = ft_logger.Logger("onos").getLogger() # onos parameters -TEST_DB = functest_utils.get_parameter_from_yaml( - "results.test_db_url") -ONOS_REPO_PATH = functest_utils.get_parameter_from_yaml( - "general.directories.dir_repos") -ONOS_CONF_DIR = functest_utils.get_parameter_from_yaml( - "general.directories.dir_functest_conf") +TEST_DB = ft_utils.get_functest_config("results.test_db_url") +ONOS_REPO_PATH = \ + ft_utils.get_functest_config("general.directories.dir_repos") +ONOS_CONF_DIR = \ + ft_utils.get_functest_config("general.directories.dir_functest_conf") ONOSCI_PATH = ONOS_REPO_PATH + "/" starttime = datetime.datetime.now() @@ -49,15 +48,14 @@ HOME = os.environ['HOME'] + "/" INSTALLER_TYPE = os.environ['INSTALLER_TYPE'] DEPLOY_SCENARIO = os.environ['DEPLOY_SCENARIO'] ONOSCI_PATH = ONOS_REPO_PATH + "/" -GLANCE_IMAGE_NAME = functest_utils.get_parameter_from_yaml( - "onos_sfc.image_name") -GLANCE_IMAGE_FILENAME = functest_utils.get_parameter_from_yaml( - "onos_sfc.image_file_name") -GLANCE_IMAGE_PATH = functest_utils.get_parameter_from_yaml( - "general.directories.dir_functest_data") + "/" + GLANCE_IMAGE_FILENAME -SFC_PATH = functest_utils.FUNCTEST_REPO + "/" + \ - functest_utils.get_parameter_from_yaml( - "general.directories.dir_onos_sfc") +GLANCE_IMAGE_NAME = ft_utils.get_functest_config("onos_sfc.image_name") +GLANCE_IMAGE_FILENAME = \ + ft_utils.get_functest_config("onos_sfc.image_file_name") +GLANCE_IMAGE_PATH = \ + ft_utils.get_functest_config("general.directories.dir_functest_data") + \ + "/" + GLANCE_IMAGE_FILENAME +SFC_PATH = ft_utils.FUNCTEST_REPO + "/" + \ + ft_utils.get_functest_config("general.directories.dir_onos_sfc") def RunScript(testname): @@ -244,12 +242,12 @@ def OnosTest(): except: logger.error("Unable to set ONOS criteria") - functest_utils.push_results_to_db("functest", - "onos", - start_time, - stop_time, - status, - result) + ft_utils.push_results_to_db("functest", + "onos", + start_time, + stop_time, + status, + result) except: logger.error("Error pushing results into Database") |