summaryrefslogtreecommitdiffstats
path: root/testcases/features/sfc/sfc.py
diff options
context:
space:
mode:
authorManuel Buil <manuel.buil@ericsson.com>2016-11-08 18:16:35 +0100
committerGeorge Paraskevopoulos <geopar@intracom-telecom.com>2016-11-17 16:06:23 +0200
commit5757ef49379bdefab7d9fbfe8f75bd4f580719f9 (patch)
tree176ec73adf8291287846f98d536ca4a9117ab800 /testcases/features/sfc/sfc.py
parent27d29fae80b84b148317b59f88e2ce997b2c9f66 (diff)
Feature to know the time it takes to update OVS
ODL takes too much time to update the classification rules and we would like to measure it to use it as a proof point that it is not acceptable. This feature allows to measure it. Change-Id: I00ade7e4aee7c9c81843077104727b98ad9bfea3 Signed-off-by: Manuel Buil <manuel.buil@ericsson.com>
Diffstat (limited to 'testcases/features/sfc/sfc.py')
-rwxr-xr-xtestcases/features/sfc/sfc.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/testcases/features/sfc/sfc.py b/testcases/features/sfc/sfc.py
index 0b83ab7ea..9de592851 100755
--- a/testcases/features/sfc/sfc.py
+++ b/testcases/features/sfc/sfc.py
@@ -10,6 +10,7 @@ import re
import json
import SSHUtils as ssh_utils
import ovs_utils
+import thread
parser = argparse.ArgumentParser()
@@ -401,6 +402,31 @@ def check_ssh(ips, retries=100):
return False
+# Measure the time it takes to update the classification rules
+
+
+def capture_time_log(compute_clients):
+ ovs_logger = ovs_utils.OVSLogger(
+ os.path.join(os.getcwd(), 'ovs-logs'),
+ "test")
+ i = 0
+ first_RSP = ""
+ start_time = time.time()
+ while True:
+ rsps = ovs_logger.ofctl_time_counter(compute_clients[0])
+ if not i:
+ first_RSP = rsps[0]
+ i = i + 1
+ if(first_RSP != rsps[0]):
+ if (rsps[0] == rsps[1]):
+ stop_time = time.time()
+ logger.info("classification rules updated")
+ difference = stop_time - start_time
+ logger.info("It took %s seconds" % difference)
+ break
+ time.sleep(1)
+ return
+
def main():
installer_type = os.environ.get("INSTALLER_TYPE")
@@ -444,6 +470,13 @@ def main():
nova_client, SERVER, FLAVOR, image_id, network_id, sg_id)
subprocess.call(TACKER_SCRIPT, shell=True)
+
+ # Start measuring the time it takes to implement the classification rules
+ try:
+ thread.start_new_thread(capture_time_log, (compute_clients,))
+ except Exception, e:
+ logger.error("Unable to start the thread that counts time %s" % e)
+
server_ip, client_ip, sf1, sf2 = get_floating_ips(
nova_client, neutron_client)
@@ -487,6 +520,13 @@ def main():
logger.info("Changing the classification")
subprocess.call(TACKER_CHANGECLASSI, shell=True)
+
+ # Start measuring the time it takes to implement the classification rules
+ try:
+ thread.start_new_thread(capture_time_log, (compute_clients,))
+ except Exception, e:
+ logger.error("Unable to start the thread that counts time %s" % e)
+
logger.info("Wait for ODL to update the classification rules in OVS")
time.sleep(100)