sonic-buildimage/platform/mellanox/mlnx-platform-api/tests/mock_platform.py
Junchao-Mellanox 80bf061b37
[Mellanox] Fix thermal control bugs (#4298)
* [thermal control] Fix pmon docker stop issue on 3800
* [thermal fix] Fix QA test issue
* [thermal fix] change psu._get_power_available_status to psu.get_power_available_status
* [thermal fix] adjust log for PSU absence and power absence
* [thermal fix] add unit test for loading thermal policy file with duplicate conditions in different policies
* [thermal] fix fan.get_presence for non-removable SKU
* [thermal fix] fix issue: fan direction is based on drawer
* Fix issue: when fan is not present, should not read fan direction from sysfs but directly return N/A
* [thermal fix] add unit test for get_direction for absent FAN
* Unplugable PSU has no FAN, no need add a FAN object for this PSU
* Update submodules

Co-authored-by: Stephen Sun <5379172+stephenxs@users.noreply.github.com>
2020-03-25 10:54:07 -07:00

49 lines
1022 B
Python

class MockFan:
def __init__(self):
self.presence = True
self.speed = 60
def get_presence(self):
return self.presence
def set_speed(self, speed):
self.speed = speed
class MockPsu:
def __init__(self):
self.presence = True
self.powergood = True
def get_presence(self):
return self.presence
def get_powergood_status(self):
return self.powergood
class MockChassis:
def __init__(self):
self.fan_list = []
self.psu_list = []
def get_all_psus(self):
return self.psu_list
def get_all_fans(self):
return self.fan_list
def get_thermal_manager(self):
from sonic_platform.thermal_manager import ThermalManager
return ThermalManager
def make_fan_absence(self):
fan = MockFan()
fan.presence = False
self.fan_list.append(fan)
def make_psu_absence(self):
psu = MockPsu()
psu.presence = False
self.psu_list.append(psu)