summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2017-09-25 17:46:24 +0200
committerManuel Buil <mbuil@suse.com>2017-09-25 20:06:13 +0000
commit12d6defc7c25e51ad0007d8db3c67cc21cc49ee9 (patch)
tree89dd43c6dcbb1e7205d4c77840955afd70097e11
parentedf1b61b0cbd33d39ffcfea19592b9555ab1020b (diff)
Bug fix: Do not start testing before checking
JIRA:SFC-113 We used to check that the ACL and RSP flows were implemented because it took a lot of time. However, the new ODL Nitrogen reduced this time a lot and thus we must check that the vxlan_tool is up and the HTTP port is up in the server before doing any test Change-Id: I70219071c7965781b17e80631bf3e2efbfcfe4cd Signed-off-by: Manuel Buil <mbuil@suse.com>
-rw-r--r--sfc/lib/utils.py35
1 files changed, 30 insertions, 5 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index e406568f..65b491be 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -282,18 +282,34 @@ def assign_floating_ip(nova_client, neutron_client, instance_id):
return floating_ip
-def start_http_server(ip):
- """Start http server on a given machine, Can be VM"""
+def start_http_server(ip, iterations_check=5):
+ """
+ Start http server on a given machine. Wait until the process exists
+ and until the port is up
+ """
cmd = "\'python -m SimpleHTTPServer 80"
cmd = cmd + " > /dev/null 2>&1 &\'"
run_cmd_remote(ip, cmd)
+
+ # Wait for the process to start before checking
+ time.sleep(3)
_, output, _ = run_cmd_remote(ip, "ps aux | grep SimpleHTTPServer")
if not output:
logger.error("Failed to start http server")
return False
-
logger.info(output)
- return True
+
+ while iterations_check > 0:
+ _, output, _ = run_cmd_remote(ip, "ss -na | grep *:80")
+ if output:
+ return True
+ else:
+ logger.debug("Port 80 is not up yet")
+ iterations_check -= 1
+ time.sleep(5)
+
+ logger.error("Failed to start http server")
+ return False
def start_vxlan_tool(remote_ip, interface="eth0", block=None):
@@ -315,7 +331,16 @@ def start_vxlan_tool(remote_ip, interface="eth0", block=None):
options=options,
output_redirection=output_redirection)
- return run_cmd_remote(remote_ip, full_command)
+ output_execution = run_cmd_remote(remote_ip, full_command)
+
+ # Wait for the process to start before checking
+ time.sleep(3)
+ _, output, _ = run_cmd_remote(remote_ip, "ps aux | grep vxlan_tool")
+ if not output:
+ logger.error("Failed to start the vxlan tool")
+ return False
+
+ return output_execution
def stop_vxlan_tool(remote_ip):