Skip to content
Closed
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
12 changes: 9 additions & 3 deletions pfcwd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
pass

# Default configuration
MAX_DETECTION_TIME = 1000
DEFAULT_DETECTION_TIME = 200
DEFAULT_RESTORATION_TIME = 200
DEFAULT_POLL_INTERVAL = 200
Expand Down Expand Up @@ -344,7 +345,7 @@ def interval(self, poll_interval):
pfcwd_info = {}
if poll_interval is not None:
pfcwd_table = self.config_db.get_table(CONFIG_DB_PFC_WD_TABLE_NAME)
entry_min = 3000
entry_min = MAX_DETECTION_TIME
for entry in pfcwd_table:
if("Ethernet" not in entry):
continue
Expand Down Expand Up @@ -418,8 +419,13 @@ def start_default(self):

# Paramter values positively correlate to the number of ports.
multiply = max(1, (port_num-1)//DEFAULT_PORT_NUM+1)

pfc_wd_detected_time = DEFAULT_DETECTION_TIME * multiply
if pfc_wd_detected_time > MAX_DETECTION_TIME:
pfc_wd_detected_time = MAX_DETECTION_TIME

pfcwd_info = {
'detection_time': DEFAULT_DETECTION_TIME * multiply,
'detection_time': pfc_wd_detected_time,
'restoration_time': DEFAULT_RESTORATION_TIME * multiply,
'action': DEFAULT_ACTION,
'pfc_stat_history': DEFAULT_PFC_HISTORY_STATUS
Expand Down Expand Up @@ -521,7 +527,7 @@ def start(db, action, restoration_time, ports, detection_time, pfc_stat_history)
# Set WD poll interval
class Interval(object):
@cli.command()
@click.argument('poll_interval', type=click.IntRange(100, 3000))
@click.argument('poll_interval', type=click.IntRange(100, MAX_DETECTION_TIME))
@clicommon.pass_db
def interval(db, poll_interval):
""" Set PFC watchdog counter polling interval """
Expand Down
Loading