Skip to content

Commit b1e4882

Browse files
committed
Policer Counter - version 1
1 parent 682eae9 commit b1e4882

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

doc/policer_counter/PolicerCounter-HLD.md

+22-17
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Counter Type:
9292
CounterType::POLICER
9393
```
9494

95-
PolicerOrch holds a new object of type FlexCounterManager and is initialized with ```StatsMode::READ```
95+
PolicerOrch holds a new object of type FlexCounterManager and is initialized to ```StatsMode::READ```
9696
and a default polling interval of 10 sec and disable by default:
9797
```c++
9898
FlexCounterManager m_pc_manager;
@@ -107,7 +107,7 @@ Added POLICER FC group support in syncd/FlexCounter.cpp.
107107

108108
### SAI API
109109

110-
No new SAI API is used.
110+
No new SAI API is needed.
111111

112112
### COUNTERS DB
113113

@@ -135,14 +135,14 @@ Counters table in COUNTERS DB:
135135
; Defines information for policer counter
136136
key = "COUNTERS:counter_oid" ; policer counter statistic
137137
;field = value
138-
SAI_POLICER_STAT_PACKETS = 1*10DIGIT ; packets
139-
SAI_POLICER_STAT_ATTR_BYTES = 1*10DIGIT ; bytes
140-
SAI_POLICER_STAT_GREEN_PACKETS = 1*10DIGIT ; packets
141-
SAI_POLICER_STAT_GREEN_BYTES = 1*10DIGIT ; bytes
142-
SAI_POLICER_STAT_YELLOW_PACKETS = 1*10DIGIT ; packets
143-
SAI_POLICER_STAT_YELLOW_BYTES = 1*10DIGIT ; bytes
144-
SAI_POLICER_STAT_RED_PACKETS = 1*10DIGIT ; packets
145-
SAI_POLICER_STAT_RED_BYTES = 1*10DIGIT ; bytes
138+
SAI_POLICER_STAT_PACKETS = number ; packets
139+
SAI_POLICER_STAT_ATTR_BYTES = number ; uint64
140+
SAI_POLICER_STAT_GREEN_PACKETS = number ; packets
141+
SAI_POLICER_STAT_GREEN_BYTES = number ; uint64
142+
SAI_POLICER_STAT_YELLOW_PACKETS = number ; packets
143+
SAI_POLICER_STAT_YELLOW_BYTES = number ; uint64
144+
SAI_POLICER_STAT_RED_PACKETS = number ; packets
145+
SAI_POLICER_STAT_RED_BYTES = number ; uint64
146146
```
147147

148148

@@ -200,7 +200,7 @@ E.g:
200200

201201
### CLI
202202

203-
*policerstat* utility is added to reads counters from the COUNTERS DB using the POLICER table in CONFIG DB and the COUNTERS_POLICER_NAME_MAP. It maps each POLICER to its VID and fetches counter values. If a map entry or VID is missing, it shows N/A, indicating either the POLICER was created without a counter, the policer/map entry isn't created yet, polling is disabled, or syncd hasn't updated the COUNTERS DB.
203+
The *policerstat* utility is added to reads counters from the COUNTERS DB using the POLICER table in CONFIG DB and the COUNTERS_POLICER_NAME_MAP. It maps each POLICER to its VID and fetches counter values. If a map entry or VID is missing, it shows N/A, indicating either the POLICER was created without a counter, the policer/map entry isn't created yet, polling is disabled, or syncd hasn't updated the COUNTERS DB.
204204

205205
```
206206
admin@sonic:~$ policerstat
@@ -210,10 +210,14 @@ span_policer 600 6144000 300 307200
210210
211211
```
212212

213-
Added a new CLI command
213+
Added a flag in ```show policer``` to show policer counter
214214
```
215-
show policer counter <policer_name>
216-
sonic-clear policer counter <policer_name>
215+
show policer -c [policer_name]
216+
```
217+
218+
Added a new CLI command - uses the policerstat utility
219+
```
220+
sonic-clear policercounters [policer_name]
217221
```
218222

219223
### Configuration and management
@@ -270,7 +274,8 @@ Flex Counter YANG model with POLICER group:
270274
Counter polling is delayed at system startup.
271275

272276
### Restrictions/Limitations
273-
N/A
277+
* Policers must be supported
278+
* Color based policing must be supported
274279

275280
### Testing Requirements/Design
276281

@@ -296,11 +301,11 @@ CLI Level Tests:
296301
- Verify command output with normal format
297302
- Verify command output with JSON format
298303

299-
5. TestPolicerStat::show_policer (Add new case for `show policer counter <policer_name>`)
304+
5. TestPolicerStat::show_policer (Add new case for `show policer -c [policer_name]`)
300305
- Verify command output with normal format
301306
- Verify command output with JSON format
302307

303-
6. TestPolicerStat::clear_policer (Add new case for `clear policer counter <policer_name>`)
308+
6. TestPolicerStat::clear_policer (Add new case for `sonic-clear policercounters [policer_name]`)
304309
- Verify stats value can be cleared
305310

306311

0 commit comments

Comments
 (0)