diff options
author | 2016-12-13 16:05:28 +0200 | |
---|---|---|
committer | 2016-12-13 16:05:28 +0200 | |
commit | 9455d897de5b4788fee1b9c820d8a09b3e6e8968 (patch) | |
tree | bde556d156df0fb1e4942cfbf38e7f0962f62265 /tests/functest/odl-sfc/utils.py | |
parent | 8b09f0ad06e5ae941fc497754cc5778fae9018de (diff) |
Use ovs_logger module from releng
JIRA: SFC-61
Releng is now installed as a python module and ovs_utils has been
transfered there in "opnfv.utils.ovs_logger" module, so we should use
that instead.
ofctl_time_counter is still hosted here under utils.py as it's not
generic enough to be moved in releng
Change-Id: Ie721c95f20a7f515f7f2eb45b7f8edd0460a6ea8
Signed-off-by: George Paraskevopoulos <geopar@intracom-telecom.com>
Diffstat (limited to 'tests/functest/odl-sfc/utils.py')
-rw-r--r-- | tests/functest/odl-sfc/utils.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/functest/odl-sfc/utils.py b/tests/functest/odl-sfc/utils.py index de23b812..826aaca7 100644 --- a/tests/functest/odl-sfc/utils.py +++ b/tests/functest/odl-sfc/utils.py @@ -355,14 +355,34 @@ def timethis(func): return timed +def ofctl_time_counter(ovs_logger, ssh_conn): + try: + # We get the flows from table 11 + table = 11 + br = "br-int" + output = ovs_logger.ofctl_dump_flows(ssh_conn, br, table) + pattern = "NXM_NX_NSP" + rsps = [] + lines = output.split(",") + for line in lines: + is_there = re.findall(pattern, line) + if is_there: + value = line.split(":")[1].split("-")[0] + rsps.append(value) + return rsps + except Exception, e: + logger.error('Error when countering %s' % e) + return None + + @timethis def capture_time_log(ovs_logger, compute_clients, timeout=200): - rsps = ovs_logger.ofctl_time_counter(compute_clients[0]) + rsps = ofctl_time_counter(ovs_logger, compute_clients[0]) 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 = ovs_logger.ofctl_time_counter(compute_clients[0]) + rsps = ofctl_time_counter(ovs_logger, compute_clients[0]) timeout -= 1 if timeout == 0: logger.error( |