@@ -204,6 +204,7 @@ def test_CmisManagerTask_get_xcvr_api_exception(self, mock_platform_chassis, moc
204
204
task .get_host_tx_status = MagicMock (return_value = 'true' )
205
205
task .get_port_admin_status = MagicMock (return_value = 'up' )
206
206
task .get_cfg_port_tbl = MagicMock ()
207
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
207
208
task .xcvr_table_helper .get_status_tbl .return_value = mock_get_status_tbl
208
209
port_change_event = PortChangeEvent ('Ethernet0' , 1 , 0 , PortChangeEvent .PORT_SET ,
209
210
{'speed' :'400000' , 'lanes' :'1,2,3,4,5,6,7,8' })
@@ -1460,6 +1461,7 @@ def test_CmisManagerTask_update_port_transceiver_status_table_sw_cmis_state(self
1460
1461
port_change_event = PortChangeEvent ('Ethernet0' , 1 , 0 , PortChangeEvent .PORT_SET )
1461
1462
task .on_port_update_event (port_change_event )
1462
1463
1464
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1463
1465
task .xcvr_table_helper .get_status_tbl = MagicMock (return_value = None )
1464
1466
task .update_port_transceiver_status_table_sw_cmis_state ("Ethernet0" , CMIS_STATE_INSERTED )
1465
1467
@@ -1505,6 +1507,7 @@ def test_CmisManagerTask_get_configured_freq(self, mock_table_helper):
1505
1507
cfg_port_tbl = MagicMock ()
1506
1508
cfg_port_tbl .get = MagicMock (return_value = (True , (('laser_freq' , 193100 ),)))
1507
1509
mock_table_helper .get_cfg_port_tbl = MagicMock (return_value = cfg_port_tbl )
1510
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1508
1511
task .xcvr_table_helper .get_cfg_port_tbl = mock_table_helper .get_cfg_port_tbl
1509
1512
assert task .get_configured_laser_freq_from_db ('Ethernet0' ) == 193100
1510
1513
@@ -1516,6 +1519,7 @@ def test_CmisManagerTask_get_configured_tx_power_from_db(self, mock_table_helper
1516
1519
cfg_port_tbl = MagicMock ()
1517
1520
cfg_port_tbl .get = MagicMock (return_value = (True , (('tx_power' , - 10 ),)))
1518
1521
mock_table_helper .get_cfg_port_tbl = MagicMock (return_value = cfg_port_tbl )
1522
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1519
1523
task .xcvr_table_helper .get_cfg_port_tbl = mock_table_helper .get_cfg_port_tbl
1520
1524
assert task .get_configured_tx_power_from_db ('Ethernet0' ) == - 10
1521
1525
@@ -1690,6 +1694,7 @@ def test_CmisManagerTask_post_port_active_apsel_to_db_error_cases(self, mock_fie
1690
1694
host_lanes_mask = 0xff
1691
1695
1692
1696
# Case: table does not exist
1697
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1693
1698
task .xcvr_table_helper .get_intf_tbl = MagicMock (return_value = None )
1694
1699
task .post_port_active_apsel_to_db (mock_xcvr_api , lport , host_lanes_mask )
1695
1700
assert mock_field_value_pairs .call_count == 0
@@ -1747,6 +1752,7 @@ def test_CmisManagerTask_post_port_active_apsel_to_db(self):
1747
1752
port_mapping = PortMapping ()
1748
1753
stop_event = threading .Event ()
1749
1754
task = CmisManagerTask (DEFAULT_NAMESPACE , port_mapping , stop_event )
1755
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1750
1756
task .xcvr_table_helper .get_intf_tbl = MagicMock (return_value = int_tbl )
1751
1757
1752
1758
# case: partial lanes update
@@ -1893,6 +1899,7 @@ def test_CmisManagerTask_task_worker(self, mock_chassis, mock_get_status_tbl):
1893
1899
stop_event = threading .Event ()
1894
1900
task = CmisManagerTask (DEFAULT_NAMESPACE , port_mapping , stop_event )
1895
1901
task .port_mapping .logical_port_list = ['Ethernet0' ]
1902
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1896
1903
task .xcvr_table_helper .get_status_tbl .return_value = mock_get_status_tbl
1897
1904
task .task_stopping_event .is_set = MagicMock (side_effect = [False , False , True ])
1898
1905
task .task_worker ()
@@ -1959,6 +1966,7 @@ def test_CmisManagerTask_task_worker(self, mock_chassis, mock_get_status_tbl):
1959
1966
stop_event = threading .Event ()
1960
1967
task = CmisManagerTask (DEFAULT_NAMESPACE , port_mapping , stop_event )
1961
1968
task .port_mapping .logical_port_list = ['Ethernet1' ]
1969
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
1962
1970
task .xcvr_table_helper .get_status_tbl .return_value = mock_get_status_tbl
1963
1971
task .task_stopping_event .is_set = MagicMock (side_effect = [False , False , True ])
1964
1972
task .task_worker ()
@@ -2095,6 +2103,7 @@ def test_CmisManagerTask_task_worker_fastboot(self, mock_chassis, mock_get_statu
2095
2103
stop_event = threading .Event ()
2096
2104
task = CmisManagerTask (DEFAULT_NAMESPACE , port_mapping , stop_event )
2097
2105
task .port_mapping .logical_port_list = ['Ethernet0' ]
2106
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
2098
2107
task .xcvr_table_helper .get_status_tbl .return_value = mock_get_status_tbl
2099
2108
task .task_stopping_event .is_set = MagicMock (side_effect = [False , False , True ])
2100
2109
task .task_worker ()
@@ -2230,6 +2239,7 @@ def test_CmisManagerTask_task_worker_host_tx_ready_false(self, mock_chassis, moc
2230
2239
stop_event = threading .Event ()
2231
2240
task = CmisManagerTask (DEFAULT_NAMESPACE , port_mapping , stop_event )
2232
2241
task .port_mapping .logical_port_list = ['Ethernet0' ]
2242
+ task .xcvr_table_helper = XcvrTableHelper (DEFAULT_NAMESPACE )
2233
2243
task .xcvr_table_helper .get_status_tbl .return_value = mock_get_status_tbl
2234
2244
task .task_stopping_event .is_set = MagicMock (side_effect = [False , False , True ])
2235
2245
task .task_worker ()
0 commit comments