aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/papi
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2019-03-18 13:30:11 +0100
committerJan Gelety <jgelety@cisco.com>2019-05-31 08:00:11 +0000
commitfe1975eb1ac994df1bd759deda7154bb7dd9d7a7 (patch)
tree694e0f5920cac8f71e4ffbff9f9223c1a217cba6 /resources/tools/papi
parent245ea1de4f111c159a50bc309f53db3f520453ed (diff)
CSIT-1468: InterfaceUtil migration from VAT to PAPI
Change-Id: I0062710d58996be767a852dc00545fedd60a5c72 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/tools/papi')
-rwxr-xr-xresources/tools/papi/vpp_papi_provider.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/resources/tools/papi/vpp_papi_provider.py b/resources/tools/papi/vpp_papi_provider.py
index cec8197329..ee0d538fba 100755
--- a/resources/tools/papi/vpp_papi_provider.py
+++ b/resources/tools/papi/vpp_papi_provider.py
@@ -131,6 +131,19 @@ def process_json_request(args):
reply = list()
+ def process_value(val):
+ 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
+ elif isinstance(val, unicode):
+ return binascii.unhexlify(val)
+ elif isinstance(val, int):
+ return val
+ else:
+ return str(val)
+
json_data = json.loads(args.data)
vpp.connect(CLIENT_NAME)
for data in json_data:
@@ -139,8 +152,7 @@ def process_json_request(args):
api_reply = dict(api_name=api_name)
api_args = dict()
for a_k, a_v in api_args_unicode.items():
- value = binascii.unhexlify(a_v) if isinstance(a_v, unicode) else a_v
- api_args[str(a_k)] = value if isinstance(value, int) else str(value)
+ api_args[str(a_k)] = process_value(a_v)
try:
papi_fn = getattr(vpp.api, api_name)
rep = papi_fn(**api_args)