當前位置: 首頁>>代碼示例>>Python>>正文


Python OpTestIPMI.ipmi_lpar_set_unique_prompt方法代碼示例

本文整理匯總了Python中common.OpTestIPMI.OpTestIPMI.ipmi_lpar_set_unique_prompt方法的典型用法代碼示例。如果您正苦於以下問題:Python OpTestIPMI.ipmi_lpar_set_unique_prompt方法的具體用法?Python OpTestIPMI.ipmi_lpar_set_unique_prompt怎麽用?Python OpTestIPMI.ipmi_lpar_set_unique_prompt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在common.OpTestIPMI.OpTestIPMI的用法示例。


在下文中一共展示了OpTestIPMI.ipmi_lpar_set_unique_prompt方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: OpTestIPMILockMode

# 需要導入模塊: from common.OpTestIPMI import OpTestIPMI [as 別名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_lpar_set_unique_prompt [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_lparIP The IP address of the LPAR
    # @param i_lparuser The userid to log into the LPAR
    # @param i_lparPasswd The password of the userid to log into the LPAR with
    #
    def __init__(self, i_bmcIP, i_bmcUser, i_bmcPasswd,
                 i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir=None, i_lparip=None,
                 i_lparuser=None, i_lparPasswd=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_lparip, i_lparuser, i_lparPasswd)
        self.cv_LPAR = OpTestLpar(i_lparip, i_lparuser, i_lparPasswd, i_bmcIP)
        self.cv_SYSTEM = OpTestSystem(i_bmcIP, i_bmcUser, i_bmcPasswd,
                 i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_lparip,
                 i_lparuser, i_lparPasswd)
        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):
        # Get OS level
        l_oslevel = self.cv_LPAR.lpar_get_OS_Level()

        # Get kernel version
        l_kernel = self.cv_LPAR.lpar_get_kernel_version()

        # Checking for ipmitool command and lm_sensors package
        self.cv_LPAR.lpar_check_command("ipmitool")

        l_pkg = self.cv_LPAR.lpar_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_LPAR.lpar_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_DEVICE_INTERFACE,
                                                      BMC_CONST.IPMI_DEV_INTF)
        self.cv_LPAR.lpar_load_module_based_on_config(l_kernel, BMC_CONST.CONFIG_IPMI_POWERNV,
                                                      BMC_CONST.IPMI_POWERNV)
        self.cv_LPAR.lpar_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_lpar_login(l_con)
        self.cv_IPMI.ipmi_lpar_set_unique_prompt(l_con)
        self.cv_IPMI.run_lpar_cmd_on_ipmi_console("uname -a")

        # Test IPMI white listed commands those should be allowed through un-authenticated
        # in-band interface
#.........這裏部分代碼省略.........
開發者ID:PavamanSubramaniyam,項目名稱:op-test-framework,代碼行數:103,代碼來源:OpTestIPMILockMode.py

示例2: __init__

# 需要導入模塊: from common.OpTestIPMI import OpTestIPMI [as 別名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_lpar_set_unique_prompt [as 別名]

#.........這裏部分代碼省略.........
        self.l_dir = l_dir
        # 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
        self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE2)
        self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE1)
        self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE0)
        self.cv_LPAR.lpar_run_command(BMC_CONST.DISABLE_CPU_SLEEP_STATE1)
        self.cv_LPAR.lpar_run_command(BMC_CONST.DISABLE_CPU_SLEEP_STATE2)
        self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE2)
        self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE1)
        self.cv_LPAR.lpar_run_command(BMC_CONST.GET_CPU_SLEEP_STATE0)

    ##
    # @brief This function is mainly used to clear hardware gard entries.
    #        It will perform below steps
    #           1. Reboot the system(Power off/on)
    #           2. Clear any Hardware gard entries
    #           3. Again reboot the system, to make use of garded Hardware.
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def clearGardEntries(self):
        # Power off and on the system.
        self.cv_IPMI.ipmi_power_off()
        self.cv_IPMI.ipmi_power_on()
        if int(self.cv_SYSTEM.sys_ipl_wait_for_working_state()):
            l_msg = "System failed to boot host OS"
            raise OpTestError(l_msg)
        time.sleep(BMC_CONST.LPAR_BRINGUP_TIME)

        # Clearing gard entries after lpar comes up
        self.cv_LPAR.lpar_get_OS_Level()
        l_con = self.cv_SYSTEM.sys_get_ipmi_console()
        self.cv_IPMI.ipmi_lpar_login(l_con)
        self.cv_IPMI.ipmi_lpar_set_unique_prompt(l_con)
        self.cv_IPMI.run_lpar_cmd_on_ipmi_console("uname -a")
        l_dir = "/tmp/skiboot"
        self.cv_IPMI.run_lpar_cmd_on_ipmi_console("cd %s/external/gard/;" % l_dir)
        l_cmd = "./gard list; echo $?"
        self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
        l_cmd = "./gard clear all; echo $?"
        l_res = self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
        if int(l_res[-1]):
            l_msg = "Clearing gard entries through gard tool is failed"
            raise OpTestError(l_msg)
        l_cmd = "./gard list; echo $?"
        self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)

        # Rebooting the system again to make use of garded hardware
        self.cv_IPMI.ipmi_power_off()
        self.cv_IPMI.ipmi_power_on()
        if int(self.cv_SYSTEM.sys_ipl_wait_for_working_state()):
            l_msg = "System failed to boot host OS"
            raise OpTestError(l_msg)
        time.sleep(BMC_CONST.LPAR_BRINGUP_TIME)
        self.cv_LPAR.lpar_get_OS_Level()
        self.cv_SYSTEM.sys_ipmi_close_console(l_con)

    ##
    # @brief This function executes HMI test case based on the i_test value, Before test starts
    #        disabling kdump service to make sure system reboots, after injecting non-recoverable errors.
    #
    # @param i_test @type int: this is the type of test case want to execute
    #                          BMC_CONST.HMI_PROC_RECV_DONE: Processor recovery done
    #                          BMC_CONST.HMI_PROC_RECV_ERROR_MASKED: proc_recv_error_masked
    #                          BMC_CONST.HMI_MALFUNCTION_ALERT: malfunction_alert
    #                          BMC_CONST.HMI_HYPERVISOR_RESOURCE_ERROR: hypervisor resource error
