# ############################################################################# try: from sonic_platform_base.thermal_base import ThermalBase from sonic_daemon_base.daemon_base import Logger from os import listdir from os.path import isfile, join import io import os.path except ImportError as e: raise ImportError(str(e) + "- required module not found") # Global logger class instance SYSLOG_IDENTIFIER = "mlnx-thermal-api" logger = Logger(SYSLOG_IDENTIFIER) THERMAL_DEV_CATEGORY_CPU_CORE = "cpu_core" THERMAL_DEV_CATEGORY_CPU_PACK = "cpu_pack" THERMAL_DEV_CATEGORY_MODULE = "module" THERMAL_DEV_CATEGORY_PSU = "psu" THERMAL_DEV_CATEGORY_GEARBOX = "gearbox" THERMAL_DEV_CATEGORY_AMBIENT = "ambient" THERMAL_DEV_ASIC_AMBIENT = "asic_amb" THERMAL_DEV_FAN_AMBIENT = "fan_amb" THERMAL_DEV_PORT_AMBIENT = "port_amb" THERMAL_DEV_COMEX_AMBIENT = "comex_amb" THERMAL_DEV_BOARD_AMBIENT = "board_amb" THERMAL_API_GET_TEMPERATURE = "get_temperature"
EEPROM_CACHE_ROOT = '/var/cache/sonic/decode-syseeprom' EEPROM_CACHE_FILE = 'syseeprom_cache' HWMGMT_SYSTEM_ROOT = '/var/run/hw-management/system/' MST_DEVICE_NAME_PATTERN = '/dev/mst/mt[0-9]*_pciconf0' MST_DEVICE_RE_PATTERN = '/dev/mst/mt([0-9]*)_pciconf0' SPECTRUM1_CHIP_ID = '52100' #reboot cause related definitions REBOOT_CAUSE_ROOT = HWMGMT_SYSTEM_ROOT REBOOT_CAUSE_FILE_LENGTH = 1 # Global logger class instance logger = Logger() # magic code defnition for port number, qsfp port position of each hwsku # port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET) hwsku_dict_port = {'ACS-MSN2010': 3, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2700': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0, 'LS-SN2700':0, 'ACS-MSN2740': 0, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'ACS-MSN3800': 4, 'Mellanox-SN3800-D112C8': 4, 'ACS-MSN4700': 0} port_position_tuple_list = [(0, 0, 31, 32, 1), (0, 0, 15, 16, 1), (0, 48, 55, 56, 1), (0, 18, 21, 22, 1), (0, 0, 63, 64, 1)] class Chassis(ChassisBase): """Platform-specific Chassis class""" def __init__(self): super(Chassis, self).__init__() # Initialize SKU name self.sku_name = self._get_sku_name() mi = get_machine_info()
from sonic_platform_base.sonic_thermal_control.thermal_action_base import ThermalPolicyActionBase from sonic_platform_base.sonic_thermal_control.thermal_json_object import thermal_json_object from sonic_daemon_base.daemon_base import Logger __all__ = [ "SetAllFanSpeedMaxAction", "SetAllFanSpeedDefaultAction", "ThermalRecoverAction", "SwitchPolicyAction", ] logger = Logger('alpha') class SetFanSpeedAction(ThermalPolicyActionBase): """ Base thermal action class to set speed for fans """ @classmethod def set_all_fan_speed(cls, thermal_info_dict, speed): from .thermal_infos import FanInfo if FanInfo.INFO_NAME in thermal_info_dict and isinstance( thermal_info_dict[FanInfo.INFO_NAME], FanInfo): fan_info_obj = thermal_info_dict[FanInfo.INFO_NAME] for fan in fan_info_obj.get_presence_fans(): fan.set_speed(speed) @thermal_json_object('fan.all.set_speed_max') class SetAllFanSpeedMaxAction(SetFanSpeedAction): """