diff --git a/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py b/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py index 7a0090264cae..6292978fb16d 100644 --- a/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py +++ b/sonic_platform_base/sonic_thermal_control/thermal_manager_base.py @@ -14,6 +14,7 @@ class ThermalManagerBase(object): JSON_FIELD_THERMAL_ALGORITHM = "thermal_control_algorithm" JSON_FIELD_FAN_SPEED_WHEN_SUSPEND = "fan_speed_when_suspend" JSON_FIELD_RUN_AT_BOOT_UP = "run_at_boot_up" + JSON_FIELD_INTERVAL = "interval" # Dictionary of ThermalPolicy objects. _policy_dict = {} @@ -25,6 +26,8 @@ class ThermalManagerBase(object): _run_thermal_algorithm_at_boot_up = None + _interval = 60 + _running = True @classmethod @@ -118,7 +121,8 @@ def load(cls, policy_file_name): } ] } - ] + ], + "interval": "30", } :param policy_file_name: Path of JSON policy file. :return: @@ -147,6 +151,10 @@ def load(cls, policy_file_name): cls._fan_speed_when_suspend = \ int(json_thermal_algorithm_config[cls.JSON_FIELD_FAN_SPEED_WHEN_SUSPEND]) + if cls.JSON_FIELD_INTERVAL in json_obj: + cls._interval = int(json_obj[cls.JSON_FIELD_INTERVAL]) + + @classmethod def _load_policy(cls, json_policy): """ @@ -215,3 +223,10 @@ def init_thermal_algorithm(cls, chassis): for psu in chassis.get_all_psus(): for fan in psu.get_all_fans(): fan.set_speed(cls._fan_speed_when_suspend) + + @classmethod + def get_interval(cls): + """ + Get the wait interval for executing thermal policies + """ + return cls._interval