def parse_firmware_info(raw, bios_versions=None, asrock=False): fields = firmware_fields if asrock: fields = asrock_firmware_fields bytes_read, data = parse_inventory_category_entry(raw, fields) if asrock: major_version = data['Major Firmware Revision'] minor_version = data['Minor Firmware Revision'] #Asrock RS160 the minor version is Binary Coded Decimal, convert it to Decimal minor_version = (0xff & (minor_version >> 4)) * 10 + (0xf & minor_version) aux_reversion = 0 if (str(data['Auxiliary Firmware Revision']) != ''): aux_reversion = ord(data['Auxiliary Firmware Revision']) bmc_version = "%s.%s.%s" % (str(major_version), str(minor_version), str(aux_reversion)) yield ("BMC", {'version': bmc_version}) if bios_versions != None: yield ("Bios", {'version': bios_versions[0:]}) else: del data["Revision"] for key in data: yield (key, {'version': data[key]}) if bios_versions != None: yield ("Bios_bundle_ver", { 'version': bios_versions['new_img_version'] }) yield ("Bios_current_ver", { 'version': bios_versions['cur_img_version'] })
def parse_dimm_info(raw): return parse_inventory_category_entry(raw, dimm_fields)
def parse_psu_info(raw): return parse_inventory_category_entry(raw, psu_fields)
def parse_drive_info(raw): return parse_inventory_category_entry(raw, drive_fields)
def parse_raid_controller_info(raw): return parse_inventory_category_entry(raw, raid_controller_fields)
def parse_firmware_info(raw): bytes_read, data = parse_inventory_category_entry(raw, firmware_fields) del data['Revision'] for key in data: yield (key, {'version': data[key]})