Skip to content

Commit

Permalink
DellEMC: N3248TE Initial platform commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun LK authored and Arun LK committed Sep 21, 2021
1 parent ddab083 commit c89b67d
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
# Platform-specific FAN status interface for SONiC
#

import commands
import os
import subprocess
import sys

SENSORS_CMD = "docker exec -i pmon /usr/bin/sensors"
Expand Down Expand Up @@ -48,9 +47,9 @@ def get_direction(self, idx):
def get_speed(self, idx):
dockerenv = self.isDockerEnv()
if not dockerenv:
status, cmd_output = commands.getstatusoutput(SENSORS_CMD)
status, cmd_output = subprocess.getstatusoutput(SENSORS_CMD)
else :
status, cmd_output = commands.getstatusoutput(DOCKER_SENSORS_CMD)
status, cmd_output = subprocess.getstatusoutput(DOCKER_SENSORS_CMD)

if status:
print('Failed to execute sensors command')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
# * PSU


import os
import sys
import logging
import subprocess

output = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def main(argv):
opts = ''
val = ''
choice = ''
resouce = ''
offset = ''

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

try:
import os
import select
import sys
import time
from sonic_platform_base.chassis_base import ChassisBase
Expand Down Expand Up @@ -132,7 +131,7 @@ def _set_cpld_register(self, reg_name, value):
try:
with open(cpld_reg_file, 'w') as fd:
rv = fd.write(str(value))
except:
except Exception:
rv = 'ERR'

return rv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
########################################################################

try:
import os
import re
import subprocess
from sonic_platform_base.component_base import ComponentBase

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self):
self.eeprom_tlv_dict = dict()
try:
self.eeprom_data = self.read_eeprom()
except:
except Exception:
self.eeprom_data = "N/A"
raise RuntimeError("Eeprom is not Programmed")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_model(self):
"""
try:
val = open(self.eeprom, "rb").read()[13:19]
except:
except Exception:
val = None
return val.decode()

Expand All @@ -79,7 +79,7 @@ def get_serial(self):
"""
try:
val = open(self.eeprom, "rb").read()[21:41]
except:
except Exception:
val = None
return val.decode()

Expand Down Expand Up @@ -124,7 +124,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
Expand All @@ -145,7 +145,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
Expand All @@ -164,6 +164,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
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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
except Exception:
return None
return val
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@

try:
import os
import time
import struct
import sys
import getopt
import select
import mmap
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform_base.sfp_base import SfpBase
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom
from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId
from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom
from sonic_platform_base.sonic_sfp.sff8472 import sffbase

except ImportError as e:
raise ImportError(str(e) + "- required module not found")
Expand Down Expand Up @@ -539,7 +533,8 @@ def get_presence(self):
sfp_mod_prs = self._get_cpld_register('sfp_modprs')
if sfp_mod_prs == 'ERR' : return presence
presence = ((int(sfp_mod_prs, 16) & bit_mask) == 0)
except: pass
except Exception:
pass
return presence

def get_model(self):
Expand Down Expand Up @@ -584,7 +579,8 @@ def get_rx_los(self):
sfp_rxlos = self._get_cpld_register('sfp_rxlos')
if sfp_rxlos == 'ERR' : return rx_los
rx_los = ((int(sfp_rxlos, 16) & bit_mask) != 0)
except: pass
except Exception:
pass
return rx_los

def get_tx_fault(self):
Expand All @@ -598,7 +594,8 @@ def get_tx_fault(self):
sfp_txfault = self._get_cpld_register('sfp_txfault')
if sfp_txfault == 'ERR' : return tx_fault
tx_fault = ((int(sfp_txfault, 16) & bit_mask) != 0)
except: pass
except Exception:
pass
return tx_fault

def get_tx_disable(self):
Expand All @@ -612,7 +609,8 @@ def get_tx_disable(self):
sfp_txdisable = self._get_cpld_register('sfp_txdis')
if sfp_txdisable == 'ERR' : return tx_disable
tx_disable = ((int(sfp_txdisable, 16) & bit_mask) != 0)
except: pass
except Exception:
pass
return tx_disable

def get_tx_disable_channel(self):
Expand Down Expand Up @@ -655,7 +653,6 @@ def get_temperature(self):
"""
Retrieves the temperature of this SFP
"""
temperature = 'N/A'
try :
temperature_data = self._get_eeprom_data('Temperature')
temperature = temperature_data['data']['Temperature']['value']
Expand All @@ -667,7 +664,6 @@ def get_voltage(self):
"""
Retrieves the supply voltage of this SFP
"""
voltage = 'N/A'
try:
voltage_data = self._get_eeprom_data('Voltage')
voltage = voltage_data['data']['Vcc']['value']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

########################################################################
#
# DELLEMC Z9332F
# DELLEMC N3248TE
#
# Abstract base class for implementing a platform-specific class with
# which to interact with a hardware watchdog module in SONiC
#
########################################################################

try:
import sys
import struct
import ctypes
import subprocess
from sonic_platform_base.watchdog_base import WatchdogBase
Expand Down Expand Up @@ -139,8 +137,6 @@ def arm(self, seconds):
self.timeout = seconds
return seconds

return -1

def disarm(self):
"""
Disarm the hardware watchdog
Expand Down
29 changes: 29 additions & 0 deletions src/sonic-device-data/tests/permitted_list
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,35 @@ appl_param_module_id
serdes_lane_config_cl72_auto_polarity_en
serdes_lane_config_cl72_restart_timeout_en
bist_enable
mmu_config_override
buf.prigroup.guarantee
buf.prigroup.device_headroom_enable
buf.prigroup.pool_resume
buf.prigroup.pool_scale
buf.prigroup.port_guarantee_enable
buf.prigroup.port_max_enable
buf.prigroup.flow_control_enable
buf.queue.pool_scale
buf.mqueue.pool_scale
buf.queue.pool_scale
buf.mqueue.pool_scale
buf.mqueue.pool_scale_cpu
buf.queue.qgroup_guarantee_enable
profile_pg_1hdrm_8shared
buf.map.pri.prigroup
udp_port
multi_hash_recurse_depth_exact_match
robust_hash_seed_exact_match
my_udp_port_int
server_udp_port_int
probe_marker1_int
probe_marker2_int
hoplimit_int
lb_port_pipe0_int
lb_port_pipe1_int
ing_origin_id_device_id_mask
egr_origin_id_device_id_mask
port_count_in_pb_stream
ifa_enable
port_gmii_mode
phy_force_firmware_load
Expand Down

0 comments on commit c89b67d

Please sign in to comment.