sonic-buildimage/device/accton/x86_64-accton_minipack-r0/plugins/psuutil.py
Roy Lee 802d5ef55a [devices] add new accton platform minipack (#2670)
[devices] add new accton platform minipack.

Add support for new platform, minipack.
It has
CPU: Broadwell DE – D1527
MAC: Tomahawk3(BCM56980).
PHY:Broadcom BCM81724, 4 pcs, Gearbox for PIM-16Q
BMC:AST2520
8 hot-swappable Port-Interface-Modules, each of them has 16*100G QSFP.

- What I did
Add device and platform files for minipack.
- How I did it
Add as SONiC Porting Guide.
- How to verify it
decode-syseeprom
sensors
psuutil
sfputil
thermal monitor
bcmsh on port status
(port LEDs may not working)
2019-03-15 09:40:38 -07:00

58 lines
1.5 KiB
Python

#!/usr/bin/env python
#############################################################################
# Accton
#
# Module contains an implementation of SONiC PSU Base API and
# provides the PSUs status which are available in the platform
#
#############################################################################
import os.path
try:
from sonic_psu.psu_base import PsuBase
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
class PsuUtil(PsuBase):
"""Platform-specific PSUutil class"""
def __init__(self):
PsuBase.__init__(self)
self.num = 4
self.psu_path = "/sys/bus/platform/devices/minipack_psensor/"
self.psu_voltage = "/in{0}_input"
def get_num_psus(self):
return self.num
def get_psu_status(self, index):
if index is None:
return False
status = 0
node = self.psu_path + self.psu_voltage.format(index*2-1)
try:
with open(node, 'r') as power_status:
status = int(power_status.read())
except IOError:
return False
return status > 0
def get_psu_presence(self, index):
if index is None:
return False
status = 0
node = self.psu_path + self.psu_voltage.format(index*2)
try:
with open(node, 'r') as presence_status:
status = int(presence_status.read())
except IOError:
return False
return status > 0