当前位置: 首页>>代码示例>>Python>>正文


Python OpTestHost.host_read_msglog_core方法代码示例

本文整理汇总了Python中common.OpTestHost.OpTestHost.host_read_msglog_core方法的典型用法代码示例。如果您正苦于以下问题:Python OpTestHost.host_read_msglog_core方法的具体用法?Python OpTestHost.host_read_msglog_core怎么用?Python OpTestHost.host_read_msglog_core使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.OpTestHost.OpTestHost的用法示例。


在下文中一共展示了OpTestHost.host_read_msglog_core方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: OpTestPrdDriver

# 需要导入模块: from common.OpTestHost import OpTestHost [as 别名]
# 或者: from common.OpTestHost.OpTestHost import host_read_msglog_core [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
开发者ID:open-power,项目名称:op-test-framework,代码行数:104,代码来源:OpTestPrdDriver.py


注:本文中的common.OpTestHost.OpTestHost.host_read_msglog_core方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。