diff options
author | Jan Gelety <jgelety@cisco.com> | 2019-03-18 13:30:11 +0100 |
---|---|---|
committer | Jan Gelety <jgelety@cisco.com> | 2019-05-31 08:00:11 +0000 |
commit | fe1975eb1ac994df1bd759deda7154bb7dd9d7a7 (patch) | |
tree | 694e0f5920cac8f71e4ffbff9f9223c1a217cba6 /resources/libraries/python/PapiExecutor.py | |
parent | 245ea1de4f111c159a50bc309f53db3f520453ed (diff) |
CSIT-1468: InterfaceUtil migration from VAT to PAPI
Change-Id: I0062710d58996be767a852dc00545fedd60a5c72
Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/PapiExecutor.py')
-rw-r--r-- | resources/libraries/python/PapiExecutor.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py index 09cbf9ac73..8261a5e331 100644 --- a/resources/libraries/python/PapiExecutor.py +++ b/resources/libraries/python/PapiExecutor.py @@ -407,12 +407,27 @@ class PapiExecutor(object): :rtype: list """ + def process_value(val): + """Process value. + + :param val: Value to be processed. + :type val: object + :returns: Processed value. + :rtype: dict or str or int + """ + if isinstance(val, dict): + val_dict = dict() + for val_k, val_v in val.iteritems(): + val_dict[str(val_k)] = process_value(val_v) + return val_dict + else: + return binascii.hexlify(val) if isinstance(val, str) else val + api_data_processed = list() for api in api_d: api_args_processed = dict() for a_k, a_v in api["api_args"].iteritems(): - value = binascii.hexlify(a_v) if isinstance(a_v, str) else a_v - api_args_processed[str(a_k)] = value + api_args_processed[str(a_k)] = process_value(a_v) api_data_processed.append(dict(api_name=api["api_name"], api_args=api_args_processed)) return api_data_processed |