def parse_statusWord(tempList):
    value = CMM.convert_to_decimal_multi(tempList[2:4])
    if str(value) == "0" or value > 0:
        return value
    return "Unknown"
Exemple #2
0
 def c_get_node_via_ipmi(self):
     global Present_Node
     global IPMI_NODE_FAIL
     global IPMI_NODE_INFO
     global CASE_PASS
     temp_text = "- Get Node info via IPMI -"
     CMM.show_message(format_item(temp_text),
                      color="green",
                      timestamp=False)
     CMM.save_data(main_log, temp_text, timestamp=False)
     MAIN_LOG_list.append(temp_text)
     for node_id in range(NODE_NUM):
         node = "Node{0}".format(node_id + 1)
         is_fail = False
         OEM_nodeIndex, OEM_pwrState, OEM_pwrConsumption, OEM_ipSrc, OEM_ip, \
         OEM_netmask, OEM_gateway = ["Unknown"] * 7
         try:
             OEM_nodeIndex = node_id + 1
             temp = check_node_Present(node_id)
             if temp == "00":
                 OEM_pwrState = 2
             elif temp == "01":
                 Present_Node.append(node_id + 1)
                 temp2 = check_node_PwrState(node_id)
                 if temp2 == "01":
                     OEM_pwrState = 1
                 elif temp2 == "00":
                     OEM_pwrState = 0
             temp = check_node_PwrConsumption(node_id)
             OEM_pwrConsumption = CMM.convert_to_decimal_multi(temp.split(),
                                                               prior="L")
             temp_list = check_node_LAN(node_id)
             temp = temp_list[0]
             if temp == "01":
                 OEM_ipSrc = 1
             elif temp == "02":
                 OEM_ipSrc = 2
             elif temp == "00":
                 OEM_ipSrc = 0
             OEM_ip = CMM.convert_to_IP(temp_list[1].split(), vers=4)
             OEM_netmask = CMM.convert_to_IP(temp_list[2].split(), vers=4)
             OEM_gateway = CMM.convert_to_IP(temp_list[3].split(), vers=4)
         except Exception as e:
             temp_text = "[Exception] {0}".format(e)
             MAIN_LOG_list.append(temp_text)
             CMM.show_message(temp_text, timestamp=False, color="red")
             CMM.save_data(main_log, temp_text, color="red")
             IPMI_NODE_FAIL = True
             is_fail = True
         IPMI_NODE_INFO.append([
             OEM_nodeIndex, OEM_pwrState, OEM_pwrConsumption, OEM_ipSrc,
             OEM_ip, OEM_netmask, OEM_gateway
         ])
         temp_text = "[{0}] IPMI info".format(node)
         if is_fail:
             CASE_PASS = False
             CMM.save_step_result(main_log, temp_text, "FAIL")
             show_step_result(temp_text, "FAIL")
             MAIN_LOG_list.append("{0} FAIL !".format(temp_text))
         else:
             CMM.save_step_result(main_log, temp_text, "PASS")
             show_step_result(temp_text, "PASS")
     CMM.save_data(main_log,
                   "IPMI Node info list\n{0}".format(IPMI_NODE_INFO),
                   timestamp=False)