From 5659288e40ba015201722e381431dddd02a8dcda Mon Sep 17 00:00:00 2001 From: Wirut Getbamrung Date: Mon, 11 Feb 2019 15:26:31 +0700 Subject: [PATCH] [device/alibaba] - Update device plugins to latest version --- .../plugins/fanutil.py | 40 +++-- .../plugins/fwmgrutil.py | 148 ++++++++++++++---- .../plugins/psuutil.py | 20 ++- .../plugins/sensorutil.py | 24 +++ .../plugins/fanutil.py | 40 +++-- .../plugins/fwmgrutil.py | 146 +++++++++++++---- .../plugins/psuutil.py | 20 ++- .../plugins/sensorutil.py | 24 +++ .../plugins/fanutil.py | 44 ++++-- .../plugins/fwmgrutil.py | 148 ++++++++++++++---- .../plugins/psuutil.py | 20 ++- .../plugins/sensorutil.py | 24 +++ .../tools/platformutil.py | 40 ++++- 13 files changed, 605 insertions(+), 133 deletions(-) diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py index 33866a6f9377..dab2f64dd5e0 100644 --- a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fanutil.py @@ -2,11 +2,11 @@ __author__ = 'Wirut G.' __license__ = "GPL" -__version__ = "0.1.1" +__version__ = "0.1.2" __status__ = "Development" -import re import requests +import re class FanUtil(): @@ -249,27 +249,35 @@ def get_all(self): # Set fan FRU data. fan_fru_dict = dict() + fan_raw_idx = 1 for fan_fru in self.fru_data_list: - if len(fan_fru) == 0: - continue fru_dict = dict() - fan_key = fan_fru[0].split() fan_ps = False - if str(fan_key[-1]).lower() == "absent": - fan_idx = int(re.findall('\d+', fan_key[0])[0]) + if len(fan_fru) == 0: + fan_idx = fan_raw_idx + fan_pn = "N/A" + fan_sn = "N/A" else: - fan_idx = int(re.findall('\d+', fan_key[-1])[0]) - fan_ps = True - pn = [s for s in fan_fru if "Part" in s] - sn = [s for s in fan_fru if "Serial" in s] - fan_pn = pn[0].split(":")[-1].strip() if len(pn) > 0 else 'N/A' - fan_sn = sn[0].split(":")[-1].strip() if len(sn) > 0 else 'N/A' + fan_key = fan_fru[0].split() + if str(fan_key[-1]).lower() == "absent": + fan_idx = int(re.findall('\d+', fan_key[0])[0]) + + else: + fan_idx = int(re.findall('\d+', fan_key[-1])[0]) + fan_ps = True + pn = [s for s in fan_fru if "Part" in s] + sn = [s for s in fan_fru if "Serial" in s] + fan_pn = pn[0].split( + ":")[-1].strip() if len(pn) > 0 else 'N/A' + fan_sn = sn[0].split( + ":")[-1].strip() if len(sn) > 0 else 'N/A' fru_dict["PN"] = "N/A" if not fan_pn or fan_pn == "" else fan_pn fru_dict["SN"] = "N/A" if not fan_sn or fan_sn == "" else fan_sn fru_dict["Present"] = fan_ps fan_fru_dict[fan_idx] = fru_dict + fan_raw_idx += 1 # Set fan sensor data. for sensor_data in self.sensor_data_list: @@ -284,13 +292,17 @@ def get_all(self): fan_data = sensor_data.get(fan_key) fan_sp_list = map(int, re.findall(r'\d+', fan_data)) fan_dict["Present"] = fan_fru_dict[f_index]["Present"] - if fan_dict["Present"]: + if fan_dict["Present"] or fan_sp_list[0] > 0: + fan_dict["Present"] = True fan_dict["Speed"] = fan_sp_list[0] fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False fan_dict["LowThd"] = fan_sp_list[1] fan_dict["HighThd"] = fan_sp_list[2] fan_dict["PN"] = fan_fru_dict[f_index]["PN"] fan_dict["SN"] = fan_fru_dict[f_index]["SN"] + fan_dict["AirFlow"] = "FTOB" if "R1241-F9001" in fan_dict["PN"] else "Unknown" + fan_dict["AirFlow"] = "BTOF" if "R1241-F9002" in fan_dict["PN"] else fan_dict["AirFlow"] + fan_dict["Status"] = True if fan_dict["AirFlow"] != "Unknown" else False fan_name = 'FAN{}_{}'.format(f_index, pos) all_fan_dict[fan_name] = fan_dict break diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py index 15a6bafb3b4b..5d072bbeae26 100644 --- a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/fwmgrutil.py @@ -5,6 +5,7 @@ import subprocess import requests +import os try: from sonic_fwmgr.fwgmr_base import FwMgrUtilBase @@ -20,6 +21,7 @@ def __init__(self): self.platform_name = "AS1332h" self.onie_config_file = "/host/machine.conf" self.bmc_info_url = "http://240.1.1.1:8080/api/sys/bmc" + self.bmc_raw_command_url = "http://240.1.1.1:8080/api/sys/raw" self.onie_config_file = "/host/machine.conf" self.cpldb_version_path = "/sys/devices/platform/%s.cpldb/getreg" % self.platform_name self.fpga_version_path = "/sys/devices/platform/%s.switchboard/FPGA/getreg" % self.platform_name @@ -43,7 +45,7 @@ def get_bmc_version(self): :returns: version string """ - bmc_version = "None" + bmc_version = None bmc_version_key = "OpenBMC Version" bmc_info_req = requests.get(self.bmc_info_url) @@ -51,7 +53,7 @@ def get_bmc_version(self): bmc_info = bmc_info_json.get('Information') bmc_version = bmc_info.get(bmc_version_key) - return bmc_version + return str(bmc_version) def get_cpld_version(self): """Get CPLD version from SONiC @@ -83,9 +85,10 @@ def get_cpld_version(self): int(CPLD_3[2], 16), int(CPLD_3[3], 16)) CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format( int(CPLD_4[2], 16), int(CPLD_4[3], 16)) - FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(float(fan_cpld)) + FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format( + float(fan_cpld)) - cpld_version_dict={} + cpld_version_dict = {} cpld_version_dict.update({'CPLD_B': CPLD_B}) cpld_version_dict.update({'CPLD_C': CPLD_C}) cpld_version_dict.update({'CPLD_1': CPLD_1}) @@ -101,57 +104,144 @@ def get_bios_version(self): :returns: version string """ - bios_version='None' + bios_version = None - p=subprocess.Popen( + p = subprocess.Popen( ["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE) - raw_data=str(p.communicate()[0]) - raw_data_list=raw_data.split("\n") - bios_version=raw_data_list[0] if len( + raw_data = str(p.communicate()[0]) + raw_data_list = raw_data.split("\n") + bios_version = raw_data_list[0] if len( raw_data_list) == 1 else raw_data_list[-2] - return bios_version + return str(bios_version) def get_onie_version(self): """Get ONiE version from SONiC :returns: version string """ - onie_verison='None' + onie_verison = None - onie_version_keys="onie_version" - onie_config_file=open(self.onie_config_file, "r") + onie_version_keys = "onie_version" + onie_config_file = open(self.onie_config_file, "r") for line in onie_config_file.readlines(): if onie_version_keys in line: - onie_version_raw=line.split('=') - onie_verison=onie_version_raw[1].strip() + onie_version_raw = line.split('=') + onie_verison = onie_version_raw[1].strip() break - return onie_verison + return str(onie_verison) def get_pcie_version(self): - """Get PCiE version from SONiC - :returns: version string + """Get PCiE version from SONiC + :returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" } + """ - cmd="sudo bcmcmd 'pciephy fw version'" - p=subprocess.Popen( + cmd = "sudo bcmcmd 'pciephy fw version'" + p = subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err=p.communicate() - if err is not '': - return 'None' - else: - lines=raw_data.split('\n') + raw_data, err = p.communicate() + + pcie_version = dict() + pcie_version["PCIE_FW_LOADER"] = 'None' + pcie_version["PCIE_FW"] = 'None' + + if err == '': + lines = raw_data.split('\n') for line in lines: if 'PCIe FW loader' in line: - version=line.split(':')[1].strip() - return str(version) + pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip() + elif 'PCIe FW version' in line: + pcie_version["PCIE_FW"] = line.split(':')[1].strip() + return pcie_version def get_fpga_version(self): """Get FPGA version from SONiC :returns: version string """ - version=self.__get_register_value(self.fpga_version_path, '0x00') + version = self.__get_register_value(self.fpga_version_path, '0x00') if version is not 'None': - version="{}.{}".format( + version = "{}.{}".format( int(version[2:][:4], 16), int(version[2:][4:], 16)) return str(version) + + def firmware_upgrade(self, fw_type, fw_path, fw_extra=None): + """ + @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' + @fw_path MANDATORY, target firmware file + @fw_extra OPTIONAL, extra information string, + + for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... + or 'cpld_fan_come_board', etc. If None, upgrade all CPLD/FPGA firmware. for fw_type 'bios' and 'bmc', + value should be one of 'master' or 'slave' or 'both' + """ + + if fw_type == 'bmc': + + # Copy BMC image file to BMC + scp_command = 'scp ' + \ + os.path.abspath(fw_path) + ' root@240.1.1.1:/home/root/' + + print "Uploading image to BMC..." + print "Running command : ", scp_command + print "Please enter the BMC password" + p = subprocess.Popen( + scp_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + + if err != "": + print "Failed" + return False + + print "Installing BMC image..." + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["data"] = "flashcp /home/root/" + \ + filename_w_ext + " /dev/mtd5" + json_data["timeout"] = 300 + + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code == 200: + print "DONE, Rebooting BMC....." + reboot_dict = dict() + reboot_dict["data"] = "reboot" + r = requests.post(self.bmc_raw_command_url, json=reboot_dict) + else: + print "Failed" + return False + + elif fw_type == 'fpga': + command = 'fpga_prog ' + fw_path + print "Running command : ", command + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print output.strip() + rc = process.poll() + return rc + + elif 'cpld' in fw_type: + command = 'ispvm ' + fw_path + if fw_extra is not None: + command = 'ispvm -c ' + \ + str(fw_extra) + " " + os.path.abspath(fw_path) + print "Running command : ", command + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print output.strip() + rc = process.poll() + return rc + + return None diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py index 242beb570e6a..b752c6169645 100644 --- a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/psuutil.py @@ -2,7 +2,7 @@ __author__ = 'Wirut G.' __license__ = "GPL" -__version__ = "0.1.2" +__version__ = "0.1.3" __status__ = "Development" import requests @@ -36,6 +36,15 @@ def request_data(self): self.psu_info_list = psu_info_json.get('Information') return self.fru_status_list, self.psu_info_list + def airflow_selector(self, pn): + # Set input type. + return { + "DPS-1100FB": "FTOB", + "DPS-1100AB": "BTOF", + "FSJ026-A20G": "FTOB", + "FSJ038-A20G": "BTOF" + }.get(pn, "Unknown") + def get_num_psus(self): """ Retrieves the number of PSUs available on the device @@ -213,12 +222,21 @@ def get_all(self): "Present")).strip() == "Present" else False psu_pw_status = True if str(fru_status.get( "Power Status")).strip() == "OK" else False + psu_pw_type = str(fru_status.get( + "Power Type")).strip() + ac_status = True if str(fru_status.get( + "AC Status")).strip().upper() == "OK" else False psu_status_dict["Present"] = psu_ps_status if psu_ps_status: psu_status_dict["PowerStatus"] = psu_pw_status psu_status_dict["PN"] = psu_info_dict[psu_idx]["PN"] psu_status_dict["SN"] = psu_info_dict[psu_idx]["SN"] + psu_status_dict["InputType"] = psu_pw_type + psu_status_dict["InputStatus"] = True if psu_pw_status and psu_ps_status else False + psu_status_dict["OutputStatus"] = ac_status + psu_status_dict["AirFlow"] = self.airflow_selector( + psu_status_dict["PN"].split()[0]) all_psu_dict[find_psu[0]] = psu_status_dict return all_psu_dict diff --git a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py index bb526aa8a174..4bf14ce6310b 100644 --- a/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py +++ b/device/alibaba/x86_64-alibaba_as13-32h-cl-r0/plugins/sensorutil.py @@ -13,6 +13,7 @@ class SensorUtil(): def __init__(self): self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.sys_fruid_url = "http://240.1.1.1:8080/api/sys/fruid/sys" self.sensor_info_list = None def request_data(self): @@ -21,6 +22,9 @@ def request_data(self): sensor_data_req = requests.get(self.sensor_url) sensor_json = sensor_data_req.json() self.sensor_info_list = sensor_json.get('Information') + sys_fruid_req = requests.get(self.sys_fruid_url) + sys_fruid_json = sys_fruid_req.json() + self.sys_fruid_list = sys_fruid_json.get('Information') return self.sensor_info_list def input_type_selector(self, unit): @@ -291,6 +295,22 @@ def get_sensor_input_high_threshold(self, sensor_index, input_index): return sensor_input_high_threshold + def get_sys_airflow(self): + sys_air_flow = "Unknown" + sys_pn_data = [ + v.split(":") for v in self.sys_fruid_list if "Product Part Number" in v] + + if len(sys_pn_data) == 0: + return sys_air_flow + + sys_pn = sys_pn_data[0][1] + if "R1241-F0001" in sys_pn: + sys_air_flow = "FTOB" + elif"R1241-F0002" in sys_pn: + sys_air_flow = "BTOF" + + return sys_air_flow + def get_all(self): all_sensor_dict = dict() @@ -336,4 +356,8 @@ def get_all(self): all_sensor_dict[self.sensor_name].update(sensor_dict) + sensor_dict = dict() + sensor_dict["Sys_AirFlow"] = self.get_sys_airflow() + all_sensor_dict["TEMPERATURE"].update(sensor_dict) + return all_sensor_dict diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py index 33866a6f9377..dab2f64dd5e0 100644 --- a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fanutil.py @@ -2,11 +2,11 @@ __author__ = 'Wirut G.' __license__ = "GPL" -__version__ = "0.1.1" +__version__ = "0.1.2" __status__ = "Development" -import re import requests +import re class FanUtil(): @@ -249,27 +249,35 @@ def get_all(self): # Set fan FRU data. fan_fru_dict = dict() + fan_raw_idx = 1 for fan_fru in self.fru_data_list: - if len(fan_fru) == 0: - continue fru_dict = dict() - fan_key = fan_fru[0].split() fan_ps = False - if str(fan_key[-1]).lower() == "absent": - fan_idx = int(re.findall('\d+', fan_key[0])[0]) + if len(fan_fru) == 0: + fan_idx = fan_raw_idx + fan_pn = "N/A" + fan_sn = "N/A" else: - fan_idx = int(re.findall('\d+', fan_key[-1])[0]) - fan_ps = True - pn = [s for s in fan_fru if "Part" in s] - sn = [s for s in fan_fru if "Serial" in s] - fan_pn = pn[0].split(":")[-1].strip() if len(pn) > 0 else 'N/A' - fan_sn = sn[0].split(":")[-1].strip() if len(sn) > 0 else 'N/A' + fan_key = fan_fru[0].split() + if str(fan_key[-1]).lower() == "absent": + fan_idx = int(re.findall('\d+', fan_key[0])[0]) + + else: + fan_idx = int(re.findall('\d+', fan_key[-1])[0]) + fan_ps = True + pn = [s for s in fan_fru if "Part" in s] + sn = [s for s in fan_fru if "Serial" in s] + fan_pn = pn[0].split( + ":")[-1].strip() if len(pn) > 0 else 'N/A' + fan_sn = sn[0].split( + ":")[-1].strip() if len(sn) > 0 else 'N/A' fru_dict["PN"] = "N/A" if not fan_pn or fan_pn == "" else fan_pn fru_dict["SN"] = "N/A" if not fan_sn or fan_sn == "" else fan_sn fru_dict["Present"] = fan_ps fan_fru_dict[fan_idx] = fru_dict + fan_raw_idx += 1 # Set fan sensor data. for sensor_data in self.sensor_data_list: @@ -284,13 +292,17 @@ def get_all(self): fan_data = sensor_data.get(fan_key) fan_sp_list = map(int, re.findall(r'\d+', fan_data)) fan_dict["Present"] = fan_fru_dict[f_index]["Present"] - if fan_dict["Present"]: + if fan_dict["Present"] or fan_sp_list[0] > 0: + fan_dict["Present"] = True fan_dict["Speed"] = fan_sp_list[0] fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False fan_dict["LowThd"] = fan_sp_list[1] fan_dict["HighThd"] = fan_sp_list[2] fan_dict["PN"] = fan_fru_dict[f_index]["PN"] fan_dict["SN"] = fan_fru_dict[f_index]["SN"] + fan_dict["AirFlow"] = "FTOB" if "R1241-F9001" in fan_dict["PN"] else "Unknown" + fan_dict["AirFlow"] = "BTOF" if "R1241-F9002" in fan_dict["PN"] else fan_dict["AirFlow"] + fan_dict["Status"] = True if fan_dict["AirFlow"] != "Unknown" else False fan_name = 'FAN{}_{}'.format(f_index, pos) all_fan_dict[fan_name] = fan_dict break diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py index 498c5da98f31..aaf0dae543b7 100644 --- a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/fwmgrutil.py @@ -5,6 +5,7 @@ import subprocess import requests +import os try: from sonic_fwmgr.fwgmr_base import FwMgrUtilBase @@ -20,6 +21,7 @@ def __init__(self): self.platform_name = "AS1348f8h" self.onie_config_file = "/host/machine.conf" self.bmc_info_url = "http://240.1.1.1:8080/api/sys/bmc" + self.bmc_raw_command_url = "http://240.1.1.1:8080/api/sys/raw" self.onie_config_file = "/host/machine.conf" self.cpldb_version_path = "/sys/devices/platform/%s.cpldb/getreg" % self.platform_name self.fpga_version_path = "/sys/devices/platform/%s.switchboard/FPGA/getreg" % self.platform_name @@ -43,7 +45,7 @@ def get_bmc_version(self): :returns: version string """ - bmc_version = "None" + bmc_version = None bmc_version_key = "OpenBMC Version" bmc_info_req = requests.get(self.bmc_info_url) @@ -51,7 +53,7 @@ def get_bmc_version(self): bmc_info = bmc_info_json.get('Information') bmc_version = bmc_info.get(bmc_version_key) - return bmc_version + return str(bmc_version) def get_cpld_version(self): """Get CPLD version from SONiC @@ -83,9 +85,10 @@ def get_cpld_version(self): int(CPLD_3[2], 16), int(CPLD_3[3], 16)) CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format( int(CPLD_4[2], 16), int(CPLD_4[3], 16)) - FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(float(fan_cpld)) + FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format( + float(fan_cpld)) - cpld_version_dict={} + cpld_version_dict = {} cpld_version_dict.update({'CPLD_B': CPLD_B}) cpld_version_dict.update({'CPLD_C': CPLD_C}) cpld_version_dict.update({'CPLD_1': CPLD_1}) @@ -101,57 +104,144 @@ def get_bios_version(self): :returns: version string """ - bios_version='None' + bios_version = None - p=subprocess.Popen( + p = subprocess.Popen( ["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE) - raw_data=str(p.communicate()[0]) - raw_data_list=raw_data.split("\n") - bios_version=raw_data_list[0] if len( + raw_data = str(p.communicate()[0]) + raw_data_list = raw_data.split("\n") + bios_version = raw_data_list[0] if len( raw_data_list) == 1 else raw_data_list[-2] - return bios_version + return str(bios_version) def get_onie_version(self): """Get ONiE version from SONiC :returns: version string """ - onie_verison='None' + onie_verison = None - onie_version_keys="onie_version" - onie_config_file=open(self.onie_config_file, "r") + onie_version_keys = "onie_version" + onie_config_file = open(self.onie_config_file, "r") for line in onie_config_file.readlines(): if onie_version_keys in line: - onie_version_raw=line.split('=') - onie_verison=onie_version_raw[1].strip() + onie_version_raw = line.split('=') + onie_verison = onie_version_raw[1].strip() break - return onie_verison + return str(onie_verison) def get_pcie_version(self): """Get PCiE version from SONiC - :returns: version string + :returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" } + """ - cmd="sudo bcmcmd 'pciephy fw version'" - p=subprocess.Popen( + cmd = "sudo bcmcmd 'pciephy fw version'" + p = subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err=p.communicate() - if err is not '': - return 'None' - else: - lines=raw_data.split('\n') + raw_data, err = p.communicate() + + pcie_version = dict() + pcie_version["PCIE_FW_LOADER"] = 'None' + pcie_version["PCIE_FW"] = 'None' + + if err == '': + lines = raw_data.split('\n') for line in lines: if 'PCIe FW loader' in line: - version=line.split(':')[1].strip() - return str(version) + pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip() + elif 'PCIe FW version' in line: + pcie_version["PCIE_FW"] = line.split(':')[1].strip() + return pcie_version def get_fpga_version(self): """Get FPGA version from SONiC :returns: version string """ - version=self.__get_register_value(self.fpga_version_path, '0x00') + version = self.__get_register_value(self.fpga_version_path, '0x00') if version is not 'None': - version="{}.{}".format( + version = "{}.{}".format( int(version[2:][:4], 16), int(version[2:][4:], 16)) return str(version) + + def firmware_upgrade(self, fw_type, fw_path, fw_extra=None): + """ + @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' + @fw_path MANDATORY, target firmware file + @fw_extra OPTIONAL, extra information string, + + for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... + or 'cpld_fan_come_board', etc. If None, upgrade all CPLD/FPGA firmware. for fw_type 'bios' and 'bmc', + value should be one of 'master' or 'slave' or 'both' + """ + + if fw_type == 'bmc': + + # Copy BMC image file to BMC + scp_command = 'scp ' + \ + os.path.abspath(fw_path) + ' root@240.1.1.1:/home/root/' + + print "Uploading image to BMC..." + print "Running command : ", scp_command + print "Please enter the BMC password" + p = subprocess.Popen( + scp_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + + if err != "": + print "Failed" + return False + + print "Installing BMC image..." + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["data"] = "flashcp /home/root/" + \ + filename_w_ext + " /dev/mtd5" + json_data["timeout"] = 300 + + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code == 200: + print "DONE, Rebooting BMC....." + reboot_dict = dict() + reboot_dict["data"] = "reboot" + r = requests.post(self.bmc_raw_command_url, json=reboot_dict) + else: + print "Failed" + return False + + elif fw_type == 'fpga': + command = 'fpga_prog ' + fw_path + print "Running command : ", command + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print output.strip() + rc = process.poll() + return rc + + elif 'cpld' in fw_type: + command = 'ispvm ' + fw_path + if fw_extra is not None: + command = 'ispvm -c ' + \ + str(fw_extra) + " " + os.path.abspath(fw_path) + print "Running command : ", command + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print output.strip() + rc = process.poll() + return rc + + return None diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py index 242beb570e6a..b752c6169645 100644 --- a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/psuutil.py @@ -2,7 +2,7 @@ __author__ = 'Wirut G.' __license__ = "GPL" -__version__ = "0.1.2" +__version__ = "0.1.3" __status__ = "Development" import requests @@ -36,6 +36,15 @@ def request_data(self): self.psu_info_list = psu_info_json.get('Information') return self.fru_status_list, self.psu_info_list + def airflow_selector(self, pn): + # Set input type. + return { + "DPS-1100FB": "FTOB", + "DPS-1100AB": "BTOF", + "FSJ026-A20G": "FTOB", + "FSJ038-A20G": "BTOF" + }.get(pn, "Unknown") + def get_num_psus(self): """ Retrieves the number of PSUs available on the device @@ -213,12 +222,21 @@ def get_all(self): "Present")).strip() == "Present" else False psu_pw_status = True if str(fru_status.get( "Power Status")).strip() == "OK" else False + psu_pw_type = str(fru_status.get( + "Power Type")).strip() + ac_status = True if str(fru_status.get( + "AC Status")).strip().upper() == "OK" else False psu_status_dict["Present"] = psu_ps_status if psu_ps_status: psu_status_dict["PowerStatus"] = psu_pw_status psu_status_dict["PN"] = psu_info_dict[psu_idx]["PN"] psu_status_dict["SN"] = psu_info_dict[psu_idx]["SN"] + psu_status_dict["InputType"] = psu_pw_type + psu_status_dict["InputStatus"] = True if psu_pw_status and psu_ps_status else False + psu_status_dict["OutputStatus"] = ac_status + psu_status_dict["AirFlow"] = self.airflow_selector( + psu_status_dict["PN"].split()[0]) all_psu_dict[find_psu[0]] = psu_status_dict return all_psu_dict diff --git a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py index bb526aa8a174..4bf14ce6310b 100644 --- a/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py +++ b/device/alibaba/x86_64-alibaba_as13-48f8h-cl-r0/plugins/sensorutil.py @@ -13,6 +13,7 @@ class SensorUtil(): def __init__(self): self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.sys_fruid_url = "http://240.1.1.1:8080/api/sys/fruid/sys" self.sensor_info_list = None def request_data(self): @@ -21,6 +22,9 @@ def request_data(self): sensor_data_req = requests.get(self.sensor_url) sensor_json = sensor_data_req.json() self.sensor_info_list = sensor_json.get('Information') + sys_fruid_req = requests.get(self.sys_fruid_url) + sys_fruid_json = sys_fruid_req.json() + self.sys_fruid_list = sys_fruid_json.get('Information') return self.sensor_info_list def input_type_selector(self, unit): @@ -291,6 +295,22 @@ def get_sensor_input_high_threshold(self, sensor_index, input_index): return sensor_input_high_threshold + def get_sys_airflow(self): + sys_air_flow = "Unknown" + sys_pn_data = [ + v.split(":") for v in self.sys_fruid_list if "Product Part Number" in v] + + if len(sys_pn_data) == 0: + return sys_air_flow + + sys_pn = sys_pn_data[0][1] + if "R1241-F0001" in sys_pn: + sys_air_flow = "FTOB" + elif"R1241-F0002" in sys_pn: + sys_air_flow = "BTOF" + + return sys_air_flow + def get_all(self): all_sensor_dict = dict() @@ -336,4 +356,8 @@ def get_all(self): all_sensor_dict[self.sensor_name].update(sensor_dict) + sensor_dict = dict() + sensor_dict["Sys_AirFlow"] = self.get_sys_airflow() + all_sensor_dict["TEMPERATURE"].update(sensor_dict) + return all_sensor_dict diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py index d3e8334271b8..7c37088b927e 100644 --- a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fanutil.py @@ -1,7 +1,12 @@ #!/usr/bin/env python -import re +__author__ = 'Wirut G.' +__license__ = "GPL" +__version__ = "0.1.2" +__status__ = "Development" + import requests +import re class FanUtil(): @@ -244,27 +249,35 @@ def get_all(self): # Set fan FRU data. fan_fru_dict = dict() + fan_raw_idx = 1 for fan_fru in self.fru_data_list: - if len(fan_fru) == 0: - continue fru_dict = dict() - fan_key = fan_fru[0].split() fan_ps = False - if str(fan_key[-1]).lower() == "absent": - fan_idx = int(re.findall('\d+', fan_key[0])[0]) + if len(fan_fru) == 0: + fan_idx = fan_raw_idx + fan_pn = "N/A" + fan_sn = "N/A" else: - fan_idx = int(re.findall('\d+', fan_key[-1])[0]) - fan_ps = True - pn = [s for s in fan_fru if "Part" in s] - sn = [s for s in fan_fru if "Serial" in s] - fan_pn = pn[0].split(":")[-1].strip() if len(pn) > 0 else 'N/A' - fan_sn = sn[0].split(":")[-1].strip() if len(sn) > 0 else 'N/A' + fan_key = fan_fru[0].split() + if str(fan_key[-1]).lower() == "absent": + fan_idx = int(re.findall('\d+', fan_key[0])[0]) + + else: + fan_idx = int(re.findall('\d+', fan_key[-1])[0]) + fan_ps = True + pn = [s for s in fan_fru if "Part" in s] + sn = [s for s in fan_fru if "Serial" in s] + fan_pn = pn[0].split( + ":")[-1].strip() if len(pn) > 0 else 'N/A' + fan_sn = sn[0].split( + ":")[-1].strip() if len(sn) > 0 else 'N/A' fru_dict["PN"] = "N/A" if not fan_pn or fan_pn == "" else fan_pn fru_dict["SN"] = "N/A" if not fan_sn or fan_sn == "" else fan_sn fru_dict["Present"] = fan_ps fan_fru_dict[fan_idx] = fru_dict + fan_raw_idx += 1 # Set fan sensor data. for sensor_data in self.sensor_data_list: @@ -279,15 +292,18 @@ def get_all(self): fan_data = sensor_data.get(fan_key) fan_sp_list = map(int, re.findall(r'\d+', fan_data)) fan_dict["Present"] = fan_fru_dict[f_index]["Present"] - if fan_dict["Present"]: + if fan_dict["Present"] or fan_sp_list[0] > 0: + fan_dict["Present"] = True fan_dict["Speed"] = fan_sp_list[0] fan_dict["Running"] = True if fan_dict["Speed"] > 0 else False fan_dict["LowThd"] = fan_sp_list[1] fan_dict["HighThd"] = fan_sp_list[2] fan_dict["PN"] = fan_fru_dict[f_index]["PN"] fan_dict["SN"] = fan_fru_dict[f_index]["SN"] + fan_dict["AirFlow"] = "FTOB" if "R1240-G0009" in fan_dict["PN"] else "Unknown" + fan_dict["Status"] = True if fan_dict["AirFlow"] != "Unknown" else False fan_name = 'FAN{}_{}'.format(f_index, pos) all_fan_dict[fan_name] = fan_dict break - return all_fan_dict \ No newline at end of file + return all_fan_dict diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py index a4d202389a4e..58b5a4ece421 100644 --- a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/fwmgrutil.py @@ -5,6 +5,7 @@ import subprocess import requests +import os try: from sonic_fwmgr.fwgmr_base import FwMgrUtilBase @@ -20,6 +21,7 @@ def __init__(self): self.platform_name = "AS23128h" self.onie_config_file = "/host/machine.conf" self.bmc_info_url = "http://240.1.1.1:8080/api/sys/bmc" + self.bmc_raw_command_url = "http://240.1.1.1:8080/api/sys/raw" self.onie_config_file = "/host/machine.conf" self.cpldb_version_path = "/sys/devices/platform/%s.cpldb/getreg" % self.platform_name self.fpga_version_path = "/sys/devices/platform/%s.switchboard/FPGA/getreg" % self.platform_name @@ -43,7 +45,7 @@ def get_bmc_version(self): :returns: version string """ - bmc_version = "None" + bmc_version = None bmc_version_key = "OpenBMC Version" bmc_info_req = requests.get(self.bmc_info_url) @@ -51,7 +53,7 @@ def get_bmc_version(self): bmc_info = bmc_info_json.get('Information') bmc_version = bmc_info.get(bmc_version_key) - return bmc_version + return str(bmc_version) def get_cpld_version(self): """Get CPLD version from SONiC @@ -83,9 +85,10 @@ def get_cpld_version(self): int(CPLD_3[2], 16), int(CPLD_3[3], 16)) CPLD_4 = 'None' if CPLD_4 is 'None' else "{}.{}".format( int(CPLD_4[2], 16), int(CPLD_4[3], 16)) - FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format(float(fan_cpld)) + FAN_CPLD = 'None' if CPLD_4 is None else "{:.1f}".format( + float(fan_cpld)) - cpld_version_dict={} + cpld_version_dict = {} cpld_version_dict.update({'CPLD_B': CPLD_B}) cpld_version_dict.update({'CPLD_C': CPLD_C}) cpld_version_dict.update({'CPLD_1': CPLD_1}) @@ -101,57 +104,144 @@ def get_bios_version(self): :returns: version string """ - bios_version='None' + bios_version = None - p=subprocess.Popen( + p = subprocess.Popen( ["sudo", "dmidecode", "-s", "bios-version"], stdout=subprocess.PIPE) - raw_data=str(p.communicate()[0]) - raw_data_list=raw_data.split("\n") - bios_version=raw_data_list[0] if len( + raw_data = str(p.communicate()[0]) + raw_data_list = raw_data.split("\n") + bios_version = raw_data_list[0] if len( raw_data_list) == 1 else raw_data_list[-2] - return bios_version + return str(bios_version) def get_onie_version(self): """Get ONiE version from SONiC :returns: version string """ - onie_verison='None' + onie_verison = None - onie_version_keys="onie_version" - onie_config_file=open(self.onie_config_file, "r") + onie_version_keys = "onie_version" + onie_config_file = open(self.onie_config_file, "r") for line in onie_config_file.readlines(): if onie_version_keys in line: - onie_version_raw=line.split('=') - onie_verison=onie_version_raw[1].strip() + onie_version_raw = line.split('=') + onie_verison = onie_version_raw[1].strip() break - return onie_verison + return str(onie_verison) def get_pcie_version(self): - """Get PCiE version from SONiC - :returns: version string + """Get PCiE version from SONiC + :returns: version dict { "PCIE_FW_LOADER": "2.5", "PCIE_FW": "D102_08" } + """ - cmd="sudo bcmcmd 'pciephy fw version'" - p=subprocess.Popen( + cmd = "sudo bcmcmd 'pciephy fw version'" + p = subprocess.Popen( cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - raw_data, err=p.communicate() - if err is not '': - return 'None' - else: - lines=raw_data.split('\n') + raw_data, err = p.communicate() + + pcie_version = dict() + pcie_version["PCIE_FW_LOADER"] = 'None' + pcie_version["PCIE_FW"] = 'None' + + if err == '': + lines = raw_data.split('\n') for line in lines: if 'PCIe FW loader' in line: - version=line.split(':')[1].strip() - return str(version) + pcie_version["PCIE_FW_LOADER"] = line.split(':')[1].strip() + elif 'PCIe FW version' in line: + pcie_version["PCIE_FW"] = line.split(':')[1].strip() + return pcie_version def get_fpga_version(self): """Get FPGA version from SONiC :returns: version string """ - version=self.__get_register_value(self.fpga_version_path, '0x00') + version = self.__get_register_value(self.fpga_version_path, '0x00') if version is not 'None': - version="{}.{}".format( + version = "{}.{}".format( int(version[2:][:4], 16), int(version[2:][4:], 16)) return str(version) + + def firmware_upgrade(self, fw_type, fw_path, fw_extra=None): + """ + @fw_type MANDATORY, firmware type, should be one of the strings: 'cpld', 'fpga', 'bios', 'bmc' + @fw_path MANDATORY, target firmware file + @fw_extra OPTIONAL, extra information string, + + for fw_type 'cpld' and 'fpga': it can be used to indicate specific cpld, such as 'cpld1', 'cpld2', ... + or 'cpld_fan_come_board', etc. If None, upgrade all CPLD/FPGA firmware. for fw_type 'bios' and 'bmc', + value should be one of 'master' or 'slave' or 'both' + """ + + if fw_type == 'bmc': + + # Copy BMC image file to BMC + scp_command = 'scp ' + \ + os.path.abspath(fw_path) + ' root@240.1.1.1:/home/root/' + + print "Uploading image to BMC..." + print "Running command : ", scp_command + print "Please enter the BMC password" + p = subprocess.Popen( + scp_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + raw_data, err = p.communicate() + + if err != "": + print "Failed" + return False + + print "Installing BMC image..." + + filename_w_ext = os.path.basename(fw_path) + json_data = dict() + json_data["data"] = "flashcp /home/root/" + \ + filename_w_ext + " /dev/mtd5" + json_data["timeout"] = 300 + + r = requests.post(self.bmc_raw_command_url, json=json_data) + if r.status_code == 200: + print "DONE, Rebooting BMC....." + reboot_dict = dict() + reboot_dict["data"] = "reboot" + r = requests.post(self.bmc_raw_command_url, json=reboot_dict) + else: + print "Failed" + return False + + elif fw_type == 'fpga': + command = 'fpga_prog ' + fw_path + print "Running command : ", command + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print output.strip() + rc = process.poll() + return rc + + elif 'cpld' in fw_type: + command = 'ispvm ' + fw_path + if fw_extra is not None: + command = 'ispvm -c ' + \ + str(fw_extra) + " " + os.path.abspath(fw_path) + print "Running command : ", command + process = subprocess.Popen( + command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + while True: + output = process.stdout.readline() + if output == '' and process.poll() is not None: + break + if output: + print output.strip() + rc = process.poll() + return rc + + return None diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py index e4910b1914b7..cfc4bc5ff3f5 100644 --- a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/psuutil.py @@ -2,7 +2,7 @@ __author__ = 'Wirut G.' __license__ = "GPL" -__version__ = "0.1.2" +__version__ = "0.1.3" __status__ = "Development" import requests @@ -36,6 +36,15 @@ def request_data(self): self.psu_info_list = psu_info_json.get('Information') return self.fru_status_list, self.psu_info_list + def airflow_selector(self, pn): + # Set input type. + return { + "DPS-1100FB": "FTOB", + "DPS-1100AB": "BTOF", + "FSJ026-A20G": "FTOB", + "FSJ038-A20G": "BTOF" + }.get(pn, "Unknown") + def get_num_psus(self): """ Retrieves the number of PSUs available on the device @@ -213,12 +222,21 @@ def get_all(self): "Present")).strip() == "Present" else False psu_pw_status = True if str(fru_status.get( "Power Status")).strip() == "OK" else False + psu_pw_type = str(fru_status.get( + "Power Type")).strip() + ac_status = True if str(fru_status.get( + "AC Status")).strip().upper() == "OK" else False psu_status_dict["Present"] = psu_ps_status if psu_ps_status: psu_status_dict["PowerStatus"] = psu_pw_status psu_status_dict["PN"] = psu_info_dict[psu_idx]["PN"] psu_status_dict["SN"] = psu_info_dict[psu_idx]["SN"] + psu_status_dict["InputType"] = psu_pw_type + psu_status_dict["InputStatus"] = True if psu_pw_status and psu_ps_status else False + psu_status_dict["OutputStatus"] = ac_status + psu_status_dict["AirFlow"] = self.airflow_selector( + psu_status_dict["PN"].split()[0]) all_psu_dict[find_psu[0]] = psu_status_dict return all_psu_dict diff --git a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py index 41c42fc90ed9..fc437dc8c8b7 100644 --- a/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py +++ b/device/alibaba/x86_64-alibaba_as23-128h-cl-r0/plugins/sensorutil.py @@ -13,6 +13,7 @@ class SensorUtil(): def __init__(self): self.sensor_url = "http://240.1.1.1:8080/api/sys/sensors" + self.sys_fruid_url = "http://240.1.1.1:8080/api/sys/fruid/sys" self.sensor_info_list = None def request_data(self): @@ -21,6 +22,9 @@ def request_data(self): sensor_data_req = requests.get(self.sensor_url) sensor_json = sensor_data_req.json() self.sensor_info_list = sensor_json.get('Information') + sys_fruid_req = requests.get(self.sys_fruid_url) + sys_fruid_json = sys_fruid_req.json() + self.sys_fruid_list = sys_fruid_json.get('Information') return self.sensor_info_list def input_type_selector(self, unit): @@ -311,6 +315,22 @@ def get_sensor_input_high_threshold(self, sensor_index, input_index): return sensor_input_high_threshold + def get_sys_airflow(self): + sys_air_flow = "Unknown" + sys_pn_data = [ + v.split(":") for v in self.sys_fruid_list if "Product Part Number" in v] + + if len(sys_pn_data) == 0: + return sys_air_flow + + sys_pn = sys_pn_data[0][1] + if "R1240-F0001" in sys_pn: + sys_air_flow = "FTOB" + elif"R1240-F0002" in sys_pn: + sys_air_flow = "BTOF" + + return sys_air_flow + def get_all(self): all_sensor_dict = dict() @@ -356,4 +376,8 @@ def get_all(self): all_sensor_dict[self.sensor_name].update(sensor_dict) + sensor_dict = dict() + sensor_dict["Sys_AirFlow"] = self.get_sys_airflow() + all_sensor_dict["TEMPERATURE"].update(sensor_dict) + return all_sensor_dict diff --git a/platform/broadcom/sonic-platform-modules-cel/tools/platformutil.py b/platform/broadcom/sonic-platform-modules-cel/tools/platformutil.py index 4b1aca2088dc..aeacdd523388 100644 --- a/platform/broadcom/sonic-platform-modules-cel/tools/platformutil.py +++ b/platform/broadcom/sonic-platform-modules-cel/tools/platformutil.py @@ -83,6 +83,8 @@ # // "HighThd": 15000.0, # // "PN": "PN-EXAMPLE-123", # // "SN": "SN-EXAMPLE-123" +# // "Status": True, +# // "AirFlow": "FTOB" # // }, # // "FAN1_2": { # // "Present": True, @@ -92,6 +94,8 @@ # // "HighThd": 15000.0, # // "PN": "PN-EXAMPLE-456", # // "SN": "SN-EXAMPLE-456" +# // "Status": True, +# // "AirFlow": "BTOF" # // }, # // "FAN2_1": { # // "Present": True, @@ -109,7 +113,6 @@ # // } # // } # dict get_all() - # # class SensorUtil: # int get_num_sensors(); //get the number of sensors @@ -133,6 +136,37 @@ # // Return python 'dict' objects, example: # // { # // "SensorName1": { +# // "CPU_TEMP": +# // "Type": "temperature", +# // "Value": 37.3, +# // "LowThd": 0.0, +# // "HighThd": 110.0 +# // }, +# // "SWITCH_TEMP": { +# // "Type": "temperature", +# // "Value": 45.2, +# // "LowThd": 0.0, +# // "HighThd": 108.0 +# // }, +# // "INLET_TEMP": { +# // "Type": "temperature", +# // "Value": 22.0, +# // "LowThd": 0.0, +# // "HighThd": 70.0 +# // }, +# // "Sys_AirFlow": "BTOF", +# // "Switch_VDDCore_0.8v": { +# // "Type": "voltage", +# // "Value": 0.75, +# // "LowThd": 0.7, +# // "HighThd": 0.85 +# // }, +# // "Cpu_VDDCore_0.8v": { +# // "Type": "voltage", +# // "Value": 0.75, +# // "LowThd": 0.7, +# // "HighThd": 0.85 +# // }, # // "SensorInput1": { # // "Type": "temperature", # // "Value": 30.0, @@ -181,7 +215,7 @@ except ImportError as e: raise ImportError("%s - required module not found" % str(e)) -VERSION = '1.1' +VERSION = '1.2' SYSLOG_IDENTIFIER = "platformutil" PLATFORM_PSU_MODULE_NAME = "psuutil" @@ -527,6 +561,8 @@ def status(ctx): si_names = [ k for k in sensor_obj.keys() ] si_names.sort() for si_name in si_names: + if si_name == "Sys_AirFlow": + continue si = sensor_obj[si_name] stype = si.get('Type') sval = si.get('Value')