summaryrefslogtreecommitdiffstats
path: root/tests/functest/odl-sfc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functest/odl-sfc')
-rw-r--r--tests/functest/odl-sfc/config.py5
-rw-r--r--tests/functest/odl-sfc/run_tests.py28
-rwxr-xr-xtests/functest/odl-sfc/sfc.py13
-rw-r--r--tests/functest/odl-sfc/utils.py10
4 files changed, 48 insertions, 8 deletions
diff --git a/tests/functest/odl-sfc/config.py b/tests/functest/odl-sfc/config.py
index b1a2ec09..d7498327 100644
--- a/tests/functest/odl-sfc/config.py
+++ b/tests/functest/odl-sfc/config.py
@@ -29,6 +29,11 @@ class CommonConfig(object):
"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.image_name = ft_utils.get_parameter_from_yaml(
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)
diff --git a/tests/functest/odl-sfc/sfc.py b/tests/functest/odl-sfc/sfc.py
index 0cc2d14a..22301a28 100755
--- a/tests/functest/odl-sfc/sfc.py
+++ b/tests/functest/odl-sfc/sfc.py
@@ -29,12 +29,6 @@ COMMON_CONFIG = sfc_config.CommonConfig()
# we rename sfc.py with appropriate name
TESTCASE_CONFIG = sfc_config.TestcaseConfig('sfc')
-PROXY = {
- 'ip': COMMON_CONFIG.fuel_master_ip,
- 'username': COMMON_CONFIG.fuel_master_uname,
- 'password': COMMON_CONFIG.fuel_master_passwd
-}
-
def main():
results = Results(COMMON_CONFIG.line_length)
@@ -56,6 +50,7 @@ def main():
'\033[91mexport INSTALLER_IP=<ip>\033[0m')
sys.exit(1)
+ test_utils.setup_compute_node(TESTCASE_CONFIG.subnet_cidr)
test_utils.configure_iptables()
test_utils.download_image(COMMON_CONFIG.url,
COMMON_CONFIG.image_path)
@@ -70,8 +65,10 @@ def main():
nova_client = os_utils.get_nova_client()
tacker_client = os_tacker.get_tacker_client()
- controller_clients = test_utils.get_ssh_clients("controller", PROXY)
- compute_clients = test_utils.get_ssh_clients("compute", PROXY)
+ controller_clients = test_utils.get_ssh_clients("controller",
+ COMMON_CONFIG.fuel_proxy)
+ compute_clients = test_utils.get_ssh_clients("compute",
+ COMMON_CONFIG.fuel_proxy)
ovs_logger = ovs_utils.OVSLogger(
os.path.join(COMMON_CONFIG.sfc_test_dir, 'ovs-logs'),
diff --git a/tests/functest/odl-sfc/utils.py b/tests/functest/odl-sfc/utils.py
index f8483170..de23b812 100644
--- a/tests/functest/odl-sfc/utils.py
+++ b/tests/functest/odl-sfc/utils.py
@@ -385,3 +385,13 @@ def get_compute_nodes(nova_client, required_node_number=2):
logger.debug("Compute nodes: %s" % compute_nodes)
return compute_nodes
+
+
+def setup_compute_node(cidr):
+ logger.info("bringing up br-int iface")
+ run_cmd_on_compute("ifconfig br-int up")
+ if not run_cmd_on_compute("ip route|grep -o %s" % cidr):
+ logger.info("adding route %s" % cidr)
+ return run_cmd_on_compute("ip route add %s" % cidr)
+ else:
+ logger.info("route %s exists" % cidr)