aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sfc/lib/utils.py35
-rw-r--r--sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py4
-rw-r--r--sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py3
3 files changed, 29 insertions, 13 deletions
diff --git a/sfc/lib/utils.py b/sfc/lib/utils.py
index 2b8bdc13..4b5e91f5 100644
--- a/sfc/lib/utils.py
+++ b/sfc/lib/utils.py
@@ -360,7 +360,8 @@ 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):
+def wait_for_classification_rules(ovs_logger, compute_clients,
+ num_chains, timeout=200):
# 10 sec. is the threshold to consider a flow from an old deployment
for compute_client in compute_clients:
max_duration = 10
@@ -369,16 +370,28 @@ def wait_for_classification_rules(ovs_logger, compute_clients, timeout=200):
# 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("This is the first_RSP: %s" % first_RSP)
+ if num_chains == 1:
+ while not ((len(rsps) == 1) and (first_RSP != rsps[0])):
+ rsps = ofctl_time_counter(ovs_logger, compute_client)
+ logger.info("These are the rsps: %s" % rsps)
+ timeout -= 1
+ if timeout == 0:
+ logger.error(
+ "Timeout but classification rules are not updated")
+ return
+ time.sleep(1)
+ elif num_chains == 2:
+ while not ((len(rsps) > 1) and (first_RSP != rsps[0]) and
+ (rsps[0] == rsps[1])):
+ rsps = ofctl_time_counter(ovs_logger, compute_client)
+ logger.info("This is the rsps: %s" % rsps)
+ timeout -= 1
+ if timeout == 0:
+ logger.error(
+ "Timeout but classification rules are not updated")
+ return
+ time.sleep(1)
logger.info("classification rules updated")
diff --git a/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py b/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py
index 88c3d5fb..77c3a4e5 100644
--- a/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py
+++ b/sfc/tests/functest/sfc_one_chain_two_service_functions_different_computes.py
@@ -165,9 +165,11 @@ def main():
logger.info(test_utils.run_cmd('tacker sfc-list')[1])
logger.info(test_utils.run_cmd('tacker sfc-classifier-list')[1])
+ num_chains = 1
+
# Start measuring the time it takes to implement the classification rules
t1 = threading.Thread(target=test_utils.wait_for_classification_rules,
- args=(ovs_logger, compute_clients,))
+ args=(ovs_logger, compute_clients, num_chains,))
try:
t1.start()
except Exception, e:
diff --git a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
index fa549b16..d96b9d83 100644
--- a/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
+++ b/sfc/tests/functest/sfc_two_chains_SSH_and_HTTP.py
@@ -180,9 +180,10 @@ def main():
logger.info(test_utils.run_cmd('tacker sfc-list')[1])
logger.info(test_utils.run_cmd('tacker sfc-classifier-list')[1])
+ num_chains = 2
# Start measuring the time it takes to implement the classification rules
t1 = threading.Thread(target=test_utils.wait_for_classification_rules,
- args=(ovs_logger, compute_clients,))
+ args=(ovs_logger, compute_clients, num_chains,))
try:
t1.start()
except Exception, e: