diff --git a/config/muxcable.py b/config/muxcable.py index 8344606ed4..f53eae22e3 100644 --- a/config/muxcable.py +++ b/config/muxcable.py @@ -370,6 +370,22 @@ def mode(db, state, port, json_output): sys.exit(CONFIG_SUCCESSFUL) +# 'muxcable' command ("config muxcable kill-radv ") +@muxcable.command(short_help="Kill radv service when it is meant to be stopped, so no good-bye packet is sent for ceasing To Be an Advertising Interface") +@click.argument('knob', metavar='', required=True, type=click.Choice(["enable", "disable"])) +@clicommon.pass_db +def kill_radv(db, knob): + """config muxcable kill radv""" + + namespaces = multi_asic.get_front_end_namespaces() + for namespace in namespaces: + config_db = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace) + config_db.connect() + + mux_lmgrd_cfg_tbl = config_db.get_table("MUX_LINKMGR") + config_db.mod_entry("MUX_LINKMGR", "SERVICE_MGMT", {"kill_radv": "True" if knob == "enable" else "False"}) + + #'muxcable' command ("config muxcable packetloss reset ") @muxcable.command() @click.argument('action', metavar='', required=True, type=click.Choice(["reset"])) diff --git a/tests/muxcable_test.py b/tests/muxcable_test.py index 5a84a65484..b8eb3dce62 100644 --- a/tests/muxcable_test.py +++ b/tests/muxcable_test.py @@ -959,6 +959,15 @@ def test_config_muxcable_packetloss_reset_Ethernet0(self): assert result.exit_code == 0 + def test_config_muxcable_kill_radv_enable(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(config.config.commands["muxcable"].commands["kill-radv"], ["enable"], obj=db) + + assert result.exit_code == 0 + assert result.output == "" + @mock.patch('show.muxcable.delete_all_keys_in_db_table', mock.MagicMock(return_value=0)) @mock.patch('show.muxcable.update_and_get_response_for_xcvr_cmd', mock.MagicMock(return_value={0: 0, 1: "active"}))