Skip to content

Commit 08da428

Browse files
sihuihan88lguohan
authored andcommitted
[pfcwd]: add cli to enable/disable BIG_RED_SWITCH mode (#237)
Signed-off-by: Sihui Han <sihan@microsoft.com>
1 parent ca11c15 commit 08da428

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

pfcwd/main.py

+18
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ def config(ports):
113113
poll_interval = configdb.get_entry( 'PFC_WD_TABLE', 'GLOBAL').get('POLL_INTERVAL')
114114
if poll_interval is not None:
115115
click.echo("Changed polling interval to " + poll_interval + "ms")
116+
117+
big_red_switch = configdb.get_entry( 'PFC_WD_TABLE', 'GLOBAL').get('BIG_RED_SWITCH')
118+
if big_red_switch is not None:
119+
click.echo("BIG_RED_SWITCH status is " + big_red_switch)
120+
116121
click.echo(tabulate(table, CONFIG_HEADER, stralign='right', numalign='right', tablefmt='simple'))
117122

118123
# Start WD
@@ -214,5 +219,18 @@ def start_default():
214219
pfcwd_info['POLL_INTERVAL'] = DEFAULT_POLL_INTERVAL * multiply
215220
configdb.mod_entry("PFC_WD_TABLE", "GLOBAL", pfcwd_info)
216221

222+
# Enable/disable PFC WD BIG_RED_SWITCH mode
223+
@cli.command()
224+
@click.argument('big_red_switch', type=click.Choice(['enable', 'disable']))
225+
def big_red_switch(big_red_switch):
226+
""" Enable/disable BIG_RED_SWITCH mode """
227+
configdb = swsssdk.ConfigDBConnector()
228+
configdb.connect()
229+
pfcwd_info = {}
230+
if big_red_switch is not None:
231+
pfcwd_info['BIG_RED_SWITCH'] = big_red_switch
232+
233+
configdb.mod_entry("PFC_WD_TABLE", "GLOBAL", pfcwd_info)
234+
217235
if __name__ == '__main__':
218236
cli()

0 commit comments

Comments
 (0)