Skip to content

Commit dac636f

Browse files
authored
[pfcwd]: add command to set pfcwd polling interval (sonic-net#192)
Signed-off-by: Sihui Han <sihan@microsoft.com>
1 parent db80717 commit dac636f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

pfcwd/main.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def config(ports):
9292
line = config_entry.get(config[1], config[2])
9393
config_list.append(line)
9494
table.append([port] + config_list)
95-
95+
poll_interval = configdb.get_entry( 'PFC_WD_TABLE', 'GLOBAL').get('POLL_INTERVAL')
96+
if poll_interval is not None:
97+
click.echo("Changed polling interval to " + poll_interval + "ms")
9698
click.echo(tabulate(table, CONFIG_HEADER, stralign='right', numalign='right', tablefmt='simple'))
9799

98100
# Start WD
@@ -127,6 +129,19 @@ def start(action, restoration_time, ports, detection_time):
127129
configdb.mod_entry("PFC_WD_TABLE", port, None)
128130
configdb.mod_entry("PFC_WD_TABLE", port, pfcwd_info)
129131

132+
# Set WD poll interval
133+
@cli.command()
134+
@click.argument('poll_interval', type=click.IntRange(100, 3000))
135+
def interval(poll_interval):
136+
""" Set PFC watchdog counter polling interval """
137+
configdb = swsssdk.ConfigDBConnector()
138+
configdb.connect()
139+
pfcwd_info = {}
140+
if poll_interval is not None:
141+
pfcwd_info['POLL_INTERVAL'] = poll_interval
142+
143+
configdb.mod_entry("PFC_WD_TABLE", "GLOBAL", pfcwd_info)
144+
130145
# Stop WD
131146
@cli.command()
132147
@click.argument('ports', nargs = -1)

0 commit comments

Comments
 (0)