@@ -2002,6 +2002,32 @@ def test_CmisManagerTask_post_port_active_apsel_to_db(self):
20022002 'host_lane_count' : '2' ,
20032003 'media_lane_count' : '1' }
20042004
2005+ # case: partial lanes update (reset to 'N/A')
2006+ lport = "Ethernet16"
2007+ host_lanes_mask = 0xc
2008+ ret = task .post_port_active_apsel_to_db (mock_xcvr_api , lport , host_lanes_mask , reset_apsel = True )
2009+ assert int_tbl .getKeys () == ["Ethernet0" , "Ethernet8" , "Ethernet16" ]
2010+ assert dict (int_tbl .mock_dict ["Ethernet16" ]) == {'active_apsel_hostlane3' : 'N/A' ,
2011+ 'active_apsel_hostlane4' : 'N/A' ,
2012+ 'host_lane_count' : 'N/A' ,
2013+ 'media_lane_count' : 'N/A' }
2014+
2015+ # case: full lanes update (reset to 'N/A')
2016+ lport = "Ethernet32"
2017+ host_lanes_mask = 0xff
2018+ task .post_port_active_apsel_to_db (mock_xcvr_api , lport , host_lanes_mask , reset_apsel = True )
2019+ assert int_tbl .getKeys () == ["Ethernet0" , "Ethernet8" , "Ethernet16" , "Ethernet32" ]
2020+ assert dict (int_tbl .mock_dict ["Ethernet32" ]) == {'active_apsel_hostlane1' : 'N/A' ,
2021+ 'active_apsel_hostlane2' : 'N/A' ,
2022+ 'active_apsel_hostlane3' : 'N/A' ,
2023+ 'active_apsel_hostlane4' : 'N/A' ,
2024+ 'active_apsel_hostlane5' : 'N/A' ,
2025+ 'active_apsel_hostlane6' : 'N/A' ,
2026+ 'active_apsel_hostlane7' : 'N/A' ,
2027+ 'active_apsel_hostlane8' : 'N/A' ,
2028+ 'host_lane_count' : 'N/A' ,
2029+ 'media_lane_count' : 'N/A' }
2030+
20052031 # case: NotImplementedError
20062032 int_tbl = Table ("STATE_DB" , TRANSCEIVER_INFO_TABLE ) # a new empty table
20072033 lport = "Ethernet0"
@@ -2413,10 +2439,13 @@ def test_CmisManagerTask_task_worker_fastboot(self, mock_chassis, mock_get_statu
24132439 task .get_configured_laser_freq_from_db = MagicMock (return_value = 193100 )
24142440 task .configure_tx_output_power = MagicMock (return_value = 1 )
24152441 task .configure_laser_frequency = MagicMock (return_value = 1 )
2442+ task .post_port_active_apsel_to_db = MagicMock ()
24162443
24172444 task .task_stopping_event .is_set = MagicMock (side_effect = [False , False , True ])
24182445 task .task_worker ()
24192446
2447+ assert mock_xcvr_api .tx_disable_channel .call_count == 1
2448+ assert task .post_port_active_apsel_to_db .call_count == 1
24202449 assert get_cmis_state_from_state_db ('Ethernet0' , task .xcvr_table_helper .get_status_tbl (task .port_mapping .get_asic_id_for_logical_port ('Ethernet0' ))) == CMIS_STATE_READY
24212450
24222451 @patch ('xcvrd.xcvrd.XcvrTableHelper.get_status_tbl' )
@@ -2548,10 +2577,12 @@ def test_CmisManagerTask_task_worker_host_tx_ready_false(self, mock_chassis, moc
25482577 task .get_configured_laser_freq_from_db = MagicMock (return_value = 193100 )
25492578 task .configure_tx_output_power = MagicMock (return_value = 1 )
25502579 task .configure_laser_frequency = MagicMock (return_value = 1 )
2580+ task .post_port_active_apsel_to_db = MagicMock ()
25512581
25522582 task .task_stopping_event .is_set = MagicMock (side_effect = [False , False , True ])
25532583 task .task_worker ()
25542584
2585+ assert task .post_port_active_apsel_to_db .call_count == 1
25552586 assert mock_xcvr_api .tx_disable_channel .call_count == 1
25562587 assert get_cmis_state_from_state_db ('Ethernet0' , task .xcvr_table_helper .get_status_tbl (task .port_mapping .get_asic_id_for_logical_port ('Ethernet0' ))) == CMIS_STATE_READY
25572588
0 commit comments