Ejemplo n.º 1
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)