Skip to content

Commit

Permalink
[Nokia ixs7215] Miscellaneous platform API fixes (sonic-net#8707)
Browse files Browse the repository at this point in the history
* [Nokia ixs7215] Miscellaneous platform API fixes

This commit delivers the following fixes for the Nokia ixs7215 platform

- Fix bug in a fan API error path
- Add support for setting the fan drawer led
- Add support for getting/setting the front panel PSU status led
- Add support for getting the min/max observed temperature value

* [Nokia ixs7215] code review changes: temperature min/max values
  • Loading branch information
dflynn-Nokia authored Sep 11, 2021
1 parent 1652613 commit b19d42e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ def get_status_led(self):
"""

if self.is_psu_fan:
return False
return None

if smbus_present == 0:
return False
return None
else:
bus = smbus.SMBus(0)
DEVICE_ADDRESS = 0x41
Expand Down Expand Up @@ -368,7 +368,7 @@ def get_target_speed(self):
(off) to 100 (full speed)
"""
speed = 0

fan_duty = self._get_i2c_register(self.set_fan_speed_reg)
if (fan_duty != 'ERR'):
dutyspeed = int(fan_duty)
Expand All @@ -380,9 +380,5 @@ def get_target_speed(self):
speed = 50
elif dutyspeed == 255:
speed = 100

return speed




return speed
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_direction(self):
return 'intake'

def set_status_led(self, color):
return True
return self._fan_list[0].set_status_led(color)

def get_status_led(self, color):
return self._fan_list[0].get_status_led()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,3 +234,23 @@ def set_status_led(self, color):
# The firmware running in the PSU controls the LED
# and the PSU LED state cannot be changed from CPU.
return False

def get_status_master_led(self):
"""
Gets the state of the front panel PSU status LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings.
"""
return self._psu_master_led_color

def set_status_master_led(self, color):
"""
Sets the state of the front panel PSU status LED
Returns:
bool: True if status LED state is set successfully, False if
not
"""
self._psu_master_led_color = color
return True
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ class Thermal(ThermalBase):
"CPU Core")

def __init__(self, thermal_index):
ThermalBase.__init__(self)
self.index = thermal_index + 1
self.is_psu_thermal = False
self.dependency = None
self._minimum = None
self._maximum = None
self.thermal_high_threshold_file = None
# PCB temperature sensors
if self.index < 3:
Expand Down Expand Up @@ -163,6 +166,10 @@ def get_temperature(self):
self.thermal_temperature_file)
if (thermal_temperature != 'ERR'):
thermal_temperature = float(thermal_temperature) / 1000
if self._minimum is None or self._minimum > thermal_temperature:
self._minimum = thermal_temperature
if self._maximum is None or self._maximum < thermal_temperature:
self._maximum = thermal_temperature
else:
thermal_temperature = 0

Expand Down Expand Up @@ -226,6 +233,14 @@ def get_high_critical_threshold(self):

return float("{:.3f}".format(thermal_high_crit_threshold))

def get_minimum_recorded(self):
self.get_temperature()
return self._minimum

def get_maximum_recorded(self):
self.get_temperature()
return self._maximum

def get_position_in_parent(self):
"""
Retrieves 1-based relative physical position in parent device
Expand Down

0 comments on commit b19d42e

Please sign in to comment.