Skip to content

Commit ff5167a

Browse files
zjswhhhisabelmsft
authored andcommitted
[muxcable][config] Add support to enable/disable ceasing to be an advertisement interface when radv service is stopped (sonic-net#2622)
This PR is to add CLI support to enable or disable the feature to send out a good-bye packet when radv service is stopped on active-active dualtor devices. sign-off: Jing Zhang [email protected]
1 parent ed1d3c9 commit ff5167a

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

config/muxcable.py

+16
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,22 @@ def mode(db, state, port, json_output):
380380
sys.exit(CONFIG_SUCCESSFUL)
381381

382382

383+
# 'muxcable' command ("config muxcable kill-radv <enable|disable> ")
384+
@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")
385+
@click.argument('knob', metavar='<feature_knob>', required=True, type=click.Choice(["enable", "disable"]))
386+
@clicommon.pass_db
387+
def kill_radv(db, knob):
388+
"""config muxcable kill radv"""
389+
390+
namespaces = multi_asic.get_front_end_namespaces()
391+
for namespace in namespaces:
392+
config_db = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
393+
config_db.connect()
394+
395+
mux_lmgrd_cfg_tbl = config_db.get_table("MUX_LINKMGR")
396+
config_db.mod_entry("MUX_LINKMGR", "SERVICE_MGMT", {"kill_radv": "True" if knob == "enable" else "False"})
397+
398+
383399
#'muxcable' command ("config muxcable packetloss reset <port|all>")
384400
@muxcable.command()
385401
@click.argument('action', metavar='<action_name>', required=True, type=click.Choice(["reset"]))

tests/muxcable_test.py

+9
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,15 @@ def test_config_muxcable_packetloss_reset_Ethernet0(self):
959959

960960
assert result.exit_code == 0
961961

962+
def test_config_muxcable_kill_radv_enable(self):
963+
runner = CliRunner()
964+
db = Db()
965+
966+
result = runner.invoke(config.config.commands["muxcable"].commands["kill-radv"], ["enable"], obj=db)
967+
968+
assert result.exit_code == 0
969+
assert result.output == ""
970+
962971
@mock.patch('show.muxcable.delete_all_keys_in_db_table', mock.MagicMock(return_value=0))
963972
@mock.patch('show.muxcable.update_and_get_response_for_xcvr_cmd', mock.MagicMock(return_value={0: 0,
964973
1: "active"}))

0 commit comments

Comments
 (0)