本文整理汇总了Python中common.OpTestSystem.OpTestSystem.sys_get_ipmi_console方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestSystem.sys_get_ipmi_console方法的具体用法?Python OpTestSystem.sys_get_ipmi_console怎么用?Python OpTestSystem.sys_get_ipmi_console使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestSystem.OpTestSystem
的用法示例。
在下文中一共展示了OpTestSystem.sys_get_ipmi_console方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpTestDropbearSafety
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
class OpTestDropbearSafety():
## 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 tests Dropbear running functionality in skiroot
# 1. Power Off the system
# 2. Power on the system
# 3. Exit to the petitboot shell
# 4. Execute ps command
# 5. test will fail incase dropbear is running and listed out by ps
# 6. At the end of test reboot the system to OS.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_dropbear_running(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
print "Test Dropbear running in Petitboot"
print "Performing IPMI Power Off Operation"
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")
# we don't grep for 'dropbear' so that our naive line.count
# below doesn't hit a false positive.
res = self.cv_IPMI.run_host_cmd_on_ipmi_console("ps|grep drop")
print res
self.cv_IPMI.ipmi_set_boot_to_disk()
for line in res:
if line.count('dropbear'):
raise OpTestError("drobear is running in the skiroot")
return BMC_CONST.FW_SUCCESS
示例2: OpTestIPMIReprovision
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
#.........这里部分代码省略.........
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:
l_msg = "IPMI_Reprovision: System failed to reach standby/Soft-off state"
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)
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()
self.cv_HOST.host_get_OS_Level()
self.cv_HOST.host_clone_skiboot_source(BMC_CONST.CLONE_SKIBOOT_DIR)
# Compile the necessary tools xscom-utils and gard utility
self.cv_HOST.host_compile_gard_utility(BMC_CONST.CLONE_SKIBOOT_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_res = self.cv_SYSTEM.sys_list_gard_records(BMC_CONST.GARD_TOOL_DIR)
print l_res
if BMC_CONST.NO_GARD_RECORDS in l_res:
print "GUARD Partition - IPMI Reprovision is done, cleared HW gard records"
else:
l_msg = "IPMI: Reprovision not happening, gard records are not erased"
raise OpTestError(l_msg)
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"
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)
print "IPMI_Reprovision: gathering the opal message logs"
self.cv_HOST.host_gather_opal_msg_log()
return BMC_CONST.FW_SUCCESS
示例3: OpTestHMIHandling
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
#.........这里部分代码省略.........
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()
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)
self.cv_HOST.host_get_OS_Level()
self.cv_SYSTEM.sys_ipmi_close_console(l_con)
##
# @brief This function executes HMI test case based on the i_test value, Before test starts
# disabling kdump service to make sure system reboots, after injecting non-recoverable errors.
#
# @param i_test @type int: this is the type of test case want to execute
# BMC_CONST.HMI_PROC_RECV_DONE: Processor recovery done
# BMC_CONST.HMI_PROC_RECV_ERROR_MASKED: proc_recv_error_masked
示例4: OpTestPrdDriver
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
class OpTestPrdDriver():
## 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 performs below steps
# 1. Initially connecting to host and ipmi consoles for execution.
# 2. check for IPOLL mask register value to see whether opal-prd is running or not
# if it is 0-->opal-prd is running-->continue
# else start opal-prd service again
# 3. call test_prd_for_fir() function for each core FIR error and this function
# can be used for any number of errors, like it is a generic function
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def testPrdDriver(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
self.test_init()
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("cd %s/external/xscom-utils/;" % BMC_CONST.CLONE_SKIBOOT_DIR)
# check for IPOLL mask register value to check opal-prd is running or not
l_cmd = "./getscom -c 0x0 %s" % BMC_CONST.IPOLL_MASK_REGISTER
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
if l_res[-1] == BMC_CONST.IPOLL_MASK_REGISTER_CONTENT:
print "Opal-prd is running"
else:
self.cv_IPMI.run_host_cmd_on_ipmi_console("service opal-prd start")
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
if l_res[-1] == BMC_CONST.IPOLL_MASK_REGISTER_CONTENT:
print "Opal-prd is running"
else:
l_msg = "IPOLL MASK REGISTER is not getting cleared by opal-prd"
raise OpTestError(l_msg)
# test for PBA FIR with different core errors
# 1.PBAFIR_OCI_APAR_ERR-->OCI Address Parity Error
print "PRD: Test for PBAFIR_OCI_APAR_ERR-->OCI Address Parity Error"
self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
BMC_CONST.PBAFIR_OCI_APAR_ERR)
# 2.PBAFIR_PB_CE_FW-->PB Read Data CE Error for Forwarded Request
print "PRD: Test for PBAFIR_PB_CE_FW-->PB Read Data CE Error for Forwarded Request"
self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
BMC_CONST.PBAFIR_PB_CE_FW)
# 3.PBAFIR_PB_RDDATATO_FW-->PB Read Data Timeout for Forwarded Request
print "PRD: Test for PBAFIR_PB_RDDATATO_FW-->PB Read Data Timeout for Forwarded Request"
self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
BMC_CONST.PBAFIR_PB_RDDATATO_FW)
# 4.PBAFIR_PB_RDADRERR_FW-->PB CRESP Addr Error Received for Forwarded Read Request
print "PRD: Test for PBAFIR_PB_RDADRERR_FW-->PB CRESP Addr Error Received for Forwarded Read Request"
self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
BMC_CONST.PBAFIR_PB_RDADRERR_FW)
return BMC_CONST.FW_SUCCESS
##
# @brief This function injects some core FIR errors and verifies whether opal-prd clears the errors.
# and also this function injects errors on random chip.
#
# @param FIR @type str: Local Fault Isolation register
# @param FIMR @type str: Local Fault Isolation mask register
# @param ERROR @type int: Core FIR error, this error will be written to FIR.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_prd_for_fir(self, FIR, FIMR, ERROR):
chip_id = "0x" + self.random_chip
print chip_id
print "OPAL-PRD: Injecting error 0x%x on FIR: %s" % (ERROR, FIR)
# Read Local Fault Isolation register
l_cmd = "./getscom -c %s %s" % (chip_id, FIR)
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [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_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)
##
# @brief This function executes HMI test case based on the i_test value, Before test starts
# disabling kdump service to make sure system reboots, after injecting non-recoverable errors.
#
# @param i_test @type int: this is the type of test case want to execute
# BMC_CONST.HMI_PROC_RECV_DONE: Processor recovery done
# BMC_CONST.HMI_PROC_RECV_ERROR_MASKED: proc_recv_error_masked
示例6: OpTestIPMILockMode
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
class OpTestIPMILockMode():
## 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_lparIP The IP address of the LPAR
# @param i_lparuser The userid to log into the LPAR
# @param i_lparPasswd The password of the userid to log into the LPAR with
#
def __init__(self, i_bmcIP, i_bmcUser, i_bmcPasswd,
i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir=None, i_lparip=None,
i_lparuser=None, i_lparPasswd=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_lparip, i_lparuser, i_lparPasswd)
self.cv_LPAR = OpTestLpar(i_lparip, i_lparuser, i_lparPasswd, i_bmcIP)
self.cv_SYSTEM = OpTestSystem(i_bmcIP, i_bmcUser, i_bmcPasswd,
i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_lparip,
i_lparuser, i_lparPasswd)
self.util = OpTestUtil()
##
# @brief This function will cover following test steps
# 1. It will get the OS level installed on power platform
# 2. It will check for kernel version installed on the Open Power Machine
# 3. It will check for ipmitool command existence and ipmitool package
# 4. Load the necessary ipmi modules based on config values
# 5. Issue a ipmi lock command through out-of-band authenticated interface
# 6. Now BMC IPMI is in locked mode, at this point only white listed
# in-band ipmi commands sholud work(No other in-band ipmi command should work)
# 7. Execute and test the functionality of whitelisted in-band ipmi
# commands in locked mode
# 8. At the end of test issue a ipmi unlock command to revert the availablity of all
# in-band ipmi commands in unlocked mode.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_ipmi_lock_mode(self):
# Get OS level
l_oslevel = self.cv_LPAR.lpar_get_OS_Level()
# Get kernel version
l_kernel = self.cv_LPAR.lpar_get_kernel_version()
# Checking for ipmitool command and lm_sensors package
self.cv_LPAR.lpar_check_command("ipmitool")
l_pkg = self.cv_LPAR.lpar_check_pkg_for_utility(l_oslevel, "ipmitool")
print "Installed package: %s" % l_pkg
# loading below ipmi modules based on config option
# ipmi_devintf, ipmi_powernv and ipmi_masghandler
self.cv_LPAR.lpar_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_DEVICE_INTERFACE,
BMC_CONST.IPMI_DEV_INTF)
self.cv_LPAR.lpar_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_POWERNV,
BMC_CONST.IPMI_POWERNV)
self.cv_LPAR.lpar_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_HANDLER,
BMC_CONST.IPMI_MSG_HANDLER)
# Issue a ipmi lock command through authenticated interface
print "Issuing ipmi lock command through authenticated interface"
l_res = self.cv_IPMI.ipmitool_execute_command(BMC_CONST.IPMI_LOCK_CMD)
l_res = l_res.splitlines()
if int(l_res[-1]):
l_msg = "IPMI:Lock command failed, There may be two reasons here.\n\
a. check the corresponding parches available in AMI driver code,\n\
b. if patches available then command is failing"
print l_msg
raise OpTestError(l_msg)
print "IPMI:Lock command executed successfully"
try:
self.run_inband_ipmi_whitelisted_cmds()
except:
l_msg = "One of white listed in-band ipmi command execution failed"
print sys.exc_info()
finally:
# Issue a ipmi unlock command at the end of test.
print "Issuing ipmi unlock command through authenticated interface"
self.cv_IPMI.ipmitool_execute_command(BMC_CONST.IPMI_UNLOCK_CMD)
##
# @brief This function will execute whitelisted in-band ipmi commands
# and test the functionality in locked mode.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def run_inband_ipmi_whitelisted_cmds(self):
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")
# Test IPMI white listed commands those should be allowed through un-authenticated
# in-band interface
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [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.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [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: OpTestFastReboot
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
class OpTestFastReboot():
## 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 tests fast reset of power systems.
# It will check booting sequence when reboot command
# getting executed in both petitboot and host OS
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_opal_fast_reboot(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
self.cv_HOST.host_run_command(BMC_CONST.NVRAM_SET_FAST_RESET_MODE)
res = self.cv_HOST.host_run_command(BMC_CONST.NVRAM_PRINT_FAST_RESET_VALUE)
if "feeling-lucky" in res:
print "Setting the fast-reset mode successful"
else:
raise OpTestError("Failed to set the fast-reset mode")
self.con = self.cv_SYSTEM.sys_get_ipmi_console()
self.cv_IPMI.ipmi_host_login(self.con)
self.cv_IPMI.ipmi_host_set_unique_prompt(self.con)
self.cv_IPMI.run_host_cmd_on_ipmi_console("uname -a")
self.cv_IPMI.ipmi_set_boot_to_petitboot()
self.con.sendline("reboot")
self.con.expect(" RESET: Initiating fast reboot", timeout=60)
# Exiting to petitboot shell
self.con.expect('Petitboot', timeout=BMC_CONST.PETITBOOT_TIMEOUT)
self.con.expect('x=exit', timeout=10)
# Exiting to petitboot
self.con.sendcontrol('l')
self.con.send('\x1b[B')
self.con.send('\x1b[B')
self.con.send('\r')
self.con.expect('Exiting petitboot')
self.con.send('\r')
self.con.send('\x08')
self.cv_IPMI.ipmi_host_set_unique_prompt(self.con)
self.cv_IPMI.run_host_cmd_on_ipmi_console("uname -a")
self.con.sendline("reboot")
self.con.expect(" RESET: Initiating fast reboot", timeout=60)
# Exiting to petitboot shell
self.con.expect('Petitboot', timeout=BMC_CONST.PETITBOOT_TIMEOUT)
self.con.expect('x=exit', timeout=10)
print "fast-reset boots the system to runtime"
self.cv_IPMI.ipmi_set_boot_to_disk()
return BMC_CONST.FW_SUCCESS
示例10: OpTestNVRAM
# 需要导入模块: from common.OpTestSystem import OpTestSystem [as 别名]
# 或者: from common.OpTestSystem.OpTestSystem import sys_get_ipmi_console [as 别名]
class OpTestNVRAM():
## 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 tests nvram partition access, print/update
# the config data and dumping the partition's data. All
# these operations are done on supported partitions in both
# host OS and Petitboot.
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_nvram_configuration(self):
# Execute these tests in host OS
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
self.cv_HOST.host_run_command("uname -a")
self.cv_HOST.host_run_command("cat /etc/os-release")
self.cv_HOST.host_run_command("nvram -v")
self.cv_HOST.host_run_command("nvram --print-config -p ibm,skiboot")
self.cv_HOST.host_run_command("nvram --print-config -p common")
self.cv_HOST.host_run_command("nvram --print-config -p lnx,oops-log")
self.cv_HOST.host_run_command("nvram --print-config -p wwwwwwwwwwww")
self.cv_HOST.host_run_command("nvram --print-vpd")
self.cv_HOST.host_run_command("nvram --print-all-vpd")
self.cv_HOST.host_run_command("nvram --print-err-log")
self.cv_HOST.host_run_command("nvram --print-event-scan")
self.cv_HOST.host_run_command("nvram --partitions")
self.cv_HOST.host_run_command("nvram --dump common")
self.cv_HOST.host_run_command("nvram --dump ibm,skiboot")
self.cv_HOST.host_run_command("nvram --dump lnx,oops-log")
self.cv_HOST.host_run_command("nvram --dump wwwwwwwwwwww")
self.cv_HOST.host_run_command("nvram --ascii common")
self.cv_HOST.host_run_command("nvram --ascii ibm,skiboot")
self.cv_HOST.host_run_command("nvram --ascii lnx,oops-log")
self.cv_HOST.host_run_command("nvram --ascii wwwwwwwwwwww")
try:
self.test_nvram_update_part_config_in_host("common")
self.test_nvram_update_part_config_in_host("ibm,skiboot")
self.test_nvram_update_part_config_in_host("lnx,oops-log")
self.test_nvram_update_part_config_in_host("wwwwwwwwwwww")
except OpTestError:
print "There is a failure in updating one of NVRAM partitions"
# Execute these tests in petitboot
self.console = self.cv_SYSTEM.sys_get_ipmi_console()
try:
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")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram -v")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-config -p ibm,skiboot")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-config -p common")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-config -p lnx,oops-log")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-config -p wwwwwwwwwwww")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-vpd")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-all-vpd")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-err-log")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --print-event-scan")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --partitions")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --dump common")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --dump ibm,skiboot")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --dump lnx,oops-log")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --dump wwwwwwwwwwww")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --ascii common")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --ascii ibm,skiboot")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --ascii lnx,oops-log")
self.cv_IPMI.run_host_cmd_on_ipmi_console("nvram --ascii wwwwwwwwwwww")
try:
self.test_nvram_update_part_config_in_petitboot("common")
self.test_nvram_update_part_config_in_petitboot("ibm,skiboot")
self.test_nvram_update_part_config_in_petitboot("lnx,oops-log")
self.test_nvram_update_part_config_in_petitboot("wwwwwwwwwwww")
except OpTestError:
print "There is a failure in updating one of NVRAM partitions"
except:
self.cv_IPMI.ipmi_set_boot_to_disk()
self.cv_IPMI.ipmi_set_boot_to_disk()
#.........这里部分代码省略.........