X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fpapi%2Fvpp_papi_provider.py;h=ff52de501bf90bc9746dab64965ef2cc59f0086e;hb=9780b57a9640e9ab40e40ec122ac80e09cd74c79;hp=bd333b1e87af4373dfd55ab5bd2c905aa56ffaf5;hpb=8dc3a2a0568e1b8e31d02e477102471bf4bc0ee1;p=csit.git diff --git a/resources/tools/papi/vpp_papi_provider.py b/resources/tools/papi/vpp_papi_provider.py index bd333b1e87..ff52de501b 100755 --- a/resources/tools/papi/vpp_papi_provider.py +++ b/resources/tools/papi/vpp_papi_provider.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2020 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -209,6 +209,8 @@ def process_json_request(args): def process_stats(args): """Process the VPP Stats. + The reply contains single item covering all paths. + :param args: Command line arguments passed to VPP PAPI Provider. :type args: ArgumentParser :returns: JSON formatted string. @@ -221,14 +223,9 @@ def process_stats(args): except Exception as err: raise RuntimeError(f"PAPI init failed:\n{err!r}") - json_data = json.loads(args.data) - - reply = list() - - for path in json_data: - directory = stats.ls(path) - data = stats.dump(directory) - reply.append(data) + paths = json.loads(args.data) + directory = stats.ls(paths) + reply = [stats.dump(directory)] try: return json.dumps(reply)