DellEMC: S5232F support for show system-health command (#8334)
Co-authored-by: Arun LK <Arun_L_K@dell.com> Why I did it Support for show system-health command in s5232f How I did it Added the configuration, API changes to support system health How to verify it Execute "show system-health summary/detail/monitor-list" CLI.
This commit is contained in:
parent
8e903f4566
commit
25416b2ce6
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"services_to_ignore": [],
|
||||||
|
"devices_to_ignore": ["fan.speed"],
|
||||||
|
"user_defined_checkers": [],
|
||||||
|
"polling_interval": 60,
|
||||||
|
"led_color": {
|
||||||
|
"fault" : "amber",
|
||||||
|
"normal" : "green",
|
||||||
|
"booting": "blinking_green"
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@ try:
|
|||||||
from sonic_platform.thermal import Thermal
|
from sonic_platform.thermal import Thermal
|
||||||
from sonic_platform.fan_drawer import FanDrawer
|
from sonic_platform.fan_drawer import FanDrawer
|
||||||
from sonic_platform.watchdog import Watchdog
|
from sonic_platform.watchdog import Watchdog
|
||||||
|
import sonic_platform.hwaccess as hwaccess
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
raise ImportError(str(e) + "- required module not found")
|
raise ImportError(str(e) + "- required module not found")
|
||||||
|
|
||||||
@ -38,6 +39,21 @@ class Chassis(ChassisBase):
|
|||||||
|
|
||||||
oir_fd = -1
|
oir_fd = -1
|
||||||
epoll = -1
|
epoll = -1
|
||||||
|
pci_res = "/sys/bus/pci/devices/0000:04:00.0/resource0"
|
||||||
|
sysled_offset = 0x0024
|
||||||
|
SYSLED_COLOR_TO_REG = {
|
||||||
|
"blinking_green": 0x0,
|
||||||
|
"green" : 0x10,
|
||||||
|
"amber" : 0x20,
|
||||||
|
"blinking_amber": 0x30
|
||||||
|
}
|
||||||
|
|
||||||
|
REG_TO_SYSLED_COLOR = {
|
||||||
|
0x0 : "blinking_green",
|
||||||
|
0x10 : "green",
|
||||||
|
0x20 : "amber",
|
||||||
|
0x30 : "blinking_amber"
|
||||||
|
}
|
||||||
|
|
||||||
_global_port_pres_dict = {}
|
_global_port_pres_dict = {}
|
||||||
|
|
||||||
@ -222,6 +238,40 @@ class Chassis(ChassisBase):
|
|||||||
"""
|
"""
|
||||||
return self._num_sfps
|
return self._num_sfps
|
||||||
|
|
||||||
|
def initizalize_system_led(self):
|
||||||
|
self.sys_ledcolor = "green"
|
||||||
|
|
||||||
|
def get_status_led(self):
|
||||||
|
"""
|
||||||
|
Gets the current system LED color
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A string that represents the supported color
|
||||||
|
"""
|
||||||
|
val = hwaccess.pci_get_value(self.pci_res, self.sysled_offset)
|
||||||
|
if val != -1:
|
||||||
|
val = val & 0x30
|
||||||
|
return self.REG_TO_SYSLED_COLOR.get(val)
|
||||||
|
return self.sys_ledcolor
|
||||||
|
|
||||||
|
def set_status_led(self, color):
|
||||||
|
"""
|
||||||
|
Set system LED status based on the color type passed in the argument.
|
||||||
|
Argument: Color to be set
|
||||||
|
Returns:
|
||||||
|
bool: True is specified color is set, Otherwise return False
|
||||||
|
"""
|
||||||
|
|
||||||
|
if color not in list(self.SYSLED_COLOR_TO_REG.keys()):
|
||||||
|
return False
|
||||||
|
|
||||||
|
val = hwaccess.pci_get_value(self.pci_res, self.sysled_offset)
|
||||||
|
val = (val & 0xFFCF) | self.SYSLED_COLOR_TO_REG[color]
|
||||||
|
|
||||||
|
hwaccess.pci_set_value(self.pci_res, val, self.sysled_offset)
|
||||||
|
self.sys_ledcolor = color
|
||||||
|
return True
|
||||||
|
|
||||||
def get_reboot_cause(self):
|
def get_reboot_cause(self):
|
||||||
"""
|
"""
|
||||||
Retrieves the cause of the previous reboot
|
Retrieves the cause of the previous reboot
|
||||||
|
@ -22,9 +22,11 @@ class Psu(PsuBase):
|
|||||||
|
|
||||||
# { PSU-ID: { Sensor-Name: Sensor-ID } }
|
# { PSU-ID: { Sensor-Name: Sensor-ID } }
|
||||||
SENSOR_MAPPING = { 1: { "State": 0x31, "Current": 0x39,
|
SENSOR_MAPPING = { 1: { "State": 0x31, "Current": 0x39,
|
||||||
"Power": 0x37, "Voltage": 0x38 },
|
"Power": 0x37, "Voltage": 0x38,
|
||||||
|
"Temperature": 0xc },
|
||||||
2: { "State": 0x32, "Current": 0x3F,
|
2: { "State": 0x32, "Current": 0x3F,
|
||||||
"Power": 0x3D, "Voltage": 0x3E } }
|
"Power": 0x3D, "Voltage": 0x3E,
|
||||||
|
"Temperature": 0xd } }
|
||||||
# ( PSU-ID: FRU-ID }
|
# ( PSU-ID: FRU-ID }
|
||||||
FRU_MAPPING = { 1: 1, 2: 2 }
|
FRU_MAPPING = { 1: 1, 2: 2 }
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ class Psu(PsuBase):
|
|||||||
self.voltage_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Voltage"])
|
self.voltage_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Voltage"])
|
||||||
self.current_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Current"])
|
self.current_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Current"])
|
||||||
self.power_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Power"])
|
self.power_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index]["Power"])
|
||||||
|
self.temp_sensor = IpmiSensor(self.SENSOR_MAPPING[self.index ]["Temperature"])
|
||||||
self.fru = IpmiFru(self.FRU_MAPPING[self.index])
|
self.fru = IpmiFru(self.FRU_MAPPING[self.index])
|
||||||
|
|
||||||
self._fan_list.append(Fan(fan_index=self.index, psu_fan=True,
|
self._fan_list.append(Fan(fan_index=self.index, psu_fan=True,
|
||||||
@ -113,6 +116,56 @@ class Psu(PsuBase):
|
|||||||
|
|
||||||
return float(voltage)
|
return float(voltage)
|
||||||
|
|
||||||
|
def get_voltage_low_threshold(self):
|
||||||
|
"""
|
||||||
|
Returns PSU low threshold in Volts
|
||||||
|
"""
|
||||||
|
|
||||||
|
is_valid, low_threshold = self.voltage_sensor.get_threshold("LowerCritical")
|
||||||
|
if not is_valid:
|
||||||
|
low_threshold = 11.6
|
||||||
|
low_threshold = "{:.2f}".format(low_threshold)
|
||||||
|
|
||||||
|
return float(low_threshold)
|
||||||
|
|
||||||
|
def get_voltage_high_threshold(self):
|
||||||
|
"""
|
||||||
|
Returns PSU high threshold in Volts
|
||||||
|
"""
|
||||||
|
|
||||||
|
is_valid, high_threshold = self.voltage_sensor.get_threshold("UpperCritical")
|
||||||
|
if not is_valid:
|
||||||
|
high_threshold = 12.8
|
||||||
|
high_threshold = "{:.2f}".format(high_threshold)
|
||||||
|
|
||||||
|
return float(high_threshold)
|
||||||
|
|
||||||
|
def get_temperature(self):
|
||||||
|
"""
|
||||||
|
Retrieves current temperature reading from thermal
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
A float number of current temperature in Celsius up to
|
||||||
|
nearest thousandth of one degree Celsius, e.g. 30.125
|
||||||
|
"""
|
||||||
|
is_valid, temperature = self.temp_sensor.get_reading()
|
||||||
|
if not is_valid:
|
||||||
|
temperature = 0
|
||||||
|
|
||||||
|
return float(temperature)
|
||||||
|
|
||||||
|
def get_temperature_high_threshold(self):
|
||||||
|
"""
|
||||||
|
Returns the high temperature threshold for PSU in Celsius
|
||||||
|
"""
|
||||||
|
|
||||||
|
is_valid, high_threshold = self.temp_sensor.get_threshold("UpperCritical")
|
||||||
|
if not is_valid:
|
||||||
|
high_threshold = 105
|
||||||
|
high_threshold = "{:.2f}".format(high_threshold)
|
||||||
|
|
||||||
|
return float(high_threshold)
|
||||||
|
|
||||||
def get_current(self):
|
def get_current(self):
|
||||||
"""
|
"""
|
||||||
Retrieves present electric current supplied by PSU
|
Retrieves present electric current supplied by PSU
|
||||||
|
Reference in New Issue
Block a user