def __init__(self, lshw, element): Component.__init__(self, lshw, element) self.data = { "slot": utils.xml_ev(lshw, element, "slot"), "size": str(int(int(utils.xml_ev(lshw, element, "size")) / 1024000000)) + "GB", "clock": int(utils.xml_ev(lshw, element, "clock")) / 1000000 if utils.xml_ev(lshw, element, "clock") else "", "type": utils.get_dmidecode_prop( "0x" + utils.xml_ev(lshw, element, "@handle", True).split(":", 1)[1], "17", "type", ), "asset_tag": "Unknown", } self.name = utils.xml_ev(lshw, element, "description") self.model = utils.xml_ev(lshw, element, "product") self.vendor = utils.normalize_vendor( utils.xml_ev(lshw, element, "vendor")) self.serial = utils.xml_ev(lshw, element, "serial") self.firmware_version = "N/A"
def list(cls, lshw): xpath = etree.XPath("//node[description='System Memory']/node") memorys = [] for memory in xpath(lshw): if "[empty]" in utils.xml_ev(lshw, memory, "description"): continue memorys.append(cls(lshw, memory)) return memorys
def list(cls, lshw): xpath = etree.XPath( "//node[@class='network'][@handle!=''][logicalname]") networks = [] for network in xpath(lshw): if utils.xml_ev(lshw, network, "logicalname") == "bond0": continue networks.append(cls(lshw, network)) return networks
def list(cls, lshw): xpath = etree.XPath("/list/node/node[1]/node[@class='processor']") processors = [] for processor in xpath(lshw): _name = utils.xml_ev(lshw, processor, "product") if _name.startswith("cpu") or _name.startswith("l2-cache"): continue processors.append(cls(lshw, processor)) return processors
def __init__(self, lshw, element): Component.__init__(self, lshw, element) self.data = { "uuid": utils.xml_ev( lshw, lshw.getroot(), "node[@class='system']/configuration/setting[@id='uuid']/@value", True, ), "date": utils.xml_ev(lshw, element, "node[@id='firmware']/date"), } self.vendor = utils.normalize_vendor( utils.xml_ev(lshw, element, "vendor")) if self.vendor == "Dell Inc.": self.model = utils.dmidecode_string("system-product-name") else: self.model = utils.xml_ev(lshw, element, "product") if self.model == "X11SSE-F": self.model = "MBD-X11SSE-F" self.name = self.model self.serial = utils.xml_ev(lshw, element, "serial") self.firmware_version = utils.xml_ev(lshw, element, "node[@id='firmware']/version")
def __init__(self, lshw, element): Component.__init__(self, lshw, element) self.name = utils.xml_ev(lshw, element, "description") self.model = utils.xml_ev(lshw, element, "product") self.serial = utils.xml_ev(lshw, element, "businfo") self.vendor = utils.normalize_vendor(utils.xml_ev(lshw, element, "vendor")) self.firmware_version = utils.xml_ev(lshw, element, "version") self.data = { "driver": utils.xml_ev( lshw, element, "configuration/setting[@id='driver']/@value", True ) } if "MegaRAID" in self.model: self.serial = utils.get_megaraid_prop("serial") for prop in ( "product_name", "firmware_bios", "firmware_ctrlr", "firmware_fw", "firmware_nvdata", "firmware_boot", "bbu", "memory_size", ): self.data["megaraid_" + prop] = utils.get_megaraid_prop(prop)
def list(cls, lshw): xpath = etree.XPath("//node[@class='storage'][@handle!='']") disk_controllers = [] for disk_controller in xpath(lshw): if ( utils.xml_ev(lshw, disk_controller, "description") == "Non-Volatile memory controller" ): continue disk_controllers.append(cls(lshw, disk_controller)) return disk_controllers
def __init__(self, lshw, element): Component.__init__(self, lshw, element) self.data = { "cores": utils.xml_ev( lshw, element, "configuration/setting[@id='cores']/@value", True ), "clock": utils.xml_ev(lshw, element, "capacity"), } self.name = utils.xml_ev(lshw, element, "product") self.model = utils.xml_ev(lshw, element, "version") self.vendor = utils.normalize_vendor(utils.xml_ev(lshw, element, "vendor")) self.serial = utils.xml_ev(lshw, element, "slot") self.firmware_version = "N/A"
def __init__(self, lshw, element): Component.__init__(self, lshw, element) self.data = { "rate": utils.xml_ev(lshw, element, "size"), "devname": utils.xml_ev(lshw, element, "logicalname"), "driver": utils.xml_ev(lshw, element, "configuration/setting[@id='driver']/@value", True), } if self.data["rate"] == "": self.data["rate"] = utils.xml_ev(lshw, element, "capacity") self.name = utils.xml_ev(lshw, element, "product") self.model = utils.xml_ev(lshw, element, "product") self.serial = utils.ethtool_mac( utils.xml_ev(lshw, element, "logicalname")) self.vendor = utils.normalize_vendor( utils.xml_ev(lshw, element, "vendor")) self.firmware_version = utils.xml_ev( lshw, element, "configuration/setting[@id='firmware']/@value", True) if not utils.xml_ev(lshw, element, "businfo") == "": self.pci_id = utils.xml_ev(lshw, element, "businfo").split(":", 1)[1] else: self.pci_id = "" if "Illegal Vendor ID" in self.vendor and self.pci_id != "": _lspci = utils.lspci(self.pci_id) self.vendor = utils.normalize_vendor(_lspci["vendor"]) self.model = _lspci["device"] self.name = self.model if "Mellanox" in self.vendor and self.pci_id != "": try: self.firmware_version = utils.get_mellanox_prop( self.pci_id, "firmware_version") self.model = utils.get_mellanox_part_number(self.pci_id) self.data["mellanox_psid"] = utils.get_mellanox_prop( self.pci_id, "psid") except Exception: self.firmware_version = "" utils.log(message="get_mellanox_prop failed.")