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


Python OpTestHost.OpTestHost类代码示例

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


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

示例1: OpTestHeartbeat

class OpTestHeartbeat():
    ##  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 will cover following test steps
    #        1. It will check for os level and get kernel version
    #        2. It will check for existence of ps command
    #        3. It will check for kopald service is running 
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def test_kopald_service(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 ps command 
        self.cv_HOST.host_check_command("ps")

        l_cmd = "ps -ef | grep -i kopald"
        print l_cmd
        l_res = self.cv_HOST.host_run_command(l_cmd)
        print l_res
        if (l_res.__contains__('[kopald]')):
            return BMC_CONST.FW_SUCCESS 
        else:
            l_msg = "kopald service is not running"
            print l_msg
            raise OpTestError(l_msg)
开发者ID:open-power,项目名称:op-test-framework,代码行数:56,代码来源:OpTestHeartbeat.py

示例2: __init__

 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,
     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
开发者ID:open-power,项目名称:op-test-framework,代码行数:31,代码来源:OpTestPCI.py

示例3: __init__

 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()
开发者ID:shenki,项目名称:op-test-framework,代码行数:8,代码来源:OpTestInbandUsbInterface.py

示例4: __init__

 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
开发者ID:open-power,项目名称:op-test-framework,代码行数:14,代码来源:OpTestMtdPnorDriver.py

示例5: __init__

 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, 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.opTestHMIHandling = OpTestHMIHandling(i_bmcIP, i_bmcUser, i_bmcPasswd,
              i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostIP,
              i_hostUser, i_hostPasswd)
开发者ID:open-power,项目名称:op-test-framework,代码行数:14,代码来源:OpTestIPMIReprovision.py

示例6: OpTestOOBIPMI

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()
#.........这里部分代码省略.........
开发者ID:open-power,项目名称:op-test-framework,代码行数:101,代码来源:OpTestOOBIPMI.py

示例7: OpTestEM

class OpTestEM():
    ##  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 will cover following test steps
    #        1. It will get the OS and kernel versions.
    #        2. Check the cpupower utility is available in host.
    #        3. Get available cpu scaling frequencies
    #        4. Set the userspace governer for all cpu's
    #        5. test the cpufreq driver by set/verify cpu frequency
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def test_cpu_freq_states(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()

        self.cv_HOST.host_check_command("cpupower")
        # Get available cpu scaling frequencies
        l_res = self.cv_HOST.host_run_command("cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies")
        freq_list = (l_res.strip()).split(' ')
        print freq_list

        # Set the cpu governer to userspace
        self.set_cpu_gov("userspace")
        self.verify_cpu_gov("userspace")
        for i in range(1, 100):
            i_freq = random.choice(freq_list)
            self.set_cpu_freq(i_freq)
            self.verify_cpu_freq(i_freq)

        return BMC_CONST.FW_SUCCESS

    ##
    # @brief This function will cover following test steps
    #        1. It will get the OS and kernel versions.
    #        2. Check the cpupower utility is available in host.
    #        3. Set the userspace governer for all cpu's
    #        4. test the cpuidle driver by enable/disable/verify the idle states
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def test_cpu_idle_states(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()

        self.cv_HOST.host_check_command("cpupower")
        # currently p8 cpu has 3 states
        for i in (0, 1, 2):
            self.enable_idle_state(i)
            self.verify_enable_idle_state(i)
        for i in (0, 1, 2):
            self.disable_idle_state(i)
            self.verify_disable_idle_state(i)

        return BMC_CONST.FW_SUCCESS

    ##
    # @brief sets the cpu frequency with i_freq value
    #
    # @param i_freq @type str: this is the frequency of cpu to be set
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def set_cpu_freq(self, i_freq):
        l_cmd = "for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_setspeed; do echo %s > $i; done" % i_freq
        self.cv_HOST.host_run_command(l_cmd)
#.........这里部分代码省略.........
开发者ID:open-power,项目名称:op-test-framework,代码行数:101,代码来源:OpTestEM.py

示例8: OpTestSwitchEndianSyscall

class OpTestSwitchEndianSyscall():
    ## 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  If git and gcc commands are availble on host, this function will clone linux
    #         git repository and check for switch_endian_test directory and make
    #         the required files. And finally execute bin file switch_endian_test.
    #
    # @return BMC_CONST.FW_SUCCESS-success or BMC_CONST.FW_FAILED-fail
    #
    def testSwitchEndianSysCall(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")
        self.cv_HOST.host_check_command("gcc")

        # Clone latest linux git repository into l_dir
        l_dir = "/tmp/linux"
        self.cv_HOST.host_clone_linux_source(l_dir)

        # Check for switch_endian test directory.
        self.check_dir_exists(l_dir)

        # make the required files
        self.make_test(l_dir)

        # Run the switch_endian sys call test once
        l_rc = self.run_once(l_dir)
        if int(l_rc) == 1:
            print "Switch endian sys call test got succesful"
            return BMC_CONST.FW_SUCCESS
        else:
            print "Switch endian sys call test failed"
            return BMC_CONST.FW_FAILED

    ##
    # @brief  It will check for existence of switch_endian directory in the cloned repository
    #
    # @param i_dir @type string: linux source directory
    #
    # @return 1-success or raise OpTestError
    #
    def check_dir_exists(self, i_dir):
        l_dir = '%s/tools/testing/selftests/powerpc/switch_endian' % i_dir
        l_cmd = "test -d %s; echo $?" % l_dir
        print l_cmd
        l_res = self.cv_HOST.host_run_command(l_cmd)
        print l_res
        l_res = l_res.replace("\r\n", "")
        if int(l_res) == 0:
            print "Switch endian test directory exists"
            return 1
        else:
            l_msg = "Switch endian directory is not present"
            print l_msg
            raise OpTestError(l_msg)

    ##
    # @brief  It will prepare for executable bin files using make command
    #         At the end it will check for bin file switch_endian_test and
    #         will throw an exception in case of missing bin file after make
    #
    # @param i_dir @type string: linux source directory
    #
    # @return 1-success or raise OpTestError
    #
    def make_test(self, i_dir):
        l_cmd = "cd %s/tools/testing/selftests/powerpc/switch_endian;\
                 make;" % i_dir
        print l_cmd
        l_res = self.cv_HOST.host_run_command(l_cmd)
        l_cmd = "test -f %s/tools/testing/selftests/powerpc/switch_endian/switch_endian_test; echo $?" % i_dir
        l_res = self.cv_HOST.host_run_command(l_cmd)
        l_res = l_res.replace("\r\n", "")
        if int(l_res) == 0:
            print "Executable binary switch_endian_test is available"
            return 1
#.........这里部分代码省略.........
开发者ID:shenki,项目名称:op-test-framework,代码行数:101,代码来源:OpTestSwitchEndianSyscall.py

示例9: OpTestInbandIPMI

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"
#.........这里部分代码省略.........
开发者ID:shenki,项目名称:op-test-framework,代码行数:101,代码来源:OpTestInbandIPMI.py

示例10: OpTestSystemBootSequence

class OpTestSystemBootSequence():
    ##  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, 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()

    ##
    # @brief This function will test mc cold reset boot sequence
    #        It has below steps
    #        1. Do a system Power OFF(Host should go down)
    #        2. Set auto reboot policy to off(chassis policy always-off)
    #        3. Issue a BMC Cold reset.
    #        4. After BMC comes up, Issue a Power ON of the system
    #        5. Check for system status and gather OPAL msg log.
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def testMcColdResetBootSequence(self):
        self.cv_SYSTEM.sys_bmc_power_on_validate_host()
        print "Testing MC Cold reset boot sequence"
        print "Performing a IPMI Power OFF Operation"
        # Perform a IPMI Power OFF Operation(Immediate Shutdown)
        self.cv_IPMI.ipmi_power_off()
        if int(self.cv_SYSTEM.sys_wait_for_standby_state(BMC_CONST.SYSTEM_STANDBY_STATE_DELAY)) == 0:
            print "System is in standby/Soft-off state"
        else:
            l_msg = "System failed to reach standby/Soft-off state"
            raise OpTestError(l_msg)
        print "Setting the system power policy to always-off"
        self.cv_IPMI.ipmi_set_power_policy("always-off")

        # Perform a BMC Cold Reset Operation
        self.cv_IPMI.ipmi_cold_reset()

        print "Performing a IPMI Power ON Operation"
        # Perform a IPMI Power ON Operation
        self.cv_IPMI.ipmi_power_on()
        self.cv_SYSTEM.sys_check_host_status()
        self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
        self.cv_IPMI.clear_ssh_keys(self.cv_HOST.ip)

        print "Gathering the OPAL msg logs"
        self.cv_HOST.host_gather_opal_msg_log()
        return BMC_CONST.FW_SUCCESS

    ##
    # @brief This function will test mc warm reset boot sequence
    #        It has below steps
    #        1. Do a system Power OFF(Host should go down)
    #        2. Set auto reboot policy to off(chassis policy always-off)
    #        3. Issue a BMC Warm reset.
    #        4. After BMC comes up, Issue a Power ON of the system
    #        5. Check for system status and gather OPAL msg log.
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def testMcWarmResetBootSequence(self):
        self.cv_SYSTEM.sys_bmc_power_on_validate_host()
        print "Testing MC Warm reset boot sequence"
        print "Performing a IPMI Power OFF Operation"
        # Perform a IPMI Power OFF Operation(Immediate Shutdown)
        self.cv_IPMI.ipmi_power_off()
        if int(self.cv_SYSTEM.sys_wait_for_standby_state(BMC_CONST.SYSTEM_STANDBY_STATE_DELAY)) == 0:
            print "System is in standby/Soft-off state"
        else:
            l_msg = "System failed to reach standby/Soft-off state"
            raise OpTestError(l_msg)
        print "Setting the system power policy to always-off"
        self.cv_IPMI.ipmi_set_power_policy("always-off")

        # Perform a BMC Warm Reset Operation
        self.cv_IPMI.ipmi_warm_reset()

        print "Performing a IPMI Power ON Operation"
        # Perform a IPMI Power ON Operation
        self.cv_IPMI.ipmi_power_on()
        self.cv_SYSTEM.sys_check_host_status()
        self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
        self.cv_IPMI.clear_ssh_keys(self.cv_HOST.ip)

#.........这里部分代码省略.........
开发者ID:open-power,项目名称:op-test-framework,代码行数:101,代码来源:OpTestSystemBootSequence.py

示例11: OpTestInbandUsbInterface

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"
#.........这里部分代码省略.........
开发者ID:shenki,项目名称:op-test-framework,代码行数:101,代码来源:OpTestInbandUsbInterface.py

示例12: OpTestFWTS

class OpTestFWTS():
    ##  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, 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.user = i_hostuser
        self.ip = i_hostip
        self.passwd = i_hostPasswd


    ##
    # @brief This function just brings the system to host OS.
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def test_system_reboot(self):
        print "Testing FWTS: Booting system to OS"
        print "Performing a IPMI Power OFF Operation"
        # Perform a IPMI Power OFF Operation(Immediate Shutdown)
        self.cv_IPMI.ipmi_power_off()
        if int(self.cv_SYSTEM.sys_wait_for_standby_state(BMC_CONST.SYSTEM_STANDBY_STATE_DELAY)) == BMC_CONST.FW_SUCCESS:
            print "System is in standby/Soft-off state"
        else:
            l_msg = "System failed to reach standby/Soft-off state"
            raise OpTestError(l_msg)

        self.cv_IPMI.ipmi_power_on()
        self.cv_SYSTEM.sys_check_host_status()
        self.util.PingFunc(self.cv_HOST.ip, BMC_CONST.PING_RETRY_POWERCYCLE)
        self.cv_IPMI.clear_ssh_keys(self.cv_HOST.ip)

        print "Gathering the OPAL msg logs"
        self.cv_HOST.host_gather_opal_msg_log()
        return BMC_CONST.FW_SUCCESS

    ##
    # @brief This function just executes the fwts_execution.sh on host OS
    #
    # @return BMC_CONST.FW_SUCCESS or raise OpTestError
    #
    def test_fwts(self):
        l_oslevel = self.cv_HOST.host_get_OS_Level()
        if not "Ubuntu" in l_oslevel:
            return
        # Copy the fwts execution file to the tmp folder in the host
        base_path = (os.path.dirname(os.path.abspath(__file__))).split('testcases')[0]
        fwts_script = base_path + "/testcases/fwts_execution.sh"
        try:
            self.util.copyFilesToDest(fwts_script, self.user,
                                             self.ip, "/tmp/", self.passwd)
        except:
            l_msg = "Copying fwts file to host failed"
            print l_msg
            raise OpTestError(l_msg)

        l_res = self.cv_HOST.host_run_command("/tmp/fwts_execution.sh")
        print l_res
开发者ID:open-power,项目名称:op-test-framework,代码行数:77,代码来源:OpTestFWTS.py

示例13: OpTestAt24driver

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
#.........这里部分代码省略.........
开发者ID:open-power,项目名称:op-test-framework,代码行数:101,代码来源:OpTestAt24driver.py

示例14: OpTestSensors

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
开发者ID:shenki,项目名称:op-test-framework,代码行数:95,代码来源:OpTestSensors.py

示例15: OpTestMCColdResetEffects

class OpTestMCColdResetEffects():
    ##  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, 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.opTestSensors = OpTestSensors(i_bmcIP, i_bmcUser, i_bmcPasswd,
                                           i_bmcUserIpmi, i_bmcPasswdIpmi, i_ffdcDir, i_hostip,
                                           i_hostuser, i_hostPasswd)

    ##
    # @brief  This function will test BMC Cold reset vs Host FW status
    #         1. When system is in runtime issue BMC Cold reset.
    #         2. Check Host FW services and drivers.
    #         3. Run sensors command
    #         4. Get list of chips
    #         5. This is expected to fail.
    #           https://github.com/open-power/op-build/issues/482
    #         6. Reboot the system at the end of test.
    #
    # @return BMC_CONST.FW_SUCCESS or BMC_CONST.FW_FAILED
    #
    def test_bmc_cold_reset_effects(self):
        print "Test BMC Cold reset effects versus Host Firmware Status"
        self.cv_SYSTEM.sys_bmc_power_on_validate_host()
        print "Issue BMC Cold reset"
        result = True
        try:
            self.cv_SYSTEM.sys_cold_reset_bmc()
            l_dir = BMC_CONST.SKIBOOT_WORKING_DIR
            self.cv_HOST.host_clone_skiboot_source(l_dir)
            self.cv_HOST.host_compile_xscom_utilities(l_dir)
            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")
            self.cv_IPMI.run_host_cmd_on_ipmi_console("cd %s/external/xscom-utils/; ./getscom -l" % l_dir)
            self.opTestSensors.test_hwmon_driver()
            self.cv_SYSTEM.sys_ipmi_close_console(l_con)
        except:
            result = False
            pass
        print "Gathering the OPAL msg logs"
        self.cv_HOST.host_gather_opal_msg_log()
        self.cv_IPMI.ipmi_power_off()
        self.cv_SYSTEM.sys_bmc_power_on_validate_host()
        if result is False:
            raise OpTestError("MC Cold reset vs Host FW Test failed")
开发者ID:open-power,项目名称:op-test-framework,代码行数:68,代码来源:OpTestMCColdResetEffects.py


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