開發者ID:saqibkh,項目名稱:op-test-framework,代碼行數:70,代碼來源:OpTestHMIHandling.py

示例3: OpTestPrdDriver

# 需要導入模塊: from common.OpTestIPMI import OpTestIPMI [as 別名]
# 或者: from common.OpTestIPMI.OpTestIPMI import ipmi_lpar_set_unique_prompt [as 別名]
class OpTestPrdDriver():
    ## 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_lparIP The IP address of the LPAR
    # @param i_lparuser The userid to log into the LPAR
    # @param i_lparPasswd The password of the userid to log into the LPAR with
    #
    def __init__(self, i_bmcIP, i_bmcUser, i_bmcPasswd,
                 i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir=None, i_lparip=None,
                 i_lparuser=None, i_lparPasswd=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_lparip, i_lparuser, i_lparPasswd)
        self.cv_LPAR = OpTestLpar(i_lparip, i_lparuser, i_lparPasswd, i_bmcIP)
        self.cv_SYSTEM = OpTestSystem(i_bmcIP, i_bmcUser, i_bmcPasswd,
                 i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_lparip,
                 i_lparuser, i_lparPasswd)
        self.util = OpTestUtil()

    ##
    # @brief This function performs below steps
    #        1. Initially connecting to lpar and ipmi consoles for execution.
    #        2. check for IPOLL mask register value to see whether opal-prd is running or not
    #           if it is 0-->opal-prd is running-->continue
    #           else start opal-prd service again
    #        3. call test_prd_for_fir() function for each core FIR error and this function
    #           can be used for any number of errors, like it is a generic function
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def testPrdDriver(self):
        self.test_init()
        l_con = self.cv_SYSTEM.sys_get_ipmi_console()
        self.cv_IPMI.ipmi_lpar_login(l_con)
        self.cv_IPMI.ipmi_lpar_set_unique_prompt(l_con)
        self.cv_IPMI.run_lpar_cmd_on_ipmi_console("cd %s/external/xscom-utils/;" % BMC_CONST.CLONE_SKIBOOT_DIR)

        # check for IPOLL mask register value to check opal-prd is running or not
        l_cmd = "./getscom -c 0x0 %s" % BMC_CONST.IPOLL_MASK_REGISTER
        l_res = self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
        if l_res[-1] == "0":
            print "Opal-prd is running"
        else:
            self.cv_IPMI.run_lpar_cmd_on_ipmi_console("service opal-prd start")
            l_res = self.cv_IPMI.run_lpar_cmd_on_ipmi_console(l_cmd)
            if l_res[-1] == "0":
                print "Opal-prd is running"
            else:
                l_msg = "IPOLL MASK REGISTER is not getting cleared by opal-prd"
                raise OpTestError(l_msg)

        # test for PBA FIR with different core errors
        # 1.PBAFIR_OCI_APAR_ERR-->OCI Address Parity Error
        self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
                              BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
                              BMC_CONST.PBAFIR_OCI_APAR_ERR)
        # 2.PBAFIR_PB_CE_FW-->PB Read Data CE Error for Forwarded Request
        self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
                              BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
                              BMC_CONST.PBAFIR_PB_CE_FW)
        # 3.PBAFIR_PB_RDDATATO_FW-->PB Read Data Timeout for Forwarded Request
        self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
                              BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
                              BMC_CONST.PBAFIR_PB_RDDATATO_FW)
        # 4.PBAFIR_PB_RDADRERR_FW-->PB CRESP Addr Error Received for Forwarded Read Request
        self.test_prd_for_fir(BMC_CONST.PBA_FAULT_ISOLATION_REGISTER,
                              BMC_CONST.PBA_FAULT_ISOLATION_MASK_REGISTER,
                              BMC_CONST.PBAFIR_PB_RDADRERR_FW)
        return BMC_CONST.FW_SUCCESS

    ##
    # @brief This function injects some core FIR errors and verifies whether opal-prd clears the errors.
    #        and also this function injects errors on random chip.
    #
    # @param FIR @type str: Local Fault Isolation register
    # @param FIMR @type str: Local Fault Isolation mask register
    # @param ERROR @type int: Core FIR error, this error will be written to FIR.
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    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_lpar_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_lpar_cmd_on_ipmi_console(l_cmd)
        print l_res

#.........這裏部分代碼省略.........
開發者ID:PavamanSubramaniyam,項目名稱:op-test-framework,代碼行數:103,代碼來源:OpTestPrdDriver.py


注:本文中的common.OpTestIPMI.OpTestIPMI.ipmi_lpar_set_unique_prompt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。