From c21161a4292d186f9ff668ed26d04008b235c098 Mon Sep 17 00:00:00 2001 From: Aravind Mani Date: Mon, 26 Jul 2021 16:13:45 +0530 Subject: [PATCH 1/2] DellEMC: Z9332f platform API changes --- .../z9332f/sonic_platform/component.py | 4 +-- .../z9332f/sonic_platform/sfp.py | 27 ++++++++++++++----- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py index 8b7ae004e8a4..01bcdeffe688 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/component.py @@ -70,12 +70,12 @@ class Component(ComponentBase): ], ['Switch CPLD 1', - 'Used for managing QSFP28/SFP port transceivers ', + 'Used for managing QSFP-DD/QSFP28/SFP port transceivers ', get_cpld1_version ], ['Switch CPLD 2', - 'Used for managing QSFP28/SFP port transceivers', + 'Used for managing QSFP-DD/QSFP28/SFP port transceivers', get_cpld2_version ] diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py index 0dcb6da49514..1680a289137f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py @@ -1073,8 +1073,13 @@ def get_tx_bias(self): try: offset = QSFP_DD_PAGE17 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 + 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 = self.qsfp_dd_DomInfo.parse_dom_tx_bias(tx_bias_data_raw, 0) @@ -1094,7 +1099,7 @@ def get_tx_bias(self): tx1_bias = self._strip_unit_from_str(tx_bias_data['data']['TXBias']['value']) tx_bias_list.append(tx1_bias) else: - tx_bias_list.append(0.0) + tx_bias_list.append("N/A") except (TypeError, ValueError): return None @@ -1107,8 +1112,12 @@ def get_rx_power(self): rx_power_list = [] try: 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 + 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 rx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_RXPOWER_OFFSET, QSFP_DD_TXPOWER_WIDTH) @@ -1129,7 +1138,7 @@ def get_rx_power(self): if rx_power_data is not None: rx1_pw = self._strip_unit_from_str(rx_power_data['data']['RXPower']['value']) else: - rx1_pw = 0.0 + rx1_pw = "N/A" rx_power_list.append(rx1_pw) except (TypeError, ValueError): return None @@ -1142,8 +1151,12 @@ def get_tx_power(self): tx_power_list = [] try: 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 + 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 tx_power_data_raw = self._read_eeprom_bytes(self.eeprom_path, offset + QSFP_DD_TXPOWER_OFFSET, @@ -1178,7 +1191,7 @@ def get_tx_power(self): if channel_monitor_data is not None: tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value']) else: - tx1_pw = 0.0 + tx1_pw = "N/A" tx_power_list.append(tx1_pw) except (TypeError, ValueError): return None @@ -1212,6 +1225,8 @@ def reset(self): # Convert our register value back to a hex string and write back self.pci_set_value(self.BASE_RES_PATH, reg_value, port_offset) + else: + return False except ValueError: return False return True From 7fdd886a83a39969c7ff2023b05f71782c8404a7 Mon Sep 17 00:00:00 2001 From: Aravind Mani Date: Mon, 26 Jul 2021 18:41:00 +0530 Subject: [PATCH 2/2] Address comments --- .../z9332f/sonic_platform/sfp.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py index 1680a289137f..4fe4b261cad0 100644 --- a/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9332f/sonic_platform/sfp.py @@ -1098,8 +1098,6 @@ def get_tx_bias(self): if tx_bias_data is not None: tx1_bias = self._strip_unit_from_str(tx_bias_data['data']['TXBias']['value']) tx_bias_list.append(tx1_bias) - else: - tx_bias_list.append("N/A") except (TypeError, ValueError): return None @@ -1137,9 +1135,7 @@ def get_rx_power(self): rx_power_data = self._get_eeprom_data('ChannelMonitor') if rx_power_data is not None: rx1_pw = self._strip_unit_from_str(rx_power_data['data']['RXPower']['value']) - else: - rx1_pw = "N/A" - rx_power_list.append(rx1_pw) + rx_power_list.append(rx1_pw) except (TypeError, ValueError): return None return rx_power_list @@ -1190,9 +1186,7 @@ def get_tx_power(self): channel_monitor_data = self._get_eeprom_data('ChannelMonitor') if channel_monitor_data is not None: tx1_pw = self._strip_unit_from_str(channel_monitor_data['data']['TXPower']['value']) - else: - tx1_pw = "N/A" - tx_power_list.append(tx1_pw) + tx_power_list.append(tx1_pw) except (TypeError, ValueError): return None return tx_power_list