Beispiel #1
0
 def verify_last_boot_order_source_retain(self, cimc_util_obj, config, parameter, con_obj):
     '''Verify last boot order source'''
     log.info('To verify whether the last boot order source is retained on ' + parameter)
     boot_mode = con_obj.get('BootDeviceDetail', 'boot_mode')
     #if boot_mode != 'Legacy' or boot_mode != 'Uefi':
     #    self.skipped('Testbed is not configured to test this test, skipping test')
     boot_order_obj = BootOrder(cimc_util_obj, config)
     log.info('remove existing boot device if any')
     boot_order_obj.remove_boot_dev()
     log.info('create LOCALHDD boot device')
     boot_device = 'myLOCALHDD_RHEL'
     boot_dev_dict = {}
     try:
         options = con_obj.options(boot_device)
     except KeyError:
         self.skipped('LOCALHDD boot device not configured on this testbed')
     for option in options:
         boot_dev_dict[option] = con_obj.get(boot_device, option)
     log.info('Remove boot device, if any created already')
     boot_order_obj.remove_boot_dev()
     res = boot_order_obj.create_and_configure_boot_device(boot_device, con_obj)
     if res is False:
         self.failed('Failed to create boot device for device type: ' + boot_device)
     elif res is 'SKIP':
         self.skipped('Boot device ' + boot_device + ' not configured on the testbed, Skipping test.')
     else:
         log.info('successfully created boot device for device type' + boot_device)
     log.info('Reboot the respective component and check for last boot order source is retained ')
     if boot_order_obj.reboot_operations(parameter) is False:
         self.failed('Failed to power cycle the %s' % (parameter))
     res = boot_order_obj.last_update_config(exp_last_source='CIMC')
     if res is True:
         self.passed('Test Passed')
     else:
         self.failed('Test Failed')
Beispiel #2
0
 def setup(self, cimc_util_obj, config, con_obj):
     '''
     Setup method for all possible boot devices
     '''
     self.boot_order_obj = BootOrder(cimc_util_obj, config)
     self.host_handle = self.boot_order_obj.host_handle
     self.host_serial_handle = cimc_util_obj.telnet_handle
     self.host_util_obj = HostUtils(cimc_util_obj, config)
     bios_obj = cimc_util_obj.bios_util_obj
     self.config_obj = config.boot_device_detail
     log.info(self.config_obj)
     self.host_ip = common_utils.get_host_mgmt_ip(config)
     log.info('Display all boot order details:')
     for key in self.config_obj.keys():
         log.info(self.config_obj[key])
     boot_mode = con_obj.get('BootDeviceDetail', 'boot_mode')
     log.info('Testbed is configured in: ' + boot_mode)
     mode = self.boot_order_obj.get_boot_mode()
     log.info('Current configured boot mode: ' + mode)
     if mode != boot_mode:
         self.boot_order_obj.configure_boot_mode(boot_mode)
         cimc_util_obj.verify_host_up(self.host_ip)
     # Disable SOL
     if bios_obj.enable_disable_sol(value='no') is False:
         log.warning('Failed to set console redirect default values')
     if bios_obj.console_redirect_defaults() is False:
         log.warning('Failed to set console redirect default values')
     aetest.loop.mark(
         self.verify_boot_order,
         boot_device=self.config_obj.keys())
Beispiel #3
0
    def inital_setup(self, cimc_util_obj, config):
        global system_capture_object
        system_capture_object = SystemDetailsCapture(cimc_util_obj, config)

        global classparam
        classparam['boot_order_obj'] = BootOrder(cimc_util_obj)
        classparam['host_util_obj'] = HostUtils(cimc_util_obj, config)
        classparam['storage_util_obj'] = StorageUtils(cimc_util_obj, config)
Beispiel #4
0
 def __init__(self, obj):
     self.bios_util_obj = obj
     self.handle = obj.handle
     self.boot_order_obj = BootOrder(self.bios_util_obj.cimc_obj)
     self.cpu_details = []
     self.processor_config = self.load_cpu_obj()
     self.msr = {"IntelTurboBoostTech" : "1A0", "EnhancedIntelSpeedStep" : "1A0",
                 "ExecuteDisable":"1A0", "HardwarePrefetch":"1A4",
                 "AdjacentCacheLinePrefetch":"1A4", "DirectCacheAccess":"1F8",
                 "lt_lock_memory":"2E7", "pkg_cst":"E2", "plat_info":"0CE",
                 "power_ctl":"1FC", "dynamic_switch":"1FC", "perf_bias":"1FC",
                 "c1e":"1FC", "ia32_energy":"1B0", "Hwpm":"1AA",
                 "cpu_cstate":"E2", 'IA32_Energy_Performance_BIAS':'1B0'}
