本文整理汇总了Python中common.OpTestHost.OpTestHost.host_get_OS_Level方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestHost.host_get_OS_Level方法的具体用法?Python OpTestHost.host_get_OS_Level怎么用?Python OpTestHost.host_get_OS_Level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestHost.OpTestHost
的用法示例。
在下文中一共展示了OpTestHost.host_get_OS_Level方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpTestHeartbeat
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestHeartbeat():
## 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)
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 cover following test steps
# 1. It will check for os level and get kernel version
# 2. It will check for existence of ps command
# 3. It will check for kopald service is running
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_kopald_service(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Checking for ps command
self.cv_HOST.host_check_command("ps")
l_cmd = "ps -ef | grep -i kopald"
print l_cmd
l_res = self.cv_HOST.host_run_command(l_cmd)
print l_res
if (l_res.__contains__('[kopald]')):
return BMC_CONST.FW_SUCCESS
else:
l_msg = "kopald service is not running"
print l_msg
raise OpTestError(l_msg)
示例2: OpTestIPMIReprovision
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [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: OpTestInbandUsbInterface
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestInbandUsbInterface():
## 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)
self.cv_HOST = OpTestHost(i_hostIP, i_hostUser, i_hostPasswd, i_bmcIP)
self.util = OpTestUtil()
##
# @brief This function will cover following test steps
# 1. It will get the OS level installed on powernv 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. Checking Inband ipmitool command functionality with different options
# using ipmitool usb interface.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_ipmi_inband_usb_interface(self):
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Checking for ipmitool command and lm_sensors package
self.cv_HOST.host_check_command("ipmitool")
l_pkg = self.cv_HOST.host_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_HOST.host_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_DEVICE_INTERFACE,
BMC_CONST.IPMI_DEV_INTF)
self.cv_HOST.host_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_POWERNV,
BMC_CONST.IPMI_POWERNV)
self.cv_HOST.host_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_HANDLER,
BMC_CONST.IPMI_MSG_HANDLER)
print "Inband IPMI[USB]: Chassis tests"
self.test_chassis()
print "Inband IPMI[USB]: Chassis Identify tests"
self.test_chassis_identifytests()
print "Inband IPMI[USB]: Chassis Bootdevice tests"
self.test_chassis_bootdev()
print "Inband IPMI[USB]: Channel tests"
#self.test_channel()
print "Inband IPMI[USB]: Info tests"
self.test_Info()
print "Inband IPMI[USB]: SDR list tests"
self.test_sdr_list_by_type()
print "Inband IPMI[USB]: SDR elist tests"
self.test_sdr_elist_by_type()
print "Inband IPMI[USB]: SDR type list tests"
self.test_sdr_type_list()
print "Inband IPMI[USB]: SDR get tests"
self.test_sdr_get_id()
print "Inband IPMI[USB]: FRU Tests"
self.test_fru_print()
self.test_fru_read()
print "Inband IPMI[USB]: SEL tests"
self.test_sel_info()
self.test_sel_list()
self.test_sel_elist()
l_res = self.test_sel_time_get()
self.test_sel_time_set(l_res[-2])
i_num = "3"
self.test_sel_list_first_n_entries(i_num)
self.test_sel_list_last_n_entries(i_num)
self.test_sel_get_functionality()
self.test_sel_clear_functionality()
print "Inband IPMI[USB]: MC tests"
self.test_mc()
print "Inband IPMI[USB]: Sensor tests"
self.test_sensor_list()
self.test_sensor_byid("Host Status")
self.test_sensor_byid("OS Boot")
self.test_sensor_byid("OCC Active")
print "Inband IPMI[USB]: dcmi tests"
self.test_dcmi()
print "Inband IPMI[USB]: echo tests"
self.test_echo()
print "Inband IPMI[USB]: event tests"
self.test_event()
print "Inband IPMI[USB]: Firewall test"
#.........这里部分代码省略.........
示例4: OpTestI2Cdriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestI2Cdriver():
## 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)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd, i_bmcIP)
self.util = OpTestUtil()
##
# @brief This function has following test steps
# 1. Getting host information(OS and kernel info)
# 2. Checking the required utilites are present on host or not
# 3. Loading the necessary modules to test I2C device driver functionalites
# (i2c_dev, i2c_opal and at24)
# 4. Getting the list of i2c buses
# 5. Querying the i2c bus for devices
# 3. Getting the list of i2c buses and eeprom chip addresses
# 4. Accessing the registers visible through the i2cbus using i2cdump utility
# 5. Listing the i2c adapter conetents and i2c bus entries to make sure sysfs entries
# created for each bus.
# 6. Testing i2cget functionality for limited samples
# Avoiding i2cset functionality, it may damage the system.
#
# @return BMC_CONST.FW_SUCCESS-success or raise OpTestError-fail
#
def testI2Cdriver(self):
# Get OS level
self.cv_HOST.host_get_OS_Level()
# make sure install "i2c-tools" package in-order to run the test
# Check whether i2cdump, i2cdetect and hexdump commands are available on host
self.cv_HOST.host_check_command("i2cdump")
self.cv_HOST.host_check_command("i2cdetect")
self.cv_HOST.host_check_command("hexdump")
self.cv_HOST.host_check_command("i2cget")
self.cv_HOST.host_check_command("i2cset")
# Get Kernel Version
l_kernel = self.cv_HOST.host_get_kernel_version()
# loading i2c_opal module based on config option
l_config = "CONFIG_I2C_OPAL"
l_module = "i2c_opal"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# loading i2c_dev module based on config option
l_config = "CONFIG_I2C_CHARDEV"
l_module = "i2c_dev"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# loading at24 module based on config option
l_config = "CONFIG_EEPROM_AT24"
l_module = "at24"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# Get information of EEPROM chips
self.cv_HOST.host_get_info_of_eeprom_chips()
# Get list of i2c buses available on host,
# l_list=["0","1"....]
# l_list1=["i2c-0","i2c-1","i2c-2"....]
l_list, l_list1 = self.cv_HOST.host_get_list_of_i2c_buses()
# Scanning i2c bus for devices attached to it.
for l_bus in l_list:
self.query_i2c_bus(l_bus)
# Get list of pairs of i2c bus and EEPROM device addresses in the host
l_chips = self.cv_HOST.host_get_list_of_eeprom_chips()
for l_args in l_chips:
# Accessing the registers visible through the i2cbus using i2cdump utility
# l_args format: "0 0x51","1 0x53",.....etc
self.i2c_dump(l_args)
# list i2c adapter conetents
l_res = self.cv_HOST.host_run_command("ls -l /sys/class/i2c-adapter; echo $?")
l_res = l_res.splitlines()
if int(l_res[-1]) == 0:
pass
else:
l_msg = "listing i2c adapter contents through the sysfs entry failed"
print l_msg
raise OpTestError(l_msg)
#.........这里部分代码省略.........
示例5: OpTestFWTS
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [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
示例6: OpTestHMIHandling
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestHMIHandling():
## 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 is a common function for all the hmi test cases. This will be executed before
# any test case starts. Basically this provides below requirements.
# 1. Validates all required host commands
# 2. It will clone skiboot source repository
# 3. Compile the necessary tools xscom-utils and gard utility to test HMI.
# 4. Get the list Of Chips and cores in the form of dictionary.
# Ex: [['00000000', ['4', '5', '6', 'c', 'd', 'e']], ['00000001', ['4', '5', '6', 'c', 'd', 'e']], ['00000010', ['4', '5', '6', 'c', 'd', 'e']]]
# 5. 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.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_init(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
self.l_oslevel = self.cv_HOST.host_get_OS_Level()
# Check whether git and gcc commands are available on the host
self.cv_HOST.host_check_command("git")
self.cv_HOST.host_check_command("gcc")
# 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)
# Getting list of processor chip Id's(executing getscom -l to get chip id's)
l_res = self.cv_HOST.host_run_command("cd %s/external/xscom-utils/; ./getscom -l" % l_dir)
l_res = l_res.splitlines()
l_chips = []
for line in l_res:
matchObj = re.search("(\d{8}).*processor", line)
if matchObj:
l_chips.append(matchObj.group(1))
if not l_chips:
l_msg = "Getscom failed to list processor chip id's"
raise OpTestError(l_msg)
l_chips.sort()
print l_chips # ['00000000', '00000001', '00000010']
# Currently getting the list of active core id's with respect to each chip is by using opal msg log
# TODO: Need to identify best way to get list of cores(If Opal msg log is empty)
l_cmd = "cat /sys/firmware/opal/msglog | grep -i CHIP"
l_res = self.cv_HOST.host_run_command(l_cmd)
l_cores = {}
self.l_dic = []
l_res = l_res.splitlines()
for line in l_res:
matchObj = re.search("Chip (\d{1,2}) Core ([a-z0-9])", line)
if matchObj:
if l_cores.has_key(int(matchObj.group(1))):
(l_cores[int(matchObj.group(1))]).append(matchObj.group(2))
else:
l_cores[int(matchObj.group(1))] = list(matchObj.group(2))
if not l_cores:
l_msg = "Failed in getting core id's information from OPAL msg log"
raise OpTestError(l_msg)
print l_cores # {0: ['4', '5', '6', 'c', 'd', 'e'], 1: ['4', '5', '6', 'c', 'd', 'e'], 10: ['4', '5', '6', 'c', 'd', 'e']}
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']]]
#.........这里部分代码省略.........
示例7: OpTestPrdDriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
#.........这里部分代码省略.........
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)
# Reading Local Fault Isolation mask register
l_cmd = "./getscom -c %s %s" % (chip_id, FIMR)
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
print l_res
# Changing the FIMR value to un-masked value.
LEN = 16
l_len = len(l_res[-1])
l_val = hex(int(("0x" + "0"*(LEN - l_len) + l_res[-1]), 16)& (ERROR ^ 0xffffffffffffffff))
# Writing the same value to Local Fault Isolation mask register again
l_cmd = "./putscom -c %s %s %s" % (chip_id, BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER, l_val)
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
# Inject a core error on FIR
l_cmd = "./putscom -c %s %s %s" % (chip_id, FIR, hex(ERROR))
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
time.sleep(30)
# Read Local Fault Isolation register again
l_cmd = "./getscom -c %s %s" % (chip_id, FIR)
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
print l_res
# Check FIR got cleared by opal-prd
if l_res[-1] == BMC_CONST.FAULT_ISOLATION_REGISTER_CONTENT:
print "Opal-prd handles core hardware error"
else:
l_msg = "Opal-prd not clearing hardware errors in runtime"
print l_msg
raise OpTestError(l_msg)
# Reading the Local Fault Isolation Mask Register again
l_cmd = "./getscom -c %s %s" % (chip_id, FIMR)
l_res = self.cv_IPMI.run_host_cmd_on_ipmi_console(l_cmd)
print l_res
# check for IPOLL mask register value to see opal-prd cleared the value
l_cmd = "./getscom -c %s %s" % (chip_id, 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 cleared the IPOLL MASK REGISTER"
return BMC_CONST.FW_SUCCESS
else:
l_msg = "Opal-prd is not clearing the IPOLL MASK REGISTER after injecting core FIR error"
print l_msg
raise OpTestError(l_msg)
##
# @brief This is a common function for all the PRD test cases. This will be executed before
# any test case starts. Basically this provides below requirements.
# 1. Validates all required host commands
# 2. It will clone skiboot source repository
# 3. Compile the necessary tools -xscom-utils(getscom and putscom)
# 4. Get the list Of Chips.
# Ex: ['00000000', '00000001', '00000010']
# 5. generate a random chip.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_init(self):
# Get OS level
self.cv_HOST.host_get_OS_Level()
# Check whether git and gcc commands are available on host
self.cv_HOST.host_check_command("git", "gcc")
# It will clone skiboot source repository
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_xscom_utilities(BMC_CONST.CLONE_SKIBOOT_DIR)
# Getting list of processor chip Id's(executing getscom -l to get chip id's)
l_res = self.cv_HOST.host_run_command("cd %s/external/xscom-utils/; ./getscom -l" % BMC_CONST.CLONE_SKIBOOT_DIR)
l_res = l_res.splitlines()
l_chips = []
for line in l_res:
matchObj = re.search("(\d{8}).*processor", line)
if matchObj:
l_chips.append(matchObj.group(1))
if not l_chips:
l_msg = "Getscom failed to list processor chip id's"
raise OpTestError(l_msg)
l_chips.sort()
print l_chips # ['00000000', '00000001', '00000010']
self.random_chip = random.choice(l_chips)
# Below will be useful for debug purposes to compare chip information
l_res = self.cv_HOST.host_read_msglog_core()
print l_res
示例8: OpTestOOBIPMI
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestOOBIPMI():
## 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)
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 It will execute and test all Out-of-band ipmi commands.
# bmc, channel, chassis, dcmi, echo, event, exec, firewall, fru, lan
# mc, pef, power, raw, sdr, sel, sensor, session, user
#
# @return l_res @type list: output of command or raise OpTestError
#
def test_oob_ipmi(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Checking for ipmitool command and lm_sensors package
self.cv_HOST.host_check_command("ipmitool")
l_pkg = self.cv_HOST.host_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_HOST.host_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_DEVICE_INTERFACE,
BMC_CONST.IPMI_DEV_INTF)
self.cv_HOST.host_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_POWERNV,
BMC_CONST.IPMI_POWERNV)
self.cv_HOST.host_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_HANDLER,
BMC_CONST.IPMI_MSG_HANDLER)
test_cases = [self.test_chassis, self.test_chassisIdentifytests,
self.test_chassisBootdev, self.test_Info, self.test_sdr_list_by_type,
self.test_sdr_elist_by_type, self.test_sdr_type_list, self.test_sdr_get_id,
self.test_fru_print, self.test_fru_read, self.test_mc,
self.test_sensor_list, self.test_sensor_get_host_status,
self.test_sensor_get_os_boot, self.test_sel_info, self.test_sel_list,
self.test_sel_elist, self.test_set_sel_time,
self.test_sel_time_get, self.test_sel_list_first_3_entries,
self.test_sel_list_last_3_entries, self.test_sel_get_functionality,
self.test_sel_clear_functionality, self.test_channel,
self.test_dcmi, self.test_echo, self.test_event,
self.test_firewall, self.test_pef, self.test_raw,
self.test_exec, self.test_bmc_golden_side_version,
self.test_get_pnor_partition_size_cmd,
self.test_bmc_boot_completed_cmd,
self.test_get_led_state_cmd, self.test_set_led_state_cmd]
fail_count = 0
for test in test_cases:
try:
print "OOB IPMI: test case %s" % test
test(self)
except:
print "Test Fail: %s failed" % test
fail_count += 1
print sys.exc_info()
continue
print "OOB IPMI: Test case failure count %s" % fail_count
print self.cv_IPMI.ipmi_get_bmc_golden_side_version()
print self.cv_IPMI.ipmi_get_pnor_partition_size("NVRAM")
print self.cv_IPMI.ipmi_get_pnor_partition_size("GUARD")
print self.cv_IPMI.ipmi_get_pnor_partition_size("BOOTKERNEL")
print self.cv_IPMI.ipmi_get_bmc_boot_completion_status()
print self.cv_IPMI.ipmi_get_fault_led_state()
print self.cv_IPMI.ipmi_get_power_on_led_state()
print self.cv_IPMI.ipmi_get_host_status_led_state()
print self.cv_IPMI.ipmi_get_chassis_identify_led_state()
self.cv_IPMI.ipmi_enable_fan_control_task_command()
self.cv_IPMI.ipmi_get_fan_control_task_state_command()
self.cv_IPMI.ipmi_disable_fan_control_task_command()
self.cv_IPMI.ipmi_get_fan_control_task_state_command()
#.........这里部分代码省略.........
示例9: OpTestSwitchEndianSyscall
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestSwitchEndianSyscall():
## 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)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd,i_bmcIP)
self.util = OpTestUtil()
##
# @brief If git and gcc commands are availble on host, this function will clone linux
# git repository and check for switch_endian_test directory and make
# the required files. And finally execute bin file switch_endian_test.
#
# @return BMC_CONST.FW_SUCCESS-success or BMC_CONST.FW_FAILED-fail
#
def testSwitchEndianSysCall(self):
# Get OS level
self.cv_HOST.host_get_OS_Level()
# Check whether git and gcc commands are available on host
self.cv_HOST.host_check_command("git")
self.cv_HOST.host_check_command("gcc")
# Clone latest linux git repository into l_dir
l_dir = "/tmp/linux"
self.cv_HOST.host_clone_linux_source(l_dir)
# Check for switch_endian test directory.
self.check_dir_exists(l_dir)
# make the required files
self.make_test(l_dir)
# Run the switch_endian sys call test once
l_rc = self.run_once(l_dir)
if int(l_rc) == 1:
print "Switch endian sys call test got succesful"
return BMC_CONST.FW_SUCCESS
else:
print "Switch endian sys call test failed"
return BMC_CONST.FW_FAILED
##
# @brief It will check for existence of switch_endian directory in the cloned repository
#
# @param i_dir @type string: linux source directory
#
# @return 1-success or raise OpTestError
#
def check_dir_exists(self, i_dir):
l_dir = '%s/tools/testing/selftests/powerpc/switch_endian' % i_dir
l_cmd = "test -d %s; echo $?" % l_dir
print l_cmd
l_res = self.cv_HOST.host_run_command(l_cmd)
print l_res
l_res = l_res.replace("\r\n", "")
if int(l_res) == 0:
print "Switch endian test directory exists"
return 1
else:
l_msg = "Switch endian directory is not present"
print l_msg
raise OpTestError(l_msg)
##
# @brief It will prepare for executable bin files using make command
# At the end it will check for bin file switch_endian_test and
# will throw an exception in case of missing bin file after make
#
# @param i_dir @type string: linux source directory
#
# @return 1-success or raise OpTestError
#
def make_test(self, i_dir):
l_cmd = "cd %s/tools/testing/selftests/powerpc/switch_endian;\
make;" % i_dir
print l_cmd
l_res = self.cv_HOST.host_run_command(l_cmd)
l_cmd = "test -f %s/tools/testing/selftests/powerpc/switch_endian/switch_endian_test; echo $?" % i_dir
l_res = self.cv_HOST.host_run_command(l_cmd)
l_res = l_res.replace("\r\n", "")
if int(l_res) == 0:
print "Executable binary switch_endian_test is available"
return 1
#.........这里部分代码省略.........
示例10: OpTestRTCdriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestRTCdriver():
## 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)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd,i_bmcIP)
self.util = OpTestUtil()
##
# @brief This function will cover following test steps
# 1. Getting host information(OS and Kernel info)
# 2. Loading rtc_opal module based on config option
# 3. Testing the rtc driver functions
# Display the current time,
# set the Hardware Clock to a specified time,
# set the Hardware Clock from the System Time, or
# set the System Time from the Hardware Clock
# keep the Hardware clock in UTC or local time format
# Hardware clock compare, predict and adjust functions
# Hardware clock debug and test modes
# Reading the Hardware clock from special file instead of default
# 4. After executing above each function reading the Hardware clock in b/w functions.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_RTC_driver(self):
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get Kernel Version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Get hwclock version
l_hwclock = self.cv_HOST.host_run_command("hwclock -V;echo $?")
# loading rtc_opal module based on config option
l_config = "CONFIG_RTC_DRV_OPAL"
l_module = "rtc_opal"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# Get the device files for rtc driver
l_res = self.cv_HOST.host_run_command("ls /dev/ | grep -i --color=never rtc")
l_files = l_res.splitlines()
l_list = []
for name in l_files:
if name.__contains__("rtc"):
l_file = "/dev/" + name
l_list.append(l_file)
else:
continue
print l_list
# Display the time of hwclock from device files
for l_file in l_list:
self.read_hwclock_from_file(l_file)
self.cv_HOST.host_read_hwclock()
time.sleep(5)
self.cv_HOST.host_set_hwclock_time("2015-01-01 10:10:10")
time.sleep(5)
self.cv_HOST.host_read_hwclock()
self.cv_HOST.host_set_hwclock_time("2016-01-01 20:20:20")
self.cv_HOST.host_read_hwclock()
self.set_hwclock_in_utc("2017-01-01 10:10:10")
self.cv_HOST.host_read_hwclock()
self.set_hwclock_in_localtime("2014-01-01 05:05:05")
self.cv_HOST.host_read_hwclock()
self.cv_HOST.host_read_systime()
self.systime_to_hwclock()
self.cv_HOST.host_read_hwclock()
self.systime_to_hwclock_in_utc()
self.cv_HOST.host_read_hwclock()
self.systime_to_hwclock_in_localtime()
self.cv_HOST.host_read_hwclock()
self.hwclock_to_systime()
self.cv_HOST.host_read_hwclock()
self.cv_HOST.host_read_systime()
self.hwclock_in_utc()
self.cv_HOST.host_read_hwclock()
self.hwclock_in_localtime()
self.cv_HOST.host_read_hwclock()
self.hwclock_predict("2015-01-01 10:10:10")
self.cv_HOST.host_read_hwclock()
self.hwclock_debug_mode()
#.........这里部分代码省略.........
示例11: OpTestInbandIPMI
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestInbandIPMI():
## 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)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd, i_bmcIP)
self.util = OpTestUtil()
##
# @brief This function will cover following test steps
# 1. It will get the OS level installed on powernv 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. Checking Inband ipmitool command functionality with different options
# using ipmitool.
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_ipmi_inband_functionality(self):
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Checking for ipmitool command and lm_sensors package
self.cv_HOST.host_check_command("ipmitool")
l_pkg = self.cv_HOST.host_check_pkg_for_utility(l_oslevel, "ipmitool")
print "Installed package: %s" % l_pkg
# Checking Inband ipmitool command functionality with different options
l_cmd = "ipmitool sdr; echo $?"
output = self.cv_HOST.host_run_command(l_cmd)
response = output.splitlines()
if int(response[-1]):
l_msg = "ipmitool sdr not working,exiting...."
raise OpTestError(l_msg)
l_cmd = "ipmitool sdr elist full; echo $?"
output = self.cv_HOST.host_run_command(l_cmd)
response = output.splitlines()
if int(response[-1]):
l_msg = "ipmitool sdr elist full not working,exiting...."
raise OpTestError(l_msg)
l_cmd = "ipmitool sdr type temperature; echo $?"
l_res = self.cv_HOST.host_run_command(l_cmd)
if l_res.__contains__("Temp"):
print "ipmitool sdr type temperature is working"
else:
l_msg = "ipmitool sdr type temperature is not working"
raise OpTestError(l_msg)
l_cmd = "ipmitool lan print 1; echo $?"
output = self.cv_HOST.host_run_command(l_cmd)
response = output.splitlines()
if int(response[-1]):
l_msg = "ipmitool lan print command is not working,exiting...."
raise OpTestError(l_msg)
l_cmd = "ipmitool fru print; echo $?"
output = self.cv_HOST.host_run_command(l_cmd)
response = output.splitlines()
if int(response[-1]):
l_msg = "ipmitool fru print is not working,exiting...."
raise OpTestError(l_msg)
l_cmd = "ipmitool chassis status | grep \"System Power\""
l_res = self.cv_HOST.host_run_command(l_cmd)
if l_res.__contains__("System Power : on"):
print "ipmitool Chassis status is working"
else:
l_msg = "ipmitool chassis status is not working"
raise OpTestError(l_msg)
l_cmd = "ipmitool chassis identify 1; echo $?"
l_res = self.cv_HOST.host_run_command(l_cmd)
if l_res.__contains__("Chassis identify interval: 1 seconds"):
print "ipmitool Chassis identify interval is working"
#.........这里部分代码省略.........
示例12: OpTestAt24driver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestAt24driver():
## 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)
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 has following test steps
# 1. Getting the host infromation(OS and kernel information)
# 2. Loading the necessary modules to test at24 device driver functionalites
# (i2c_dev, i2c_opal and at24)
# 3. Getting the list of i2c buses and eeprom chip addresses
# 4. Accessing the registers visible through the i2cbus using i2cdump utility
# 5. Getting the eeprom device data using hexdump utility in hex + Ascii format
#
# @return BMC_CONST.FW_SUCCESS-success or raise OpTestError
#
def testAt24driver(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
self.cv_HOST.host_get_OS_Level()
# Check whether i2cdump and hexdump commands are available on host
self.cv_HOST.host_check_command("i2cdump", "hexdump")
# Get Kernel Version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Loading i2c_opal module based on config option
l_config = "CONFIG_I2C_OPAL"
l_module = "i2c_opal"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# Loading i2c_dev module based on config option
l_config = "CONFIG_I2C_CHARDEV"
l_module = "i2c_dev"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# Loading at24 module based on config option
l_config = "CONFIG_EEPROM_AT24"
l_module = "at24"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# Get infomtion of EEPROM chips
self.cv_HOST.host_get_info_of_eeprom_chips()
# Get list of pairs of i2c bus and EEPROM device addresses in the host
l_chips = self.cv_HOST.host_get_list_of_eeprom_chips()
for l_args in l_chips:
# Accessing the registers visible through the i2cbus using i2cdump utility
# l_args format: "0 0x51","1 0x53",.....etc
self.i2c_dump(l_args)
# Getting the list of sysfs eeprom interfaces
l_res = self.cv_HOST.host_run_command("find /sys/ -name eeprom; echo $?")
l_res = l_res.splitlines()
if int(l_res[-1]) == 0:
pass
else:
l_msg = "EEPROM sysfs entries are not created"
print l_msg
raise OpTestError(l_msg)
for l_dev in l_res:
if l_dev.__contains__("eeprom"):
# Getting the eeprom device data using hexdump utility in hex + Ascii format
self.cv_HOST.host_hexdump(l_dev)
else:
pass
return BMC_CONST.FW_SUCCESS
##
# @brief This i2cdump function takes arguments in pair of a string like "i2cbus address".
# i2cbus indicates the number or name of the I2C bus to be scanned. This number should
# correspond to one of the busses listed by i2cdetect -l. address indicates
# the address to be scanned on that bus, and is an integer between 0x03 and 0x77
# i2cdump is a program to examine registers visible through the I2C bus
#
# @param i_args @type string: this is the argument to i2cdump utility
# args are in the form of "i2c-bus-number eeprom-chip-address"
# Ex: "0 0x51","3 0x52" ....etc
#.........这里部分代码省略.........
示例13: OpTestSensors
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestSensors():
## 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)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd,i_bmcIP)
self.util = OpTestUtil()
##
# @brief This function will cover following test steps
# 1. It will check for kernel config option CONFIG_SENSORS_IBMPOWERNV
# 2. It will load ibmpowernv driver only on powernv platform
# 3. It will check for sensors command existence and lm_sensors package
# 4. start the lm_sensors service and detect any sensor chips
# using sensors-detect.
# 5. At the end it will test sensors command functionality
# with different options
#
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_hwmon_driver(self):
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
# Checking for sensors config option CONFIG_SENSORS_IBMPOWERNV
l_config = "CONFIG_SENSORS_IBMPOWERNV"
l_val = self.cv_HOST.host_check_config(l_kernel, l_config)
if l_val == "y":
print "Driver build into kernel itself"
else:
print "Driver will be built as module"
# Loading ibmpowernv driver only on powernv platform
self.cv_HOST.host_load_ibmpowernv(l_oslevel)
# Checking for sensors command and lm_sensors package
self.cv_HOST.host_check_command("sensors")
l_pkg = self.cv_HOST.host_check_pkg_for_utility(l_oslevel, "sensors")
print "Installed package: %s" % l_pkg
# Restart the lm_sensor service
self.cv_HOST.host_start_lm_sensor_svc(l_oslevel)
# To detect different sensor chips and modules
res = self.cv_HOST.host_run_command("yes | sensors-detect")
print res
# Checking sensors command functionality with different options
output = self.cv_HOST.host_run_command("sensors; echo $?")
response = output.splitlines()
if int(response[-1]):
l_msg = "sensors not working,exiting...."
raise OpTestError(l_msg)
print output
output = self.cv_HOST.host_run_command("sensors -f; echo $?")
response = output.splitlines()
if int(response[-1]):
l_msg = "sensors -f not working,exiting...."
raise OpTestError(l_msg)
print output
output = self.cv_HOST.host_run_command("sensors -A; echo $?")
response = output.splitlines()
if int(response[-1]):
l_msg = "sensors -A not working,exiting...."
raise OpTestError(l_msg)
print output
output = self.cv_HOST.host_run_command("sensors -u; echo $?")
response = output.splitlines()
if int(response[-1]):
l_msg = "sensors -u not working,exiting...."
raise OpTestError(l_msg)
print output
return BMC_CONST.FW_SUCCESS
示例14: OpTestMtdPnorDriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestMtdPnorDriver():
## Initialize this object and also getting the host login credentials to use by scp utility
# @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)
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()
self.host_user = i_hostuser
self.host_ip = i_hostip
self.host_Passwd = i_hostPasswd
##
# @brief This function has following test steps
# 1. Get host information(OS and Kernel information)
# 2. Load the mtd module based on config value
# 3. Check /dev/mtd0 character device file existence on host
# 4. Copying the contents of the flash in a file /tmp/pnor
# 5. Getting the /tmp/pnor file into local x86 machine using scp utility
# 6. Remove existing /tmp/ffs directory and
# Clone latest ffs git repository in local x86 working machine
# 7. Compile ffs repository to get fcp utility
# 8. Check existence of fcp utility in ffs repository, after compiling
# 9. Get the PNOR flash contents on an x86 machine using fcp utility
#
# @return BMC_CONST.FW_SUCCESS-success or raise OpTestError-fail
#
def testMtdPnorDriver(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get Kernel Version
l_kernel = self.cv_HOST.host_get_kernel_version()
# loading mtd module based on config option
l_config = "CONFIG_MTD_POWERNV_FLASH"
l_module = "mtd"
self.cv_HOST.host_load_module_based_on_config(l_kernel, l_config, l_module)
# Check /dev/mtd0 file existence on host
l_cmd = "ls -l /dev/mtd0; echo $?"
l_res = self.cv_HOST.host_run_command(l_cmd)
l_res = l_res.splitlines()
if int(l_res[-1]) == 0:
print "/dev/mtd0 character device file exists on host"
else:
l_msg = "/dev/mtd0 character device file doesn't exist on host"
print l_msg
raise OpTestError(l_msg)
# Copying the contents of the PNOR flash in a file /tmp/pnor
l_file = "/tmp/pnor"
l_cmd = "cat /dev/mtd0 > %s; echo $?" % l_file
l_res = self.cv_HOST.host_run_command(l_cmd)
l_res = l_res.splitlines()
if int(l_res[-1]) == 0:
print "Fetched PNOR data from /dev/mtd0 into temp file /tmp/pnor"
else:
l_msg = "Fetching PNOR data is failed from /dev/mtd0 into temp file /tmp/pnor"
print l_msg
raise OpTestError(l_msg)
# Getting the /tmp/pnor file into local x86 machine
l_path = "/tmp/"
self.util.copyFilesToDest(l_path, self.host_user, self.host_ip, l_file, self.host_Passwd, "2", BMC_CONST.SCP_TO_LOCAL)
l_list = commands.getstatusoutput("ls -l %s; echo $?" % l_path)
print l_list
l_workdir = "/tmp/ffs"
# Remove existing /tmp/ffs directory
l_res = commands.getstatusoutput("rm -rf %s" % l_workdir)
print l_res
# Clone latest ffs git repository in local x86 working machine
l_cmd = "git clone https://github.com/open-power/ffs/ %s" % l_workdir
l_res = commands.getstatusoutput(l_cmd)
print l_res
if int(l_res[0]) == 0:
print "Cloning of ffs repository is successfull"
else:
l_msg = "Cloning ffs repository is failed"
print l_msg
#.........这里部分代码省略.........
示例15: OpTestEM
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_OS_Level [as 别名]
class OpTestEM():
## 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)
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 cover following test steps
# 1. It will get the OS and kernel versions.
# 2. Check the cpupower utility is available in host.
# 3. Get available cpu scaling frequencies
# 4. Set the userspace governer for all cpu's
# 5. test the cpufreq driver by set/verify cpu frequency
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_cpu_freq_states(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
self.cv_HOST.host_check_command("cpupower")
# Get available cpu scaling frequencies
l_res = self.cv_HOST.host_run_command("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies")
freq_list = (l_res.strip()).split(' ')
print freq_list
# Set the cpu governer to userspace
self.set_cpu_gov("userspace")
self.verify_cpu_gov("userspace")
for i in range(1, 100):
i_freq = random.choice(freq_list)
self.set_cpu_freq(i_freq)
self.verify_cpu_freq(i_freq)
return BMC_CONST.FW_SUCCESS
##
# @brief This function will cover following test steps
# 1. It will get the OS and kernel versions.
# 2. Check the cpupower utility is available in host.
# 3. Set the userspace governer for all cpu's
# 4. test the cpuidle driver by enable/disable/verify the idle states
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def test_cpu_idle_states(self):
self.cv_SYSTEM.sys_bmc_power_on_validate_host()
# Get OS level
l_oslevel = self.cv_HOST.host_get_OS_Level()
# Get kernel version
l_kernel = self.cv_HOST.host_get_kernel_version()
self.cv_HOST.host_check_command("cpupower")
# currently p8 cpu has 3 states
for i in (0, 1, 2):
self.enable_idle_state(i)
self.verify_enable_idle_state(i)
for i in (0, 1, 2):
self.disable_idle_state(i)
self.verify_disable_idle_state(i)
return BMC_CONST.FW_SUCCESS
##
# @brief sets the cpu frequency with i_freq value
#
# @param i_freq @type str: this is the frequency of cpu to be set
#
# @return BMC_CONST.FW_SUCCESS or raise OpTestError
#
def set_cpu_freq(self, i_freq):
l_cmd = "for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed; do echo %s > $i; done" % i_freq
self.cv_HOST.host_run_command(l_cmd)
#.........这里部分代码省略.........