aboutsummaryrefslogtreecommitdiffstats
path: root/testcases
diff options
context:
space:
mode:
authorGeorge Paraskevopoulos <geopar@intracom-telecom.com>2016-10-21 18:32:29 +0300
committerJose Lausuch <jose.lausuch@ericsson.com>2016-10-21 15:52:12 +0000
commitff582b79220b214d4ef530144c1b66084a832261 (patch)
tree40f80a1e034a3961d213cb46342eb30bce890bf5 /testcases
parent09bff0da2a2292faf81cb1eab5c48e0ca6dcca68 (diff)
Add ovs logging in sfc_colorado1
Change-Id: I25671508c28d44b83263073971c2bf52cea80c58 Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com> (cherry picked from commit 573953d3fda65c03ece01b1ee70516599c7ae831)
Diffstat (limited to 'testcases')
-rwxr-xr-xtestcases/features/sfc/sfc_colorado1.py65
1 files changed, 57 insertions, 8 deletions
diff --git a/testcases/features/sfc/sfc_colorado1.py b/testcases/features/sfc/sfc_colorado1.py
index 8c82d6dc1..4aef9d933 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()
@@ -115,6 +117,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):
@@ -416,8 +428,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
@@ -439,8 +461,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
@@ -482,8 +513,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
@@ -505,8 +545,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