Skip to content

Commit

Permalink
Fix pfcwd start_default: Use config_db to get the active port list. (s…
Browse files Browse the repository at this point in the history
…onic-net#319)

* Fix pfcwd start_default: Use config_db to get the active port list. Remove
the use of counters_db because start_default can be called on a device where no
pfcwd is enabled, so the only source we can reply on to get the port
info is the config_db not counters_db.

Signed-off-by: Wenda Ni <[email protected]>

* Address comments: remove function get_active_ports_from_configdb, inline the operation

Signed-off-by: Wenda <[email protected]>
  • Loading branch information
wendani authored and lguohan committed Sep 14, 2018
1 parent 53c0007 commit cba11a0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ def start_default():
configdb = swsssdk.ConfigDBConnector()
configdb.connect()
enable = configdb.get_entry('DEVICE_METADATA', 'localhost').get('default_pfcwd_status')
countersdb = swsssdk.SonicV2Connector(host='127.0.0.1')
countersdb.connect(countersdb.COUNTERS_DB)

all_ports = get_all_ports(countersdb)
# Get active ports from Config DB
active_ports = natsorted(configdb.get_table('DEVICE_NEIGHBOR').keys())

if not enable or enable.lower() != "enable":
return
Expand All @@ -215,7 +214,7 @@ def start_default():
'action': DEFAULT_ACTION
}

for port in all_ports:
for port in active_ports:
configdb.set_entry("PFC_WD_TABLE", port, pfcwd_info)

pfcwd_info = {}
Expand Down

0 comments on commit cba11a0

Please sign in to comment.