aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author“Manuel Buil” <mbuil@suse.com>2017-02-03 13:27:28 +0100
committer“Manuel Buil” <mbuil@suse.com>2017-02-03 13:52:08 +0100
commitc83ec00f76d46d41f407df0dd455d3d81eb7dae5 (patch)
treefdfd79b7ac2a0c183753868f4ccb123295c35afb
parent58c118253a081f19a8a14a0a16895b04c6b8f222 (diff)
Modification of the ofctl_time counter
If ODL is fast and changes the class. flow too quick, this function considers it as coming from an old deployment and thus never detects that the flows changed Change-Id: I0d6d1c27b325fb832d9ed6d4849f830eeea70185 Signed-off-by: “Manuel Buil” <mbuil@suse.com>
-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 f4412abf..ef261627 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -352,7 +352,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
@@ -362,6 +362,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]
@@ -374,7 +385,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