Skip to content

Commit b5ac600

Browse files
authored
[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 981f953 commit b5ac600

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
@@ -370,6 +370,22 @@ def mode(db, state, port, json_output):
370370
sys.exit(CONFIG_SUCCESSFUL)
371371

372372

373+
# 'muxcable' command ("config muxcable kill-radv <enable|disable> ")
374+
@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")
375+
@click.argument('knob', metavar='<feature_knob>', required=True, type=click.Choice(["enable", "disable"]))
376+
@clicommon.pass_db
377+
def kill_radv(db, knob):
378+
"""config muxcable kill radv"""
379+
380+
namespaces = multi_asic.get_front_end_namespaces()
381+
for namespace in namespaces:
382+
config_db = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
383+
config_db.connect()
384+
385+
mux_lmgrd_cfg_tbl = config_db.get_table("MUX_LINKMGR")
386+
config_db.mod_entry("MUX_LINKMGR", "SERVICE_MGMT", {"kill_radv": "True" if knob == "enable" else "False"})
387+
388+
373389
#'muxcable' command ("config muxcable packetloss reset <port|all>")
374390
@muxcable.command()
375391
@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)