Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions dockers/docker-platform-monitor/start.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ if [ -e /usr/share/sonic/platform/fancontrol ]; then
supervisorctl start fancontrol
fi

# If this platform has a python api wheel file, install it
if [ -e /usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl ]; then
# install sonic_platform wheel
pip install /usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl
fi

{% if not skip_ledd %}
supervisorctl start ledd
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ common/dell_i2c_utils.sh usr/local/bin
common/io_rd_wr.py usr/local/bin
common/platform_reboot usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/platform_sensors.py usr/local/bin
s6100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
s6100/scripts/sensors usr/bin
s6100/systemd/platform-modules-s6100.service etc/systemd/system
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ z9100/scripts/z9100_qsfp_monitor.py usr/local/bin
z9100/scripts/z9100_preemp_db.py usr/local/bin
z9100/scripts/qsfp_monitor usr/local/bin
z9100/scripts/sensors usr/bin
z9100/modules/sonic_platform-1.0-py2-none-any.whl usr/share/sonic/device/x86_64-dell_z9100_c2538-r0
z9100/cfg/z9100-modules.conf etc/modules-load.d
z9100/systemd/platform-modules-z9100.service etc/systemd/system
z9100/systemd/z9100-qsfp-monitor.service etc/systemd/system
12 changes: 12 additions & 0 deletions platform/broadcom/sonic-platform-modules-dell/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ override_dh_auto_build:
if [ $$mod = "s6100" ]; then \
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
cd $(MOD_SRC_DIR)/$${mod}; \
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
cd $(MOD_SRC_DIR); \
elif [ $$mod = "z9100" ]; then \
cp $(COMMON_DIR)/dell_pmc.c $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \
cp $(COMMON_DIR)/dell_ich.c $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
cd $(MOD_SRC_DIR)/$${mod}; \
python2.7 setup.py bdist_wheel -d $(MOD_SRC_DIR)/$${mod}/modules; \
cd $(MOD_SRC_DIR); \
fi; \
echo "making man page alias $$mod -> $$mod APIs";\
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules; \
Expand All @@ -40,9 +46,15 @@ override_dh_clean:
if [ $$mod = "s6100" ]; then \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_s6100_lpc.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \
elif [ $$mod = "z9100" ]; then \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_mailbox.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/dell_ich.c; \
rm -f $(MOD_SRC_DIR)/$${mod}/modules/*.whl; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build; \
rm -rf $(MOD_SRC_DIR)/$${mod}/build/*.egg-info; \
fi; \
make -C $(KERNEL_SRC)/build M=$(MOD_SRC_DIR)/$${mod}/modules clean; \
done)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ reset_muxes() {
io_rd_wr.py --set --val 0xff --offset 0x20b
}

install_python_api_package() {
device="/usr/share/sonic/device"
platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)

rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl)
echo "pip install result = $rv"
}

init_devnum

if [[ "$1" == "init" ]]; then
Expand All @@ -235,6 +243,9 @@ if [[ "$1" == "init" ]]; then
switch_board_qsfp "new_device"
switch_board_qsfp_lpmode "disable"
xcvr_presence_interrupts "enable"

install_python_api_package

elif [[ "$1" == "deinit" ]]; then
xcvr_presence_interrupts "disable"
switch_board_sfp "delete_device"
Expand Down
30 changes: 30 additions & 0 deletions platform/broadcom/sonic-platform-modules-dell/s6100/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from setuptools import setup

setup(
name='sonic-platform',
version='1.0',
description='SONiC platform API implementation on DellEmc Platforms',
license='Apache 2.0',
author='SONiC Team',
author_email='[email protected]',
url='https://github.com/Azure/sonic-buildimage',
maintainer='DellEMC',
maintainer_email='[email protected]',
packages=[
'sonic_platform',
],
classifiers=[
'Development Status :: 3 - Alpha',
'Environment :: Plugins',
'Intended Audience :: Developers',
'Intended Audience :: Information Technology',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 2.7',
'Topic :: Utilities',
],
keywords='sonic SONiC platform PLATFORM',
)

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/usr/bin/env python

#############################################################################
# DELLEMC
#
# Module contains an implementation of SONiC Platform Base API and
# provides the platform information
#
#############################################################################

try:
import os
from sonic_platform_base.chassis_base import ChassisBase
except ImportError as e:
raise ImportError(str(e) + "- required module not found")


class Chassis(ChassisBase):
"""
DELLEMC Platform-specific Chassis class
"""

HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/"
HWMON_NODE = os.listdir(HWMON_DIR)[0]
MAILBOX_DIR = HWMON_DIR + HWMON_NODE

reset_reason_dict = {}
reset_reason_dict[11] = [(ChassisBase.REBOOT_CAUSE_POWER_LOSS)]
reset_reason_dict[33] = [(ChassisBase.REBOOT_CAUSE_WATCHDOG)]
reset_reason_dict[44] = [(ChassisBase.REBOOT_CAUSE_NON_HARDWARE)]
reset_reason_dict[55] = [(ChassisBase.REBOOT_CAUSE_NON_HARDWARE)]

power_reason_dict = {}
power_reason_dict[11] = [(ChassisBase.REBOOT_CAUSE_POWER_LOSS)]
power_reason_dict[22] = [(ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU)]
power_reason_dict[33] = [(ChassisBase.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC)]
power_reason_dict[44] = [(ChassisBase.REBOOT_CAUSE_INSUFFICIENT_FAN)]

def __init__(self):
ChassisBase.__init__(self)

def get_pmc_register(self, reg_name):
rv = 'ERR'
mb_reg_file = self.MAILBOX_DIR+'/'+reg_name

if (not os.path.isfile(mb_reg_file)):
print mb_reg_file, 'not found !'
return rv

try:
with open(mb_reg_file, 'r') as fd:
rv = fd.read()
except Exception as error:
logging.error("Unable to open ", mb_reg_file, "file !")

rv = rv.rstrip('\r\n')
rv = rv.lstrip(" ")
return rv

def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
"""
reset_reason = int(self.get_pmc_register('smf_reset_reason'))
power_reason = int(self.get_pmc_register('smf_poweron_reason'))

# Reset_Reason = 11 ==> PowerLoss
# So return the reboot reason from Last Power_Reason Dictionary
# If Reset_Reason is not 11 return from Reset_Reason dictionary
# Also check if power_reason, reset_reason are valid values by
# checking key presence in dictionary else return empty tuple
if (reset_reason == 11):
if (power_reason in self.power_reason_dict):
return self.power_reason_dict[power_reason]
else:
if (reset_reason in self.reset_reason_dict):
return self.reset_reason_dict[reset_reason]
return ((),)

Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ init_switch_port_led() {

}

install_python_api_package() {
device="/usr/share/sonic/device"
platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)

rv=$(pip install $device/$platform/sonic_platform-1.0-py2-none-any.whl)
echo "pip install result = $rv"
}

init_devnum

if [[ "$1" == "init" ]]; then
Expand All @@ -220,6 +228,7 @@ if [[ "$1" == "init" ]]; then

#Copy led_proc_init.soc
init_switch_port_led
install_python_api_package

value=0x0
echo $value > /sys/class/i2c-adapter/i2c-14/14-003e/qsfp_lpmode
Expand Down