Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[muxcable][config] Add support to enable/disable ceasing to be an advertisement interface when radv service is stopped #2622

Merged
merged 3 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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