Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes bug for PFCWD feature parameters #838

Merged
merged 6 commits into from
Apr 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import click
import swsssdk
import os
import sys
from tabulate import tabulate
from natsort import natsorted

Expand Down Expand Up @@ -194,9 +195,25 @@ def interval(poll_interval):
configdb.connect()
pfcwd_info = {}
if poll_interval is not None:
pfcwd_table = configdb.get_table(CONFIG_DB_PFC_WD_TABLE_NAME)
entry_min = 3000
for entry in pfcwd_table:
if("Ethernet" not in entry):
continue
detection_time_entry_value = int(configdb.get_entry(CONFIG_DB_PFC_WD_TABLE_NAME, entry).get('detection_time'))
restoration_time_entry_value = int(configdb.get_entry(CONFIG_DB_PFC_WD_TABLE_NAME, entry).get('restoration_time'))
if ((detection_time_entry_value != None) and (detection_time_entry_value < entry_min)):
entry_min = detection_time_entry_value
entry_min_str = "detection time"
if ((restoration_time_entry_value != None) and (restoration_time_entry_value < entry_min)):
entry_min = restoration_time_entry_value
entry_min_str = "restoration time"
if entry_min < poll_interval:
print >> sys.stderr, "unable to use polling interval = {}ms, value is bigger than one of the configured {} values, please choose a smaller polling_interval".format(poll_interval,entry_min_str)
exit(1)

pfcwd_info['POLL_INTERVAL'] = poll_interval

configdb.mod_entry(CONFIG_DB_PFC_WD_TABLE_NAME, "GLOBAL", pfcwd_info)
configdb.mod_entry(CONFIG_DB_PFC_WD_TABLE_NAME, "GLOBAL", pfcwd_info)

# Stop WD
@cli.command()
Expand Down