74
74
QSFP_CHANNL_TX_FAULT_STATUS_WIDTH = 1
75
75
QSFP_POWEROVERRIDE_OFFSET = 93
76
76
QSFP_POWEROVERRIDE_WIDTH = 1
77
+ QSFP_PAGE03_OFFSET = 384
77
78
QSFP_MODULE_THRESHOLD_OFFSET = 128
78
79
QSFP_MODULE_THRESHOLD_WIDTH = 24
79
80
QSFP_CHANNEL_THRESHOLD_OFFSET = 176
@@ -152,7 +153,8 @@ def __init__(self, sfp_index=0):
152
153
self .port_to_eeprom_mapping [x ] = eeprom_path .format (self ._port_to_i2c_mapping [x ])
153
154
154
155
self .info_dict_keys = ['type' , 'vendor_rev' , 'serial' , 'manufacturer' , 'model' , 'connector' , 'encoding' , 'ext_identifier' ,
155
- 'ext_rateselect_compliance' , 'cable_type' , 'cable_length' , 'nominal_bit_rate' , 'specification_compliance' , 'vendor_date' , 'vendor_oui' ]
156
+ 'ext_rateselect_compliance' , 'cable_type' , 'cable_length' , 'nominal_bit_rate' , 'specification_compliance' , 'vendor_date' , 'vendor_oui' ,
157
+ 'application_advertisement' , 'type_abbrv_name' ]
156
158
157
159
self .dom_dict_keys = ['rx_los' , 'tx_fault' , 'reset_status' , 'power_lpmode' , 'tx_disable' , 'tx_disable_channel' , 'temperature' , 'voltage' ,
158
160
'rx1power' , 'rx2power' , 'rx3power' , 'rx4power' , 'tx1bias' , 'tx2bias' , 'tx3bias' , 'tx4bias' , 'tx1power' , 'tx2power' , 'tx3power' , 'tx4power' ]
@@ -247,6 +249,7 @@ def get_transceiver_info(self):
247
249
specification_compliance |1*255VCHAR |specification compliance
248
250
vendor_date |1*255VCHAR |vendor date
249
251
vendor_oui |1*255VCHAR |vendor OUI
252
+ application_advertisement |1*255VCHAR |supported applications advertisement
250
253
========================================================================
251
254
"""
252
255
# check present status
@@ -442,7 +445,7 @@ def get_transceiver_bulk_status(self):
442
445
qsfp_dom_capability_raw = self .__read_eeprom_specific_bytes (
443
446
(offset_xcvr + XCVR_DOM_CAPABILITY_OFFSET ), XCVR_DOM_CAPABILITY_WIDTH )
444
447
if qsfp_dom_capability_raw is not None :
445
- qspf_dom_capability_data = sfpi_obj .parse_qsfp_dom_capability (
448
+ qspf_dom_capability_data = sfpi_obj .parse_dom_capability (
446
449
qsfp_dom_capability_raw , 0 )
447
450
else :
448
451
return None
@@ -598,10 +601,11 @@ def get_transceiver_threshold_info(self):
598
601
if not self .get_presence () or not sfpd_obj :
599
602
return {}
600
603
604
+ offset = QSFP_PAGE03_OFFSET
601
605
transceiver_dom_threshold_dict = dict .fromkeys (
602
606
self .threshold_dict_keys , 'N/A' )
603
607
dom_thres_raw = self .__read_eeprom_specific_bytes (
604
- QSFP_MODULE_THRESHOLD_OFFSET , QSFP_MODULE_THRESHOLD_WIDTH ) if self .get_presence () and sfpd_obj else None
608
+ offset + QSFP_MODULE_THRESHOLD_OFFSET , QSFP_MODULE_THRESHOLD_WIDTH ) if self .get_presence () and sfpd_obj else None
605
609
606
610
if dom_thres_raw :
607
611
module_threshold_values = sfpd_obj .parse_module_threshold_values (
@@ -618,7 +622,7 @@ def get_transceiver_threshold_info(self):
618
622
transceiver_dom_threshold_dict ['vcclowwarning' ] = module_threshold_data ['VccLowWarning' ]['value' ]
619
623
620
624
dom_thres_raw = self .__read_eeprom_specific_bytes (
621
- QSFP_CHANNEL_THRESHOLD_OFFSET , QSFP_CHANNEL_THRESHOLD_WIDTH ) if self .get_presence () and sfpd_obj else None
625
+ offset + QSFP_CHANNEL_THRESHOLD_OFFSET , QSFP_CHANNEL_THRESHOLD_WIDTH ) if self .get_presence () and sfpd_obj else None
622
626
channel_threshold_values = sfpd_obj .parse_channel_threshold_values (
623
627
dom_thres_raw , 0 )
624
628
channel_threshold_data = channel_threshold_values .get ('data' )
@@ -648,11 +652,16 @@ def get_reset_status(self):
648
652
Returns:
649
653
A Boolean, True if reset enabled, False if disabled
650
654
"""
651
- if self .port_num < 49 : #Copper port, no sysfs
655
+ if self .port_num < 53 : # non-QSFP ports don't support it.
652
656
return False
653
657
654
- return False # CPLD port doesn't support this feature
658
+ reset_path = "{}{}{}" .format (CPLD_I2C_PATH , "module_reset_" , str (self .port_num ))
659
+ val = self ._api_helper .read_txt_file (reset_path )
655
660
661
+ if val is not None :
662
+ return int (val , 10 ) == 1
663
+ else :
664
+ return False
656
665
657
666
def get_rx_los (self ):
658
667
"""
@@ -827,7 +836,7 @@ def get_power_set(self):
827
836
return False
828
837
829
838
dom_control_raw = self .__read_eeprom_specific_bytes (
830
- QSFP_POWEROVERRIDE_OFFSET , QSFP_CONTROL_WIDTH ) if self .get_presence () else None
839
+ QSFP_CONTROL_OFFSET , QSFP_CONTROL_WIDTH ) if self .get_presence () else None
831
840
if dom_control_raw is not None :
832
841
dom_control_data = sfpd_obj .parse_control_bytes (dom_control_raw , 0 )
833
842
power_set = (
@@ -852,7 +861,7 @@ def get_power_override(self):
852
861
return False
853
862
854
863
dom_control_raw = self .__read_eeprom_specific_bytes (
855
- QSFP_POWEROVERRIDE_OFFSET , QSFP_CONTROL_WIDTH ) if self .get_presence () else None
864
+ QSFP_CONTROL_OFFSET , QSFP_CONTROL_WIDTH ) if self .get_presence () else None
856
865
if dom_control_raw is not None :
857
866
dom_control_data = sfpd_obj .parse_control_bytes (dom_control_raw , 0 )
858
867
power_override = (
@@ -939,23 +948,19 @@ def reset(self):
939
948
A boolean, True if successful, False if not
940
949
"""
941
950
# Check for invalid port_num
942
- if self .port_num < 49 : #Copper port, no sysfs
951
+ if self .port_num < 53 : # non-QSFP ports don't support it.
943
952
return False
944
953
945
- '''
946
954
reset_path = "{}{}{}" .format (CPLD_I2C_PATH , 'module_reset_' , self .port_num )
947
- ret = self.__write_txt_file (reset_path, 1)
955
+ ret = self ._api_helper . write_txt_file (reset_path , 1 )
948
956
if ret is not True :
949
957
return ret
950
-
958
+
951
959
time .sleep (0.01 )
952
- ret = self.__write_txt_file (reset_path, 0)
960
+ ret = self ._api_helper . write_txt_file (reset_path , 0 )
953
961
time .sleep (0.2 )
954
-
955
- return ret
956
- '''
957
962
958
- return False #CPLD doens't support this feature
963
+ return ret
959
964
960
965
def tx_disable (self , tx_disable ):
961
966
"""
@@ -1167,3 +1172,20 @@ def get_status(self):
1167
1172
A boolean value, True if device is operating properly, False if not
1168
1173
"""
1169
1174
return self .get_presence () and self .get_transceiver_bulk_status ()
1175
+
1176
+ def get_position_in_parent (self ):
1177
+ """
1178
+ Retrieves 1-based relative physical position in parent device. If the agent cannot determine the parent-relative position
1179
+ for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned
1180
+ Returns:
1181
+ integer: The 1-based relative physical position in parent device or -1 if cannot determine the position
1182
+ """
1183
+ return self .port_num
1184
+
1185
+ def is_replaceable (self ):
1186
+ """
1187
+ Indicate whether this device is replaceable.
1188
+ Returns:
1189
+ bool: True if it is replaceable.
1190
+ """
1191
+ return True
0 commit comments