@@ -1635,6 +1635,7 @@ def test_CmisManagerTask_task_worker(self, mock_chassis, mock_get_status_tbl):
1635
1635
mock_xcvr_api .get_module_pwr_up_duration = MagicMock (return_value = 70000.0 )
1636
1636
mock_xcvr_api .get_datapath_deinit_duration = MagicMock (return_value = 600000.0 )
1637
1637
mock_xcvr_api .get_cmis_rev = MagicMock (return_value = '5.0' )
1638
+ mock_xcvr_api .get_supported_freq_config = MagicMock (return_value = (0xA0 ,0 ,0 ,191300 ,196100 ))
1638
1639
mock_xcvr_api .get_dpinit_pending = MagicMock (return_value = {
1639
1640
'DPInitPending1' : True ,
1640
1641
'DPInitPending2' : True ,
@@ -2495,7 +2496,22 @@ def test_DaemonXcvrd_init_deinit_cold(self):
2495
2496
xcvrdaemon .deinit ()
2496
2497
2497
2498
status_tbl .hdel .assert_called ()
2499
+ @pytest .mark .parametrize ("lport, freq, grid, expected" , [
2500
+ (1 , 193100 , 75 , True ),
2501
+ (1 , 193100 , 100 , False ),
2502
+ (1 , 193125 , 75 , False ),
2503
+ (1 , 193100 , 25 , True )
2504
+ ])
2505
+ def test_CmisManagerTask_config_laser_frequency_validate (self , lport , freq , grid , expected ):
2506
+ mock_xcvr_api = MagicMock ()
2507
+ mock_xcvr_api .get_supported_freq_config = MagicMock ()
2508
+ mock_xcvr_api .get_supported_freq_config .return_value = (0x80 , 0 , 0 , 191300 , 196100 )
2498
2509
2510
+ port_mapping = PortMapping ()
2511
+ stop_event = threading .Event ()
2512
+ task = CmisManagerTask (DEFAULT_NAMESPACE , port_mapping , stop_event )
2513
+ result = task .config_laser_frequency_validate (mock_xcvr_api , lport , freq , grid )
2514
+ assert result == expected
2499
2515
2500
2516
def wait_until (total_wait_time , interval , call_back , * args , ** kwargs ):
2501
2517
wait_time = 0
0 commit comments