From ace4cb43631b843606433e43cbcf11ab5bb39493 Mon Sep 17 00:00:00 2001 From: liamkearney-msft Date: Tue, 19 Nov 2024 17:32:49 +1000 Subject: [PATCH] [macsec/show_macsec]: Only cache macsec stats (#20654) Existing implementation would also cache XPN / SAI_MACSEC_ATTR values, which should not be reset on a sonic-clear macsec command. Change the show command to only look at SAI_MACSEC_SA_STAT values when accounting for the cache Signed-off-by: Liam Kearney --- dockers/docker-macsec/cli/show/plugins/show_macsec.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockers/docker-macsec/cli/show/plugins/show_macsec.py b/dockers/docker-macsec/cli/show/plugins/show_macsec.py index f8a1265b07e9..a1c58cd34bb1 100644 --- a/dockers/docker-macsec/cli/show/plugins/show_macsec.py +++ b/dockers/docker-macsec/cli/show/plugins/show_macsec.py @@ -63,7 +63,7 @@ def dump_str(self, cache = None) -> str: counters = copy.deepcopy(self.counters) if cache: for k, v in counters.items(): - if k in cache.counters: + if k in cache.counters and k.startswith("SAI_MACSEC_SA_STAT"): counters[k] = int(counters[k]) - int(cache.counters[k]) counters = sorted(counters.items(), key=lambda x: x[0]) buffer += tabulate(meta + counters)