diff options
author | Manuel Buil <manuelbuil87@gmail.com> | 2016-12-09 14:29:58 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2016-12-09 14:29:58 +0000 |
commit | cf27d8c61ee456fdd05f5e7d558bb8fadbff2fdc (patch) | |
tree | 58f97648d368788a75fc1954187d014355b484d1 /tests/functest/odl-sfc/run_tests.py | |
parent | 4cf88806b7342d6e9674664799a906d18520a06b (diff) | |
parent | 04443eaf16effe54eff8eba35d04bfc1a1960d32 (diff) |
Merge "remove dependancy of prepare_odl_sfc.py"
Diffstat (limited to 'tests/functest/odl-sfc/run_tests.py')
-rw-r--r-- | tests/functest/odl-sfc/run_tests.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/functest/odl-sfc/run_tests.py b/tests/functest/odl-sfc/run_tests.py index 96ed9a3f..451ce564 100644 --- a/tests/functest/odl-sfc/run_tests.py +++ b/tests/functest/odl-sfc/run_tests.py @@ -18,6 +18,8 @@ import ovs_utils import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import yaml +import utils +import SSHUtils as ssh_utils parser = argparse.ArgumentParser() @@ -40,7 +42,33 @@ def push_results(testname, start_time, end_time, criteria, details): details) +def get_tackerc_file(): + rc_file = os.path.join(COMMON_CONFIG.sfc_test_dir, 'tackerc') + if not os.path.exists(rc_file): + logger.info("tackerc file not found, getting it from controller") + ip = utils.get_openstack_node_ips("controller") + ssh_conn = ssh_utils.get_ssh_client(ip[0], 'root', + proxy=COMMON_CONFIG.fuel_proxy) + ssh_utils.get_file(ssh_conn, "tackerc", rc_file) + else: + logger.info("found tackerc file") + + return rc_file + + +def set_tacker_rc_file_env(): + rc_file = get_tackerc_file() + with open(rc_file) as f: + for line in f.readlines(): + if not (line.startswith('#') or len(line) == 1): + filtered = line.strip().split(' ') + kv = filtered[1].split('=') + logger.info("Set shell env %s=%s" % (kv[0], kv[1])) + os.environ[kv[0]] = kv[1].strip("'") + + def main(): + set_tacker_rc_file_env() ovs_logger = ovs_utils.OVSLogger( os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'), COMMON_CONFIG.functest_results_dir) |