Skip to content

Commit

Permalink
[muxcable][config] Add support to enable/disable ceasing to be an adv…
Browse files Browse the repository at this point in the history
…ertisement interface when `radv` service is stopped (#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 zhangjing@microsoft.com
  • Loading branch information
zjswhhh authored and yxieca committed Jan 23, 2023
1 parent 1e3f38d commit c63a62b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions config/muxcable.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,22 @@ def mode(db, state, port, json_output):
sys.exit(CONFIG_SUCCESSFUL)


# 'muxcable' command ("config muxcable kill-radv <enable|disable> ")
@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='<feature_knob>', 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 <port|all>")
@muxcable.command()
@click.argument('action', metavar='<action_name>', required=True, type=click.Choice(["reset"]))
Expand Down
9 changes: 9 additions & 0 deletions tests/muxcable_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"}))
Expand Down

0 comments on commit c63a62b

Please sign in to comment.