diff options
Diffstat (limited to 'src/vpp-api/python/vpp_papi')
-rw-r--r-- | src/vpp-api/python/vpp_papi/vpp_stats.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py index bb6cdf5ffdc..06daaf86f50 100644 --- a/src/vpp-api/python/vpp_papi/vpp_stats.py +++ b/src/vpp-api/python/vpp_papi/vpp_stats.py @@ -196,8 +196,13 @@ class VPPStats(object): retries = 0 while True: try: - dir = self.ls(name) - return self.dump(dir).values()[0] + d = self.ls(name) + s = self.dump(d) + if len(s) > 1: + raise AttributeError('Matches multiple counters {}' + .format(name)) + k, v = s.popitem() + return v except VPPStatsIOError as e: if retries > 10: return None |