Skip to content

Commit

Permalink
[FlexCounter] Refactor FlexCounter class (sonic-net#1073)
Browse files Browse the repository at this point in the history
HLD: sonic-net/SONiC#1020

**Why I did it?**
FlexCounter class is a representation of flex counter group which supports querying multiple types of statistic/attributes. It supports multiple statistic/attribute types such as port counter, port debug counter, queue counter, queue attribute and so on. For each statistic/attribute type, it defines several member functions:

- setXXXCounterList: e.g. setPortCounterList, setPortDebugCounterList
- removeXXX: e.g. removePort, removeQueue
- collectXXXCounters: e.g. collectPortCounters, collectQueueCounters
- collectXXXAttr: e.g. collectQueueAttrs, collectPriorityGroupAttrs
- so on
- 
For different statistic/attribute types, these functions have very similar logic. This PR moved similar logic to single place to avoid redundant code.

**How I test it?**

Almost full unit test coverage of newly added code.
  • Loading branch information
Junchao-Mellanox authored Jul 28, 2022
1 parent 9652ea4 commit 513cb2a
Show file tree
Hide file tree
Showing 3 changed files with 1,463 additions and 3,602 deletions.
Loading

0 comments on commit 513cb2a

Please sign in to comment.