stats: check epoch in python vpp_stats ls
The VPP Stats Python binding was missing checking epoch.
Resulting it would not pick up changes in the directory.
Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I3226d71c77be2e80e24b5cd48fc9820833f7d30e
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/src/vpp-api/python/vpp_papi/vpp_stats.py b/src/vpp-api/python/vpp_papi/vpp_stats.py
index b9b23b5..3831a82 100755
--- a/src/vpp-api/python/vpp_papi/vpp_stats.py
+++ b/src/vpp-api/python/vpp_papi/vpp_stats.py
@@ -280,6 +280,9 @@
if not isinstance(patterns, list):
patterns = [patterns]
regex = [re.compile(i) for i in patterns]
+ if self.last_epoch != self.epoch:
+ self.refresh()
+
return [k for k, v in self.directory.items()
if any(re.match(pattern, k) for pattern in regex)]