aboutsummaryrefslogtreecommitdiffstats
path: root/sfc/lib/utils.py
diff options
context:
space:
mode:
authorGeorge Paraskevopoulos <geopar@intracom-telecom.com>2017-02-21 10:10:09 +0200
committerGeorge Paraskevopoulos <geopar@intracom-telecom.com>2017-02-21 10:12:33 +0200
commit32cc637c69580b18112e1e347830b6ee194b1b60 (patch)
treea0e0a8ea5078c03403f2ee77c026a1db21e97cad /sfc/lib/utils.py
parent371685974781964b0d5339f8497c06c89b24ae20 (diff)
Wait for flows to appear in all compute nodes
Right now we check the classification rules only on the first compute node. This leads to race conditions when running the testcases on multiple computes (ie the test fails when a rule is installed in the first compute but not the other[s]) Change-Id: I13cf26201aae185a0a5d1220b38e061d8bd3c766 Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
Diffstat (limited to 'sfc/lib/utils.py')
-rw-r--r--sfc/lib/utils.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index a7edef68..c8641dd0 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -399,22 +399,24 @@ def ofctl_time_counter(ovs_logger, ssh_conn, max_duration=None):
@ft_utils.timethis
def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200):
# 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
- (rsps[0] == rsps[1])):
- rsps = ofctl_time_counter(ovs_logger, compute_clients[0])
- timeout -= 1
- if timeout == 0:
- logger.error(
- "Timeout but classification rules are not updated")
- return
- time.sleep(1)
- logger.info("classification rules updated")
+ for compute_client in compute_clients:
+ max_duration = 10
+ rsps = ofctl_time_counter(ovs_logger, compute_client, 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
+ (rsps[0] == rsps[1])):
+ rsps = ofctl_time_counter(ovs_logger, compute_client)
+ timeout -= 1
+ if timeout == 0:
+ logger.error(
+ "Timeout but classification rules are not updated")
+ return
+ time.sleep(1)
+ logger.info("classification rules updated")
def setup_compute_node(cidr, compute_nodes):