-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DellEMC: Z9264-Platform2.0 Implementation [Thermal] (#4175)
- Loading branch information
1 parent
ab78ee0
commit 30ef111
Showing
2 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
155 changes: 155 additions & 0 deletions
155
platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/thermal.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
#!/usr/bin/env python | ||
|
||
######################################################################## | ||
# DellEMC Z9264 | ||
# | ||
# Module contains an implementation of SONiC Platform Base API and | ||
# provides the Thermals' information which are available in the platform | ||
# | ||
######################################################################## | ||
|
||
|
||
try: | ||
from sonic_platform_base.thermal_base import ThermalBase | ||
from sonic_platform.ipmihelper import IpmiSensor, IpmiFru | ||
except ImportError as e: | ||
raise ImportError(str(e) + "- required module not found") | ||
|
||
|
||
class Thermal(ThermalBase): | ||
"""DellEMC Platform-specific Thermal class""" | ||
|
||
# [ Sensor-Name, Sensor-ID ] | ||
SENSOR_MAPPING = [ | ||
['CPU On-board', 0x6], | ||
['ASIC On-board', 0x8], | ||
['System Front Left', 0x3], | ||
['System Front Middle', 0x7], | ||
['System Front Right', 0x4], | ||
['Inlet Airflow Sensor', 0x5], | ||
['PSU1 Airflow Sensor', 0x2], | ||
['PSU2 Airflow Sensor', 0x1] | ||
] | ||
|
||
def __init__(self, thermal_index): | ||
ThermalBase.__init__(self) | ||
self.index = thermal_index + 1 | ||
self.sensor = IpmiSensor(self.SENSOR_MAPPING[self.index - 1][1]) | ||
|
||
def get_name(self): | ||
""" | ||
Retrieves the name of the thermal | ||
Returns: | ||
string: The name of the thermal | ||
""" | ||
return self.SENSOR_MAPPING[self.index - 1][0] | ||
|
||
def get_presence(self): | ||
""" | ||
Retrieves the presence of the thermal | ||
Returns: | ||
bool: True if thermal is present, False if not | ||
""" | ||
return True | ||
|
||
def get_model(self): | ||
""" | ||
Retrieves the model number (or part number) of the Thermal | ||
Returns: | ||
string: Model/part number of Thermal | ||
""" | ||
return 'NA' | ||
|
||
def get_serial(self): | ||
""" | ||
Retrieves the serial number of the Thermal | ||
Returns: | ||
string: Serial number of Thermal | ||
""" | ||
return 'NA' | ||
|
||
def get_status(self): | ||
""" | ||
Retrieves the operational status of the thermal | ||
Returns: | ||
A boolean value, True if thermal is operating properly, | ||
False if not | ||
""" | ||
return True | ||
|
||
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.sensor.get_reading() | ||
if not is_valid: | ||
temperature = 0 | ||
|
||
return "{:.3f}".format(temperature) | ||
|
||
def get_high_threshold(self): | ||
""" | ||
Retrieves the high threshold temperature of thermal | ||
Returns: | ||
A float number, the high threshold temperature of thermal in | ||
Celsius up to nearest thousandth of one degree Celsius, | ||
e.g. 30.125 | ||
""" | ||
is_valid, high_threshold = self.sensor.get_threshold("UpperNonRecoverable") | ||
if not is_valid: | ||
high_threshold = 0 | ||
|
||
return "{:.3f}".format(high_threshold) | ||
|
||
def get_low_threshold(self): | ||
""" | ||
Retrieves the low threshold temperature of thermal | ||
Returns: | ||
A float number, the low threshold temperature of thermal in | ||
Celsius up to nearest thousandth of one degree Celsius, | ||
e.g. 30.125 | ||
""" | ||
is_valid, low_threshold = self.sensor.get_threshold("LowerNonRecoverable") | ||
if not is_valid: | ||
low_threshold = 0 | ||
|
||
return "{:.3f}".format(low_threshold) | ||
|
||
def set_high_threshold(self, temperature): | ||
""" | ||
Sets the high threshold temperature of thermal | ||
Args : | ||
temperature: A float number up to nearest thousandth of one | ||
degree Celsius, e.g. 30.125 | ||
Returns: | ||
A boolean, True if threshold is set successfully, False if | ||
not | ||
""" | ||
# Thermal threshold values are pre-defined based on HW. | ||
return False | ||
|
||
def set_low_threshold(self, temperature): | ||
""" | ||
Sets the low threshold temperature of thermal | ||
Args : | ||
temperature: A float number up to nearest thousandth of one | ||
degree Celsius, e.g. 30.125 | ||
Returns: | ||
A boolean, True if threshold is set successfully, False if | ||
not | ||
""" | ||
# Thermal threshold values are pre-defined based on HW. | ||
return False |