From e9d09632203c3e99d45f3d66faf38b562be534fd Mon Sep 17 00:00:00 2001 From: Arun LK Date: Mon, 30 Aug 2021 17:47:40 +0530 Subject: [PATCH] DellEMC: N3248PXE Initial platform commit --- ...-n3248pxe-48x10GCU+4x25G-2x100G.config.bcm | 27 ++++++++- .../plugins/fanutil.py | 1 - .../plugins/psuutil.py | 2 +- .../plugins/sfputil.py | 4 -- .../n3248pxe/scripts/platform_sensors.py | 4 -- .../n3248pxe/scripts/portiocfg.py | 1 - .../n3248pxe/scripts/ports_xcvrd_notify.py | 6 -- .../n3248pxe/sonic_platform/chassis.py | 42 +++++++------- .../n3248pxe/sonic_platform/component.py | 4 +- .../n3248pxe/sonic_platform/eeprom.py | 2 +- .../n3248pxe/sonic_platform/fan.py | 12 ++-- .../n3248pxe/sonic_platform/fan_drawer.py | 6 +- .../n3248pxe/sonic_platform/psu.py | 25 +++++---- .../n3248pxe/sonic_platform/sfp.py | 56 ++++++++++--------- .../n3248pxe/sonic_platform/thermal.py | 5 +- .../n3248pxe/sonic_platform/watchdog.py | 10 +--- src/sonic-device-data/tests/permitted_list | 11 ++++ 17 files changed, 120 insertions(+), 98 deletions(-) diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/DELLEMC-N3248PXE/td3-x5-n3248pxe-48x10GCU+4x25G-2x100G.config.bcm b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/DELLEMC-N3248PXE/td3-x5-n3248pxe-48x10GCU+4x25G-2x100G.config.bcm index b6a424f55eda..8d3a064211c4 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/DELLEMC-N3248PXE/td3-x5-n3248pxe-48x10GCU+4x25G-2x100G.config.bcm +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/DELLEMC-N3248PXE/td3-x5-n3248pxe-48x10GCU+4x25G-2x100G.config.bcm @@ -323,6 +323,10 @@ phy_an_c73=3 oversubscribe_mode=1 core_clock_frequency=1525 +#25G,10G and 1G support +serdes_10g_at_25g_vco=1 +serdes_1000x_at_25g_vco=1 + l2xmsg_mode=1 l2xmsg_hostbuf_size=16384 @@ -360,5 +364,26 @@ riot_overlay_ecmp_resilient_hash_size=16384 pfc_deadlock_seq_control=1 #Common configs from broadcom/x86_64-broadcom_common/x86_64-broadcom_b77/broadcom-sonic-td3.config.bcm (Lower version of Td3 (0xb771)) - +mem_cache_enable=0 +ifp_inports_support_enable=1 +ipv6_lpm_128b_enable=0x1 +l3_max_ecmp_mode=1 +lpm_scaling_enable=0 +bcm_num_cos=10 +default_cpu_tx_queue=9 +mmu_lossless=0 +host_as_route_disable=1 +sai_eapp_config_file=/etc/broadcom/eapps_cfg.json +sai_fast_convergence_support=1 flow_init_mode=1 +sai_interface_type_auto_detect=0 +mpls_mem_entries=16384 +vlan_xlate_1_mem_entries=65536 +vlan_xlate_2_mem_entries=16384 +sai_load_hw_config=/usr/lib/cancun/ +sai_nbr_bcast_ifp_optimized=1 +sai_brcm_sonic_acl_enhancements=1 +# Reduced Trap Group QSET for BRCM Sonic +sai_brcm_sonic_trap_group=1 +l2_entry_used_as_my_station=1 +multi_hash_recurse_depth_l3=2 diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py index 5a3e882c3e44..b70d58901330 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/fanutil.py @@ -4,7 +4,6 @@ # import commands -import os import sys SENSORS_CMD = "docker exec -i pmon /usr/bin/sensors" diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py index 71ab0e812e86..a9cfd00b9e2d 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/psuutil.py @@ -47,7 +47,7 @@ def get_cpld_register(self, reg_name): try: with open(reg_file, 'r') as fd: retval = fd.read() - except Exception as error: + except Exception: print("Unable to open ", reg_file, "file !") retval = retval.rstrip('\r\n') diff --git a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/sfputil.py b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/sfputil.py index 49c712b158be..3aedcca1851b 100644 --- a/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/sfputil.py +++ b/device/dell/x86_64-dellemc_n3248pxe_c3338-r0/plugins/sfputil.py @@ -5,10 +5,6 @@ try: import time - import datetime - import os - import struct - import traceback from socket import * from select import * from sonic_sfp.sfputilbase import SfpUtilBase diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/platform_sensors.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/platform_sensors.py index 9640f16750e6..e76fffa20cc2 100755 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/platform_sensors.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/platform_sensors.py @@ -4,10 +4,6 @@ # * FAN trays # * PSU - -import os -import sys -import logging import subprocess output = "" diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/portiocfg.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/portiocfg.py index 51cc9ab27db3..348ae9920164 100755 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/portiocfg.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/portiocfg.py @@ -64,7 +64,6 @@ def main(argv): opts = '' val = '' choice = '' - resouce = '' offset = '' try: diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/ports_xcvrd_notify.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/ports_xcvrd_notify.py index be44d58343cb..8e40ce4853ef 100755 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/ports_xcvrd_notify.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/scripts/ports_xcvrd_notify.py @@ -6,9 +6,6 @@ """ try: - import os - import sys - import time from datetime import datetime from swsscommon import swsscommon from sonic_py_common import daemon_base, logger @@ -89,9 +86,6 @@ def main(): helper_logger.log_notice("Start port_notify") # Connect to APP_DB and create transceiver dom info table appl_db = daemon_base.db_connect("APPL_DB") - cst = swsscommon.SubscriberStateTable(appl_db, swsscommon.APP_PORT_TABLE_NAME) - - app_port_tbl = swsscommon.ProducerStateTable(appl_db, swsscommon.APP_PORT_TABLE_NAME) app_status_port_tbl = swsscommon.ProducerStateTable(appl_db, swsscommon.APP_PORT_APP_STATUS_TABLE_NAME) diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/chassis.py index 3dd887eae28a..5576aaf039ce 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/chassis.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC N3248TE +# DELLEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -10,7 +10,6 @@ try: import os - import select import sys import time from sonic_platform_base.chassis_base import ChassisBase @@ -26,11 +25,11 @@ raise ImportError(str(e) + "- required module not found") -MAX_N3248TE_FANTRAY = 3 -MAX_N3248TE_FAN = 1 -MAX_N3248TE_PSU = 2 -MAX_N3248TE_THERMAL = 5 -MAX_N3248TE_COMPONENT = 3 # BIOS, CPU CPLD and SYS CPLD +MAX_N3248PXE_FANTRAY = 3 +MAX_N3248PXE_FAN = 1 +MAX_N3248PXE_PSU = 2 +MAX_N3248PXE_THERMAL = 5 +MAX_N3248PXE_COMPONENT = 3 # BIOS, CPU CPLD and SYS CPLD media_part_num_list = set([ \ "8T47V","XTY28","MHVPK","GF76J","J6FGD","F1KMV","9DN5J","H4DHD","6MCNV","0WRX0","X7F70","5R2PT","WTRD1","WTRD1","WTRD1","WTRD1","5250G","WTRD1","C5RNH","C5RNH","FTLX8571D3BCL-FC", @@ -60,6 +59,8 @@ class Chassis(ChassisBase): 50: 21, 51: 22, 52: 23, + 53: 24, + 54: 25, } def __init__(self): @@ -67,7 +68,7 @@ def __init__(self): # sfp.py will read eeprom contents and retrive the eeprom data. # We pass the eeprom path from chassis.py self.PORT_START = 1 - self.PORT_END = 52 + self.PORT_END = 54 self.PORTS_IN_BLOCK = (self.PORT_END + 1) self.SFP_PORT_START = 49 self._sfp_port = range(self.SFP_PORT_START, self.PORTS_IN_BLOCK) @@ -81,21 +82,21 @@ def __init__(self): self._eeprom = Eeprom() self._watchdog = Watchdog() - self._num_sfps = 52 - self._num_fans = MAX_N3248TE_FANTRAY * MAX_N3248TE_FAN - self._fan_list = [Fan(i, j) for i in range(MAX_N3248TE_FANTRAY) \ - for j in range(MAX_N3248TE_FAN)] - for k in range(MAX_N3248TE_FANTRAY): + self._num_sfps = 54 + self._num_fans = MAX_N3248PXE_FANTRAY * MAX_N3248PXE_FAN + self._fan_list = [Fan(i, j) for i in range(MAX_N3248PXE_FANTRAY) \ + for j in range(MAX_N3248PXE_FAN)] + for k in range(MAX_N3248PXE_FANTRAY): fandrawer = FanDrawer(k) self._fan_drawer_list.append(fandrawer) self._fan_list.extend(fandrawer._fan_list) - self._psu_list = [Psu(i) for i in range(MAX_N3248TE_PSU)] - self._thermal_list = [Thermal(i) for i in range(MAX_N3248TE_THERMAL)] - self._component_list = [Component(i) for i in range(MAX_N3248TE_COMPONENT)] + self._psu_list = [Psu(i) for i in range(MAX_N3248PXE_PSU)] + self._thermal_list = [Thermal(i) for i in range(MAX_N3248PXE_THERMAL)] + self._component_list = [Component(i) for i in range(MAX_N3248PXE_COMPONENT)] for port_num in self._sfp_port: # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num-1).get_presence() + presence = self.get_sfp(port_num).get_presence() self._global_port_pres_dict[port_num] = '1' if presence else '0' self._watchdog = Watchdog() @@ -119,13 +120,12 @@ def _set_cpld_register(self, reg_name, value): cpld_reg_file = self.CPLD_DIR + '/' + reg_name if (not os.path.isfile(cpld_reg_file)): - #print "open error" return rv try: with open(cpld_reg_file, 'w') as fd: rv = fd.write(str(value)) - except: + except Exception: rv = 'ERR' return rv @@ -143,7 +143,7 @@ def get_change_event(self, timeout=0): while True: for port_num in self._sfp_port: # sfp get uses zero-indexing, but port numbers start from 1 - presence = self.get_sfp(port_num-1).get_presence() + presence = self.get_sfp(port_num).get_presence() if(presence and self._global_port_pres_dict[port_num] == '0'): self._global_port_pres_dict[port_num] = '1' port_dict[port_num] = '1' @@ -175,7 +175,7 @@ def get_sfp(self, index): try: # The index will start from 0 - sfp = self._sfp_list[index] + sfp = self._sfp_list[index-1] except IndexError: sys.stderr.write("SFP index {} out of range (0-{})\n".format( index, len(self._sfp_list)-1)) diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py index 3e1254b99cf1..50b85cc179e4 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/component.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DELLEMC N3248TE +# DELLEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the Components' (e.g., BIOS, CPLD, FPGA, BMC etc.) available in @@ -10,8 +10,6 @@ ######################################################################## try: - import os - import re import subprocess from sonic_platform_base.component_base import ComponentBase diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/eeprom.py index df33c78d13e7..1343265508e0 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/eeprom.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DellEmc Z9332F +# DellEmc N3248PXE # # Platform and model specific eeprom subclass, inherits from the base class, # and provides the followings: diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan.py index bd525bf6fe5c..85d262f1c049 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC Z9332F +# DellEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the Fans' information which are available in the platform. @@ -66,7 +66,7 @@ def get_model(self): """ try: val = open(self.eeprom, "rb").read()[13:19] - except: + except Exception: val = None return val.decode() @@ -78,7 +78,7 @@ def get_serial(self): """ try: val = open(self.eeprom, "rb").read()[21:41] - except: + except Exception: val = None return val.decode() @@ -126,7 +126,7 @@ def get_direction(self): else: try: val = open(self.eeprom, "rb").read()[0xe1:0xe8] - except: + except Exception: return None direction = 'Exhaust' if val == 'FORWARD' else 'Intake' return direction @@ -147,7 +147,7 @@ def get_speed(self): dps_dir = self.dps_hwmon + '/' + os.listdir(self.dps_hwmon)[0] rpm_file = dps_dir + '/' + 'fan1_input' fan_speed = int(open(rpm_file, "rb").read()) - except: + except Exception: return None speed = (100 * fan_speed)//self.max_speed return speed @@ -166,6 +166,6 @@ def get_speed_rpm(self): dps_dir = self.dps_hwmon + '/' + os.listdir(self.dps_hwmon)[0] rpm_file = dps_dir + '/' + 'fan1_input' fan_speed = int(open(rpm_file, "rb").read()) - except: + except Exception: return None return fan_speed diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan_drawer.py index 5142827554db..45abfae3647a 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/fan_drawer.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC N3248TE +# DellEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the Fan-Drawers' information available in the platform. @@ -14,7 +14,7 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") -N3248TE_FANS_PER_FANTRAY = 2 +N3248PXE_FANS_PER_FANTRAY = 2 class FanDrawer(FanDrawerBase): @@ -25,7 +25,7 @@ def __init__(self, fantray_index): FanDrawerBase.__init__(self) # FanTray is 1-based in DellEMC platforms self.fantrayindex = fantray_index + 1 - for i in range(N3248TE_FANS_PER_FANTRAY): + for i in range(N3248PXE_FANS_PER_FANTRAY): self._fan_list.append(Fan(fantray_index, i)) def get_name(self): diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py index b10505900afb..74f8a766f6d8 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/psu.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC Z9332F +# DellEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the PSUs' information which are available in the platform @@ -101,7 +101,8 @@ def get_model(self): string: Part number of PSU """ try: val = open(self.eeprom, "rb").read()[0x50:0x62] - except: val = None + except Exception: + val = None return val.decode() def get_serial(self): @@ -112,7 +113,8 @@ def get_serial(self): string: Serial number of PSU """ try: val = open(self.eeprom, "rb").read()[0xc4:0xd9] - except: val = None + except Exception: + val = None return val.decode() def get_status(self): @@ -134,11 +136,11 @@ def get_voltage(self): A float number, the output voltage in volts, e.g. 12.1 """ - voltage = 0.0 volt_reading = self._get_dps_register(self.psu_voltage_reg) try: voltage = int(volt_reading)/1000 - except : return None + except Exception: + return None return "{:.1f}".format(voltage) def get_current(self): @@ -149,11 +151,11 @@ def get_current(self): A float number, electric current in amperes, e.g. 15.4 """ - current = 0.0 curr_reading = self._get_dps_register(self.psu_current_reg) try: current = int(curr_reading)/1000 - except : return None + except Exception: + return None return "{:.1f}".format(current) def get_power(self): @@ -164,11 +166,11 @@ def get_power(self): A float number, the power in watts, e.g. 302.6 """ - power = 0.0 power_reading = self._get_dps_register(self.psu_power_reg) try: power = int(power_reading)/1000 - except : return None + except Exception: + return None return "{:.1f}".format(power) def get_powergood_status(self): @@ -200,5 +202,6 @@ def get_type(self): A string, PSU power type """ try: val = open(self.eeprom, "rb").read()[0xe8:0xea] - except: return None - return val + except Exception: + return None + return val.decode() diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py index 04d30490ddd6..1a56c036dc86 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/sfp.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ############################################################################# -# DELLEMC S5248F +# DELLEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the platform information @@ -37,7 +37,7 @@ QSFP_DOM_OFFSET1 = 384 SFP_PORT_START = 49 -SFP_PORT_END = 52 +SFP_PORT_END = 54 SFP_INFO_OFFSET = 0 SFP_DOM_OFFSET = 256 @@ -69,8 +69,8 @@ 'FibreChannelTechnology', 'SFP+CableTechnology', 'FibreChannelTransmissionMedia', 'FibreChannelSpeed') -info_dict_keys = ['type', 'hardwarerev', 'serialnum', - 'manufacturename', 'modelname', 'Connector', +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', 'type_abbrv_name','vendor_date', 'vendor_oui'] @@ -109,7 +109,7 @@ 'cable_type': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], 'cable_length': [QSFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'Connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], + 'connector': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], 'type': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], 'encoding': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], 'ext_identifier': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], @@ -119,11 +119,11 @@ 'specification_compliance': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], 'type_abbrv_name': [QSFP_INFO_OFFSET, 0, 20, 'parse_sfp_info_bulk'], - 'manufacturename': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], + 'manufacturer': [QSFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], 'vendor_oui': [QSFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'modelname': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardwarerev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], - 'serialnum': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], + 'model': [QSFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], + 'hardware_rev': [QSFP_INFO_OFFSET, 56, 2, 'parse_vendor_rev'], + 'serial': [QSFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], 'vendor_date': [QSFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], 'dom_capability': [QSFP_INFO_OFFSET, 92, 1, 'parse_qsfp_dom_capability'], 'dom_rev': [QSFP_DOM_OFFSET, 1, 1, 'parse_sfp_dom_rev'], @@ -138,7 +138,7 @@ 'cable_type': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], 'cable_length': [SFP_INFO_OFFSET, -1, -1, 'parse_sfp_info_bulk'], - 'Connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], + 'connector': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], 'type': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], 'encoding': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], 'ext_identifier': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], @@ -148,11 +148,11 @@ 'specification_compliance': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], 'type_abbrv_name': [SFP_INFO_OFFSET, 0, 21, 'parse_sfp_info_bulk'], - 'manufacturename': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], + 'manufacturer': [SFP_INFO_OFFSET, 20, 16, 'parse_vendor_name'], 'vendor_oui': [SFP_INFO_OFFSET, 37, 3, 'parse_vendor_oui'], - 'modelname': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], - 'hardwarerev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], - 'serialnum': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], + 'model': [SFP_INFO_OFFSET, 40, 16, 'parse_vendor_pn'], + 'hardware_rev': [SFP_INFO_OFFSET, 56, 4, 'parse_vendor_rev'], + 'serial': [SFP_INFO_OFFSET, 68, 16, 'parse_vendor_sn'], 'vendor_date': [SFP_INFO_OFFSET, 84, 8, 'parse_vendor_date'], 'ModuleThreshold': [SFP_DOM_OFFSET, 0, 56, 'parse_alarm_warning_threshold'], } @@ -207,6 +207,7 @@ def pci_get_value(self, resource, offset): def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): eeprom_raw = [] + print(eeprom_path, num_bytes) try: eeprom = open(eeprom_path, mode="rb", buffering=0) except IOError: @@ -222,9 +223,11 @@ def _read_eeprom_bytes(self, eeprom_path, offset, num_bytes): eeprom.close() return None + raw = bytearray(raw) + try: 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 BaseException: eeprom.close() return None @@ -322,7 +325,7 @@ def get_transceiver_info(self): transceiver_info_dict['type_abbrv_name']=type_abbrv_name transceiver_info_dict['type'] = identifier - transceiver_info_dict['Connector'] = connector + transceiver_info_dict['connector'] = connector transceiver_info_dict['encoding'] = encoding transceiver_info_dict['ext_identifier'] = ext_id transceiver_info_dict['ext_rateselect_compliance'] = rate_identifier @@ -341,9 +344,9 @@ def get_transceiver_info(self): # Vendor Name try: - vendor_name_data = self._get_eeprom_data('manufacturename') + vendor_name_data = self._get_eeprom_data('manufacturer') vendor_name = vendor_name_data['data']['Vendor Name']['value'] - transceiver_info_dict['manufacturename'] = vendor_name + transceiver_info_dict['manufacturer'] = vendor_name except (ValueError, TypeError) : pass # Vendor OUI @@ -355,23 +358,23 @@ def get_transceiver_info(self): # Vendor PN try: - vendor_pn_data = self._get_eeprom_data('modelname') + vendor_pn_data = self._get_eeprom_data('model') vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] - transceiver_info_dict['modelname'] = vendor_pn + transceiver_info_dict['model'] = vendor_pn except (ValueError, TypeError) : pass # Vendor Revision try: - vendor_rev_data = self._get_eeprom_data('hardwarerev') + vendor_rev_data = self._get_eeprom_data('hardware_rev') vendor_rev = vendor_rev_data['data']['Vendor Rev']['value'] - transceiver_info_dict['hardwarerev'] = vendor_rev + transceiver_info_dict['hardware_rev'] = vendor_rev except (ValueError, TypeError) : pass # Vendor Serial Number try: - vendor_sn_data = self._get_eeprom_data('serialnum') + vendor_sn_data = self._get_eeprom_data('serial') vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] - transceiver_info_dict['serialnum'] = vendor_sn + transceiver_info_dict['serial'] = vendor_sn except (ValueError, TypeError) : pass return transceiver_info_dict @@ -540,12 +543,13 @@ def get_presence(self): except: pass return presence + def get_model(self): """ Retrieves the model number (or part number) of the sfp """ try: - vendor_pn_data = self._get_eeprom_data('modelname') + vendor_pn_data = self._get_eeprom_data('model') vendor_pn = vendor_pn_data['data']['Vendor PN']['value'] except (TypeError, ValueError): return 'N/A' @@ -557,7 +561,7 @@ def get_serial(self): Retrieves the serial number of the sfp """ try: - vendor_sn_data = self._get_eeprom_data('serialnum') + vendor_sn_data = self._get_eeprom_data('serial') vendor_sn = vendor_sn_data['data']['Vendor SN']['value'] except (TypeError, ValueError): return 'N/A' diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/thermal.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/thermal.py index cdbd74562392..d89b50ababd0 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/thermal.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/thermal.py @@ -1,7 +1,7 @@ #!/usr/bin/env python ######################################################################## -# DellEMC Z9332F +# DellEMC N3248PXE # # Module contains an implementation of SONiC Platform Base API and # provides the Thermals' information which are available in the platform @@ -91,7 +91,8 @@ def get_temperature(self): temperature = 0.0 try : temperature = float(open(self.temp_file).read()) / 1000.0 - except : pass + except Exception: + pass return float(temperature) def get_high_threshold(self): diff --git a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py index 90a6c7f6eef4..876aa4beda51 100644 --- a/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/n3248pxe/sonic_platform/watchdog.py @@ -2,7 +2,7 @@ ######################################################################## # -# DELLEMC Z9332F +# DELLEMC N3248PXE # # Abstract base class for implementing a platform-specific class with # which to interact with a hardware watchdog module in SONiC @@ -10,8 +10,6 @@ ######################################################################## try: - import sys - import struct import ctypes import subprocess from sonic_platform_base.watchdog_base import WatchdogBase @@ -128,7 +126,6 @@ def arm(self, seconds): self.armed_time = self._get_time() self.timeout = seconds - return seconds else: # Setting 4th bit to enable WD # 4th bit = Enable WD @@ -137,9 +134,8 @@ def arm(self, seconds): self.armed_time = self._get_time() self.timeout = seconds - return seconds - return -1 + return seconds def disarm(self): """ @@ -187,7 +183,7 @@ def get_remaining_time(self): their watchdog timer. If the watchdog is not armed, returns -1. - S5232 doesnot have hardware support to show remaining time. + N3248PXE doesnot have hardware support to show remaining time. Due to this limitation, this API is implemented in software. This API would return correct software time difference if it is called from the process which armed the watchdog timer. diff --git a/src/sonic-device-data/tests/permitted_list b/src/sonic-device-data/tests/permitted_list index f4f576b8dc31..fca54f6b4110 100644 --- a/src/sonic-device-data/tests/permitted_list +++ b/src/sonic-device-data/tests/permitted_list @@ -256,3 +256,14 @@ appl_param_module_id serdes_lane_config_cl72_auto_polarity_en serdes_lane_config_cl72_restart_timeout_en bist_enable +mpls_mem_entries +vlan_xlate_1_mem_entries +vlan_xlate_2_mem_entries +sai_nbr_bcast_ifp_optimized +sai_brcm_sonic_acl_enhancements +sai_brcm_sonic_trap_group +l2_entry_used_as_my_station +multi_hash_recurse_depth_l3 +serdes_10g_at_25g_vco +serdes_1000x_at_25g_vco +sai_interface_type_auto_detect