Beispiel #5
0
    def inital_setup(self, cimc_util_obj, config):
        '''
        Initial Setups
        '''
        global classparam
        classparam['boot_order_object'] = BootOrder(cimc_util_obj, config)
        classparam['cimc_util_obj'] = cimc_util_obj
        classparam['smbios_obj'] = SmbiosLib()
        bios_obj = cimc_util_obj.bios_util_obj

        # Disable SOL
        if bios_obj.enable_disable_sol(value='no') is False:
            log.warning('Failed to set console redirect default values')
        if bios_obj.console_redirect_defaults() is False:
            log.warning('Failed to set console redirect default values')
Beispiel #6
0
    def cdn_enable_test(self, cimc_util_obj, config):
        '''
        Logical ID: RACK-BIOS-DN-CDN-VIC-003
        Test Case: To Check CDN is Enabled from CIMC
        '''
        vic_list = config.inventory_detail
        logger.info('VIC list are: ' + str(vic_list))
        bios_obj = cimc_util_obj.bios_util_obj

        host_util = HostUtils()
        boot_order_obj = BootOrder(cimc_util_obj)
        status = host_util.check_host_up(cimc_util_obj, boot_order_obj, config)
        if status is False:
            logger.warning(
                'Host OS is not pinging after setting the boot order to HDD ')

        bios_token = 'cdnEnable'
        token_new_value = 'Enabled'
        logger.info('Power on the host')
        if cimc_util_obj.set_host_power('on') is False:
            self.failed('Failed to power on host', goto=['cleanup'])
        host_ip = get_host_mgmt_ip(config)
        token_val = bios_obj.get_bios_token_value(bios_token)
        if token_val == token_new_value:
            logger.info('CDN is already enabled on CIMC')
        else:
            logger.info('Set the cdnEnable token Enable and Reboot the host')
            res = bios_obj.set_bios_token_value(bios_token, token_new_value)
            if res is False:
                logger.error('Failed to set bios token value')
                self.failed('Failed to set bios token value', goto=['cleanup'])
            '''Wait for host to reboot'''
            res = cimc_util_obj.verify_host_up(host_ip,
                                               wait_for_ping_fail=False,
                                               wait_time=400)
            if res is False:
                logger.warning('Failed to ping the host after host reboot')
                self.failed('Failed to ping host', goto=['cleanup'])
            scope = 'advanced'
            token_val = bios_obj.get_bios_token_value(bios_token)
            if token_val == token_new_value:
                self.passed(
                    'Successfully verified that CDN token can be enabled from CIMC'
                )
            else:
                self.failed('Failed to verify that CDN token,\
                    Expected is:' + token_new_value + ' But got as: ' +
                            token_val)
Beispiel #7
0
    def initial_setup(self, cimc_util_obj, config):
        '''
        Initial Setups
        '''
        global classparam
        classparam['bios_obj'] = cimc_util_obj.bios_util_obj
        classparam['host_utils'] = HostUtils()
        classparam['boot_order_obj'] = BootOrder(cimc_util_obj, config)
        classparam['host_ip'] = get_host_mgmt_ip(config)

        # Disable SOL
        if cimc_util_obj.bios_util_obj.enable_disable_sol(value='no') is False:
            log.warning('Failed to set console redirect default values')
        if cimc_util_obj.bios_util_obj.console_redirect_defaults() is False:
            log.warning('Failed to set console redirect default values')

