From 0d65bbb9619720ecc6bca1529acfb3a5239d9719 Mon Sep 17 00:00:00 2001 From: Vratko Polak Date: Tue, 30 Mar 2021 16:31:26 +0200 Subject: PAPI stats: Use list as argument to ls In the VPP PAPI stats code, the "ls" argument has always [0] been named "patterns", suggesting it expects a list of strings. In the CSIT utility we have always [1] been using it wrong (passing a single string), but it happened to work as VPP code had a workaround [2] for that. This workaround that got removed by accident in [3], and will be reintroduced in [4]. This change fixes occasional failures in CSIT (if merged sooner than [4]), mainly useful in aviding such failures during bisection. [0] https://gerrit.fd.io/r/c/vpp/+/14584/4/src/vpp-api/python/vpp_papi/vpp_stats.py#122 [1] https://gerrit.fd.io/r/c/csit/+/18419/13/resources/tools/papi/vpp_papi_provider.py#181 [2] https://gerrit.fd.io/r/c/vpp/+/14584/4/src/vpp-api/python/vpp_papi/vpp_stats.py#64 [3] https://gerrit.fd.io/r/c/vpp/+/31678 [4] https://gerrit.fd.io/r/c/vpp/+/31817 Change-Id: Ic0f9d906be064b386b67154ba738646c4362aa2b Signed-off-by: Vratko Polak --- resources/tools/papi/vpp_papi_provider.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/resources/tools/papi/vpp_papi_provider.py b/resources/tools/papi/vpp_papi_provider.py index bd333b1e87..c9a43447f9 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: @@ -226,7 +226,12 @@ def process_stats(args): reply = list() for path in json_data: - directory = stats.ls(path) + # 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) -- cgit 1.2.3-korg