本文整理汇总了Python中common.OpTestHost.OpTestHost.host_get_pci_verbose_info方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestHost.host_get_pci_verbose_info方法的具体用法?Python OpTestHost.host_get_pci_verbose_info怎么用?Python OpTestHost.host_get_pci_verbose_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common.OpTestHost.OpTestHost
的用法示例。
在下文中一共展示了OpTestHost.host_get_pci_verbose_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_get_pci_verbose_info [as 别名]
#.........这里部分代码省略.........
i_bmcUserIpmi,
i_bmcPasswdIpmi,
i_ffdcDir=None,
i_hostip=None,
i_hostuser=None,
i_hostPasswd=None,
i_hostLspci=None,
):
self.cv_BMC = OpTestBMC(i_bmcIP, i_bmcUser, i_bmcPasswd, i_ffdcDir)
self.cv_IPMI = OpTestIPMI(
i_bmcIP, i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostip, i_hostuser, i_hostPasswd
)
self.cv_HOST = OpTestHost(i_hostip, i_hostuser, i_hostPasswd, i_bmcIP, i_ffdcDir)
self.cv_SYSTEM = OpTestSystem(
i_bmcIP,
i_bmcUser,
i_bmcPasswd,
i_bmcUserIpmi,
i_bmcPasswdIpmi,
i_ffdcDir,
i_hostip,
i_hostuser,
i_hostPasswd,
)
self.util = OpTestUtil()
self.lspci_file = i_hostLspci
##
# @brief This function will get the PCI and USB susbsytem Info
# And also this test compares known good data of
# "lspci -mm -n" which is stored in testcases/data directory
# with the current lspci data.
# User need to specify the corresponding file name into
# machines xml like lspci.txt which contains "lspci -mm -n"
# command output in a working good state of system.
# tools used are lspci and lsusb
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_host_pci_devices_info(self):
if self.lspci_file == "empty.txt":
print "Skipping the pci devices comparision as missing the lspci data file name in machines xml"
return BMC_CONST.FW_SUCCESS
filename = os.path.join(os.path.dirname(__file__).split("testcases")[0], self.lspci_file)
if not os.path.isfile(filename):
raise OpTestError("lspci file %s not found in top level directory" % filename)
self.pci_good_data_file = filename
self.test_skiroot_pci_devices()
self.cv_IPMI.ipmi_set_boot_to_disk()
self.cv_IPMI.ipmi_power_off()
self.cv_IPMI.ipmi_power_on()
self.cv_IPMI.ipl_wait_for_working_state()
self.test_host_pci_devices()
##
# @brief This function will get the "lspci -mm -n" output from the petitboot
# and compares it with known good lspci data
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_skiroot_pci_devices(self):
cmd = "lspci -mm -n"
self.console = self.cv_SYSTEM.sys_get_ipmi_console()
self.cv_SYSTEM.sys_ipmi_boot_system_to_petitboot(self.console)
self.cv_IPMI.ipmi_host_set_unique_prompt(self.console)
self.cv_IPMI.run_host_cmd_on_ipmi_console("uname -a")
self.cv_IPMI.run_host_cmd_on_ipmi_console("cat /etc/os-release")
res = self.cv_IPMI.run_host_cmd_on_ipmi_console(cmd)
self.cv_SYSTEM.sys_ipmi_close_console(self.console)
self.pci_data_petitboot = "\n".join(res[1:])
diff_process = subprocess.Popen(["diff", "-u", self.pci_good_data_file, "-"], stdin=subprocess.PIPE)
diff_stdout, diff_stderr = diff_process.communicate(self.pci_data_petitboot + "\n")
r = diff_process.wait()
if r == 0:
print "All the pci devices are detected at petitboot"
else:
print diff_stdout
raise OpTestError("There is a mismatch b/w known good output and tested petitboot lspci output")
##
# @brief This function will get the "lspci -mm -n" output from the host OS
# and compares it with known good lspci data
#
# @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
#
def test_host_pci_devices(self):
self.cv_HOST.host_check_command("lspci", "lsusb")
self.cv_HOST.host_list_pci_devices()
self.cv_HOST.host_get_pci_verbose_info()
self.cv_HOST.host_list_usb_devices()
l_res = self.cv_HOST.host_run_command("lspci -mm -n")
self.pci_data_hostos = l_res.replace("\r\n", "\n")
diff_process = subprocess.Popen(["diff", "-u", self.pci_good_data_file, "-"], stdin=subprocess.PIPE)
diff_stdout, diff_stderr = diff_process.communicate(self.pci_data_hostos)
r = diff_process.wait()
if r == 0:
print "All the pci devices are detected in host OS"
else:
print diff_stdout
raise OpTestError("There is a mismatch b/w known good output and tested host OS lspci output")