@@ -32,7 +32,7 @@ def get_model(self):
32
32
33
33
def get_vendor_rev (self ):
34
34
'''
35
- This function returns the revision level for part number provided by vendor
35
+ This function returns the revision level for part number provided by vendor
36
36
'''
37
37
return self .xcvr_eeprom .read (consts .VENDOR_REV_FIELD )
38
38
@@ -58,6 +58,8 @@ def get_module_hardware_revision(self):
58
58
'''
59
59
This function returns the module hardware revision
60
60
'''
61
+ if self .is_flat_memory ():
62
+ return '0.0'
61
63
hw_major_rev = self .xcvr_eeprom .read (consts .HW_MAJOR_REV )
62
64
hw_minor_rev = self .xcvr_eeprom .read (consts .HW_MAJOR_REV )
63
65
hw_rev = [str (num ) for num in [hw_major_rev , hw_minor_rev ]]
@@ -98,6 +100,8 @@ def get_module_inactive_firmware(self):
98
100
'''
99
101
This function returns the inactive firmware version
100
102
'''
103
+ if self .is_flat_memory ():
104
+ return 'N/A'
101
105
inactive_fw_major = self .xcvr_eeprom .read (consts .INACTIVE_FW_MAJOR_REV )
102
106
inactive_fw_minor = self .xcvr_eeprom .read (consts .INACTIVE_FW_MINOR_REV )
103
107
inactive_fw = [str (num ) for num in [inactive_fw_major , inactive_fw_minor ]]
@@ -115,7 +119,7 @@ def get_transceiver_info(self):
115
119
xcvr_info = {
116
120
"type" : admin_info [consts .ID_FIELD ],
117
121
"type_abbrv_name" : admin_info [consts .ID_ABBRV_FIELD ],
118
- "hardware_rev" : '.' . join ([ str ( admin_info [ consts . HW_MAJOR_REV ]), str ( admin_info [ consts . HW_MINOR_REV ])] ),
122
+ "hardware_rev" : self . get_module_hardware_revision ( ),
119
123
"serial" : admin_info [consts .VENDOR_SERIAL_NO_FIELD ],
120
124
"manufacturer" : admin_info [consts .VENDOR_NAME_FIELD ],
121
125
"model" : admin_info [consts .VENDOR_PART_NO_FIELD ],
@@ -139,15 +143,9 @@ def get_transceiver_info(self):
139
143
xcvr_info ['host_lane_assignment_option' ] = self .get_host_lane_assignment_option ()
140
144
xcvr_info ['media_lane_assignment_option' ] = self .get_media_lane_assignment_option ()
141
145
apsel_dict = self .get_active_apsel_hostlane ()
142
- xcvr_info ['active_apsel_hostlane1' ] = apsel_dict ['ActiveAppSelLane1' ]
143
- xcvr_info ['active_apsel_hostlane2' ] = apsel_dict ['ActiveAppSelLane2' ]
144
- xcvr_info ['active_apsel_hostlane3' ] = apsel_dict ['ActiveAppSelLane3' ]
145
- xcvr_info ['active_apsel_hostlane4' ] = apsel_dict ['ActiveAppSelLane4' ]
146
- xcvr_info ['active_apsel_hostlane5' ] = apsel_dict ['ActiveAppSelLane5' ]
147
- xcvr_info ['active_apsel_hostlane6' ] = apsel_dict ['ActiveAppSelLane6' ]
148
- xcvr_info ['active_apsel_hostlane7' ] = apsel_dict ['ActiveAppSelLane7' ]
149
- xcvr_info ['active_apsel_hostlane8' ] = apsel_dict ['ActiveAppSelLane8' ]
150
-
146
+ for lane in range (1 , self .NUM_CHANNELS + 1 ):
147
+ xcvr_info ["%s%d" % ("active_apsel_hostlane" , lane )] = \
148
+ apsel_dict ["%s%d" % (consts .ACTIVE_APSEL_HOSTLANE , lane )]
151
149
xcvr_info ['media_interface_technology' ] = self .get_media_interface_technology ()
152
150
xcvr_info ['vendor_rev' ] = self .get_vendor_rev ()
153
151
xcvr_info ['cmis_rev' ] = self .get_cmis_rev ()
@@ -188,9 +186,9 @@ def get_transceiver_bulk_status(self):
188
186
}
189
187
190
188
for i in range (1 , self .NUM_CHANNELS + 1 ):
191
- bulk_status ["tx%dbias" % i ] = tx_bias ['LaserBiasTx%dField' % i ]
192
- bulk_status ["rx%dpower" % i ] = rx_power ['OpticalPowerRx%dField' % i ]
193
- bulk_status ["tx%dpower" % i ] = tx_power ['OpticalPowerTx%dField' % i ]
189
+ bulk_status ["tx%dbias" % i ] = tx_bias [i - 1 ]
190
+ bulk_status ["rx%dpower" % i ] = rx_power [i - 1 ]
191
+ bulk_status ["tx%dpower" % i ] = tx_power [i - 1 ]
194
192
195
193
laser_temp_dict = self .get_laser_temperature ()
196
194
bulk_status ['laser_temperature' ] = laser_temp_dict ['monitor value' ]
@@ -257,7 +255,7 @@ def get_transceiver_threshold_info(self):
257
255
threshold_info_dict ['prefecberhighalarm' ] = self .vdm_dict ['Pre-FEC BER Average Media Input' ][1 ][1 ]
258
256
threshold_info_dict ['prefecberlowalarm' ] = self .vdm_dict ['Pre-FEC BER Average Media Input' ][1 ][2 ]
259
257
threshold_info_dict ['prefecberhighwarning' ] = self .vdm_dict ['Pre-FEC BER Average Media Input' ][1 ][3 ]
260
- threshold_info_dict ['prefecberlowwarning' ] = self .vdm_dict ['Pre-FEC BER Average Media Input' ][1 ][4 ]
258
+ threshold_info_dict ['prefecberlowwarning' ] = self .vdm_dict ['Pre-FEC BER Average Media Input' ][1 ][4 ]
261
259
threshold_info_dict ['postfecberhighalarm' ] = self .vdm_dict ['Errored Frames Average Media Input' ][1 ][1 ]
262
260
threshold_info_dict ['postfecberlowalarm' ] = self .vdm_dict ['Errored Frames Average Media Input' ][1 ][2 ]
263
261
threshold_info_dict ['postfecberhighwarning' ] = self .vdm_dict ['Errored Frames Average Media Input' ][1 ][3 ]
@@ -459,9 +457,13 @@ def get_tx_bias(self):
459
457
tx_bias_support = self .get_tx_bias_support ()
460
458
if tx_bias_support is None :
461
459
return None
462
- if not tx_bias_support :
463
- return ["N/A" for _ in range (self .NUM_CHANNELS )]
464
- tx_bias = self .xcvr_eeprom .read (consts .TX_BIAS_FIELD )
460
+ tx_bias = ["N/A" for _ in range (self .NUM_CHANNELS )]
461
+
462
+ if tx_bias_support :
463
+ tx_bias = self .xcvr_eeprom .read (consts .TX_BIAS_FIELD )
464
+ if tx_bias is not None :
465
+ tx_bias = [tx_bias ['LaserBiasTx%dField' % i ] for i in range (1 , self .NUM_CHANNELS + 1 )]
466
+
465
467
return tx_bias
466
468
467
469
def get_tx_power (self ):
@@ -471,9 +473,14 @@ def get_tx_power(self):
471
473
tx_power_support = self .get_tx_power_support ()
472
474
if tx_power_support is None :
473
475
return None
474
- if not tx_power_support :
475
- return ["N/A" for _ in range (self .NUM_CHANNELS )]
476
- tx_power = self .xcvr_eeprom .read (consts .TX_POWER_FIELD )
476
+
477
+ tx_power = ["N/A" for _ in range (self .NUM_CHANNELS )]
478
+
479
+ if tx_power_support :
480
+ tx_power = self .xcvr_eeprom .read (consts .TX_POWER_FIELD )
481
+ if tx_power is not None :
482
+ tx_power = [tx_power ['OpticalPowerTx%dField' % i ] for i in range (1 , self .NUM_CHANNELS + 1 )]
483
+
477
484
return tx_power
478
485
479
486
def get_tx_power_support (self ):
@@ -486,9 +493,14 @@ def get_rx_power(self):
486
493
rx_power_support = self .get_rx_power_support ()
487
494
if rx_power_support is None :
488
495
return None
489
- if not rx_power_support :
490
- return ["N/A" for _ in range (self .NUM_CHANNELS )]
491
- rx_power = self .xcvr_eeprom .read (consts .RX_POWER_FIELD )
496
+
497
+ rx_power = ["N/A" for _ in range (self .NUM_CHANNELS )]
498
+
499
+ if rx_power_support :
500
+ rx_power = self .xcvr_eeprom .read (consts .RX_POWER_FIELD )
501
+ if rx_power is not None :
502
+ rx_power = [rx_power ['OpticalPowerRx%dField' % i ] for i in range (1 , self .NUM_CHANNELS + 1 )]
503
+
492
504
return rx_power
493
505
494
506
def get_rx_power_support (self ):
@@ -596,6 +608,8 @@ def get_module_media_type(self):
596
608
'''
597
609
This function returns module media type: MMF, SMF, Passive Copper Cable, Active Cable Assembly or Base-T.
598
610
'''
611
+ if self .is_flat_memory ():
612
+ return 'N/A'
599
613
return self .xcvr_eeprom .read (consts .MEDIA_TYPE_FIELD )
600
614
601
615
def get_host_electrical_interface (self ):
@@ -608,6 +622,9 @@ def get_module_media_interface(self):
608
622
'''
609
623
This function returns module media electrical interface. Table 4-6 ~ 4-10 in SFF-8024 Rev4.6
610
624
'''
625
+ if self .is_flat_memory ():
626
+ return 'N/A'
627
+
611
628
media_type = self .get_module_media_type ()
612
629
if media_type == 'Multimode Fiber (MMF)' :
613
630
return self .xcvr_eeprom .read (consts .MODULE_MEDIA_INTERFACE_850NM )
@@ -631,15 +648,16 @@ def is_coherent_module(self):
631
648
632
649
def get_host_lane_count (self ):
633
650
'''
634
- This function returns number of host lanes
651
+ This function returns number of host lanes for default application
635
652
'''
636
653
return self .xcvr_eeprom .read (consts .HOST_LANE_COUNT )
637
654
638
-
639
655
def get_media_lane_count (self ):
640
656
'''
641
- This function returns number of media lanes
657
+ This function returns number of media lanes for default application
642
658
'''
659
+ if self .is_flat_memory ():
660
+ return 0
643
661
return self .xcvr_eeprom .read (consts .MEDIA_LANE_COUNT )
644
662
645
663
def get_media_interface_technology (self ):
@@ -658,13 +676,21 @@ def get_media_lane_assignment_option(self):
658
676
'''
659
677
This function returns the media lane that the application is allowed to begin on
660
678
'''
679
+ if self .is_flat_memory ():
680
+ return 'N/A'
661
681
return self .xcvr_eeprom .read (consts .MEDIA_LANE_ASSIGNMENT_OPTION )
662
682
663
683
def get_active_apsel_hostlane (self ):
664
684
'''
665
685
This function returns the application select code that each host lane has
666
686
'''
667
- return self .xcvr_eeprom .read (consts .ACTIVE_APSEL_CODE )
687
+ apsel_dict = {}
688
+ if self .is_flat_memory ():
689
+ for lane in range (1 , self .NUM_CHANNELS + 1 ):
690
+ apsel_dict ["%s%d" % (consts .ACTIVE_APSEL_HOSTLANE , lane )] = 'N/A'
691
+ else :
692
+ apsel_dict = self .xcvr_eeprom .read (consts .ACTIVE_APSEL_CODE )
693
+ return apsel_dict
668
694
669
695
def get_tx_config_power (self ):
670
696
'''
@@ -730,6 +756,17 @@ def get_laser_temperature(self):
730
756
'''
731
757
This function returns the laser temperature monitor value
732
758
'''
759
+ laser_temp_dict = {
760
+ 'monitor value' : 'N/A' ,
761
+ 'high alarm' : 'N/A' ,
762
+ 'low alarm' : 'N/A' ,
763
+ 'high warn' : 'N/A' ,
764
+ 'low warn' : 'N/A'
765
+ }
766
+
767
+ if self .is_flat_memory ():
768
+ return laser_temp_dict
769
+
733
770
try :
734
771
aux1_mon_type , aux2_mon_type , aux3_mon_type = self .get_aux_mon_type ()
735
772
except TypeError :
@@ -748,7 +785,8 @@ def get_laser_temperature(self):
748
785
laser_temp_high_warn = self .xcvr_eeprom .read (consts .AUX3_HIGH_WARN )/ LASER_TEMP_SCALE
749
786
laser_temp_low_warn = self .xcvr_eeprom .read (consts .AUX3_LOW_WARN )/ LASER_TEMP_SCALE
750
787
else :
751
- return None
788
+ return laser_temp_dict
789
+
752
790
laser_temp_dict = {'monitor value' : laser_temp ,
753
791
'high alarm' : laser_temp_high_alarm ,
754
792
'low alarm' : laser_temp_low_alarm ,
@@ -913,7 +951,7 @@ def get_vdm(self):
913
951
self .vdm
914
952
except AttributeError :
915
953
self .get_vdm_api ()
916
- vdm = self .vdm .get_vdm_allpage ()
954
+ vdm = self .vdm .get_vdm_allpage () if not self . is_flat_memory () else {}
917
955
return vdm
918
956
919
957
def get_module_firmware_fault_state_changed (self ):
@@ -1100,7 +1138,7 @@ def get_module_fw_info(self):
1100
1138
else :
1101
1139
ImageA = "N/A"
1102
1140
txt += 'Image A Version: %s\n ' % ImageA
1103
-
1141
+
1104
1142
if ImageBValid == 0 :
1105
1143
# Registers 9Fh:174,175; 176.177
1106
1144
ImageB = '%d.%d.%d' % (rpl [38 ], rpl [39 ], ((rpl [40 ]<< 8 ) | rpl [41 ]))
@@ -1119,7 +1157,7 @@ def get_module_fw_info(self):
1119
1157
elif ImageBCommitted == 1 :
1120
1158
CommittedImage = 'B'
1121
1159
else :
1122
- CommittedImage = 'N/A'
1160
+ CommittedImage = 'N/A'
1123
1161
txt += 'Running Image: %s; Committed Image: %s\n ' % (RunningImage , CommittedImage )
1124
1162
else :
1125
1163
txt += 'Reply payload check code error\n '
@@ -1142,8 +1180,8 @@ def module_fw_run(self, mode = 0x01):
1142
1180
02h = Traffic affecting Reset to Running Image.
1143
1181
03h = Attempt Hitless Reset to Running Image
1144
1182
1145
- This function returns True if firmware run successfully completes.
1146
- Otherwise it will return False.
1183
+ This function returns True if firmware run successfully completes.
1184
+ Otherwise it will return False.
1147
1185
"""
1148
1186
try :
1149
1187
self .cdb
@@ -1177,8 +1215,8 @@ def module_fw_commit(self):
1177
1215
The host uses this command to commit the running image
1178
1216
so that the module will boot from it on future boots.
1179
1217
1180
- This function returns True if firmware commit successfully completes.
1181
- Otherwise it will return False.
1218
+ This function returns True if firmware commit successfully completes.
1219
+ Otherwise it will return False.
1182
1220
"""
1183
1221
try :
1184
1222
self .cdb
@@ -1327,7 +1365,7 @@ def module_fw_upgrade(self, imagepath):
1327
1365
imagepath specifies where firmware image file is located.
1328
1366
target_firmware is a string that specifies the firmware version to upgrade to
1329
1367
1330
- This function returns True if download successfully completes.
1368
+ This function returns True if download successfully completes.
1331
1369
Otherwise it will return False.
1332
1370
"""
1333
1371
result = self .get_module_fw_info ()
@@ -1336,7 +1374,7 @@ def module_fw_upgrade(self, imagepath):
1336
1374
except (ValueError , TypeError ):
1337
1375
return result ['status' ], result ['info' ]
1338
1376
result = self .get_module_fw_upgrade_feature ()
1339
- try :
1377
+ try :
1340
1378
startLPLsize , maxblocksize , lplonly_flag , autopaging_flag , writelength = result ['result' ]
1341
1379
except (ValueError , TypeError ):
1342
1380
return result ['status' ], result ['info' ]
@@ -1351,7 +1389,7 @@ def module_fw_upgrade(self, imagepath):
1351
1389
def module_fw_switch (self ):
1352
1390
"""
1353
1391
This function switch the active/inactive module firmware in the current module memory
1354
- This function returns True if firmware switch successfully completes.
1392
+ This function returns True if firmware switch successfully completes.
1355
1393
Otherwise it will return False.
1356
1394
If not both images are valid, it will stop firmware switch and return False
1357
1395
"""
@@ -1572,7 +1610,7 @@ def get_transceiver_status(self):
1572
1610
trans_status ['vcclowalarm_flag' ] = module_flag ['voltage_flags' ]['voltage_low_alarm_flag' ]
1573
1611
trans_status ['vcchighwarning_flag' ] = module_flag ['voltage_flags' ]['voltage_high_warn_flag' ]
1574
1612
trans_status ['vcclowwarning_flag' ] = module_flag ['voltage_flags' ]['voltage_low_warn_flag' ]
1575
- try :
1613
+ try :
1576
1614
aux1_mon_type , aux2_mon_type , aux3_mon_type = self .get_aux_mon_type ()
1577
1615
if aux2_mon_type == 0 :
1578
1616
trans_status ['lasertemphighalarm_flag' ] = module_flag ['aux2_flags' ]['aux2_high_alarm_flag' ]
0 commit comments