Skip to content

Commit

Permalink
[ycabled] correct the wrong function call for 'config hwmode state' (#…
Browse files Browse the repository at this point in the history
…372)

This PR fixes the other sub routine by adding the param hw_mux_cable_tbl to
handle_config_hwmode_state_cmd_arg_tbl_notification method, since this is called by wrong params

How Has This Been Tested?
UT and testing this on DUT
  • Loading branch information
vdahiya12 authored Jun 5, 2023
1 parent b9d52d2 commit 37f0c36
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
18 changes: 12 additions & 6 deletions sonic-ycabled/tests/test_y_cable_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5752,14 +5752,15 @@ def test_handle_config_mux_state_cmd_arg_tbl_notification_no_port(self, mock_sws

xcvrd_config_hwmode_state_cmd_sts_tbl = mock_swsscommon_table
xcvrd_config_hwmode_state_rsp_tbl = mock_swsscommon_table
hw_mux_cable_tbl = mock_swsscommon_table

asic_index = 0
task_download_firmware_thread = {}
port = "Ethernet0"
fvp = {"config": "active"}

rc = handle_config_hwmode_state_cmd_arg_tbl_notification(
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port)
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port)
assert(rc == -1)

@patch('swsscommon.swsscommon.Table')
Expand All @@ -5776,14 +5777,15 @@ def test_handle_show_mux_switchmode_cmd_arg_tbl_notification_else_condition(self

xcvrd_config_hwmode_state_cmd_sts_tbl = mock_swsscommon_table
xcvrd_config_hwmode_state_rsp_tbl = mock_swsscommon_table
hw_mux_cable_tbl = mock_swsscommon_table

asic_index = 0
task_download_firmware_thread = {}
port = "Ethernet0"
fvp = {"down_firmware": "null"}

rc = handle_config_hwmode_state_cmd_arg_tbl_notification(
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port)
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port)
assert(rc == None)

@patch('swsscommon.swsscommon.Table')
Expand All @@ -5804,6 +5806,7 @@ def test_handle_config_mux_state_cmd_arg_tbl_notification_with_instance_manual(s

xcvrd_config_hwmode_state_cmd_sts_tbl = mock_swsscommon_table
xcvrd_config_hwmode_state_rsp_tbl = mock_swsscommon_table
hw_mux_cable_tbl = mock_swsscommon_table
asic_index = 0
task_download_firmware_thread = {}
port = "Ethernet0"
Expand Down Expand Up @@ -5838,7 +5841,7 @@ def get_mux_direction():

patched_util.get.return_value = PortInstanceHelper()
rc = handle_config_hwmode_state_cmd_arg_tbl_notification(
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port)
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port)
assert(rc == None)

@patch('swsscommon.swsscommon.Table')
Expand All @@ -5859,6 +5862,7 @@ def test_handle_config_mux_state_cmd_arg_tbl_notification_with_instance_cmd_arg(

xcvrd_config_hwmode_state_cmd_sts_tbl = mock_swsscommon_table
xcvrd_config_hwmode_state_rsp_tbl = mock_swsscommon_table
hw_mux_cable_tbl = mock_swsscommon_table
asic_index = 0
task_download_firmware_thread = {}
port = "Ethernet0"
Expand Down Expand Up @@ -5893,7 +5897,7 @@ def get_mux_direction():

patched_util.get.return_value = PortInstanceHelper()
rc = handle_config_hwmode_state_cmd_arg_tbl_notification(
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port)
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port)
assert(rc == -1)

@patch('swsscommon.swsscommon.Table')
Expand All @@ -5910,14 +5914,15 @@ def test_handle_config_mux_state_cmd_arg_tbl_notification_no_instance(self, mock

xcvrd_config_hwmode_state_cmd_sts_tbl = mock_swsscommon_table
xcvrd_config_hwmode_state_rsp_tbl = mock_swsscommon_table
hw_mux_cable_tbl = mock_swsscommon_table

asic_index = 0
task_download_firmware_thread = {}
port = "Ethernet0"
fvp = {"config": "active"}

rc = handle_config_hwmode_state_cmd_arg_tbl_notification(
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port)
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port)
assert(rc == -1)

@patch('swsscommon.swsscommon.Table')
Expand All @@ -5938,6 +5943,7 @@ def test_handle_config_mux_state_cmd_arg_tbl_notification_with_instance_auto(sel

xcvrd_config_hwmode_state_cmd_sts_tbl = mock_swsscommon_table
xcvrd_config_hwmode_state_rsp_tbl = mock_swsscommon_table
hw_mux_cable_tbl = mock_swsscommon_table
asic_index = 0
task_download_firmware_thread = {}
port = "Ethernet0"
Expand Down Expand Up @@ -5972,7 +5978,7 @@ def get_mux_direction():

patched_util.get.return_value = PortInstanceHelper()
rc = handle_config_hwmode_state_cmd_arg_tbl_notification(
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port)
fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port)
assert(rc == None)

@patch('swsscommon.swsscommon.Table')
Expand Down
2 changes: 1 addition & 1 deletion sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,7 @@ def handle_show_hwmode_swmode_cmd_arg_tbl_notification(fvp, xcvrd_show_hwmode_sw
helper_logger.log_error("Error: Incorrect input param for cli cmd show mux hwmode switchmode logical port {}".format(port))
set_result_and_delete_port('state', 'unknown', xcvrd_show_hwmode_swmode_cmd_sts_tbl[asic_index], xcvrd_show_hwmode_swmode_rsp_tbl[asic_index], port)

def handle_config_hwmode_state_cmd_arg_tbl_notification(fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, asic_index, port):
def handle_config_hwmode_state_cmd_arg_tbl_notification(fvp, xcvrd_config_hwmode_state_cmd_sts_tbl, xcvrd_config_hwmode_state_rsp_tbl, hw_mux_cable_tbl, asic_index, port):

fvp_dict = dict(fvp)

Expand Down

0 comments on commit 37f0c36

Please sign in to comment.