Skip to content

Commit

Permalink
[macsec/show_macsec]: Only cache macsec stats (sonic-net#20654)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
liamkearney-msft authored and github-actions[bot] committed Nov 19, 2024
1 parent 8d78391 commit 0a4ec77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dockers/docker-macsec/cli/show/plugins/show_macsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a4ec77

Please sign in to comment.