sonic-buildimage/platform/barefoot/sonic-platform-modules-bfn-montara/sonic_platform/thermal.py

227 lines
7.1 KiB
Python
Raw Normal View History

try:
import subprocess
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
from collections import namedtuple
import json
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
from bfn_extensions.platform_sensors import platform_sensors_get
from sonic_platform_base.thermal_base import ThermalBase
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
from sonic_py_common import device_info
import logging
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
'''
data argument is in "sensors -A -u" format, example:
coretemp-isa-0000
Package id 0:
temp1_input: 37.000
temp1_max: 82.000
temp1_crit: 104.000
temp1_crit_alarm: 0.000
Core 0:
temp2_input: 37.000
...
'''
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
Threshold = namedtuple('Threshold', ['crit', 'max', 'min', 'alarm'])
def _sensors_chip_parsed(data: str):
def kv(line):
k, v, *_ = [t.strip(': ') for t in line.split(':') if t] + ['']
return k, v
chip, *data = data.strip().split('\n')
chip = chip.strip(': ')
sensors = []
for line in data:
if not line.startswith(' '):
sensor_label = line.strip(': ')
sensors.append((sensor_label, {}))
continue
if len(sensors) == 0:
raise RuntimeError(f'invalid data to parse: {data}')
attr, value = kv(line)
sensor_label, sensor_data = sensors[-1]
sensor_data.update({attr: value})
return chip, dict(sensors)
'''
Example of returned dict:
{
'coretemp-isa-0000': {
'Core 1': { "temp1_input": 40, ... },
'Core 2': { ... }
}
}
'''
def _sensors_get() -> dict:
data = platform_sensors_get(['-A', '-u']) or ''
data += subprocess.check_output("/usr/bin/sensors -A -u",
shell=True, text=True)
data = data.split('\n\n')
data = [_sensors_chip_parsed(chip_data) for chip_data in data if chip_data]
data = dict(data)
return data
def _value_get(d: dict, key_prefix, key_suffix=''):
for k, v in d.items():
if k.startswith(key_prefix) and k.endswith(key_suffix):
return v
return None
# Thermal -> ThermalBase -> DeviceBase
class Thermal(ThermalBase):
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
_thresholds = dict()
_max_temperature = 100.0
_min_temperature = 0.0
_min_high_threshold_temperature = 35.0
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
def __init__(self, chip, label, index = 0):
self.__chip = chip
self.__label = label
self.__name = f"{chip}:{label}".lower().replace(' ', '-')
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
self.__collect_temp = []
self.__index = index
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
self.__high_threshold = None
self.__low_threshold = None
f = None
try:
path = device_info.get_path_to_platform_dir() + '/' + 'thermal_thresholds.json'
f = open(path)
except FileNotFoundError:
logging.warning('can not open the file')
if f is not None:
self.__get_thresholds(f)
def __get_thresholds(self, f):
def_threshold_json = json.load(f)
all_data = def_threshold_json["thermals"]
for i in all_data:
for key, value in i.items():
self._thresholds[key] = Threshold(*value)
def check_in_range(self, temperature):
temp_f = float(temperature)
return temp_f > self._min_temperature and temp_f <= self._max_temperature
def check_high_threshold(self, temperature, attr_suffix):
temp_f = float(temperature)
check_range = True
if attr_suffix == 'max':
if temp_f < self._min_high_threshold_temperature:
if self.__name in self._thresholds:
temp = self._thresholds[self.__name].max
self.set_high_threshold(temp)
check_range = False
return check_range
def __get(self, attr_prefix, attr_suffix):
sensor_data = _sensors_get().get(self.__chip, {}).get(self.__label, {})
value = _value_get(sensor_data, attr_prefix, attr_suffix)
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
if value is not None and self.check_in_range(value) and self.check_high_threshold(value, attr_suffix):
return value
elif self.__name in self._thresholds and attr_prefix == 'temp':
if attr_suffix == 'crit':
return self._thresholds[self.__name].crit
elif attr_suffix == 'max':
if self.__high_threshold is None:
return self._thresholds[self.__name].max
else:
return self.__high_threshold
elif attr_suffix == 'min':
if self.__low_threshold is None:
return self._thresholds[self.__name].min
else:
return self.__low_threshold
elif attr_suffix == 'alarm':
return self._thresholds[self.__name].alarm
else:
return 1.0
else:
return 0.05
# ThermalBase interface methods:
def get_temperature(self) -> float:
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
temp = self.__get('temp', 'input')
self.__collect_temp.append(float(temp))
self.__collect_temp.sort()
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
if len(self.__collect_temp) == 3:
del self.__collect_temp[1]
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
return float(temp)
def get_high_threshold(self) -> float:
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
if self.__high_threshold is None:
return float(self.__get('temp', 'max'))
return float(self.__high_threshold)
def get_high_critical_threshold(self) -> float:
return float(self.__get('temp', 'crit'))
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
def get_low_critical_threshold(self) -> float:
return float(self.__get('temp', 'alarm'))
def get_model(self):
return f"{self.__label}".lower()
# DeviceBase interface methods:
def get_name(self):
return self.__name
def get_presence(self):
return True
def get_status(self):
return True
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
def is_replaceable(self):
return False
def get_low_threshold(self) -> float:
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
if self.__low_threshold is None:
return float(self.__get('temp', 'min'))
return float(self.__low_threshold)
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
def get_serial(self):
return 'N/A'
def get_minimum_recorded(self) -> float:
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
temp = self.__collect_temp[0] if len(self.__collect_temp) > 0 else self.get_temperature()
temp = temp if temp <= 100.0 else 100.0
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
temp = temp if temp > 0.0 else 0.1
return float(temp)
def get_maximum_recorded(self) -> float:
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
temp = self.__collect_temp[-1] if len(self.__collect_temp) > 0 else self.get_temperature()
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
temp = temp if temp <= 100.0 else 100.0
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
temp = temp if temp > 0.0 else 0.1
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
return float(temp)
def get_position_in_parent(self):
return self.__index
def set_high_threshold(self, temperature):
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
if self.check_in_range(temperature):
self.__high_threshold = temperature
return True
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
return False
def set_low_threshold(self, temperature):
[BFN] Refactoring and adding some functions of Thermal class (set and get thresholds and etc.) (#10205) * Revised set_high_thershold and set_low_thershold methobs in the thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised set_low_thershold and set_high_thershold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added separated files with thermal thresholds, changed platform.json and thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code revieww Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Reverted thermal.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther python.py Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added fucntion for fix the problem of tofino sensor high critical threshold Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised due to code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised only for cab18-4 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised default thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised ther def thresholds Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised on code review Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised platform.json and thermal_thresholds.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Code review in PR to azure (trigger CI) Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Added handle of exception Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revised exception handler * Added psu-1 thermal names to platfrom.json Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Changed platform.json and thermal_thresholds.json in x86_64-acton_as9516_32d-r0 Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Removed indentation from json file Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com>
2022-04-05 11:13:08 -05:00
if self.check_in_range(temperature):
self.__low_threshold = temperature
return True
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
return False
def thermal_list_get():
l = []
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
index = 0
for chip, chip_data in _sensors_get().items():
for sensor, sensor_data in chip_data.items():
# add only temperature sensors
if _value_get(sensor_data, "temp") is not None:
[BFN] Updated platform plugins (#9540) * [BFN] Updated platform APIs impl Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Extended BFN platform SFP APIs implementation * Update sfp.py * [BFN] Extended SFP platform plugin implementation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Extended Fans platform plugin implementation * [BFN] divided classes Fan and FanDrawer into 2 files * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> What I did Add get_model() function Add get_low_critical_threshold() function Change __get(...) function. How I did it Differnece from previous implementation of __get(...) function is return real value or -9999.9 if value is not provided by thrift API * Add get_presence() function and revised __get() function Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * [BFN] Updated PSU platform APIs impl Signed-off-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> * Added BFN PSU cache (#9) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] Fans and Fantray platform APIs update (#7) * [BFN] Updated SFP platform APIs (#10) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [BFN] Updated platform API for thermal (#8) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "[BFN] Fans and Fantray platform APIs update (#7)" (#11) This reverts commit c62a733443be49cbe4ba2d06047aac7516f0495e. * Add support health monitor system (#15) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * Update chassis.py * [BFN] Updated FANs and FAN Tray platform API (#14) * Fix fix_alignment (#17) Signed-off-by: Petro Bratash <petrox.bratash@intel.com> * [BFN] Improvement show environment (#16) * Added PSU temperature skip into platform.json (#18) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Do not skip psud on Newport Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [BFN] fix fan status from Not OK to Ok (#19) * [BFN] Updated SFP platform plugin (#13) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * [DPB] Fix typo for Ethernet0 2x200G[100G,40G] breakout mode (#21) Signed-off-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com> * [barefoot] Tmp fix vendor_rev (#22) Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * Fixed python issues in sonic_platform/fan_drawer.py Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Updated fan_drawer.py * Fixing trailing white spaces in fan_drawer.py * [BFN] Fix thrift for SFPs API Signed-off-by: Volodymyr Boyko <volodymyrx.boiko@intel.com> * In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * [Newport] Thermal manager (#23) * Signed-off-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> * Revert "In platform.json, replaced 'false' with '0' to workaround ast.literal_eval() issue" This reverts commit 1e7312783097e99ae937d7fc212d98a2cb261ada. * Removed 'controllable' options from platform.json to fix factory default config generation Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> * Update thermal_manager.py * Migrated SFP plugin to sonic_xcvr API (#30) Signed-off-by: Andriy Kokhan <andriyx.kokhan@intel.com> Co-authored-by: KostiantynYarovyiBf <kostiantynx.yarovyi@intel.com> Co-authored-by: Vadym Yashchenko <vadymx.yashchenko@intel.com> Co-authored-by: Dmytro Lytvynenko <dmytrox.lytvynenko@intel.com> Co-authored-by: Volodymyr Boiko <volodymyrx.boiko@intel.com> Co-authored-by: Petro Bratash <petrox.bratash@intel.com> Co-authored-by: Mykola Gerasymenko <mykolax.gerasymenko@intel.com>
2022-01-16 23:46:20 -06:00
l.append(Thermal(chip, sensor, index))
index += 1
return l