本文整理汇总了Python中common.OpTestIPMI.OpTestIPMI.ipmi_power_off方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestIPMI.ipmi_power_off方法的具体用法?Python OpTestIPMI.ipmi_power_off怎么用?Python OpTestIPMI.ipmi_power_off使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestIPMI.OpTestIPMI
的用法示例。
在下文中一共展示了OpTestIPMI.ipmi_power_off方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpTestIPMIReprovision
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [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:
#.........这里部分代码省略.........
示例2: OpTestHMIHandling
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [as 别名]
#.........这里部分代码省略.........
# 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_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
示例3: OpTestFWTS
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [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
示例4: OpTestIPMIPowerControl
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [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"
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [as 别名]
#.........这里部分代码省略.........
l_cores = sorted(l_cores.iteritems())
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()
示例6: OpTestEnergyScale
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [as 别名]
class OpTestEnergyScale():
## 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_platName=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.cv_PLATFORM = i_platName
self.util = OpTestUtil()
##
# @brief This function will get and return platform power limits for supported machine
#
# @param i_platform type: str platform name to get the power limits
#
# @return l_power_limit_low lower platform power limit
# l_power_limit_high higher platform power limit
# or raise OpTestError if it is a new platform
#
def get_platform_power_limits(self, i_platform):
l_platform = i_platform
if BMC_CONST.HABANERO in l_platform:
l_power_limit_high = BMC_CONST.HABANERO_POWER_LIMIT_HIGH
l_power_limit_low = BMC_CONST.HABANERO_POWER_LIMIT_LOW
elif BMC_CONST.FIRESTONE in l_platform:
l_power_limit_high = BMC_CONST.FIRESTONE_POWER_LIMIT_HIGH
l_power_limit_low = BMC_CONST.FIRESTONE_POWER_LIMIT_LOW
elif BMC_CONST.GARRISON in l_platform:
l_power_limit_high = BMC_CONST.GARRISON_POWER_LIMIT_HIGH
l_power_limit_low = BMC_CONST.GARRISON_POWER_LIMIT_LOW
else:
l_msg = "New platform, add power limit support to this platform and retry"
raise OpTestError(l_msg)
return l_power_limit_low, l_power_limit_high
##
# @brief This function will test Energy scale features at standby state
# 1. Power OFF the system.
# 2. Validate below Energy scale features at standby 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 standby state.
# ipmitool dcmi discover :This command is used to discover
# supported capabilities in DCMI.
# ipmitool dcmi power reading :Get power related readings from the system.
# ipmitool dcmi power get_limit :Get the configured power limits.
# ipmitool dcmi power sensors :Prints the available DCMI sensors.
# ipmitool dcmi get_temp_reading :Get Temperature Sensor Readings.
# 4. Power ON the system.
# 5. Check after system booted to runtime, whether occ's are active or not.
# 6. Again in runtime execute all dcmi commands to check the functionality.
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_energy_scale_at_standby_state(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "Energy Scale Test 1: Get, Set, activate and deactivate platform power limit at power off"
l_power_limit_low, l_power_limit_high = self.get_platform_power_limits(self.cv_PLATFORM)
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()
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [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: OpTestMCColdResetEffects
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [as 别名]
class OpTestMCColdResetEffects():
## 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.opTestSensors = OpTestSensors(i_bmcIP, i_bmcUser, i_bmcPasswd,
i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostip,
i_hostuser, i_hostPasswd)
##
# @brief This function will test BMC Cold reset vs Host FW status
# 1. When system is in runtime issue BMC Cold reset.
# 2. Check Host FW services and drivers.
# 3. Run sensors command
# 4. Get list of chips
# 5. This is expected to fail.
# https://github.com/open-power/op-build/issues/482
# 6. Reboot the system at the end of test.
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_bmc_cold_reset_effects(self):
print "Test BMC Cold reset effects versus Host Firmware Status"
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "Issue BMC Cold reset"
result = True
try:
self.cv_SYSTEM.sys_cold_reset_bmc()
l_dir = BMC_CONST.SKIBOOT_WORKING_DIR
self.cv_HOST.host_clone_skiboot_source(l_dir)
self.cv_HOST.host_compile_xscom_utilities(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")
self.cv_IPMI.run_host_cmd_on_ipmi_console("cd %s/external/xscom-utils/; ./getscom -l" % l_dir)
self.opTestSensors.test_hwmon_driver()
self.cv_SYSTEM.sys_ipmi_close_console(l_con)
except:
result = False
pass
print "Gathering the OPAL msg logs"
self.cv_HOST.host_gather_opal_msg_log()
self.cv_IPMI.ipmi_power_off()
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
if result is False:
raise OpTestError("MC Cold reset vs Host FW Test failed")
示例9: OpTestSystemBootSequence
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [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)
#.........这里部分代码省略.........
示例10: OpTestOCC
# 需要导入模块: from common.OpTestIPMI import OpTestIPMI [as 别名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_power_off [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()
#.........这里部分代码省略.........