mirror of
https://github.com/Telecominfraproject/ols-nos.git
synced 2025-11-01 18:48:05 +00:00
Replace swsssdk with swsscommon (#11215)
#### Why I did it Update scripts in sonic-buildimage from py-swsssdk to swsscommon #### How I did it Change code to use swsscommon. #### How to verify it Pass all E2E test case #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 - [ ] 202205 #### Description for the changelog Update scripts in sonic-buildimage from py-swsssdk to swsscommon #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md --> #### A picture of a cute animal (not mandatory but encouraged)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import time
|
||||
import swsssdk
|
||||
from swsscommon import swsscommon
|
||||
|
||||
# ALPHA defines the size of the window over which we calculate the average value. ALPHA is 2/(N+1) where N is the interval(window size)
|
||||
# In this case we configure the window to be 10s. This way if we have a huge 1s spike in traffic,
|
||||
@@ -23,7 +23,7 @@ def enable_counter_group(db, name):
|
||||
|
||||
def enable_rates():
|
||||
# set the default interval for rates
|
||||
counters_db = swsssdk.SonicV2Connector()
|
||||
counters_db = swsscommon.SonicV2Connector()
|
||||
counters_db.connect('COUNTERS_DB')
|
||||
counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL)
|
||||
counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_ALPHA', DEFAULT_ALPHA)
|
||||
@@ -36,7 +36,7 @@ def enable_rates():
|
||||
|
||||
|
||||
def enable_counters():
|
||||
db = swsssdk.ConfigDBConnector()
|
||||
db = swsscommon.ConfigDBConnector()
|
||||
db.connect()
|
||||
default_enabled_counters = ['PORT', 'RIF', 'QUEUE', 'PFCWD', 'PG_WATERMARK', 'PG_DROP',
|
||||
'QUEUE_WATERMARK', 'BUFFER_POOL_WATERMARK', 'PORT_BUFFER_DROP', 'ACL']
|
||||
|
||||
Reference in New Issue
Block a user