summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2017-02-08 09:39:25 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-02-08 09:39:25 +0000
commit16e66d31e3a62ef8f13de78dd7e84b417d14dd98 (patch)
treed409753c3164b07e19a7c150ec5c88508dc35fd2
parent995a0d9cfa3051034027b44c5bccb45e9180f8a0 (diff)
parentc83ec00f76d46d41f407df0dd455d3d81eb7dae5 (diff)
Merge "Modification of the ofctl_time counter"
-rw-r--r--sfc/lib/utils.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index 13f534be..a89dc5b5 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -348,7 +348,7 @@ def check_ssh(ips, retries=100):
return False
-def ofctl_time_counter(ovs_logger, ssh_conn):
+def ofctl_time_counter(ovs_logger, ssh_conn, max_duration=None):
try:
# We get the flows from table 11
table = 11
@@ -358,6 +358,17 @@ def ofctl_time_counter(ovs_logger, ssh_conn):
rsps = []
lines = output.split(",")
for line in lines:
+ if max_duration is not None:
+ pattern2 = "duration"
+ is_there2 = re.findall(pattern2, line)
+ if is_there2:
+ value = line.split("=")[1].split(".")[0]
+ value_int = int(value)
+ if value_int < max_duration:
+ # The RSP is new, no need to store the RSP in first_RSP
+ return rsps
+ else:
+ continue
is_there = re.findall(pattern, line)
if is_there:
value = line.split(":")[1].split("-")[0]
@@ -370,7 +381,11 @@ def ofctl_time_counter(ovs_logger, ssh_conn):
@ft_utils.timethis
def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200):
- rsps = ofctl_time_counter(ovs_logger, compute_clients[0])
+ # 10 sec. is the threshold to consider a flow from an old deployment
+ max_duration = 10
+ rsps = ofctl_time_counter(ovs_logger, compute_clients[0], max_duration)
+ # first_RSP saves a potential RSP from an old deployment. ODL may take
+ # quite some time to implement the new flow and an old flow may be there
first_RSP = rsps[0] if len(rsps) > 0 else ''
while not ((len(rsps) > 1) and
(first_RSP != rsps[0]) and