def __init__ (self, psu_id, psu): """ Initialize the PSU information. :param psu_id: The ID of the PSU. :param psu: The result of the system query for power supply information. """ self.id = str (psu_id) self.serial = psu.get ("Board Serial", None) self.state = "ON" if (check_success (psu)) else "NA" self.type = None if (psu_id == 1): self.power = psu.get ("Feed1Phase1PowerInWatts", -1) elif (psu_id == 2): self.power = psu.get ("Feed1Phase2PowerInWatts", -1) elif (psu_id == 3): self.power = psu.get ("Feed1Phase3PowerInWatts", -1) elif (psu_id == 4): self.power = psu.get ("Feed2Phase1PowerInWatts", -1) elif (psu_id == 5): self.power = psu.get ("Feed2Phase2PowerInWatts", -1) elif (psu_id == 6): self.power = psu.get ("Feed2Phase3PowerInWatts", -1) else: self.power = psu.get ("PowerDrawnInWatts", -1) self.power = str (int (self.power))
def __init__ (self, info): """ Initialize the controller information. :param info: The result of the system query for controller information. """ self.serial = info.get ("Board Serial", None) self.asset_tag = info.get ("Product Assettag", None) self.fw = "NA" if (check_success (info)) else None self.hw = info.get ("Board Version", None) self.sw = info.get ("Package", None) self.uptime = info.get ("Up Time", None)
def __init__ (self, nic = None): """ Initialize the blade NIC information. :param nic: The result of the system query for blade NIC information. """ if (nic): self.id = "1" if check_success (nic) else "0" self.mac = nic.get ("MAC1", None) else: self.id = "2" self.mac = None
def __init__ (self, info): """ Initialize the blade info response. :param info: The result of the system query for blade info. """ server = info.get ("Server", {}) if (check_success (info)): self.type = "Server" else: self.type = None self.serial = info.get ("SerialNumber", None) self.asset_tag = info.get ("AssetTag", None) self.fw = server.get ("BMCVersion", None) self.hw = server.get ("HWVersion", None)
def get_nic_list (mac): """ Get the list of NIC information objects for the system. :param mac: The result of the system query for blade NIC information. :return A list contaning response objects for the NIC information. """ nics = [] if (mac): status = request_status (mac) nic1 = blade_nic_info (mac) nics.append (response_category ("NicInfo", status = status, results = [nic1])) if (check_success (mac)): status = request_status (set_failure_dict ("Not Present", "Success")) nic2 = blade_nic_info () nics.append (response_category ("NicInfo", status = status, results = [nic2])) return nics