diff options
-rw-r--r-- | sfc/lib/odl_utils.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sfc/lib/odl_utils.py b/sfc/lib/odl_utils.py index c8b0ebdd..edd52054 100644 --- a/sfc/lib/odl_utils.py +++ b/sfc/lib/odl_utils.py @@ -5,7 +5,7 @@ import time import json import re import logging -import functest.utils.functest_utils as ft_utils +import functools import sfc.lib.openstack_utils as os_sfc_utils @@ -100,7 +100,21 @@ def promised_rsps_in_computes(odl_ip, odl_port): return rsps_in_computes -@ft_utils.timethis +def timethis(func): + """Measure the time it takes for a function to complete""" + @functools.wraps(func) + def timed(*args, **kwargs): + ts = time.time() + result = func(*args, **kwargs) + te = time.time() + elapsed = '{0}'.format(te - ts) + logger.info('{f}(*{a}, **{kw}) took: {t} sec'.format( + f=func.__name__, a=args, kw=kwargs, t=elapsed)) + return result, elapsed + return timed + + +@timethis def wait_for_classification_rules(ovs_logger, compute_nodes, odl_ip, odl_port, compute_client_name, timeout=200): ''' @@ -334,6 +348,7 @@ def check_vnffg_deletion(odl_ip, odl_port, ovs_logger, compute_client_name, return True + def create_chain(tacker_client, default_param_file, neutron_port, COMMON_CONFIG, TESTCASE_CONFIG): |