0e0772596e
Signed-off-by: pettershao-ragilenetworks pettershao@ragilenetworks.com What I did it Add new platform x86_64-ragile_ra-b6510-32c-r0 (Trident 3) ASIC Vendor: Broadcom Switch ASIC: Trident 3 Port Config: 32x100G Add new platform x86_64-ragile_ra-b6920-4s-r0 (Tomahawk 3) ASIC Vendor: Broadcom Switch ASIC: Tomahawk 3 Port Config: 128x100G -How I did it Provide device and platform related files. -How to verify it show platform fan show platform ssdhealth show platform psustatus show platform summary show platform syseeprom show platform temperature show interface status
60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
#
|
|
# psuutil.py
|
|
# Platform-specific PSU status interface for SONiC
|
|
#
|
|
|
|
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)
|
|
|
|
def get_num_psus(self):
|
|
return 4
|
|
|
|
def get_psu_status(self, index):
|
|
if index < 1 or index > 4:
|
|
return False
|
|
|
|
path_tmp = "/sys/devices/pci0000:00/0000:00:1f.0/psu_status_"
|
|
psu_path = "%s%d"%(path_tmp, index)
|
|
|
|
try:
|
|
data = open(psu_path, "rb")
|
|
except IOError:
|
|
return False
|
|
|
|
result = int(data.read(2), 16)
|
|
data.close()
|
|
|
|
if (result & 0x2):
|
|
return True
|
|
|
|
return False
|
|
|
|
def get_psu_presence(self, index):
|
|
if index < 1 or index > 4:
|
|
return False
|
|
|
|
path_tmp = "/sys/devices/pci0000:00/0000:00:1f.0/psu_status_"
|
|
psu_path = "%s%d"%(path_tmp, index)
|
|
|
|
try:
|
|
data = open(psu_path, "rb")
|
|
except IOError:
|
|
return False
|
|
|
|
result = int(data.read(2), 16)
|
|
data.close()
|
|
|
|
if (result & 0x1) == 0:
|
|
return True
|
|
|
|
return False
|