There is only one call site (VppCounters.vpp_show_runtime)
which uses a single path ("^/sys/node"),
so we do not need to split the replies anymore.
This simplifies investigating bugs related to VPP stats.
Change-Id: Idfc029c795cd78cf6d41c2f461f7844aed53410d
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
is "stats".
- the second parameter must be 'path' as it is used by PapiExecutor
method 'add'.
is "stats".
- the second parameter must be 'path' as it is used by PapiExecutor
method 'add'.
+ - even if the parameter contains multiple paths, there is only one
+ reply item (for each .add).
"""
def __init__(self, node):
"""
def __init__(self, node):
def process_stats(args):
"""Process the VPP Stats.
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.
:param args: Command line arguments passed to VPP PAPI Provider.
:type args: ArgumentParser
:returns: JSON formatted string.
except Exception as err:
raise RuntimeError(f"PAPI init failed:\n{err!r}")
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:
- # The ls method can match multiple patterns,
- # but we feed it one path at a time anyway, because the caller
- # expect results in a list, one item per path.
- # Most VPP versions understand a string is a single pattern,
- # but some blindly iterate (as if it was a list of chars).
- 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)
try:
return json.dumps(reply)