diff --git a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json index 25237ab0522d..041f9bceb5c1 100644 --- a/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json +++ b/device/barefoot/x86_64-accton_as9516_32d-r0/platform.json @@ -3,46 +3,120 @@ "name": "Newport", "fans": [ { - "name": "counter-rotating-fan-1" - }, - { - "name": "counter-rotating-fan-2" - }, - { - "name": "counter-rotating-fan-3" - }, - { - "name": "counter-rotating-fan-4" - }, - { - "name": "counter-rotating-fan-5" - }, - { - "name": "counter-rotating-fan-6" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ], "fan_drawers":[ { - "name": "fantray", - "num_fans" : 6, + "name": "fantray-1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "counter-rotating-fan-1" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-2" + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-3" + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-4" + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-6" + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] } diff --git a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json index b8bbfd703566..964e389d9ace 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_32x-r0/platform.json @@ -3,40 +3,102 @@ "name": "Wedge100BF-32X-O-AC-F-BF", "fans": [ { - "name": "counter-rotating-fan-1" - }, - { - "name": "counter-rotating-fan-2" - }, - { - "name": "counter-rotating-fan-3" - }, - { - "name": "counter-rotating-fan-4" - }, - { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ], "fan_drawers":[ { - "name": "fantray", - "num_fans" : 5, + "name": "fantray-1", + "status_led": { + "controllable": false + }, "fans": [ { - "name": "counter-rotating-fan-1" + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-2" + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-3" + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-4" + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "counter-rotating-fan-5" + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] } diff --git a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json index a2394135c0fc..7f05f2402e42 100644 --- a/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json +++ b/device/barefoot/x86_64-accton_wedge100bf_65x-r0/platform.json @@ -1,4 +1,207 @@ { + "chassis": { + "name": "Mavericks", + "fans": [ + { + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-7", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-8", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-9", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-10", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + ], + "fan_drawers":[ + { + "name": "fantray-1", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "counter-rotating-fan-1", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-2", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-3", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-4", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-5", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + ] + }, + { + "name": "fantray-2", + "status_led": { + "controllable": false + }, + "fans": [ + { + "name": "counter-rotating-fan-6", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-7", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-8", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-9", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + }, + { + "name": "counter-rotating-fan-10", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } + } + ] + } + ] + }, "interfaces": { "Ethernet0": { "index": "1,1,1,1", diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py index 2402988f55ad..c6614d318fec 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan.py @@ -1,6 +1,7 @@ try: from sonic_platform.platform_thrift_client import thrift_try from sonic_platform_base.fan_base import FanBase + from sonic_py_common import device_info except ImportError as e: raise ImportError (str(e) + "- required module not found") @@ -16,35 +17,35 @@ def get_data(client): # Fan -> FanBase -> DeviceBase class Fan(FanBase): - def __init__(self, num): - self.__num = num + def __init__(self, index, fantrayindex): + self.__index = index + self.__fantrayindex = fantrayindex # FanBase interface methods: # returns speed in percents def get_speed(self): def cb(info): return info.percent - return _fan_info_get(self.__num, cb, 0) + return _fan_info_get(self.__index, cb, 0) def set_speed(self, percent): - def set_fan_speed(client): - return client.pltfm_mgr.pltfm_mgr_fan_speed_set(self.__num, percent) - return thrift_try(set_fan_speed) + # Fan tray speed controlled by BMC + return False # DeviceBase interface methods: def get_name(self): - return f"counter-rotating-fan-{self.__num}" + return "counter-rotating-fan-{}".format((self.__fantrayindex - 1) * self.__index + self.__index) def get_presence(self): - return _fan_info_get(self.__num, lambda _: True, False) + return _fan_info_get(self.__index, lambda _: True, False) def get_position_in_parent(self): - return self.__num + return self.__index def is_replaceable(self): - return True + return False def get_status(self): - return True + return (self.get_presence() and self.get_presence() > 0) def get_model(self): """ @@ -57,7 +58,6 @@ def get_model(self): def get_direction(self): """ Retrieves the direction of fan - Returns: A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST depending on fan direction @@ -76,17 +76,17 @@ def get_target_speed(self): def get_speed_tolerance(self): """ Retrieves the speed tolerance of the fan - Returns: An integer, the percentage of variance from target speed which is considered tolerable """ - return 0 + if device_info.get_platform() in ["x86_64-accton_as9516_32d-r0", "x86_64-accton_as9516bf_32d-r0"]: + return 6 + return 3 def get_serial(self): """ Retrieves the serial number of the device - Returns: string: Serial number of device """ @@ -95,14 +95,11 @@ def get_serial(self): def set_status_led(self, color): """ Sets the state of the fan module status LED - Args: color: A string representing the color with which to set the fan module status LED - Returns: bool: True if status LED state is set successfully, False if not """ # Fan tray status LED controlled by BMC - # Should return True to avoid thermalctld alarm return False diff --git a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py index fef7bbd11033..b8b0f81dfe0e 100644 --- a/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py +++ b/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/fan_drawer.py @@ -2,30 +2,21 @@ from sonic_platform.platform_thrift_client import thrift_try from sonic_platform_base.fan_drawer_base import FanDrawerBase from sonic_platform_base.fan_base import FanBase + from sonic_py_common import device_info from fan import Fan except ImportError as e: raise ImportError (str(e) + "- required module not found") -_MAX_FAN = 10 - -def _fan_info_get_all(): - for fan_num in range(1, _MAX_FAN + 1): - def get_data(client, fan_num=fan_num): - return client.pltfm_mgr.pltfm_mgr_fan_info_get(fan_num) - fan_info = thrift_try(get_data) - if fan_info.fan_num == fan_num: - yield fan_info - # FanDrawer -> FanDrawerBase -> DeviceBase class FanDrawer(FanDrawerBase): - def __init__(self, fantray_index): + def __init__(self, fantray_index, max_fan): # For now we return only present fans - self._fan_list = [Fan(i.fan_num) for i in _fan_info_get_all()] - self.fantrayindex = fantray_index + 1 + self.fantrayindex = fantray_index + self._fan_list = [Fan(i, self.fantrayindex) for i in range(1, max_fan + 1)] # DeviceBase interface methods: def get_name(self): - return 'fantray' + return f"fantray-{self.fantrayindex}" def get_presence(self): return True @@ -48,7 +39,7 @@ def is_replaceable(self): Returns: bool: True if it is replaceable, False if not """ - return True + return False def get_model(self): """ @@ -76,7 +67,6 @@ def set_status_led(self, color): bool: True if set success, False if fail. """ # Fan tray status LED controlled by BMC - # Should return True to avoid thermalctld alarm return False def get_status_led(self): @@ -97,4 +87,18 @@ def get_maximum_consumed_power(self): return 36.0 def fan_drawer_list_get(): - return [FanDrawer(0)] + max_fan = 5 + max_fantray = 1 + + platform = device_info.get_platform() + if platform in ["x86_64-accton_as9516_32d-r0", "x86_64-accton_as9516bf_32d-r0"]: + max_fantray = 1 + max_fan = 6 + elif platform == "x86_64-accton_wedge100bf_65x-r0": + max_fantray = 2 + max_fan = 5 + else: + max_fan = 5 + max_fantray = 1 + + return [FanDrawer(i, max_fan) for i in range(1, max_fantray + 1)]