diff options
author | George Paraskevopoulos <geopar@intracom-telecom.com> | 2016-10-21 18:32:29 +0300 |
---|---|---|
committer | George Paraskevopoulos <geopar@intracom-telecom.com> | 2016-10-21 18:33:25 +0300 |
commit | 573953d3fda65c03ece01b1ee70516599c7ae831 (patch) | |
tree | 5ff9a4eeb92b83aa26113181c9fc2de3d7b377d5 /testcases/features | |
parent | 2e2bf5dbc7dcc332f39e152349faaf8fe941e3fc (diff) |
Add ovs logging in sfc_colorado1
Change-Id: I25671508c28d44b83263073971c2bf52cea80c58
Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
Diffstat (limited to 'testcases/features')
-rwxr-xr-x | testcases/features/sfc/sfc_colorado1.py | 65 |
1 files changed, 57 insertions, 8 deletions
diff --git a/testcases/features/sfc/sfc_colorado1.py b/testcases/features/sfc/sfc_colorado1.py index ed35cb329..20bfa2e44 100755 --- a/testcases/features/sfc/sfc_colorado1.py +++ b/testcases/features/sfc/sfc_colorado1.py @@ -8,6 +8,8 @@ import paramiko import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils import functest.utils.openstack_utils as os_utils +import SSHUtils as ssh_utils +import ovs_utils parser = argparse.ArgumentParser() @@ -106,6 +108,16 @@ def main(): neutron_client = os_utils.get_neutron_client() glance_client = os_utils.get_glance_client() + ovs_logger = ovs_utils.OVSLogger(FUNCTEST_RESULTS_DIR) + jumphost = { + 'ip': '10.20.0.2', + 'username': 'root', + 'password': 'r00tme' + } + controller_client = ssh_utils.get_ssh_client(ip_server, + 'root', + jumphost=jumphost) + # Download the image if not os.path.isfile(IMAGE_PATH): @@ -405,8 +417,18 @@ def main(): i = i + 1 json_results.update({"Test 1: SSH Blocked": "Passed"}) else: - logger.error('\033[91m' + "TEST 1 [FAILED] " - "==> SSH NOT BLOCKED" + '\033[0m') + timestamp = time.strftime("%Y%m%d-%H%M%S") + error = ('\033[91m' + "TEST 1 [FAILED] " + "==> SSH NOT BLOCKED" + '\033[0m') + logger.error(error) + ovs_logger.ofctl_dump_flows(controller_client, + timestamp=timestamp) + ovs_logger.vsctl_show(controller_client, + timestamp=timestamp) + + dumpdir = os.path.join(ovs_logger.ovs_dir, timestamp) + with open(os.path.join(dumpdir, 'error'), 'w') as f: + f.write(error) status = "FAIL" json_results.update({"Test 1: SSH Blocked": "Failed"}) failures += 1 @@ -428,8 +450,17 @@ def main(): i = i + 1 json_results.update({"Test 2: HTTP works": "Passed"}) else: - logger.error('\033[91m' + "TEST 2 [FAILED] " - "==> HTTP BLOCKED" + '\033[0m') + error = ('\033[91m' + "TEST 2 [FAILED] " + "==> HTTP BLOCKED" + '\033[0m') + logger.error(error) + ovs_logger.ofctl_dump_flows(controller_client, + timestamp=timestamp) + ovs_logger.vsctl_show(controller_client, + timestamp=timestamp) + + dumpdir = os.path.join(ovs_logger.ovs_dir, timestamp) + with open(os.path.join(dumpdir, 'error'), 'w') as f: + f.write(error) status = "FAIL" json_results.update({"Test 2: HTTP works": "Failed"}) failures += 1 @@ -461,8 +492,17 @@ def main(): i = i + 1 json_results.update({"Test 3: HTTP Blocked": "Passed"}) else: - logger.error('\033[91m' + "TEST 3 [FAILED] " - "==> HTTP NOT BLOCKED" + '\033[0m') + error = ('\033[91m' + "TEST 3 [FAILED] " + "==> HTTP NOT BLOCKED" + '\033[0m') + logger.error(error) + ovs_logger.ofctl_dump_flows(controller_client, + timestamp=timestamp) + ovs_logger.vsctl_show(controller_client, + timestamp=timestamp) + + dumpdir = os.path.join(ovs_logger.ovs_dir, timestamp) + with open(os.path.join(dumpdir, 'error'), 'w') as f: + f.write(error) status = "FAIL" json_results.update({"Test 3: HTTP Blocked": "Failed"}) failures += 1 @@ -484,8 +524,17 @@ def main(): i = i + 1 json_results.update({"Test 4: SSH works": "Passed"}) else: - logger.error('\033[91m' + "TEST 4 [FAILED] " - "==> SSH BLOCKED" + '\033[0m') + error = ('\033[91m' + "TEST 4 [FAILED] " + "==> SSH BLOCKED" + '\033[0m') + logger.error(error) + ovs_logger.ofctl_dump_flows(controller_client, + timestamp=timestamp) + ovs_logger.vsctl_show(controller_client, + timestamp=timestamp) + + dumpdir = os.path.join(ovs_logger.ovs_dir, timestamp) + with open(os.path.join(dumpdir, 'error'), 'w') as f: + f.write(error) status = "FAIL" json_results.update({"Test 4: SSH works": "Failed"}) failures += 1 |