Skip to content

Commit 1ec0540

Browse files
Fix the switch level Voq counter to use switch_id Oid instead of counter name for PACKET_INTEGRITY counter (#3769)
What I did Changed the switch level Voq counter to use switch_id Oid instead of counter name for PACKET_INTEGRITY counter How I did it Changed the orchagent to use switch level Voq counter to use Switch_id Oid instead of counter name for PACKET_INTEGRITY counter. So updated the corresponding changes in sonic-utilities. How to verify it Verified with show drop count and mock test Signed-off-by: saksarav <[email protected]>
1 parent fd43d51 commit 1ec0540

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

scripts/dropstat

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/python3
22

33
#####################################################################
44
#
@@ -51,7 +51,7 @@ DEBUG_COUNTER_PORT_STAT_MAP = 'COUNTERS_DEBUG_NAME_PORT_STAT_MAP'
5151
DEBUG_COUNTER_SWITCH_STAT_MAP = 'COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP'
5252
COUNTERS_PORT_NAME_MAP = 'COUNTERS_PORT_NAME_MAP'
5353
COUNTER_TABLE_PREFIX = 'COUNTERS:'
54-
SWITCH_LEVEL_COUNTER_PREFIX = 'SWITCH_STD_DROP_COUNTER-'
54+
SWITCH_LEVEL_COUNTER_PREFIX = 'SWITCH_ID'
5555

5656
# ASIC_DB Tables
5757
ASIC_SWITCH_INFO_PREFIX = 'ASIC_STATE:SAI_OBJECT_TYPE_SWITCH:'
@@ -89,6 +89,7 @@ std_port_headers_map = {
8989
std_switch_description_header = ['DEVICE']
9090

9191
std_switch_dflt_drop_headers= [ 'SWITCH-ID']
92+
std_switch_drop_counters = ['SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP']
9293
std_switch_drop_headers_map = {
9394
'SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP': 'PKT_INTEGRITY_ERR'
9495
}
@@ -198,9 +199,9 @@ class DropStat(object):
198199
counters = self.get_configured_counters(DEBUG_COUNTER_SWITCH_STAT_MAP, True)
199200
if not counters:
200201
return
201-
switch_id = self.get_switch_id()
202-
switch_std_stats = self.get_counts(counters, switch_id)
203202

203+
switch_id = self.get_switch_id()
204+
switch_std_stats = self.get_counts(std_switch_drop_counters, switch_id)
204205
if not switch_std_stats:
205206
return
206207

@@ -211,10 +212,9 @@ class DropStat(object):
211212
row = [cfg_switch_id]
212213

213214
headers = std_switch_dflt_drop_headers
214-
for cntr in counters:
215-
if cntr in std_switch_drop_headers_map:
216-
row.append(switch_std_stats.get(cntr, 0) - switch_std_drop_ckpt.get(cntr, 0))
217-
headers.append(std_switch_drop_headers_map[cntr])
215+
for cntr in std_switch_drop_counters:
216+
row.append(switch_std_stats.get(cntr, 0) - switch_std_drop_ckpt.get(cntr, 0))
217+
headers.append(std_switch_drop_headers_map[cntr])
218218
if row:
219219
print(tabulate([row], headers, tablefmt='simple', stralign='right'))
220220
print('')

tests/mock_tables/counters_db.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@
21452145
"COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP": {
21462146
"DEBUG_1": "SAI_SWITCH_STAT_OUT_DROP_REASON_RANGE_BASE",
21472147
"lowercase_counter": "SAI_SWITCH_STAT_OUT_CONFIGURED_DROP_REASONS_1_DROPPED_PKTS",
2148-
"SWITCH_STD_DROP_COUNTER-SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP": "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP"
2148+
"SWITCH_ID": "0x21000000000000"
21492149
},
21502150
"COUNTERS:oid:0x1500000000035a": {
21512151
"PFC_WD_ACTION": "drop",

0 commit comments

Comments
 (0)