diff --git a/config/muxcable.py b/config/muxcable.py index 216da578d3..8edde8c461 100644 --- a/config/muxcable.py +++ b/config/muxcable.py @@ -70,7 +70,7 @@ def lookup_statedb_and_update_configdb(per_npu_statedb, config_db, port, state_c ipv6_value = get_value_for_key_in_config_tbl(config_db, port, "server_ipv6", "MUX_CABLE") state = get_value_for_key_in_dict(muxcable_statedb_dict, port, "state", "MUX_CABLE_TABLE") - if (state == "active" and configdb_state == "active") or (state == "standby" and configdb_state == "active") or (state == "unknown" and configdb_state == "active") : + if (state == "active" and configdb_state == "active") or (state == "standby" and configdb_state == "active") or (state == "unknown" and configdb_state == "active"): if state_cfg_val == "active": # status is already active, so right back error port_status_dict[port] = 'OK' @@ -89,7 +89,7 @@ def lookup_statedb_and_update_configdb(per_npu_statedb, config_db, port, state_c # dont write anything to db, write OK to user port_status_dict[port] = 'OK' - elif (state == "standby" and configdb_state == "auto") or (state == "unknown" and configdb_state == "auto"): + elif (state == "standby" and configdb_state == "auto") or (state == "unknown" and configdb_state == "auto"): if state_cfg_val == "active": # make the state active config_db.set_entry("MUX_CABLE", port, {"state": "active", @@ -187,3 +187,73 @@ def mode(state, port, json_output): click.echo(tabulate(data, headers=headers)) sys.exit(CONFIG_SUCCESSFUL) + +@muxcable.group(cls=clicommon.AbbreviationGroup) +def prbs(): + """Enable/disable PRBS mode on a port""" + pass + +@prbs.command() +@click.argument('port', required=True, default=None, type=click.INT) +@click.argument('target', required=True, default=None, type=click.INT) +@click.argument('mode_value', required=True, default=None, type=click.INT) +@click.argument('lane_map', required=True, default=None, type=click.INT) +def enable(port, target, mode_value, lane_map): + """Enable PRBS mode on a port""" + + import sonic_y_cable.y_cable + res = sonic_y_cable.y_cable.enable_prbs_mode(port, target, mode_value, lane_map) + if res != True: + click.echo("PRBS config unsuccesful") + sys.exit(CONFIG_FAIL) + click.echo("PRBS config sucessful") + sys.exit(CONFIG_SUCCESSFUL) + +@prbs.command() +@click.argument('port', required=True, default=None, type=click.INT) +@click.argument('target', required=True, default=None, type=click.INT) +def disable(port, target): + """Disable PRBS mode on a port""" + + import sonic_y_cable.y_cable + res = sonic_y_cable.y_cable.disable_prbs_mode(port, target) + if res != True: + click.echo("PRBS disable unsuccesful") + sys.exit(CONFIG_FAIL) + click.echo("PRBS disable sucessful") + sys.exit(CONFIG_SUCCESSFUL) + +@muxcable.group(cls=clicommon.AbbreviationGroup) +def loopback(): + """Enable/disable loopback mode on a port""" + pass + + +@loopback.command() +@click.argument('port', required=True, default=None, type=click.INT) +@click.argument('target', required=True, default=None, type=click.INT) +@click.argument('lane_map', required=True, default=None, type=click.INT) +def enable(port, target, lane_map): + """Enable loopback mode on a port""" + + import sonic_y_cable.y_cable + res = sonic_y_cable.y_cable.enable_loopback_mode(port, target, lane_map) + if res != True: + click.echo("loopback config unsuccesful") + sys.exit(CONFIG_FAIL) + click.echo("loopback config sucessful") + sys.exit(CONFIG_SUCCESSFUL) + +@loopback.command() +@click.argument('port', required=True, default=None, type=click.INT) +@click.argument('target', required=True, default=None, type=click.INT) +def disable(port, target): + """Disable loopback mode on a port""" + + import sonic_y_cable.y_cable + res = sonic_y_cable.y_cable.disable_loopback_mode(port, target) + if res != True: + click.echo("loopback disable unsuccesful") + sys.exit(CONFIG_FAIL) + click.echo("loopback disable sucessful") + sys.exit(CONFIG_SUCCESSFUL) diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index 3088b6db61..b2015fb51a 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -4734,6 +4734,54 @@ While displaying the muxcable configuration, users can configure the following f } ``` +**show muxcable ber-info** + +This command displays the ber(Bit error rate) of the port user provides on the target user provides. The target provided as an integer corresponds to actual target as. +0 -> local +1 -> tor 1 +2 -> tor 2 +3 -> nic + +- Usage: + ``` + Usage: show muxcable ber-info [OPTIONS] PORT TARGET + ``` + + +- PORT required - Port number should be a valid port +- TARGET required - the actual target to get the ber info of. + +- Example: + ``` + admin@sonic:~$ show muxcable ber-info 1 1 + Lane1 Lane2 + ------- ------- + 0 0 + ``` + +**show muxcable ber-info** + +This command displays the eye info in mv(milli volts) of the port user provides on the target user provides. The target provided as an integer corresponds to actual target as. +0 -> local +1 -> tor 1 +2 -> tor 2 +3 -> nic + +- Usage: + ``` + Usage: show muxcable eye-info [OPTIONS] PORT TARGET + ``` + +- PORT required - Port number should be a valid port +- TARGET required - the actual target to get the eye info of. + +- Example: + ``` + admin@sonic:~$ show muxcable ber-info 1 1 + Lane1 Lane2 + ------- ------- + 632 622 + ``` ### Muxcable Config commands @@ -4769,7 +4817,6 @@ While configuring the muxcable, users needs to configure the following fields fo "Ethernet0": "OK" } ``` - ``` admin@sonic:~$ sudo config muxcable mode active all port state @@ -4785,7 +4832,67 @@ While configuring the muxcable, users needs to configure the following fields fo "Ethernet32": "INPROGRESS", "Ethernet0": "OK" } - ``` + ``` +**config muxcable prbs enable/disable** + +This command is used for setting the configuration and enable/diable of prbs on a port user provides. While enabling in addition to port the user also needs to provides the target, prbs mode and lane map on which the user intends to run prbs on. The target reflects where the enable/dsiable will happen. + +- Usage: + ``` + config muxcable prbs enable [OPTIONS] PORT TARGET MODE_VALUE LANE_MAP + config muxcable prbs disable [OPTIONS] PORT TARGET + ``` + +While configuring the muxcable, users needs to configure the following fields for the operation + +- PORT required - Port number should be a valid port +- TARGET required - the actual target to run the prbs on + 0 -> local side, + 1 -> TOR 1 + 2 -> TOR 2 + 3 -> NIC +- MODE_VALUE required - the mode/type for configuring the PRBS mode. + 0x00 = PRBS 9, 0x01 = PRBS 15, 0x02 = PRBS 23, 0x03 = PRBS 31 +- LANE_MAP required - an integer representing the lane_map to be run PRBS on + 0bit for lane 0, 1bit for lane1 and so on. + for example 3 -> 0b'0011 , means running on lane0 and lane1 +- Example: + ``` + admin@sonic:~$ sudo config muxcable prbs enable 1 1 3 3 + PRBS config sucessful + admin@sonic:~$ sudo config muxcable prbs disable 1 0 + PRBS disable sucessful + ``` + +**config muxcable loopback enable/disable** + +This command is used for setting the configuration and enable/disable of loopback on a port user provides. While enabling in addition to port the user also needs to provides the target and lane map on which the user intends to run loopback on. The target reflects where the enable/dsiable will happen. + +- Usage: + ``` + config muxcable loopback enable [OPTIONS] PORT TARGET LANE_MAP + config muxcable loopback disable [OPTIONS] PORT TARGET + ``` + +While configuring the muxcable, users needs to configure the following fields for the operation + +- PORT required - Port number should be a valid port +- TARGET required - the actual target to run the loopback on + 0 -> local side, + 1 -> TOR 1 + 2 -> TOR 2 + 3 -> NIC +- LANE_MAP required - an integer representing the lane_map to be run loopback on + 0bit for lane 0, 1bit for lane1 and so on. + for example 3 -> 0b'0011 , means running on lane0 and lane1 + +- Example: + ``` + admin@sonic:~$ sudo config muxcable loopback enable 1 1 3 + loopback config sucessful + admin@sonic:~$ sudo config muxcable loopback disable 1 0 + loopback disable sucessfull + ``` Go Back To [Beginning of the document](#) or [Beginning of this section](#muxcable) diff --git a/setup.py b/setup.py index 2af6829029..e28ef477de 100644 --- a/setup.py +++ b/setup.py @@ -156,6 +156,7 @@ 'netifaces==0.10.7', 'pexpect==4.8.0', 'requests==2.25.0', + 'sonic-platform-common', 'sonic-py-common', 'sonic-yang-mgmt', 'swsssdk>=2.0.1', diff --git a/show/muxcable.py b/show/muxcable.py index 0dff20b1d7..fd2abaf526 100644 --- a/show/muxcable.py +++ b/show/muxcable.py @@ -1,4 +1,5 @@ import json +import os import sys import click @@ -14,6 +15,8 @@ CONFIG_SUCCESSFUL = 101 CONFIG_FAIL = 1 +EXIT_FAIL = 1 +EXIT_SUCCESS = 0 STATUS_FAIL = 1 STATUS_SUCCESSFUL = 102 @@ -335,3 +338,45 @@ def config(port, json_output): click.echo(tabulate(print_data, headers=headers)) sys.exit(CONFIG_SUCCESSFUL) + + +@muxcable.command() +@click.argument('port', required=True, default=None, type=click.INT) +@click.argument('target', required=True, default=None, type=click.INT) +def berinfo(port, target): + """Show muxcable BER (bit error rate) information""" + + if os.geteuid() != 0: + click.echo("Root privileges are required for this operation") + sys.exit(EXIT_FAIL) + import sonic_y_cable.y_cable + res = sonic_y_cable.y_cable.get_ber_info(port, target) + if res == False or res == -1: + click.echo("Unable to fetch ber info") + sys.exit(EXIT_FAIL) + headers = ['Lane1', 'Lane2', 'Lane3', 'Lane4'] + lane_data = [] + lane_data.append(res) + click.echo(tabulate(lane_data, headers=headers)) + sys.exit(EXIT_SUCCESS) + + +@muxcable.command() +@click.argument('port', required=True, default=None, type=click.INT) +@click.argument('target', required=True, default=None, type=click.INT) +def eyeinfo(port, target): + """Show muxcable eye information in mv""" + + if os.geteuid() != 0: + click.echo("Root privileges are required for this operation") + sys.exit(EXIT_FAIL) + import sonic_y_cable.y_cable + res = sonic_y_cable.y_cable.get_eye_info(port, target) + if res == False or res == -1: + click.echo("Unable to fetch eye info") + sys.exit(EXIT_FAIL) + headers = ['Lane1', 'Lane2', 'Lane3', 'Lane4'] + lane_data = [] + lane_data.append(res) + click.echo(tabulate(lane_data, headers=headers)) + sys.exit(EXIT_SUCCESS) diff --git a/tests/muxcable_test.py b/tests/muxcable_test.py index 7fad557f4a..0639fca7aa 100644 --- a/tests/muxcable_test.py +++ b/tests/muxcable_test.py @@ -10,6 +10,11 @@ sys.modules['sonic_platform_base'] = mock.Mock() sys.modules['sonic_platform_base.sonic_sfp'] = mock.Mock() sys.modules['sonic_platform_base.sonic_sfp.sfputilhelper'] = mock.Mock() +sys.modules['sonic_y_cable'] = mock.Mock() +sys.modules['y_cable'] = mock.Mock() +sys.modules['sonic_y_cable.y_cable'] = mock.Mock() +#sys.modules['os'] = mock.Mock() +#sys.modules['os.geteuid'] = mock.Mock() #sys.modules['platform_sfputil'] = mock.Mock() import config.main as config import show.main as show @@ -160,8 +165,8 @@ def test_muxcable_status(self): db = Db() result = runner.invoke(show.cli.commands["muxcable"].commands["status"], obj=db) - assert(result.exit_code == 102) - assert(result.output == tabular_data_status_output_expected) + assert result.exit_code == 102 + assert result.output == tabular_data_status_output_expected def test_muxcable_status_json(self): runner = CliRunner() @@ -169,8 +174,8 @@ def test_muxcable_status_json(self): result = runner.invoke(show.cli.commands["muxcable"].commands["status"], ["--json"], obj=db) - assert(result.exit_code == 102) - assert(result.output == json_data_status_output_expected) + assert result.exit_code == 102 + assert result.output == json_data_status_output_expected def test_muxcable_status_config(self): runner = CliRunner() @@ -178,8 +183,8 @@ def test_muxcable_status_config(self): result = runner.invoke(show.cli.commands["muxcable"].commands["config"], obj=db) - assert(result.exit_code == 101) - assert(result.output == tabular_data_config_output_expected) + assert result.exit_code == 101 + assert result.output == tabular_data_config_output_expected def test_muxcable_status_config_json(self): runner = CliRunner() @@ -187,8 +192,8 @@ def test_muxcable_status_config_json(self): result = runner.invoke(show.cli.commands["muxcable"].commands["config"], ["--json"], obj=db) - assert(result.exit_code == 101) - assert(result.output == json_data_status_config_output_expected) + assert result.exit_code == 101 + assert result.output == json_data_status_config_output_expected def test_muxcable_config_json_with_incorrect_port(self): runner = CliRunner() @@ -196,7 +201,7 @@ def test_muxcable_config_json_with_incorrect_port(self): result = runner.invoke(show.cli.commands["muxcable"].commands["config"], ["Ethernet33", "--json"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 def test_muxcable_status_json_with_correct_port(self): runner = CliRunner() @@ -205,7 +210,7 @@ def test_muxcable_status_json_with_correct_port(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(show.cli.commands["muxcable"].commands["status"], ["Ethernet0", "--json"], obj=db) - assert(result.exit_code == 102) + assert result.exit_code == 102 def test_muxcable_status_json_port_incorrect_index(self): runner = CliRunner() @@ -214,7 +219,7 @@ def test_muxcable_status_json_port_incorrect_index(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 1 result = runner.invoke(show.cli.commands["muxcable"].commands["status"], ["Ethernet0", "--json"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 def test_muxcable_status_with_patch(self): runner = CliRunner() @@ -229,7 +234,7 @@ def test_muxcable_status_json_with_incorrect_port(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(show.cli.commands["muxcable"].commands["status"], ["Ethernet33", "--json"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 def test_muxcable_config_with_correct_port(self): runner = CliRunner() @@ -238,7 +243,7 @@ def test_muxcable_config_with_correct_port(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(show.cli.commands["muxcable"].commands["config"], ["Ethernet0"], obj=db) - assert(result.exit_code == 101) + assert result.exit_code == 101 def test_muxcable_config_json_with_correct_port(self): runner = CliRunner() @@ -247,7 +252,7 @@ def test_muxcable_config_json_with_correct_port(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(show.cli.commands["muxcable"].commands["config"], ["Ethernet0", "--json"], obj=db) - assert(result.exit_code == 101) + assert result.exit_code == 101 def test_muxcable_config_json_port_with_incorrect_index(self): runner = CliRunner() @@ -256,7 +261,7 @@ def test_muxcable_config_json_port_with_incorrect_index(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 1 result = runner.invoke(show.cli.commands["muxcable"].commands["config"], ["Ethernet0", "--json"], obj=db) - assert(result.exit_code == 101) + assert result.exit_code == 101 def test_muxcable_config_json_with_incorrect_port_patch(self): runner = CliRunner() @@ -265,7 +270,7 @@ def test_muxcable_config_json_with_incorrect_port_patch(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(show.cli.commands["muxcable"].commands["config"], ["Ethernet33", "--json"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 def test_muxcable_status_json_port_eth0(self): runner = CliRunner() @@ -274,7 +279,7 @@ def test_muxcable_status_json_port_eth0(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(show.cli.commands["muxcable"].commands["status"], ["Ethernet0"], obj=db) - assert(result.exit_code == 102) + assert result.exit_code == 102 def test_config_muxcable_tabular_port_Ethernet8_active(self): runner = CliRunner() @@ -284,7 +289,7 @@ def test_config_muxcable_tabular_port_Ethernet8_active(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["active", "Ethernet8"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_tabular_port_Ethernet8_auto(self): runner = CliRunner() @@ -294,7 +299,7 @@ def test_config_muxcable_tabular_port_Ethernet8_auto(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["auto", "Ethernet8"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_mode_auto_json(self): runner = CliRunner() @@ -302,8 +307,8 @@ def test_config_muxcable_mode_auto_json(self): result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["auto", "all", "--json"], obj=db) - assert(result.exit_code == 100) - assert(result.output == json_data_config_output_auto_expected) + assert result.exit_code == 100 + assert result.output == json_data_config_output_auto_expected def test_config_muxcable_mode_active_json(self): runner = CliRunner() @@ -313,8 +318,8 @@ def test_config_muxcable_mode_active_json(self): f = open("newfile1", "w") f.write(result.output) - assert(result.exit_code == 100) - assert(result.output == json_data_config_output_active_expected) + assert result.exit_code == 100 + assert result.output == json_data_config_output_active_expected def test_config_muxcable_json_port_auto_Ethernet0(self): runner = CliRunner() @@ -325,7 +330,7 @@ def test_config_muxcable_json_port_auto_Ethernet0(self): result = runner.invoke(config.config.commands["muxcable"].commands["mode"], [ "auto", "Ethernet0", "--json"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_json_port_active_Ethernet0(self): runner = CliRunner() @@ -336,13 +341,13 @@ def test_config_muxcable_json_port_active_Ethernet0(self): result = runner.invoke(config.config.commands["muxcable"].commands["mode"], [ "active", "Ethernet0", "--json"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_mode_auto_tabular(self): runner = CliRunner() db = Db() result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["auto", "all"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_mode_active_tabular(self): runner = CliRunner() @@ -352,7 +357,7 @@ def test_config_muxcable_mode_active_tabular(self): f = open("newfile", "w") f.write(result.output) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_tabular_port(self): runner = CliRunner() @@ -362,7 +367,7 @@ def test_config_muxcable_tabular_port(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["active", "Ethernet0"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_tabular_port_Ethernet4_active(self): runner = CliRunner() @@ -372,7 +377,7 @@ def test_config_muxcable_tabular_port_Ethernet4_active(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["active", "Ethernet4"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_tabular_port_Ethernet4_auto(self): runner = CliRunner() @@ -382,7 +387,7 @@ def test_config_muxcable_tabular_port_Ethernet4_auto(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 0 result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["auto", "Ethernet4"], obj=db) - assert(result.exit_code == 100) + assert result.exit_code == 100 def test_config_muxcable_tabular_port_with_incorrect_index(self): runner = CliRunner() @@ -392,7 +397,7 @@ def test_config_muxcable_tabular_port_with_incorrect_index(self): patched_util.SfpUtilHelper.return_value.get_asic_id_for_logical_port.return_value = 2 result = runner.invoke(config.config.commands["muxcable"].commands["mode"], ["active", "Ethernet0"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 def test_config_muxcable_tabular_port_with_incorrect_port_index(self): runner = CliRunner() @@ -403,7 +408,7 @@ def test_config_muxcable_tabular_port_with_incorrect_port_index(self): result = runner.invoke(config.config.commands["muxcable"].commands["mode"], [ "active", "Ethernet33"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 def test_config_muxcable_tabular_port_with_incorrect_port(self): runner = CliRunner() @@ -414,7 +419,73 @@ def test_config_muxcable_tabular_port_with_incorrect_port(self): result = runner.invoke(config.config.commands["muxcable"].commands["mode"], [ "active", "Ethernet33"], obj=db) - assert(result.exit_code == 1) + assert result.exit_code == 1 + + @mock.patch('os.geteuid', mock.MagicMock(return_value=0)) + @mock.patch('sonic_y_cable.y_cable.get_eye_info', mock.MagicMock(return_value=[0, 0])) + def test_show_muxcable_eye_info(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(show.cli.commands["muxcable"].commands["eyeinfo"], + ["0", "0"], obj=db) + + assert result.exit_code == 0 + + @mock.patch('os.geteuid', mock.MagicMock(return_value=0)) + @mock.patch('sonic_y_cable.y_cable.get_ber_info', mock.MagicMock(return_value=[0, 0])) + def test_show_muxcable_ber_info(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(show.cli.commands["muxcable"].commands["berinfo"], + ["0", "0"], obj=db) + + assert result.exit_code == 0 + + @mock.patch('os.geteuid', mock.MagicMock(return_value=0)) + @mock.patch('sonic_y_cable.y_cable.enable_prbs_mode', mock.MagicMock(return_value=1)) + def test_config_muxcable_enable_prbs(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(config.config.commands["muxcable"].commands["prbs"].commands["enable"], + ["0", "0", "0", "0"], obj=db) + + assert result.exit_code == 100 + + @mock.patch('os.geteuid', mock.MagicMock(return_value=0)) + @mock.patch('sonic_y_cable.y_cable.enable_loopback_mode', mock.MagicMock(return_value=1)) + def test_config_muxcable_enable_loopback(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(config.config.commands["muxcable"].commands["loopback"].commands["enable"], + ["0", "0", "0"], obj=db) + + assert result.exit_code == 100 + + @mock.patch('os.geteuid', mock.MagicMock(return_value=0)) + @mock.patch('sonic_y_cable.y_cable.disable_prbs_mode', mock.MagicMock(return_value=1)) + def test_config_muxcable_disble_prbs(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(config.config.commands["muxcable"].commands["prbs"].commands["disable"], + ["0", "0"], obj=db) + + assert result.exit_code == 100 + + @mock.patch('os.geteuid', mock.MagicMock(return_value=0)) + @mock.patch('sonic_y_cable.y_cable.disable_loopback_mode', mock.MagicMock(return_value=1)) + def test_config_muxcable_disable_loopback(self): + runner = CliRunner() + db = Db() + + result = runner.invoke(config.config.commands["muxcable"].commands["loopback"].commands["disable"], + ["0", "0"], obj=db) + + assert result.exit_code == 100 @classmethod def teardown_class(cls):