Making PDDF 2.0 base classes python3 compliant (#6924)
- Made python2 to python3 changes - Removed ord() func as python3 return int instead of str - Had to change chr(..) to bytes([..]) function while using ctypes class methods
This commit is contained in:
Родитель
08202017d9
Коммит
20f0f069c1
|
@ -1,9 +1,7 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# PDDF
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the platform information
|
||||
# Module contains an implementation of SONiC PDDF Chassis Base API and
|
||||
# provides the chassis information
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class PddfEeprom(eeprom_tlvinfo.TlvInfoDecoder):
|
|||
if not self.is_valid_tlvinfo_header(eeprom):
|
||||
return
|
||||
|
||||
total_length = (ord(eeprom[9]) << 8) | ord(eeprom[10])
|
||||
total_length = ((eeprom[9]) << 8) | (eeprom[10])
|
||||
tlv_index = self._TLV_INFO_HDR_LEN
|
||||
tlv_end = self._TLV_INFO_HDR_LEN + total_length
|
||||
|
||||
|
@ -50,21 +50,21 @@ class PddfEeprom(eeprom_tlvinfo.TlvInfoDecoder):
|
|||
break
|
||||
|
||||
tlv = eeprom[tlv_index:tlv_index + 2
|
||||
+ ord(eeprom[tlv_index + 1])]
|
||||
code = "0x%02X" % (ord(tlv[0]))
|
||||
+ (eeprom[tlv_index + 1])]
|
||||
code = "0x%02X" % ((tlv[0]))
|
||||
|
||||
if ord(tlv[0]) == self._TLV_CODE_VENDOR_EXT:
|
||||
value = str((ord(tlv[2]) << 24) | (ord(tlv[3]) << 16) |
|
||||
(ord(tlv[4]) << 8) | ord(tlv[5]))
|
||||
value += str(tlv[6:6 + ord(tlv[1])])
|
||||
if (tlv[0]) == self._TLV_CODE_VENDOR_EXT:
|
||||
value = str(((tlv[2]) << 24) | ((tlv[3]) << 16) |
|
||||
((tlv[4]) << 8) | (tlv[5]))
|
||||
value += str(tlv[6:6 + (tlv[1])])
|
||||
else:
|
||||
name, value = self.decoder(None, tlv)
|
||||
|
||||
self.eeprom_tlv_dict[code] = value
|
||||
if ord(eeprom[tlv_index]) == self._TLV_CODE_CRC_32:
|
||||
if (eeprom[tlv_index]) == self._TLV_CODE_CRC_32:
|
||||
break
|
||||
|
||||
tlv_index += ord(eeprom[tlv_index+1]) + 2
|
||||
tlv_index += (eeprom[tlv_index+1]) + 2
|
||||
|
||||
def serial_number_str(self):
|
||||
(is_valid, results) = self.get_tlv_field(self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER)
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# All the supported FAN SysFS aattributes are
|
||||
#- fan<idx>_present
|
||||
#- fan<idx>_direction
|
||||
#- fan<idx>_input
|
||||
#- fan<idx>_pwm
|
||||
#- fan<idx>_fault
|
||||
# where idx is in the range [1-32]
|
||||
#############################################################################
|
||||
# PDDF
|
||||
#
|
||||
# PDDF fan base class inherited from the base class
|
||||
#
|
||||
# All the supported FAN SysFS aattributes are
|
||||
# - fan<idx>_present
|
||||
# - fan<idx>_direction
|
||||
# - fan<idx>_input
|
||||
# - fan<idx>_pwm
|
||||
# - fan<idx>_fault
|
||||
# where idx is in the range [1-32]
|
||||
#############################################################################
|
||||
|
||||
try:
|
||||
from sonic_platform_base.fan_base import FanBase
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# PDDF
|
||||
# Module contains an implementation of SONiC Platform API and
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
#############################################################################
|
||||
# PDDF
|
||||
#
|
||||
# PDDF psu base class inherited from the base class
|
||||
#
|
||||
# All the supported PSU SysFS aattributes are
|
||||
#- psu_present
|
||||
#- psu_model_name
|
||||
#- psu_power_good
|
||||
#- psu_mfr_id
|
||||
#- psu_serial_num
|
||||
#- psu_fan_dir
|
||||
#- psu_v_out
|
||||
#- psu_i_out
|
||||
#- psu_p_out
|
||||
#- psu_fan1_speed_rpm
|
||||
#
|
||||
# - psu_present
|
||||
# - psu_model_name
|
||||
# - psu_power_good
|
||||
# - psu_mfr_id
|
||||
# - psu_serial_num
|
||||
# - psu_fan_dir
|
||||
# - psu_v_out
|
||||
# - psu_i_out
|
||||
# - psu_p_out
|
||||
# - psu_fan1_speed_rpm
|
||||
#############################################################################
|
||||
|
||||
|
||||
try:
|
||||
|
@ -37,7 +40,6 @@ class PddfPsu(PsuBase):
|
|||
self.platform = self.pddf_obj.get_platform()
|
||||
self.psu_index = index + 1
|
||||
|
||||
self._fan_list = [] # _fan_list under PsuBase class is a global variable, hence we need to use _fan_list per class instatiation
|
||||
self.num_psu_fans = int(self.pddf_obj.get_num_psu_fans('PSU{}'.format(index+1)))
|
||||
for psu_fan_idx in range(self.num_psu_fans):
|
||||
psu_fan = Fan(0, psu_fan_idx, pddf_data, pddf_plugin_data, True, self.psu_index)
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
#############################################################################
|
||||
# PDDF
|
||||
#
|
||||
# PDDF sfp base class inherited from the base class
|
||||
#############################################################################
|
||||
|
||||
try:
|
||||
import time
|
||||
|
@ -153,7 +157,7 @@ class PddfSfp(SfpBase):
|
|||
sysfsfile_eeprom.seek(offset)
|
||||
raw = sysfsfile_eeprom.read(num_bytes)
|
||||
for n in range(0, num_bytes):
|
||||
eeprom_raw[n] = hex(ord(raw[n]))[2:].zfill(2)
|
||||
eeprom_raw[n] = hex(raw[n])[2:].zfill(2)
|
||||
except Exception as e:
|
||||
print("Error: Unable to open eeprom_path: %s" % (str(e)))
|
||||
finally:
|
||||
|
@ -186,18 +190,19 @@ class PddfSfp(SfpBase):
|
|||
self.eeprom_path = self.pddf_obj.get_path(self.device, 'eeprom')
|
||||
|
||||
self.info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding',
|
||||
'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length', 'nominal_bit_rate',
|
||||
'specification_compliance', 'vendor_date', 'vendor_oui', 'application_advertisement']
|
||||
'ext_identifier', 'ext_rateselect_compliance', 'cable_type', 'cable_length',
|
||||
'nominal_bit_rate', 'specification_compliance', 'vendor_date', 'vendor_oui',
|
||||
'application_advertisement']
|
||||
|
||||
self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode', 'tx_disable', 'tx_disable_channel',
|
||||
'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias', 'tx2bias',
|
||||
'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power']
|
||||
'temperature', 'voltage', 'rx1power', 'rx2power', 'rx3power', 'rx4power', 'tx1bias',
|
||||
'tx2bias', 'tx3bias', 'tx4bias', 'tx1power', 'tx2power', 'tx3power', 'tx4power']
|
||||
|
||||
self.threshold_dict_keys = ['temphighalarm', 'temphighwarning', 'templowalarm', 'templowwarning',
|
||||
'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning', 'rxpowerhighalarm',
|
||||
'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning', 'txpowerhighalarm', 'txpowerhighwarning',
|
||||
'txpowerlowalarm', 'txpowerlowwarning', 'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm',
|
||||
'txbiaslowwarning']
|
||||
'vcchighalarm', 'vcchighwarning', 'vcclowalarm', 'vcclowwarning',
|
||||
'rxpowerhighalarm', 'rxpowerhighwarning', 'rxpowerlowalarm', 'rxpowerlowwarning',
|
||||
'txpowerhighalarm', 'txpowerhighwarning', 'txpowerlowalarm', 'txpowerlowwarning',
|
||||
'txbiashighalarm', 'txbiashighwarning', 'txbiaslowalarm', 'txbiaslowwarning']
|
||||
|
||||
SfpBase.__init__(self)
|
||||
|
||||
|
@ -321,13 +326,17 @@ class PddfSfp(SfpBase):
|
|||
xcvr_info_dict['type_abbrv_name'] = sfp_interface_bulk_data['data']['type_abbrv_name']['value']
|
||||
else:
|
||||
xcvr_info_dict['type'] = sfp_type_data['data']['type']['value'] if sfp_type_data else 'N/A'
|
||||
xcvr_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value'] if sfp_type_abbrv_name else 'N/A'
|
||||
xcvr_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value'] \
|
||||
if sfp_type_abbrv_name else 'N/A'
|
||||
|
||||
xcvr_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] if sfp_vendor_name_data else 'N/A'
|
||||
xcvr_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value'] \
|
||||
if sfp_vendor_name_data else 'N/A'
|
||||
xcvr_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value'] if sfp_vendor_pn_data else 'N/A'
|
||||
xcvr_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] if sfp_vendor_rev_data else 'N/A'
|
||||
xcvr_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value'] \
|
||||
if sfp_vendor_rev_data else 'N/A'
|
||||
xcvr_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value'] if sfp_vendor_sn_data else 'N/A'
|
||||
xcvr_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] if sfp_vendor_oui_data else 'N/A'
|
||||
xcvr_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value'] \
|
||||
if sfp_vendor_oui_data else 'N/A'
|
||||
xcvr_info_dict['vendor_date'] = sfp_vendor_date_data['data'][
|
||||
'VendorDataCode(YYYY-MM-DD Lot)']['value'] if sfp_vendor_date_data else 'N/A'
|
||||
xcvr_info_dict['cable_type'] = "Unknown"
|
||||
|
@ -341,7 +350,8 @@ class PddfSfp(SfpBase):
|
|||
|
||||
for key in qsfp_compliance_code_tup:
|
||||
if key in sfp_interface_bulk_data['data']['Specification compliance']['value']:
|
||||
compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value']
|
||||
compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][
|
||||
'value'][key]['value']
|
||||
xcvr_info_dict['specification_compliance'] = str(compliance_code_dict)
|
||||
|
||||
nkey = 'Nominal Bit Rate(100Mbs)'
|
||||
|
@ -360,7 +370,8 @@ class PddfSfp(SfpBase):
|
|||
|
||||
for key in sfp_compliance_code_tup:
|
||||
if key in sfp_interface_bulk_data['data']['Specification compliance']['value']:
|
||||
compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value']
|
||||
compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance'][
|
||||
'value'][key]['value']
|
||||
xcvr_info_dict['specification_compliance'] = str(compliance_code_dict)
|
||||
|
||||
xcvr_info_dict['nominal_bit_rate'] = str(
|
||||
|
@ -602,20 +613,20 @@ class PddfSfp(SfpBase):
|
|||
if dom_thres_raw:
|
||||
channel_threshold_values = sfpd_obj.parse_channel_threshold_values(
|
||||
dom_thres_raw, 0)
|
||||
channel_threshold_data = channel_threshold_values.get('data')
|
||||
if channel_threshold_data:
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = channel_threshold_data['RxPowerHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = channel_threshold_data['RxPowerLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = channel_threshold_data['RxPowerHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = channel_threshold_data['RxPowerLowWarning']['value']
|
||||
ch_th_data = channel_threshold_values.get('data')
|
||||
if ch_th_data:
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = ch_th_data['RxPowerHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = ch_th_data['RxPowerLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = ch_th_data['RxPowerHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = ch_th_data['RxPowerLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerhighalarm'] = "0.0dBm"
|
||||
xcvr_dom_threshold_info_dict['txpowerlowalarm'] = "0.0dBm"
|
||||
xcvr_dom_threshold_info_dict['txpowerhighwarning'] = "0.0dBm"
|
||||
xcvr_dom_threshold_info_dict['txpowerlowwarning'] = "0.0dBm"
|
||||
xcvr_dom_threshold_info_dict['txbiashighalarm'] = channel_threshold_data['TxBiasHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowalarm'] = channel_threshold_data['TxBiasLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighwarning'] = channel_threshold_data['TxBiasHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowwarning'] = channel_threshold_data['TxBiasLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighalarm'] = ch_th_data['TxBiasHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowalarm'] = ch_th_data['TxBiasLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighwarning'] = ch_th_data['TxBiasHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowwarning'] = ch_th_data['TxBiasLowWarning']['value']
|
||||
|
||||
else:
|
||||
# SFPs
|
||||
|
@ -629,30 +640,34 @@ class PddfSfp(SfpBase):
|
|||
dom_module_threshold_raw = self.__read_eeprom_specific_bytes(
|
||||
(offset + SFP_MODULE_THRESHOLD_OFFSET), SFP_MODULE_THRESHOLD_WIDTH)
|
||||
if dom_module_threshold_raw is not None:
|
||||
dom_module_threshold_data = sfpd_obj.parse_alarm_warning_threshold(
|
||||
dom_mod_th_data = sfpd_obj.parse_alarm_warning_threshold(
|
||||
dom_module_threshold_raw, 0)
|
||||
|
||||
xcvr_dom_threshold_info_dict['temphighalarm'] = dom_module_threshold_data['data']['TempHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['templowalarm'] = dom_module_threshold_data['data']['TempLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['temphighwarning'] = dom_module_threshold_data['data']['TempHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['templowwarning'] = dom_module_threshold_data['data']['TempLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['vcchighalarm'] = dom_module_threshold_data['data']['VoltageHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['vcclowalarm'] = dom_module_threshold_data['data']['VoltageLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['vcchighwarning'] = dom_module_threshold_data[
|
||||
xcvr_dom_threshold_info_dict['temphighalarm'] = dom_mod_th_data['data']['TempHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['templowalarm'] = dom_mod_th_data['data']['TempLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['temphighwarning'] = dom_mod_th_data['data']['TempHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['templowwarning'] = dom_mod_th_data['data']['TempLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['vcchighalarm'] = dom_mod_th_data['data']['VoltageHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['vcclowalarm'] = dom_mod_th_data['data']['VoltageLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['vcchighwarning'] = dom_mod_th_data[
|
||||
'data']['VoltageHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['vcclowwarning'] = dom_module_threshold_data['data']['VoltageLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighalarm'] = dom_module_threshold_data['data']['BiasHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowalarm'] = dom_module_threshold_data['data']['BiasLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighwarning'] = dom_module_threshold_data['data']['BiasHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowwarning'] = dom_module_threshold_data['data']['BiasLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerhighalarm'] = dom_module_threshold_data['data']['TXPowerHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerlowalarm'] = dom_module_threshold_data['data']['TXPowerLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerhighwarning'] = dom_module_threshold_data['data']['TXPowerHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerlowwarning'] = dom_module_threshold_data['data']['TXPowerLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = dom_module_threshold_data['data']['RXPowerHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = dom_module_threshold_data['data']['RXPowerLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = dom_module_threshold_data['data']['RXPowerHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = dom_module_threshold_data['data']['RXPowerLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['vcclowwarning'] = dom_mod_th_data['data']['VoltageLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighalarm'] = dom_mod_th_data['data']['BiasHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowalarm'] = dom_mod_th_data['data']['BiasLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiashighwarning'] = dom_mod_th_data['data']['BiasHighWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txbiaslowwarning'] = dom_mod_th_data['data']['BiasLowWarning']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerhighalarm'] = dom_mod_th_data['data']['TXPowerHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerlowalarm'] = dom_mod_th_data['data']['TXPowerLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['txpowerhighwarning'] = dom_mod_th_data['data']['TXPowerHighWarning'][
|
||||
'value']
|
||||
xcvr_dom_threshold_info_dict['txpowerlowwarning'] = dom_mod_th_data['data']['TXPowerLowWarning'][
|
||||
'value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighalarm'] = dom_mod_th_data['data']['RXPowerHighAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowalarm'] = dom_mod_th_data['data']['RXPowerLowAlarm']['value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerhighwarning'] = dom_mod_th_data['data']['RXPowerHighWarning'][
|
||||
'value']
|
||||
xcvr_dom_threshold_info_dict['rxpowerlowwarning'] = dom_mod_th_data['data']['RXPowerLowWarning'][
|
||||
'value']
|
||||
|
||||
return xcvr_dom_threshold_info_dict
|
||||
|
||||
|
@ -748,7 +763,8 @@ class PddfSfp(SfpBase):
|
|||
elif self.is_qsfp_port:
|
||||
tx_fault_list = []
|
||||
dom_channel_monitor_raw = self.__read_eeprom_specific_bytes(
|
||||
QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) if self.get_presence() else None
|
||||
QSFP_CHANNL_TX_FAULT_STATUS_OFFSET, QSFP_CHANNL_TX_FAULT_STATUS_WIDTH) \
|
||||
if self.get_presence() else None
|
||||
if dom_channel_monitor_raw is not None:
|
||||
tx_fault_data = int(dom_channel_monitor_raw[0], 16)
|
||||
tx_fault_list.append(tx_fault_data & 0x01 != 0)
|
||||
|
@ -1087,7 +1103,7 @@ class PddfSfp(SfpBase):
|
|||
try:
|
||||
txdisable_ctl = 0xf if tx_disable else 0x0
|
||||
buf = create_string_buffer(1)
|
||||
buf[0] = chr(txdisable_ctl)
|
||||
buf[0] = bytes([txdisable_ctl])
|
||||
# Write to eeprom
|
||||
eeprom_f = open(self.eeprom_path, "r+b")
|
||||
eeprom_f.seek(QSFP_CONTROL_OFFSET)
|
||||
|
@ -1114,7 +1130,7 @@ class PddfSfp(SfpBase):
|
|||
try:
|
||||
eeprom_f = open(self.eeprom_path, mode="r+b", buffering=0)
|
||||
buf = create_string_buffer(1)
|
||||
buf[0] = chr(txdisable_ctl)
|
||||
buf[0] = bytes([txdisable_ctl])
|
||||
# Write to eeprom
|
||||
eeprom_f.seek(SFP_STATUS_CONTROL_OFFSET)
|
||||
eeprom_f.write(buf[0])
|
||||
|
@ -1168,7 +1184,7 @@ class PddfSfp(SfpBase):
|
|||
channel_state = self.get_tx_disable_channel()
|
||||
txdisable_ctl = (channel_state | channel) if disable else (channel_state & ~channel)
|
||||
buf = create_string_buffer(1)
|
||||
buf[0] = chr(txdisable_ctl)
|
||||
buf[0] = bytes([txdisable_ctl])
|
||||
# Write to eeprom
|
||||
eeprom_f = open(self.eeprom_path, "r+b")
|
||||
eeprom_f.seek(QSFP_CONTROL_OFFSET)
|
||||
|
@ -1216,7 +1232,7 @@ class PddfSfp(SfpBase):
|
|||
# Fill in write buffer
|
||||
regval = 0x3 if lpmode else 0x1 # 0x3:Low Power Mode, 0x1:High Power Mode
|
||||
buffer = create_string_buffer(1)
|
||||
buffer[0] = chr(regval)
|
||||
buffer[0] = bytes([regval])
|
||||
|
||||
# Write to eeprom
|
||||
eeprom_f = open(self.eeprom_path, "r+b")
|
||||
|
@ -1286,7 +1302,7 @@ class PddfSfp(SfpBase):
|
|||
power_set_bit |= 1 << 1
|
||||
|
||||
buffer = create_string_buffer(1)
|
||||
buffer[0] = chr(power_override_bit | power_set_bit)
|
||||
buffer[0] = bytes([power_override_bit | power_set_bit])
|
||||
# Write to eeprom
|
||||
eeprom_f = open(self.eeprom_path, "r+b")
|
||||
eeprom_f.seek(QSFP_POWEROVERRIDE_OFFSET)
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
#############################################################################
|
||||
# PDDF
|
||||
#
|
||||
# PDDF thermal base class inherited from the base class
|
||||
#
|
||||
# All the supported Temperature Sensor SysFS aattributes are
|
||||
#- temp1_high_crit_threshold
|
||||
#- temp1_high_threshold
|
||||
#- temp1_input
|
||||
#- temp_low_threshold
|
||||
#- temp1_low_crit_threshold
|
||||
# - temp1_high_crit_threshold
|
||||
# - temp1_high_threshold
|
||||
# - temp1_input
|
||||
# - temp_low_threshold
|
||||
# - temp1_low_crit_threshold
|
||||
#############################################################################
|
||||
|
||||
try:
|
||||
from sonic_platform_base.thermal_base import ThermalBase
|
||||
|
|
|
@ -33,6 +33,7 @@ $(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(SONIC_CHASSISD_PY3)
|
|||
|
||||
ifeq ($(PDDF_SUPPORT),y)
|
||||
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY2)
|
||||
$(DOCKER_PLATFORM_MONITOR)_PYTHON_WHEELS += $(PDDF_PLATFORM_API_BASE_PY3)
|
||||
endif
|
||||
|
||||
$(DOCKER_PLATFORM_MONITOR)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BUSTER)_DBG_DEPENDS)
|
||||
|
|
Загрузка…
Ссылка в новой задаче