@@ -16,6 +16,41 @@ class SfpBase(device_base.DeviceBase):
16
16
# Device type definition. Note, this is a constant.
17
17
DEVICE_TYPE = "sfp"
18
18
19
+ # Generic error types definition
20
+ SFP_STATUS_INITIALIZING = 'Initializing'
21
+ SFP_STATUS_OK = 'OK'
22
+ SFP_STATUS_UNPLUGGED = 'Unplugged'
23
+ SFP_STATUS_DISABLED = 'Disabled'
24
+ SFP_ERROR_DESCRIPTION_BLOCKING = 'Blocking EEPROM from being read'
25
+ SFP_ERROR_DESCRIPTION_POWER_BUDGET_EXCEEDED = 'Power budget exceeded'
26
+ SFP_ERROR_DESCRIPTION_I2C_STUCK = 'Bus stuck (I2C data or clock shorted)'
27
+ SFP_ERROR_DESCRIPTION_BAD_EEPROM = 'Bad or unsupported EEPROM'
28
+ SFP_ERROR_DESCRIPTION_UNSUPPORTED_CABLE = 'Unsupported cable'
29
+ SFP_ERROR_DESCRIPTION_HIGH_TEMP = 'High temperature'
30
+ SFP_ERROR_DESCRIPTION_BAD_CABLE = 'Bad cable (module/cable is shorted)'
31
+
32
+ # SFP status
33
+ SFP_STATUS_BIT_REMOVED = 0x00000000
34
+ SFP_STATUS_BIT_INSERTED = 0x00000001
35
+ # SFP error status
36
+ SFP_ERROR_BIT_BLOCKING = 0x00000002
37
+ SFP_ERROR_BIT_POWER_BUDGET_EXCEEDED = 0x00000004
38
+ SFP_ERROR_BIT_I2C_STUCK = 0x00000008
39
+ SFP_ERROR_BIT_BAD_EEPROM = 0x00000010
40
+ SFP_ERROR_BIT_UNSUPPORTED_CABLE = 0x00000020
41
+ SFP_ERROR_BIT_HIGH_TEMP = 0x00000040
42
+ SFP_ERROR_BIT_BAD_CABLE = 0x00000080
43
+
44
+ SFP_ERROR_BIT_TO_DESCRIPTION_DICT = {
45
+ SFP_ERROR_BIT_BLOCKING : SFP_ERROR_DESCRIPTION_BLOCKING ,
46
+ SFP_ERROR_BIT_POWER_BUDGET_EXCEEDED : SFP_ERROR_DESCRIPTION_POWER_BUDGET_EXCEEDED ,
47
+ SFP_ERROR_BIT_I2C_STUCK : SFP_ERROR_DESCRIPTION_I2C_STUCK ,
48
+ SFP_ERROR_BIT_BAD_EEPROM : SFP_ERROR_DESCRIPTION_BAD_EEPROM ,
49
+ SFP_ERROR_BIT_UNSUPPORTED_CABLE : SFP_ERROR_DESCRIPTION_UNSUPPORTED_CABLE ,
50
+ SFP_ERROR_BIT_HIGH_TEMP : SFP_ERROR_DESCRIPTION_HIGH_TEMP ,
51
+ SFP_ERROR_BIT_BAD_CABLE : SFP_ERROR_DESCRIPTION_BAD_CABLE
52
+ }
53
+
19
54
def __init__ (self ):
20
55
# List of ThermalBase-derived objects representing all thermals
21
56
# available on the SFP
@@ -384,4 +419,13 @@ def write_eeprom(self, offset, num_bytes, write_buffer):
384
419
"""
385
420
raise NotImplementedError
386
421
422
+ def get_error_description (self ):
423
+ """
424
+ Retrives the error descriptions of the SFP module
387
425
426
+ Returns:
427
+ String that represents the current error descriptions of vendor specific errors
428
+ In case there are multiple errors, they should be joined by '|',
429
+ like: "Bad EEPROM|Unsupported cable"
430
+ """
431
+ raise NotImplementedError
0 commit comments