[DellEMC]: FanDrawer and get_high_critical_threshold Platform API implementation for S6000, S6100, Z9100 and Z9264F (#5673)
- Implement FanDrawer and get_high_critical_threshold Platform API for S6000, S6100, Z9100 and Z9264F. - Fix incorrect fan direction values in S6100, Z9100
This commit is contained in:
parent
e111204206
commit
6145e4f6f1
@ -718,18 +718,13 @@ static ssize_t show_fan_airflow(struct device *dev,
|
||||
{
|
||||
int index = to_sensor_dev_attr(devattr)->index;
|
||||
struct smf_data *data = dev_get_drvdata(dev);
|
||||
int ret=1, fan_airflow;
|
||||
int ret, fan_airflow;
|
||||
|
||||
if (data->kind == s6100smf && index == FAN_TRAY_5)
|
||||
return 0;
|
||||
|
||||
fan_airflow = smf_read_reg(data, FAN_TRAY_AIRFLOW);
|
||||
|
||||
if (fan_airflow & (1 << (index)))
|
||||
ret=1;
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = (fan_airflow >> index) & 1;
|
||||
|
||||
return sprintf(buf, "%d\n", ret);
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
__all__ = ["platform", "chassis", "sfp", "psu", "thermal"]
|
||||
__all__ = ["platform", "chassis", "fan", "fan_drawer", "sfp", "psu", "thermal"]
|
||||
from sonic_platform import *
|
||||
|
@ -14,7 +14,7 @@ try:
|
||||
from sonic_platform_base.chassis_base import ChassisBase
|
||||
from sonic_platform.sfp import Sfp
|
||||
from sonic_platform.eeprom import Eeprom, EepromS6000
|
||||
from sonic_platform.fan import Fan
|
||||
from sonic_platform.fan_drawer import FanDrawer
|
||||
from sonic_platform.psu import Psu
|
||||
from sonic_platform.thermal import Thermal
|
||||
from sonic_platform.component import Component
|
||||
@ -22,7 +22,7 @@ except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
MAX_S6000_FAN = 3
|
||||
MAX_S6000_FANTRAY = 3
|
||||
MAX_S6000_PSU = 2
|
||||
MAX_S6000_THERMAL = 10
|
||||
MAX_S6000_COMPONENT = 4
|
||||
@ -74,9 +74,10 @@ class Chassis(ChassisBase):
|
||||
else:
|
||||
self._eeprom = EepromS6000()
|
||||
|
||||
for i in range(MAX_S6000_FAN):
|
||||
fan = Fan(i)
|
||||
self._fan_list.append(fan)
|
||||
for i in range(MAX_S6000_FANTRAY):
|
||||
fandrawer = FanDrawer(i)
|
||||
self._fan_drawer_list.append(fandrawer)
|
||||
self._fan_list.extend(fandrawer._fan_list)
|
||||
|
||||
for i in range(MAX_S6000_PSU):
|
||||
psu = Psu(i)
|
||||
|
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC S6000
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Fan-Drawers' information available in the platform.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
try:
|
||||
from sonic_platform_base.fan_drawer_base import FanDrawerBase
|
||||
from sonic_platform.fan import Fan
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class FanDrawer(FanDrawerBase):
|
||||
"""DellEMC Platform-specific Fan class"""
|
||||
|
||||
def __init__(self, fantray_index):
|
||||
|
||||
FanDrawerBase.__init__(self)
|
||||
# FanTray is 1-based in DellEMC platforms
|
||||
self.fantrayindex = fantray_index + 1
|
||||
self._fan_list.append(Fan(fantray_index))
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the fan drawer name
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "FanTray{}".format(self.fantrayindex)
|
@ -1,3 +1,3 @@
|
||||
__all__ = ["platform", "chassis", "module", "fan", "psu", "sfp", "thermal"]
|
||||
__all__ = ["platform", "chassis", "module", "fan", "fan_drawer", "psu", "sfp", "thermal"]
|
||||
from sonic_platform import *
|
||||
|
||||
|
@ -13,7 +13,7 @@ try:
|
||||
from sonic_platform_base.chassis_base import ChassisBase
|
||||
from sonic_platform.sfp import Sfp
|
||||
from sonic_platform.psu import Psu
|
||||
from sonic_platform.fan import Fan
|
||||
from sonic_platform.fan_drawer import FanDrawer
|
||||
from sonic_platform.module import Module
|
||||
from sonic_platform.thermal import Thermal
|
||||
from sonic_platform.component import Component
|
||||
@ -24,7 +24,7 @@ except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
MAX_S6100_MODULE = 4
|
||||
MAX_S6100_FAN = 4
|
||||
MAX_S6100_FANTRAY = 4
|
||||
MAX_S6100_PSU = 2
|
||||
MAX_S6100_THERMAL = 10
|
||||
MAX_S6100_COMPONENT = 3
|
||||
@ -64,9 +64,10 @@ class Chassis(ChassisBase):
|
||||
self._module_list.append(module)
|
||||
self._sfp_list.extend(module._sfp_list)
|
||||
|
||||
for i in range(MAX_S6100_FAN):
|
||||
fan = Fan(i)
|
||||
self._fan_list.append(fan)
|
||||
for i in range(MAX_S6100_FANTRAY):
|
||||
fandrawer = FanDrawer(i)
|
||||
self._fan_drawer_list.append(fandrawer)
|
||||
self._fan_list.extend(fandrawer._fan_list)
|
||||
|
||||
for i in range(MAX_S6100_PSU):
|
||||
psu = Psu(i)
|
||||
|
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC S6100
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Fan-Drawers' information available in the platform.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
try:
|
||||
from sonic_platform_base.fan_drawer_base import FanDrawerBase
|
||||
from sonic_platform.fan import Fan
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class FanDrawer(FanDrawerBase):
|
||||
"""DellEMC Platform-specific Fan class"""
|
||||
|
||||
def __init__(self, fantray_index):
|
||||
|
||||
FanDrawerBase.__init__(self)
|
||||
# FanTray is 1-based in DellEMC platforms
|
||||
self.fantrayindex = fantray_index + 1
|
||||
self._fan_list.append(Fan(fantray_index))
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the fan drawer name
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "FanTray{}".format(self.fantrayindex)
|
@ -49,10 +49,14 @@ class Thermal(ThermalBase):
|
||||
self.thermal_temperature_file = self.HWMON_DIR \
|
||||
+ "temp{}_input".format(hwmon_temp_index)
|
||||
self.thermal_high_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_crit".format(hwmon_temp_index)
|
||||
+ "temp{}_max".format(hwmon_temp_index)
|
||||
self.thermal_low_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_min".format(hwmon_temp_index)
|
||||
|
||||
if not self.is_cpu_thermal:
|
||||
self.thermal_high_crit_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_crit".format(hwmon_temp_index)
|
||||
|
||||
def _read_sysfs_file(self, sysfs_file):
|
||||
# On successful read, returns the value read from given
|
||||
# sysfs_file and on failure returns 'ERR'
|
||||
@ -180,6 +184,27 @@ class Thermal(ThermalBase):
|
||||
|
||||
return thermal_low_threshold / 1000.0
|
||||
|
||||
def get_high_critical_threshold(self):
|
||||
"""
|
||||
Retrieves the high critical threshold temperature of thermal
|
||||
|
||||
Returns:
|
||||
A float number, the high critical threshold temperature of
|
||||
thermal in Celsius up to nearest thousandth of one degree
|
||||
Celsius, e.g. 30.125
|
||||
"""
|
||||
if self.is_cpu_thermal:
|
||||
return super(Thermal, self).get_high_critical_threshold()
|
||||
|
||||
thermal_high_crit_threshold = self._read_sysfs_file(
|
||||
self.thermal_high_crit_threshold_file)
|
||||
if (thermal_high_crit_threshold != 'ERR'):
|
||||
thermal_high_crit_threshold = float(thermal_high_crit_threshold)
|
||||
else:
|
||||
thermal_high_crit_threshold = 0
|
||||
|
||||
return thermal_high_crit_threshold / 1000.0
|
||||
|
||||
def set_high_threshold(self, temperature):
|
||||
"""
|
||||
Sets the high threshold temperature of thermal
|
||||
|
@ -1,3 +1,3 @@
|
||||
__all__ = ["platform", "chassis", "fan", "psu", "sfp", "thermal"]
|
||||
__all__ = ["platform", "chassis", "fan", "fan_drawer", "psu", "sfp", "thermal"]
|
||||
from sonic_platform import *
|
||||
|
||||
|
@ -14,7 +14,7 @@ try:
|
||||
import sys
|
||||
from sonic_platform_base.chassis_base import ChassisBase
|
||||
from sonic_platform.sfp import Sfp
|
||||
from sonic_platform.fan import Fan
|
||||
from sonic_platform.fan_drawer import FanDrawer
|
||||
from sonic_platform.psu import Psu
|
||||
from sonic_platform.thermal import Thermal
|
||||
from sonic_platform.component import Component
|
||||
@ -24,7 +24,6 @@ except ImportError as e:
|
||||
|
||||
|
||||
MAX_Z9100_FANTRAY = 5
|
||||
MAX_Z9100_FAN = 2
|
||||
MAX_Z9100_PSU = 2
|
||||
MAX_Z9100_THERMAL = 8
|
||||
MAX_Z9100_COMPONENT = 6
|
||||
@ -100,9 +99,9 @@ class Chassis(ChassisBase):
|
||||
# Initialize EEPROM
|
||||
self._eeprom = Eeprom()
|
||||
for i in range(MAX_Z9100_FANTRAY):
|
||||
for j in range(MAX_Z9100_FAN):
|
||||
fan = Fan(i, j)
|
||||
self._fan_list.append(fan)
|
||||
fandrawer = FanDrawer(i)
|
||||
self._fan_drawer_list.append(fandrawer)
|
||||
self._fan_list.extend(fandrawer._fan_list)
|
||||
|
||||
for i in range(MAX_Z9100_PSU):
|
||||
psu = Psu(i)
|
||||
|
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC Z9100
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Fan-Drawers' information available in the platform.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
try:
|
||||
from sonic_platform_base.fan_drawer_base import FanDrawerBase
|
||||
from sonic_platform.fan import Fan
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
Z9100_FANS_PER_FANTRAY = 2
|
||||
|
||||
|
||||
class FanDrawer(FanDrawerBase):
|
||||
"""DellEMC Platform-specific Fan class"""
|
||||
|
||||
def __init__(self, fantray_index):
|
||||
|
||||
FanDrawerBase.__init__(self)
|
||||
# FanTray is 1-based in DellEMC platforms
|
||||
self.fantrayindex = fantray_index + 1
|
||||
for i in range(Z9100_FANS_PER_FANTRAY):
|
||||
self._fan_list.append(Fan(fantray_index, i))
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the fan drawer name
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "FanTray{}".format(self.fantrayindex)
|
@ -45,10 +45,14 @@ class Thermal(ThermalBase):
|
||||
self.thermal_temperature_file = self.HWMON_DIR \
|
||||
+ "temp{}_input".format(hwmon_temp_index)
|
||||
self.thermal_high_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_crit".format(hwmon_temp_index)
|
||||
+ "temp{}_max".format(hwmon_temp_index)
|
||||
self.thermal_low_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_min".format(hwmon_temp_index)
|
||||
|
||||
if not self.is_cpu_thermal:
|
||||
self.thermal_high_crit_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_crit".format(hwmon_temp_index)
|
||||
|
||||
def _read_sysfs_file(self, sysfs_file):
|
||||
# On successful read, returns the value read from given
|
||||
# sysfs_file and on failure returns 'ERR'
|
||||
@ -176,6 +180,27 @@ class Thermal(ThermalBase):
|
||||
|
||||
return thermal_low_threshold / 1000.0
|
||||
|
||||
def get_high_critical_threshold(self):
|
||||
"""
|
||||
Retrieves the high critical threshold temperature of thermal
|
||||
|
||||
Returns:
|
||||
A float number, the high critical threshold temperature of
|
||||
thermal in Celsius up to nearest thousandth of one degree
|
||||
Celsius, e.g. 30.125
|
||||
"""
|
||||
if self.is_cpu_thermal:
|
||||
return super(Thermal, self).get_high_critical_threshold()
|
||||
|
||||
thermal_high_crit_threshold = self._read_sysfs_file(
|
||||
self.thermal_high_crit_threshold_file)
|
||||
if (thermal_high_crit_threshold != 'ERR'):
|
||||
thermal_high_crit_threshold = float(thermal_high_crit_threshold)
|
||||
else:
|
||||
thermal_high_crit_threshold = 0
|
||||
|
||||
return thermal_high_crit_threshold / 1000.0
|
||||
|
||||
def set_high_threshold(self, temperature):
|
||||
"""
|
||||
Sets the high threshold temperature of thermal
|
||||
|
@ -1,2 +1,2 @@
|
||||
__all__ = ["platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan"]
|
||||
from sonic_platform import *
|
||||
__all__ = ["platform", "chassis", "sfp", "eeprom", "component", "psu", "thermal", "fan", "fan_drawer"]
|
||||
from sonic_platform import *
|
||||
|
@ -18,13 +18,12 @@ try:
|
||||
from sonic_platform.component import Component
|
||||
from sonic_platform.psu import Psu
|
||||
from sonic_platform.watchdog import Watchdog
|
||||
from sonic_platform.fan import Fan
|
||||
from sonic_platform.fan_drawer import FanDrawer
|
||||
from sonic_platform.thermal import Thermal
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
MAX_Z9264F_FANTRAY =4
|
||||
MAX_Z9264F_FAN = 2
|
||||
MAX_Z9264F_COMPONENT = 8 # BIOS,BMC,FPGA,SYSTEM CPLD,4 SLAVE CPLDs
|
||||
MAX_Z9264F_PSU = 2
|
||||
MAX_Z9264F_THERMAL = 8
|
||||
@ -65,24 +64,24 @@ class Chassis(ChassisBase):
|
||||
self._eeprom = Eeprom()
|
||||
|
||||
self._watchdog = Watchdog()
|
||||
|
||||
|
||||
for i in range(MAX_Z9264F_COMPONENT):
|
||||
component = Component(i)
|
||||
self._component_list.append(component)
|
||||
|
||||
|
||||
for i in range(MAX_Z9264F_PSU):
|
||||
psu = Psu(i)
|
||||
self._psu_list.append(psu)
|
||||
|
||||
for i in range(MAX_Z9264F_FANTRAY):
|
||||
for j in range(MAX_Z9264F_FAN):
|
||||
fan = Fan(i,j)
|
||||
self._fan_list.append(fan)
|
||||
fandrawer = FanDrawer(i)
|
||||
self._fan_drawer_list.append(fandrawer)
|
||||
self._fan_list.extend(fandrawer._fan_list)
|
||||
|
||||
for i in range(MAX_Z9264F_THERMAL):
|
||||
thermal = Thermal(i)
|
||||
self._thermal_list.append(thermal)
|
||||
|
||||
|
||||
for port_num in range(self.PORT_START, (self.PORT_END + 1)):
|
||||
presence = self.get_sfp(port_num).get_presence()
|
||||
if presence:
|
||||
|
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC Z9264F
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Fan-Drawers' information available in the platform.
|
||||
#
|
||||
########################################################################
|
||||
|
||||
try:
|
||||
from sonic_platform_base.fan_drawer_base import FanDrawerBase
|
||||
from sonic_platform.fan import Fan
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
Z9264F_FANS_PER_FANTRAY = 2
|
||||
|
||||
|
||||
class FanDrawer(FanDrawerBase):
|
||||
"""DellEMC Platform-specific Fan class"""
|
||||
|
||||
def __init__(self, fantray_index):
|
||||
|
||||
FanDrawerBase.__init__(self)
|
||||
# FanTray is 1-based in DellEMC platforms
|
||||
self.fantrayindex = fantray_index + 1
|
||||
for i in range(Z9264F_FANS_PER_FANTRAY):
|
||||
self._fan_list.append(Fan(fantray_index, i))
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the fan drawer name
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "FanTray{}".format(self.fantrayindex)
|
@ -105,7 +105,7 @@ class Thermal(ThermalBase):
|
||||
Celsius up to nearest thousandth of one degree Celsius,
|
||||
e.g. 30.125
|
||||
"""
|
||||
is_valid, high_threshold = self.sensor.get_threshold("UpperNonRecoverable")
|
||||
is_valid, high_threshold = self.sensor.get_threshold("UpperCritical")
|
||||
if not is_valid:
|
||||
high_threshold = 0
|
||||
|
||||
@ -126,6 +126,21 @@ class Thermal(ThermalBase):
|
||||
|
||||
return float(low_threshold)
|
||||
|
||||
def get_high_critical_threshold(self):
|
||||
"""
|
||||
Retrieves the high critical threshold temperature of thermal
|
||||
|
||||
Returns:
|
||||
A float number, the high critical threshold temperature of
|
||||
thermal in Celsius up to nearest thousandth of one degree
|
||||
Celsius, e.g. 30.125
|
||||
"""
|
||||
is_valid, high_crit_threshold = self.sensor.get_threshold("UpperNonRecoverable")
|
||||
if not is_valid:
|
||||
high_crit_threshold = 0
|
||||
|
||||
return float(high_crit_threshold)
|
||||
|
||||
def set_high_threshold(self, temperature):
|
||||
"""
|
||||
Sets the high threshold temperature of thermal
|
||||
|
Loading…
Reference in New Issue
Block a user