class OpTestIPMIPowerControl(): ## Initialize this object # @param i_bmcIP The IP address of the BMC # @param i_bmcUser The userid to log into the BMC with # @param i_bmcPasswd The password of the userid to log into the BMC with # @param i_bmcUserIpmi The userid to issue the BMC IPMI commands with # @param i_bmcPasswdIpmi The password of BMC IPMI userid # @param i_ffdcDir Optional param to indicate where to write FFDC # # "Only required for inband tests" else Default = None # @param i_hostIP The IP address of the HOST # @param i_hostuser The userid to log into the HOST # @param i_hostPasswd The password of the userid to log into the HOST with # def __init__(self, i_bmcIP, i_bmcUser, i_bmcPasswd, i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir=None, i_hostip=None, i_hostuser=None, i_hostPasswd=None): self.cv_BMC = OpTestBMC(i_bmcIP, i_bmcUser, i_bmcPasswd, i_ffdcDir) self.cv_IPMI = OpTestIPMI(i_bmcIP, i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostip, i_hostuser, i_hostPasswd) self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd, i_bmcIP) self.cv_SYSTEM = OpTestSystem(i_bmcIP, i_bmcUser, i_bmcPasswd, i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostip, i_hostuser, i_hostPasswd) self.util = OpTestUtil() ## # @brief This function will test below system power control operations # IPMI Power ON # Power OFF # Power Soft # Power Cycle # Power Reset # So each operation is executed through ipmi commands. and # check_system_status function will check whether FW and Host OS # Boot completed or not. # # @return BMC_CONST.FW_SUCCESS or raise OpTestError # def testIPMIPowerControl(self): self.cv_SYSTEM.sys_bmc_power_on_validate_host() print "Performing a IPMI Power OFF Operation" # Perform a IPMI Power OFF Operation(Immediate Shutdown) self.cv_IPMI.ipmi_power_off() if int(self.cv_SYSTEM.sys_wait_for_standby_state(BMC_CONST.SYSTEM_STANDBY_STATE_DELAY)) == 0: print "System is in standby/Soft-off state" else: l_msg = "System failed to reach standby/Soft-off state" raise OpTestError(l_msg) print "Performing a IPMI Power ON Operation" # Perform a IPMI Power ON Operation self.cv_IPMI.ipmi_power_on() self.check_system_status() self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE) print "Performing a IPMI Soft Power OFF Operation" # Perform a IPMI Soft Power OFF Operation(Graceful shutdown) self.cv_IPMI.ipmi_power_soft() if int(self.cv_SYSTEM.sys_wait_for_standby_state(BMC_CONST.SYSTEM_STANDBY_STATE_DELAY)) == 0: print "System is in standby/Soft-off state" else: l_msg = "System failed to reach standby/Soft-off state" raise OpTestError(l_msg) print "Perform a IPMI Power ON Operation" # Perform a IPMI Power ON Operation self.cv_IPMI.ipmi_power_on() self.check_system_status() self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE) print "Performing a IPMI Power Cycle(Soft reboot) Operation " # Perform a IPMI Power Cycle(Soft reboot) Operation only when system is in ON state self.cv_IPMI.ipmi_power_cycle() self.check_system_status() self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE) print "Performing a IPMI Power Hard Reset Operation" # Perform a IPMI Power Hard Reset Operation self.cv_IPMI.ipmi_power_reset() self.check_system_status() self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE) return BMC_CONST.FW_SUCCESS ## # @brief This function will check for system status and wait for # FW and Host OS Boot progress to complete. # # @return BMC_CONST.FW_SUCCESS or raise OpTestError # def check_system_status(self): if int(self.cv_SYSTEM.sys_ipl_wait_for_working_state()) == 0: print "System booted to working state" else: l_msg = "System failed to boot" raise OpTestError(l_msg) if int(self.cv_SYSTEM.sys_wait_for_os_boot_complete()) == 0: print "System booted to Host OS" else: l_msg = "System failed to boot Host OS" raise OpTestError(l_msg) return BMC_CONST.FW_SUCCESS