@@ -1189,18 +1189,31 @@ def configure_tx_output_power(self, api, lport, tx_power):
1189
1189
self .log_error ("{} configured tx power {} > maximum power {} supported" .format (lport , tx_power , max_p ))
1190
1190
return api .set_tx_power (tx_power )
1191
1191
1192
- def configure_laser_frequency (self , api , lport , freq , grid = 75 ):
1193
- _ , _ , _ , lowf , highf = api .get_supported_freq_config ()
1192
+ def config_laser_frequency_validate (self , api , lport , freq , grid = 75 ):
1193
+ supported_grid , _ , _ , lowf , highf = api .get_supported_freq_config ()
1194
1194
if freq < lowf :
1195
1195
self .log_error ("{} configured freq:{} GHz is lower than the supported freq:{} GHz" .format (lport , freq , lowf ))
1196
+ return false
1196
1197
if freq > highf :
1197
1198
self .log_error ("{} configured freq:{} GHz is higher than the supported freq:{} GHz" .format (lport , freq , highf ))
1198
- chan = int (round ((freq - 193100 )/ 25 ))
1199
- if chan % 3 != 0 :
1200
- self .log_error ("{} configured freq:{} GHz is NOT in 75GHz grid" .format (lport , freq ))
1199
+ return false
1200
+ if grid == 75 :
1201
+ if (supported_grid >> 7 ) & 0x1 != 1 :
1202
+ self .log_error ("{} 75GHz is not supported" .format (lport ))
1203
+ return False
1204
+ chan = int (round ((freq - 193100 )/ 25 ))
1205
+ if chan % 3 != 0 :
1206
+ self .log_error ("{} configured freq:{} GHz is NOT in 75GHz grid" .format (lport , freq ))
1207
+ return False
1208
+ return True
1209
+
1210
+ def configure_laser_frequency (self , api , lport , freq , grid = 75 ):
1201
1211
if api .get_tuning_in_progress ():
1202
1212
self .log_error ("{} Tuning in progress, subport selection may fail!" .format (lport ))
1203
- return api .set_laser_freq (freq , grid )
1213
+ try :
1214
+ return api .set_laser_freq (freq , grid )
1215
+ except :
1216
+ return False
1204
1217
1205
1218
def post_port_active_apsel_to_db (self , api , lport , host_lanes_mask ):
1206
1219
try :
@@ -1424,11 +1437,15 @@ def task_worker(self):
1424
1437
1425
1438
# For ZR module, Datapath needes to be re-initlialized on new channel selection
1426
1439
if api .is_coherent_module ():
1427
- freq = self .port_dict [lport ]['laser_freq' ]
1428
- # If user requested frequency is NOT the same as configured on the module
1429
- # force datapath re-initialization
1430
- if 0 != freq and freq != api .get_laser_config_freq ():
1431
- need_update = True
1440
+ freq = self .port_dict [lport ]['laser_freq' ]
1441
+ # If user requested frequency is NOT the same as configured on the module
1442
+ # force datapath re-initialization
1443
+ if 0 != freq and freq != api .get_laser_config_freq ():
1444
+ if self .config_laser_frequency_validate (api , lport , freq ) == True :
1445
+ need_update = True
1446
+ else :
1447
+ # clear setting of invalid frequency config
1448
+ self .port_dict [lport ]['laser_freq' ] = 0
1432
1449
1433
1450
if not need_update :
1434
1451
# No application updates
0 commit comments