[counter] Fix issue: non default counters will be delayed forever after fastboot (#10413)

- Why I did it
Fastboot will delay all counters in CONFIG DB, it relies on enable_counters.py to recover the delayed counters. However, enable_counters.py does not recover those non-default counters.

- How I did it
For non-default counters, if it is in CONFIG DB, put delay status to false after the waiting.

- How to verify it
Manual test
This commit is contained in:
Junchao-Mellanox 2022-03-31 20:23:57 +08:00 committed by Judy Joseph
parent 0302a86bd7
commit b82f95cd6e

View File

@ -38,16 +38,18 @@ def enable_rates():
def enable_counters():
db = swsssdk.ConfigDBConnector()
db.connect()
enable_counter_group(db, 'PORT')
enable_counter_group(db, 'RIF')
enable_counter_group(db, 'QUEUE')
enable_counter_group(db, 'PFCWD')
enable_counter_group(db, 'PG_WATERMARK')
enable_counter_group(db, 'PG_DROP')
enable_counter_group(db, 'QUEUE_WATERMARK')
enable_counter_group(db, 'BUFFER_POOL_WATERMARK')
enable_counter_group(db, 'PORT_BUFFER_DROP')
enable_counter_group(db, 'ACL')
default_enabled_counters = ['PORT', 'RIF', 'QUEUE', 'PFCWD', 'PG_WATERMARK', 'PG_DROP',
'QUEUE_WATERMARK', 'BUFFER_POOL_WATERMARK', 'PORT_BUFFER_DROP', 'ACL']
# Enable those default counters
for key in default_enabled_counters:
enable_counter_group(db, key)
# Set FLEX_COUNTER_DELAY_STATUS to false for those non-default counters
keys = db.get_keys('FLEX_COUNTER_TABLE')
for key in keys:
if key not in default_enabled_counters:
enable_counter_group(db, key)
enable_rates()