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