################# Common setup Ends ##############################################
        '''
Beispiel #8
0
 def setup(self, cimc_util_obj, config, con_obj):
     '''
     Setup method for all possible basic boot devices
     '''
     self.boot_order_obj = BootOrder(cimc_util_obj, config)
     self.host_handle = self.boot_order_obj.host_handle
     self.host_serial_handle = cimc_util_obj.telnet_handle
     self.host_util_obj = HostUtils(cimc_util_obj, config)
     self.config_obj = config.basic_boot_device_detail
     self.host_ip = common_utils.get_host_mgmt_ip(config)
     bios_obj = cimc_util_obj.bios_util_obj
     log.info('Display all basic boot order details:')
     for key in self.config_obj.keys():
         log.info(self.config_obj[key])
     # Disable SOL
     if bios_obj.enable_disable_sol(value='no') is False:
         log.warning('Failed to set console redirect default values')
     if bios_obj.console_redirect_defaults() is False:
         log.warning('Failed to set console redirect default values')
     aetest.loop.mark(
         self.verify_basic_boot_order,
         boot_device=self.config_obj.keys())
Beispiel #9
0
 def verify_boot_when_wrong_attr_set(self, cimc_util_obj, config, parameter, con_obj):
     '''Verify boot device when wrong attribute set'''
     log.info('Verify that the host boots to the other available configured device \
             by setting the wrong attributes')
     boot_mode = con_obj.get('BootDeviceDetail', 'boot_mode')
     #if boot_mode != 'Legacy' or boot_mode != 'Uefi':
     #    self.skipped('Testbed is not configured to test this test, skipping test')
     boot_order_obj = BootOrder(cimc_util_obj, config)
     boot_device = 'myPXE'
     boot_dev_dict = {}
     try:
         options = con_obj.options(boot_device)
     except KeyError:
         self.skipped('PXE boot device not configured on testbed config file')
     for option in options:
         boot_dev_dict[option] = con_obj.get(boot_device, option)
     log.info('Boot configure parameters:')
     log.info(boot_dev_dict)
     boot_config_dict = {k:v for k, v in (x.split(':') for x in boot_dev_dict['config'].split(','))}
     slot_id = boot_config_dict['slot']
     port_id = boot_config_dict['port']
     log.info('Slot: %s and port: %s' % (slot_id, port_id))
     log.info(boot_config_dict)
     log.info('remove existing boot device if any')
     boot_order_obj.remove_boot_dev()
     log.info('create PXE boot device and enable the state, set order to 1, and wrong slot')
     if boot_order_obj.create_and_config_pxe_boot_device(slot_id, port_id, device_type='PXE', wrong_slot='MLOM') is False:
         self.failed('Failed to create PXE boot device')
     log.info('create LOCALHDD boot device and enable the state, set order to 2')
     if boot_order_obj.create_and_config_localhdd_boot_device(device_type=parameter, dev_order='2') is False:
         self.failed('Failed to create LOCALHDD boot device')
     log.info('Power cycle the host and verify that host boots into PXE boot device')
     boot_order_obj.powercycle_and_wait_for_host_comes_up()
     log.info('verify the actual boot order after host reboot')
     res1 = boot_order_obj.verify_host_booted_from_configured_device(device_type=parameter)
     if res1 is True:
         self.passed('Test Passed')
     else:
         self.failed('Test Failed')
Beispiel #10
0
 def setup(self, mem_mode_array, cimc_util_obj, config):
     '''
     Loops through testcase for all the memory mode config passed from job file
     and loads host related details
     '''
     host_detail_config = config.host_info[0].nw_intf_list[0]
     host_info_config = config.host_info[0].host_detail
     logger.info("IP : " + host_detail_config.ip_address + "\n user : "******"\n pass : "******"Host OS is pinging  ...")
     else:
         output = self.boot_order_obj.set_boot_order_HDD()
         if output == True:
             host_ping_status = cimc_util_obj.verify_host_up(
                 hostname=self.host_ip,
                 wait_for_ping_fail=False,
                 wait_time=600)
             if host_ping_status is True:
                 logger.info("Host OS is pinging  ...")
             else:
                 logger.error("ERROR :Host OS is not pinging \
                             ,after setting the boot order to HDD and retrying ..."
                              )
                 logger.error(
                     "Testcase failed .... since Unabke to boot to OS")
     aetest.loop.mark(self.validate_memory_config_in_cimc_and_host,
                      mem_mode=mem_mode_array)
Beispiel #11
0
    def verify_memory_config_in_efi_shell(self):
        boot_order_lib = BootOrder(self.cimc_utils_obj)
        memory_cmd = 'Smbiosview -t 203'
        total_mem = ''
        eff_mem = ''
        eff_mem_mode = ''
        mem_vol_efi = 0.0
        boot_result = boot_order_lib.boot_to_efi_shell(post_flag=True)
        logger.info('Boot result data is')
        logger.info(boot_result)
        boot_result = re.sub('[^A-Za-z0-9]+', '', boot_result[1])
        total_mem_post = re.search(r'TotalMemory(.*?)GB', boot_result).group(1)
        logger.info('Total mem post:' + total_mem_post)
        eff_mem_post = re.search(r'EffectiveMemory(.*?)GB',
                                 boot_result).group(1)
        operating_speed_post = re.search(r'MemoryOperatingSpeed(.*?)Mhz',
                                         boot_result).group(1)
        telnet_handle = self.cimc_utils_obj.telnet_handle
        efi_output = telnet_handle.execute_cmd_serial_host(memory_cmd)
        logger.info('EFI shell output is:' + efi_output)
        for data in efi_output.splitlines():
            if 'Total Memory' in data:
                total_mem = data.split(':')[1]
            elif 'Effective Memory' in data:
                eff_mem = data.split(':')[1]
            elif 'Operating Memory Mode' in data:
                eff_mem_mode = data.split(':')[1].replace(" ", "")
                if eff_mem_mode == 'Independent':
                    logger.info('Check1: MaximumPerformance')
                    eff_mem_mode = 'MaximumPerformance'
                if eff_mem_mode == 'MirrorMode':
                    logger.info('Check2: MirrorMode1LM')
                    eff_mem_mode = 'MirrorMode1LM'
            elif 'Operating Memory Voltage' in data:
                mem_vol_efi = float(
                    data.split(':')[1].replace('0V', '').replace(' ', ''))
        mem_vol_cli = self.get_mem_voltage()
        mem_summary = self.get_memory_summary()
        eff_mem_cli = mem_summary['effectivememory']
        total_mem_cli = mem_summary['totalmemory']
        ras_mode_cli = mem_summary['configuration']
        mem_speed = mem_summary['memoryspeed'].replace(' ',
                                                       '').replace('MHz', '')
        logger.info('POST data below:')
        logger.info(total_mem_post)
        logger.info(eff_mem_post)
        logger.info(operating_speed_post)
        logger.info(mem_speed)
        boot_order_lib.change_boot_order(boot_option='hdd')
        telnet_handle.disconnect()
        '''BIOS POST verification
        '''
        total_mem_post = int(total_mem_post) * 1024
        eff_mem_post = int(eff_mem_post) * 1024
        post_result = False

        logger.info(
            'EFI:: total_mem_post: %s and cli: %s' %
            (total_mem_post, total_mem_cli.replace(' ', '').replace('MB', '')))
        logger.info('EFI:: eff_mem_post: %s and cli: %s' %
                    (eff_mem_post,
                     int(eff_mem_cli.replace(' ', '').replace('MB', ''))))
        logger.info('EFI:: operating speed %s and cli %s' %
                    (operating_speed_post, mem_speed))
        if total_mem_post == int(
                total_mem_cli.replace(' ', '').replace(
                    'MB', '')) and eff_mem_post == int(
                        eff_mem_cli.replace(' ', '').replace(
                            'MB', '')) and operating_speed_post == mem_speed:
            logger.info('Memory validation ins post passed')
            post_result = True
        else:
            logger.error('memory validation in post failed')
            logger.error('Total mem in post:' + str(total_mem_post) +
                         ' and cli:' +
                         total_mem_cli.replace(' ', '').replace('MB', ''))
            logger.error('eff mem in post:' + str(eff_mem_post) + ' and cli:' +
                         eff_mem_cli.replace(' ', '').replace('MB', ''))
            logger.error('mem freq in post:' + operating_speed_post +
                         ' and cli:' + mem_speed)
            post_result = False

        #if total_mem.replace('\s', '') == total_mem_cli.replace('\s', '') and eff_mem.replace('\s', '') == eff_mem_cli.replace(
        #        '\s', '') and eff_mem_mode.replace('\s', '') == ras_mode_cli.replace('\s', '') and mem_vol_cli == mem_vol_efi:
        #    logger.info('mem validation success in efi shell')
        #    return [True, post_result]
        if total_mem.replace('\s', '') == total_mem_cli.replace(
                '\s', '') and eff_mem.replace('\s', '') == eff_mem_cli.replace(
                    '\s', '') and eff_mem_mode.replace(
                        ' ', '') == ras_mode_cli.replace(' ', ''):
            logger.info('mem validation success in efi shell')
            return [True, post_result]
        else:
            logger.error('memory validation in EFI shell failed')
            logger.error('Total mem in efi:' + total_mem + ' and cli:' +
                         total_mem_cli)
            logger.error('eff mem in efi:' + eff_mem + ' and cli:' +
                         eff_mem_cli)
            logger.error('mem mode in efi:' + eff_mem_mode + ' and cli:' +
                         ras_mode_cli)
            logger.error('memory voltage in efi:' + str(mem_vol_efi) +
                         'and cli:' + str(mem_vol_cli))
            return [False, post_result]
 def __init__(self, cimc_util_obj, config):
     self.cimc_util_obj = cimc_util_obj
     self.config = config
     self.boot_order_obj = BootOrder(cimc_util_obj, config)