本文整理汇总了Python中common.OpTestHost.OpTestHost.host_load_module_based_on_config方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestHost.host_load_module_based_on_config方法的具体用法?Python OpTestHost.host_load_module_based_on_config怎么用?Python OpTestHost.host_load_module_based_on_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestHost.OpTestHost
的用法示例。
在下文中一共展示了OpTestHost.host_load_module_based_on_config方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpTestI2Cdriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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)
#.........这里部分代码省略.........
示例2: OpTestInbandUsbInterface
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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"
#.........这里部分代码省略.........
示例3: OpTestOOBIPMI
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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()
#.........这里部分代码省略.........
示例4: OpTestRTCdriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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()
#.........这里部分代码省略.........
示例5: OpTestAt24driver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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
#.........这里部分代码省略.........
示例6: OpTestMtdPnorDriver
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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
#.........这里部分代码省略.........
示例7: OpTestIPMILockMode
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_load_module_based_on_config [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_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 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):
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)
# 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_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")
#.........这里部分代码省略.........