DellEMC: Z9332f platform API changes (#8258)

Why I did it
platform test suite failed for few API's in DellEMC Z9332f platform.

How I did it
Modified the API's to return the expected values in the script.

How to verify it
Run platform test suite after making the changes.
This commit is contained in:
Aravind Mani 2021-08-05 20:42:04 -07:00 committed by Judy Joseph
parent e40948f98e
commit 17b22a8fba
2 changed files with 22 additions and 13 deletions

View File

@ -70,12 +70,12 @@ class Component(ComponentBase):
], ],
['Switch CPLD 1', ['Switch CPLD 1',
'Used for managing QSFP28/SFP port transceivers ', 'Used for managing QSFP-DD/QSFP28/SFP port transceivers ',
get_cpld1_version get_cpld1_version
], ],
['Switch CPLD 2', ['Switch CPLD 2',
'Used for managing QSFP28/SFP port transceivers', 'Used for managing QSFP-DD/QSFP28/SFP port transceivers',
get_cpld2_version get_cpld2_version
] ]

View File

@ -1073,8 +1073,13 @@ class Sfp(SfpBase):
try: try:
offset = QSFP_DD_PAGE17 offset = QSFP_DD_PAGE17
if self.sfp_type == 'QSFP_DD': if self.sfp_type == 'QSFP_DD':
if self.qsfp_dd_DomInfo is None or not self.qsfp_dd_txbias_supported: if self.qsfp_dd_DomInfo is None:
return None return None
if not self.qsfp_dd_txbias_supported:
for lane in range(0, 8):
tx_bias_list.append("N/A")
return tx_bias_list
tx_bias_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXBIAS_OFFSET, QSFP_DD_TXBIAS_WIDTH) tx_bias_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXBIAS_OFFSET, QSFP_DD_TXBIAS_WIDTH)
tx_bias_data = self.qsfp_dd_DomInfo.parse_dom_tx_bias(tx_bias_data_raw, 0) tx_bias_data = self.qsfp_dd_DomInfo.parse_dom_tx_bias(tx_bias_data_raw, 0)
@ -1093,8 +1098,6 @@ class Sfp(SfpBase):
if tx_bias_data is not None: if tx_bias_data is not None:
tx1_bias = self._strip_unit_from_str(tx_bias_data['data']['TXBias']['value']) tx1_bias = self._strip_unit_from_str(tx_bias_data['data']['TXBias']['value'])
tx_bias_list.append(tx1_bias) tx_bias_list.append(tx1_bias)
else:
tx_bias_list.append(0.0)
except (TypeError, ValueError): except (TypeError, ValueError):
return None return None
@ -1107,8 +1110,12 @@ class Sfp(SfpBase):
rx_power_list = [] rx_power_list = []
try: try:
if self.sfp_type == 'QSFP_DD': if self.sfp_type == 'QSFP_DD':
if self.qsfp_dd_DomInfo is None or not self.qsfp_dd_rxpower_supported: if self.qsfp_dd_DomInfo is None:
return None return None
if not self.qsfp_dd_rxpower_supported:
for lane in range(0, 8):
rx_power_list.append("N/A")
return rx_power_list
offset = QSFP_DD_PAGE17 offset = QSFP_DD_PAGE17
rx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_RXPOWER_OFFSET, QSFP_DD_TXPOWER_WIDTH) rx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_RXPOWER_OFFSET, QSFP_DD_TXPOWER_WIDTH)
@ -1128,8 +1135,6 @@ class Sfp(SfpBase):
rx_power_data = self._get_eeprom_data('ChannelMonitor') rx_power_data = self._get_eeprom_data('ChannelMonitor')
if rx_power_data is not None: if rx_power_data is not None:
rx1_pw = self._strip_unit_from_str(rx_power_data['data']['RXPower']['value']) rx1_pw = self._strip_unit_from_str(rx_power_data['data']['RXPower']['value'])
else:
rx1_pw = 0.0
rx_power_list.append(rx1_pw) rx_power_list.append(rx1_pw)
except (TypeError, ValueError): except (TypeError, ValueError):
return None return None
@ -1142,8 +1147,12 @@ class Sfp(SfpBase):
tx_power_list = [] tx_power_list = []
try: try:
if self.sfp_type == 'QSFP_DD': if self.sfp_type == 'QSFP_DD':
if self.qsfp_dd_DomInfo is None or not self.qsfp_dd_txpower_supported: if self.qsfp_dd_DomInfo is None:
return None return None
if not self.qsfp_dd_txpower_supported:
for lane in range(0, 8):
tx_power_list.append("N/A")
return tx_power_list
offset = QSFP_DD_PAGE17 offset = QSFP_DD_PAGE17
tx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXPOWER_OFFSET, tx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXPOWER_OFFSET,
@ -1177,8 +1186,6 @@ class Sfp(SfpBase):
channel_monitor_data = self._get_eeprom_data('ChannelMonitor') channel_monitor_data = self._get_eeprom_data('ChannelMonitor')
if channel_monitor_data is not None: if channel_monitor_data is not None:
tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value']) tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value'])
else:
tx1_pw = 0.0
tx_power_list.append(tx1_pw) tx_power_list.append(tx1_pw)
except (TypeError, ValueError): except (TypeError, ValueError):
return None return None
@ -1212,6 +1219,8 @@ class Sfp(SfpBase):
# Convert our register value back to a hex string and write back # Convert our register value back to a hex string and write back
self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset)
else:
return False
except ValueError: except ValueError:
return False return False
return True return True