本文整理汇总了Python中common.OpTestIPMI.OpTestIPMI.ipmi_power_on方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestIPMI.ipmi_power_on方法的具体用法?Python OpTestIPMI.ipmi_power_on怎么用?Python OpTestIPMI.ipmi_power_on使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestIPMI.OpTestIPMI
的用法示例。
在下文中一共展示了OpTestIPMI.ipmi_power_on方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpTestFWTS
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
class OpTestFWTS():
## 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, i_ffdcDir)
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()
self.user = i_hostuser
self.ip = i_hostip
self.passwd = i_hostPasswd
##
# @brief This function just brings the system to host OS.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_system_reboot(self):
print "Testing FWTS: Booting system to OS"
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)) == BMC_CONST.FW_SUCCESS:
print "System is in standby/Soft-off state"
else:
l_msg = "System failed to reach standby/Soft-off state"
raise OpTestError(l_msg)
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
self.cv_IPMI.clear_ssh_keys(self.cv_HOST.ip)
print "Gathering the OPAL msg logs"
self.cv_HOST.host_gather_opal_msg_log()
return BMC_CONST.FW_SUCCESS
##
# @brief This function just executes the fwts_execution.sh on host OS
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_fwts(self):
l_oslevel = self.cv_HOST.host_get_OS_Level()
if not "Ubuntu" in l_oslevel:
return
# Copy the fwts execution file to the tmp folder in the host
base_path = (os.path.dirname(os.path.abspath(__file__))).split('testcases')[0]
fwts_script = base_path + "/testcases/fwts_execution.sh"
try:
self.util.copyFilesToDest(fwts_script, self.user,
self.ip, "/tmp/", self.passwd)
except:
l_msg = "Copying fwts file to host failed"
print l_msg
raise OpTestError(l_msg)
l_res = self.cv_HOST.host_run_command("/tmp/fwts_execution.sh")
print l_res
示例2: OpTestIPMIReprovision
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
class OpTestIPMIReprovision():
## 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, i_ffdcDir)
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()
self.opTestHMIHandling = OpTestHMIHandling(i_bmcIP, i_bmcUser, i_bmcPasswd,
i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostIP,
i_hostUser, i_hostPasswd)
##
# @brief This function will cover following test steps
# Testcase: NVRAM Partition-IPMI Reprovision
# 1. Update NVRAM config data with test config data
# i.e "nvram --update-config test-name=test-value"
# 2. Issue an IPMI PNOR Reprovision request command, to reset NVRAM partition to default.
# 3. Wait for PNOR Reprovision progress to complete(00).
# 4. Do a Hard reboot(Power OFF/ON) to avoid nvram cache data.
# 5. Once system booted, check for NVRAM parition whether the test config data
# got erased or not.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_nvram_ipmi_reprovision(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
self.cv_HOST.host_run_command("uname -a")
self.cv_HOST.host_run_command(BMC_CONST.NVRAM_PRINT_CFG)
print "IPMI_Reprovision: Updating the nvram partition with test cfg data"
self.cv_HOST.host_run_command(BMC_CONST.NVRAM_UPDATE_CONFIG_TEST_DATA)
self.cv_HOST.host_run_command(BMC_CONST.NVRAM_PRINT_CFG)
print "IPMI_Reprovision: issuing ipmi pnor reprovision request"
self.cv_SYSTEM.sys_issue_ipmi_pnor_reprovision_request()
print "IPMI_Reprovision: wait for reprovision to complete"
self.cv_SYSTEM.sys_wait_for_ipmi_pnor_reprovision_to_complete()
print "IPMI_Reprovision: gathering the opal message logs"
self.cv_HOST.host_gather_opal_msg_log()
print "IPMI_Reprovision: 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)) == BMC_CONST.FW_SUCCESS:
print "IPMI_Reprovision: System is in standby/Soft-off state"
else:
l_msg = "IPMI_Reprovision: System failed to reach standby/Soft-off state after pnor reprovisioning"
raise OpTestError(l_msg)
print "IPMI_Reprovision: Performing a IPMI Power ON Operation"
# Perform a IPMI Power ON Operation
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
l_res = self.cv_HOST.host_run_command(BMC_CONST.NVRAM_PRINT_CFG)
if l_res.__contains__(BMC_CONST.NVRAM_TEST_DATA):
l_msg = "NVRAM Partition - IPMI Reprovision not happening, nvram test config data still exists"
raise OpTestError(l_msg)
print "NVRAM Partition - IPMI Reprovision is done, cleared the nvram test config data"
self.cv_HOST.host_gather_opal_msg_log()
return BMC_CONST.FW_SUCCESS
##
# @brief This function will cover following test steps
# Testcase: GARD Partition-IPMI Reprovision
# 1. Inject core checkstop using existed function from OpTestHMIHandling.py
# 2. Do a Hard reboot(IPMI Power OFF/ON)
# 2. Issue an IPMI PNOR Reprovision request command, to reset GUARD partition to default.
# 3. Wait for IPMI PNOR Reprovision progress to complete(00).
# 4. Check for GUARD parition whether the existing gard records erased or not.
# 6. Reboot the system back to see system is booting fine or not.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_gard_ipmi_reprovision(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "IPMI_Reprovision: Injecting system core checkstop to guard the phyisical cpu"
self.opTestHMIHandling.testHMIHandling(BMC_CONST.HMI_MALFUNCTION_ALERT)
print "IPMI_Reprovision: 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)) == BMC_CONST.FW_SUCCESS:
print "IPMI_Reprovision: System is in standby/Soft-off state"
else:
#.........这里部分代码省略.........
示例3: __init__
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
#.........这里部分代码省略.........
print l_cores
i = 0
for tup in l_cores:
new_list = [l_chips[i], tup[1]]
self.l_dic.append(new_list)
i += 1
print self.l_dic
# self.l_dic is a list of chip id's, core id's . and is of below format
# [['00000000', ['4', '5', '6', 'c', 'd', 'e']], ['00000001', ['4', '5', '6', 'c', 'd', 'e']], ['00000010', ['4', '5', '6', 'c', 'd', 'e']]]
self.l_dir = l_dir
# In-order to inject HMI errors on cpu's, cpu should be running, so disabling the sleep states 1 and 2 of all CPU's
self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE2)
self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE1)
self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE0)
self.cv_LPAR.lpar_run_command(BMC_CONST.DISABLE_CPU_SLEEP_STATE1)
self.cv_LPAR.lpar_run_command(BMC_CONST.DISABLE_CPU_SLEEP_STATE2)
self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE2)
self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE1)
self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE0)
##
# @brief This function is mainly used to clear hardware gard entries.
# It will perform below steps
# 1. Reboot the system(Power off/on)
# 2. Clear any Hardware gard entries
# 3. Again reboot the system, to make use of garded Hardware.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def clearGardEntries(self):
# Power off and on the system.
self.cv_IPMI.ipmi_power_off()
self.cv_IPMI.ipmi_power_on()
if int(self.cv_SYSTEM.sys_ipl_wait_for_working_state()):
l_msg = "System failed to boot host OS"
raise OpTestError(l_msg)
time.sleep(BMC_CONST.LPAR_BRINGUP_TIME)
# Clearing gard entries after lpar comes up
self.cv_LPAR.lpar_get_OS_Level()
l_con = self.cv_SYSTEM.sys_get_ipmi_console()
self.cv_IPMI.ipmi_lpar_login(l_con)
self.cv_IPMI.ipmi_lpar_set_unique_prompt(l_con)
self.cv_IPMI.run_lpar_cmd_on_ipmi_console("uname -a")
l_dir = "/tmp/skiboot"
self.cv_IPMI.run_lpar_cmd_on_ipmi_console("cd %s/external/gard/;" % l_dir)
l_cmd = "./gard list; echo $?"
self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
l_cmd = "./gard clear all; echo $?"
l_res = self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
if int(l_res[-1]):
l_msg = "Clearing gard entries through gard tool is failed"
raise OpTestError(l_msg)
l_cmd = "./gard list; echo $?"
self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
# Rebooting the system again to make use of garded hardware
self.cv_IPMI.ipmi_power_off()
self.cv_IPMI.ipmi_power_on()
if int(self.cv_SYSTEM.sys_ipl_wait_for_working_state()):
l_msg = "System failed to boot host OS"
raise OpTestError(l_msg)
time.sleep(BMC_CONST.LPAR_BRINGUP_TIME)
self.cv_LPAR.lpar_get_OS_Level()
self.cv_SYSTEM.sys_ipmi_close_console(l_con)
示例4: OpTestHMIHandling
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
#.........这里部分代码省略.........
# [['00000000', ['4', '5', '6', 'c', 'd', 'e']], ['00000001', ['4', '5', '6', 'c', 'd', 'e']], ['00000010', ['4', '5', '6', 'c', 'd', 'e']]]
self.l_dir = l_dir
# In-order to inject HMI errors on cpu's, cpu should be running, so disabling the sleep states 1 and 2 of all CPU's
self.cv_HOST.host_run_command(BMC_CONST.GET_CPU_SLEEP_STATE2)
self.cv_HOST.host_run_command(BMC_CONST.GET_CPU_SLEEP_STATE1)
self.cv_HOST.host_run_command(BMC_CONST.GET_CPU_SLEEP_STATE0)
self.cv_HOST.host_run_command(BMC_CONST.DISABLE_CPU_SLEEP_STATE1)
self.cv_HOST.host_run_command(BMC_CONST.DISABLE_CPU_SLEEP_STATE2)
self.cv_HOST.host_run_command(BMC_CONST.GET_CPU_SLEEP_STATE2)
self.cv_HOST.host_run_command(BMC_CONST.GET_CPU_SLEEP_STATE1)
self.cv_HOST.host_run_command(BMC_CONST.GET_CPU_SLEEP_STATE0)
if "Ubuntu" in self.l_oslevel:
self.cv_HOST.host_run_command("service kdump-tools stop")
self.cv_HOST.host_run_command("service kdump-tools status")
else:
self.cv_HOST.host_run_command("service kdump stop")
self.cv_HOST.host_run_command("service kdump status")
##
# @brief This function is mainly used to clear hardware gard entries.
# It will perform below steps
# 1. Reboot the system(Power off/on)
# 2. Clear any Hardware gard entries
# 3. Again reboot the system, to make use of garded Hardware.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def clearGardEntries(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Power off and on the system.
self.cv_IPMI.ipmi_power_off()
self.cv_IPMI.ipmi_power_on()
if int(self.cv_SYSTEM.sys_ipl_wait_for_working_state()):
l_msg = "System failed to boot host OS"
raise OpTestError(l_msg)
time.sleep(BMC_CONST.HOST_BRINGUP_TIME)
# Clearing gard entries after host comes up
self.cv_HOST.host_get_OS_Level()
# It will clone skiboot source repository
l_dir = "/tmp/skiboot"
self.cv_HOST.host_clone_skiboot_source(l_dir)
# Compile the necessary tools xscom-utils and gard utility
self.cv_HOST.host_compile_xscom_utilities(l_dir)
self.cv_HOST.host_compile_gard_utility(l_dir)
l_con = self.cv_SYSTEM.sys_get_ipmi_console()
self.cv_IPMI.ipmi_host_login(l_con)
self.cv_IPMI.ipmi_host_set_unique_prompt(l_con)
self.cv_IPMI.run_host_cmd_on_ipmi_console("uname -a")
l_dir = "/tmp/skiboot"
self.cv_IPMI.run_host_cmd_on_ipmi_console("cd %s/external/gard/;" % l_dir)
l_cmd = "./gard list; echo $?"
self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
l_cmd = "./gard clear all; echo $?"
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
if int(l_res[-1]):
l_msg = "Clearing gard entries through gard tool is failed"
raise OpTestError(l_msg)
l_cmd = "./gard list; echo $?"
self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
# Rebooting the system again to make use of garded hardware
self.cv_IPMI.ipmi_power_off()
示例5: OpTestIPMIPowerControl
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
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"
#.........这里部分代码省略.........
示例6: OpTestEnergyScale
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
#.........这里部分代码省略.........
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)
self.cv_IPMI.ipmi_sdr_clear()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_set_power_limit(l_power_limit_high)
self.cv_IPMI.ipmi_activate_power_limit()
self.cv_IPMI.ipmi_deactivate_power_limit()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_activate_power_limit()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_deactivate_power_limit()
self.cv_IPMI.ipmi_set_power_limit(l_power_limit_low)
self.cv_IPMI.ipmi_activate_power_limit()
print self.cv_IPMI.ipmi_get_power_limit()
self.cv_IPMI.ipmi_set_power_limit(l_power_limit_high)
self.cv_IPMI.ipmi_get_power_limit()
print "Get All dcmi readings at power off"
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_DISCOVER)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_POWER_READING)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_POWER_GET_LIMIT)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_SENSORS)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_GET_MC_ID_STRING)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_GET_TEMP_READING)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_GET_CONF_PARAM)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_OOB_DISCOVER)
print "Performing a IPMI Power ON Operation"
# Perform a IPMI Power ON Operation
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
l_status = self.cv_IPMI.ipmi_get_occ_status()
print l_status
if BMC_CONST.OCC_DEVICE_ENABLED in l_status:
print "OCC's are up and active"
else:
l_msg = "OCC's are not in active state"
raise OpTestError(l_msg)
print self.cv_IPMI.ipmi_get_power_limit()
print "Get All dcmi readings at runtime"
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_DISCOVER)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_POWER_READING)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_POWER_GET_LIMIT)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_SENSORS)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_GET_MC_ID_STRING)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_GET_TEMP_READING)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_GET_CONF_PARAM)
self.run_ipmi_cmd(BMC_CONST.IPMI_DCMI_OOB_DISCOVER)
##
# @brief This function will test Energy scale features at standby state
# 1. Power OFF the system.
# 2. Power On the system to boot to host OS
# 2. Validate below Energy scale features at runtime state
# ipmitool dcmi power get_limit :Get the configured power limits.
# ipmitool dcmi power set_limit limit <value> :Power Limit Requested in Watts.
# ipmitool dcmi power activate :Activate the set power limit.
# ipmitool dcmi power deactivate :Deactivate the set power limit.
# 3. Once platform power limit activated execute below dcmi commands at runtime state.
# ipmitool dcmi discover :This command is used to discover
示例7: __init__
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
class OpTestPCI:
## 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,
i_hostLspci=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, i_ffdcDir)
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()
self.lspci_file = i_hostLspci
##
# @brief This function will get the PCI and USB susbsytem Info
# And also this test compares known good data of
# "lspci -mm -n" which is stored in testcases/data directory
# with the current lspci data.
# User need to specify the corresponding file name into
# machines xml like lspci.txt which contains "lspci -mm -n"
# command output in a working good state of system.
# tools used are lspci and lsusb
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_host_pci_devices_info(self):
if self.lspci_file == "empty.txt":
print "Skipping the pci devices comparision as missing the lspci data file name in machines xml"
return BMC_CONST.FW_SUCCESS
filename = os.path.join(os.path.dirname(__file__).split("testcases")[0], self.lspci_file)
if not os.path.isfile(filename):
raise OpTestError("lspci file %s not found in top level directory" % filename)
self.pci_good_data_file = filename
self.test_skiroot_pci_devices()
self.cv_IPMI.ipmi_set_boot_to_disk()
self.cv_IPMI.ipmi_power_off()
self.cv_IPMI.ipmi_power_on()
self.cv_IPMI.ipl_wait_for_working_state()
self.test_host_pci_devices()
##
# @brief This function will get the "lspci -mm -n" output from the petitboot
# and compares it with known good lspci data
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_skiroot_pci_devices(self):
cmd = "lspci -mm -n"
self.console = self.cv_SYSTEM.sys_get_ipmi_console()
self.cv_SYSTEM.sys_ipmi_boot_system_to_petitboot(self.console)
self.cv_IPMI.ipmi_host_set_unique_prompt(self.console)
self.cv_IPMI.run_host_cmd_on_ipmi_console("uname -a")
self.cv_IPMI.run_host_cmd_on_ipmi_console("cat /etc/os-release")
res = self.cv_IPMI.run_host_cmd_on_ipmi_console(cmd)
self.cv_SYSTEM.sys_ipmi_close_console(self.console)
self.pci_data_petitboot = "\n".join(res[1:])
diff_process = subprocess.Popen(["diff", "-u", self.pci_good_data_file, "-"], stdin=subprocess.PIPE)
diff_stdout, diff_stderr = diff_process.communicate(self.pci_data_petitboot + "\n")
r = diff_process.wait()
if r == 0:
print "All the pci devices are detected at petitboot"
else:
print diff_stdout
raise OpTestError("There is a mismatch b/w known good output and tested petitboot lspci output")
##
# @brief This function will get the "lspci -mm -n" output from the host OS
#.........这里部分代码省略.........
示例8: OpTestSystemBootSequence
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
class OpTestSystemBootSequence():
## 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, i_ffdcDir)
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 mc cold reset boot sequence
# It has below steps
# 1. Do a system Power OFF(Host should go down)
# 2. Set auto reboot policy to off(chassis policy always-off)
# 3. Issue a BMC Cold reset.
# 4. After BMC comes up, Issue a Power ON of the system
# 5. Check for system status and gather OPAL msg log.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def testMcColdResetBootSequence(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "Testing MC Cold reset boot sequence"
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 "Setting the system power policy to always-off"
self.cv_IPMI.ipmi_set_power_policy("always-off")
# Perform a BMC Cold Reset Operation
self.cv_IPMI.ipmi_cold_reset()
print "Performing a IPMI Power ON Operation"
# Perform a IPMI Power ON Operation
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
self.cv_IPMI.clear_ssh_keys(self.cv_HOST.ip)
print "Gathering the OPAL msg logs"
self.cv_HOST.host_gather_opal_msg_log()
return BMC_CONST.FW_SUCCESS
##
# @brief This function will test mc warm reset boot sequence
# It has below steps
# 1. Do a system Power OFF(Host should go down)
# 2. Set auto reboot policy to off(chassis policy always-off)
# 3. Issue a BMC Warm reset.
# 4. After BMC comes up, Issue a Power ON of the system
# 5. Check for system status and gather OPAL msg log.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def testMcWarmResetBootSequence(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "Testing MC Warm reset boot sequence"
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 "Setting the system power policy to always-off"
self.cv_IPMI.ipmi_set_power_policy("always-off")
# Perform a BMC Warm Reset Operation
self.cv_IPMI.ipmi_warm_reset()
print "Performing a IPMI Power ON Operation"
# Perform a IPMI Power ON Operation
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
self.cv_IPMI.clear_ssh_keys(self.cv_HOST.ip)
#.........这里部分代码省略.........
示例9: OpTestOCC
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_on [as 别名]
class OpTestOCC():
## 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 is used to test OCC Reset funtionality in BMC based systems.
# OCC Reset reload is limited to 3 times per full power cycle.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_occ_reset_functionality(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)
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
if self.check_occ_status() == BMC_CONST.FW_FAILED:
l_msg = "OCC's are not in active state"
#raise OpTestError(l_msg)
print "OPAL-PRD: OCC Enable"
self.cv_HOST.host_run_command(BMC_CONST.OCC_ENABLE)
print "OPAL-PRD: OCC DISABLE"
self.cv_HOST.host_run_command(BMC_CONST.OCC_DISABLE)
print "OPAL-PRD: OCC RESET"
self.cv_HOST.host_run_command(BMC_CONST.OCC_RESET)
time.sleep(60)
if self.check_occ_status() == BMC_CONST.FW_FAILED:
l_msg = "OCC's are not in active state"
#raise OpTestError(l_msg)
print "OPAL-PRD: OCC Enable"
self.cv_HOST.host_run_command(BMC_CONST.OCC_ENABLE)
print "OPAL-PRD: OCC DISABLE"
self.cv_HOST.host_run_command(BMC_CONST.OCC_DISABLE)
print "OPAL-PRD: OCC RESET"
self.cv_HOST.host_run_command(BMC_CONST.OCC_RESET)
time.sleep(60)
if self.check_occ_status() == BMC_CONST.FW_FAILED:
l_msg = "OCC's are not in active state"
#raise OpTestError(l_msg)
print "OPAL-PRD: OCC Enable"
self.cv_HOST.host_run_command(BMC_CONST.OCC_ENABLE)
print "OPAL-PRD: OCC DISABLE"
self.cv_HOST.host_run_command(BMC_CONST.OCC_DISABLE)
print "OPAL-PRD: OCC RESET"
self.cv_HOST.host_run_command(BMC_CONST.OCC_RESET)
time.sleep(60)
if self.check_occ_status() == BMC_CONST.FW_FAILED:
l_msg = "OCC's are not in active state, rebooting the system"
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)
self.cv_IPMI.ipmi_power_on()
self.cv_SYSTEM.sys_check_host_status()
if self.check_occ_status() == BMC_CONST.FW_FAILED:
l_msg = "OCC's are not in active state"
raise OpTestError(l_msg)
##
# @brief This function is used to test OCC Reset funtionality in BMC based systems.
# OCC Reset reload can be done more than 3 times per full power cycle, by
# resetting OCC resetreload count.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_occ_reset_n_times(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
#.........这里部分代码省略.........