Beispiel #1
0
def is_pwr_option_visible(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is visible.

    Args:
        vm_names: List of instances to interact with, if from_details=True is passed,
                  only one instance can be passed in the list.
        option: Power option param, see :py:class:`EC2Instance` and :py:class:`OpenStackInstance`
        provider_crud: provider object where instance resides (optional)
    """
    _method_setup(vm_names, provider_crud)
    try:
        toolbar.is_greyed('Power', option)
        return True
    except sel.NoSuchElementException:
        return False
def is_pwr_option_visible(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is visible.

    Args:
        vm_names: List of VMs to interact with, if from_details=True is passed, only one VM can
            be passed in the list.
        option: Power option param.
        provider_crud: provider object where vm resides on (optional)
    """
    _method_setup(vm_names, provider_crud)
    try:
        toolbar.is_greyed('Power', option)
        return True
    except NoSuchElementException:
        return False
def is_pwr_option_visible(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is visible.

    Args:
        vm_names: List of VMs to interact with, if from_details=True is passed, only one VM can
            be passed in the list.
        option: Power option param.
        provider_crud: provider object where vm resides on (optional)
    """
    _method_setup(vm_names, provider_crud)
    try:
        toolbar.is_greyed('Power', option)
        return True
    except NoSuchElementException:
        return False
Beispiel #4
0
def is_pwr_option_visible(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is visible.

    Args:
        vm_names: List of instances to interact with, if from_details=True is passed,
                  only one instance can be passed in the list.
        option: Power option param, see :py:class:`EC2Instance` and :py:class:`OpenStackInstance`
        provider_crud: provider object where instance resides (optional)
    """
    _method_setup(vm_names, provider_crud)
    try:
        toolbar.is_greyed('Power', option)
        return True
    except sel.NoSuchElementException:
        return False
def test_collect_unconfigured(request, soft_assert):
    """ Test checking is collect button enable and disable after log depot was configured

    """
    request.addfinalizer(configure.ServerLogDepot.Credentials.clear)
    log_credentials = configure.ServerLogDepot.Credentials("smb",
                                                           "testname",
                                                           "testhost",
                                                           username="******",
                                                           password="******")
    log_credentials.update(validate=False)
    # check button is enable after adding log depot
    soft_assert(toolbar.is_greyed("Collect", "Collect all logs") is False)
    configure.ServerLogDepot.Credentials.clear()
    # check button is disable after removing log depot
    soft_assert(toolbar.is_greyed("Collect", "Collect all logs") is True)
def test_current_user_login_delete(request):
    """Test for deleting current user login.

    Steps:
        * Login as Admin user
        * Create a new user
        * Login with the new user
        * Try deleting the user
    """
    group_user = Group("EvmGroup-super_administrator")
    user = User(
        name='user' + fauxfactory.gen_alphanumeric(),
        credential=new_credential(),
        email='*****@*****.**',
        group=group_user)
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(login.login_admin)
    with user:
        if version.current_version() >= '5.7':
            navigate_to(user, 'Details')
            menu_item = ('Configuration', 'Delete this User')
            assert tb.exists(*menu_item) and tb.is_greyed(*menu_item), "Delete User is not dimmed"
        else:
            with error.expected("Current EVM User \"{}\" cannot be deleted".format(user.name)):
                user.delete()
Beispiel #7
0
def test_current_user_login_delete(request):
    """Test for deleting current user login.

    Steps:
        * Login as Admin user
        * Create a new user
        * Login with the new user
        * Try deleting the user
    """
    group_user = Group("EvmGroup-super_administrator")
    user = User(name='user' + fauxfactory.gen_alphanumeric(),
                credential=new_credential(),
                email='*****@*****.**',
                group=group_user)
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(user.appliance.server.login_admin())
    with user:
        if version.current_version() >= '5.7':
            navigate_to(user, 'Details')
            menu_item = ('Configuration', 'Delete this User')
            assert tb.exists(*menu_item) and tb.is_greyed(
                *menu_item), "Delete User is not dimmed"
        else:
            with error.expected(
                    "Current EVM User \"{}\" cannot be deleted".format(
                        user.name)):
                user.delete()
Beispiel #8
0
def test_collect_unconfigured(request, soft_assert):
    """ Test checking is collect button enable and disable after log depot was configured

    """
    request.addfinalizer(configure.ServerLogDepot.Credentials.clear)
    log_credentials = configure.ServerLogDepot.Credentials("smb",
                                                           "testname",
                                                           "testhost",
                                                           username="******",
                                                           password="******")
    log_credentials.update(validate=False)
    # check button is enable after adding log depot
    soft_assert(toolbar.is_greyed("Collect", "Collect all logs") is False)
    configure.ServerLogDepot.Credentials.clear()
    # check button is disable after removing log depot
    soft_assert(toolbar.is_greyed("Collect", "Collect all logs") is True)
Beispiel #9
0
def wait_for_ssa_enabled():
    wait_for(lambda: not toolbar.is_greyed('Configuration',
                                           'Perform SmartState Analysis'),
             delay=10,
             handle_exception=True,
             num_sec=600,
             fail_func=lambda: toolbar.select("Reload"))
def check_power_options(provider, soft_assert, vm, power_state):
    must_be_available = {'on': [vm.POWER_OFF, vm.SUSPEND, vm.RESET],
                         'off': [vm.POWER_ON]
                         }
    mustnt_be_available = {'on': [vm.POWER_ON],
                           'off': [vm.POWER_OFF, vm.SUSPEND, vm.RESET]
                           }
    # VMware and RHEVM have extended power options
    if not provider.one_of(SCVMMProvider):
        must_be_available['on'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
        mustnt_be_available['off'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
    if provider.one_of(RHEVMProvider):
        must_be_available['on'].remove(vm.RESET)
        must_be_available['on'].remove(vm.GUEST_RESTART)
    vm.load_details()
    toolbar.pf_select('Power')
    for pwr_option in must_be_available[power_state]:
        soft_assert(
            toolbar.exists('Power', pwr_option),
            "'{}' must be available in current power state - '{}' ".format(
                pwr_option, power_state))
    for pwr_option in mustnt_be_available[power_state]:
        soft_assert(
            not toolbar.exists('Power', pwr_option),
            "'{}' must not be available in current power state - '{}' ".format(
                pwr_option, power_state))
    # check if Guest OS power operations exist and greyed from "on"
    if power_state == vm.STATE_ON and (not provider.one_of(SCVMMProvider, RHEVMProvider)):
        for pwr_option in [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN]:
            soft_assert(-
                toolbar.is_greyed('Power', pwr_option),
                "'{}' must be greyed/disabled in current power state - '{}' ".format(
                    pwr_option, power_state))
Beispiel #11
0
def wait_for_ssa_enabled():
    wait_for(
        lambda: not toolbar.is_greyed("Configuration", "Perform SmartState Analysis"),
        delay=10,
        handle_exception=True,
        num_sec=600,
        fail_func=lambda: toolbar.select("Reload"),
    )
Beispiel #12
0
    def wait_candu_data_available(self, timeout=600):
        """Waits until C&U data are available for this VM/Instance

        Args:
            timeout: Timeout passed to :py:func:`utils.wait.wait_for`
        """
        self.load_details(refresh=True)
        wait_for(
            lambda: not toolbar.is_greyed('Monitoring', 'Utilization'),
            delay=10, handle_exception=True, num_sec=timeout,
            fail_func=lambda: toolbar.select("Reload"))
Beispiel #13
0
    def is_pwr_option_available_in_cfme(self, option, from_details=False):
        """Checks to see if a power option is available on the instance

        Args:
            option: corresponds to option values under the power button,
                    see :py:class:`EC2Instance` and :py:class:`OpenStackInstance`
            from_details: Whether or not to perform action from instance details page
        """
        self._method_helper(from_details=from_details)
        try:
            return not toolbar.is_greyed('Power', option)
        except sel.NoSuchElementException:
            return False
    def is_pwr_option_available_in_cfme(self, from_details=False, option=None):
        """Checks to see if a power option is available on the VM

        Args:
            from_details: Whether or not to perform action from vm details page
            option: corresponds to option values under the power button, preferred approach
                is to use Vm option constansts
        """
        self._power_helper(option=option, from_details=from_details)
        try:
            return not toolbar.is_greyed('Power', option)
        except NoSuchElementException:
            return False
Beispiel #15
0
    def is_pwr_option_available_in_cfme(self, option, from_details=False):
        """Checks to see if a power option is available on the instance

        Args:
            option: corresponds to option values under the power button,
                    see :py:class:`EC2Instance` and :py:class:`OpenStackInstance`
            from_details: Whether or not to perform action from instance details page
        """
        self._method_helper(from_details=from_details)
        try:
            return not toolbar.is_greyed('Power', option)
        except sel.NoSuchElementException:
            return False
    def is_pwr_option_available_in_cfme(self, option, from_details=False):
        """Checks to see if a power option is available on the VM

        Args:
            option: corresponds to option values under the power button, preferred approach
                is to use Vm option constansts
            from_details: Whether or not to perform action from vm details page
        """
        self._method_helper(from_details=from_details)
        try:
            return not toolbar.is_greyed('Power', option)
        except NoSuchElementException:
            return False
Beispiel #17
0
    def is_pwr_option_available_in_cfme(self, option, from_details=False):
        """Checks to see if a power option is available on the VM

        Args:
            option: corresponds to option values under the power button,
                    see :py:class:`EC2Instance` and :py:class:`OpenStackInstance`
            from_details: Whether or not to perform action from instance details page
        """
        if from_details:
            self.load_details(refresh=True)
        else:
            self.find_quadicon(mark=True)
        try:
            return not toolbar.is_greyed('Power', option)
        except sel.NoSuchElementException:
            return False
Beispiel #18
0
def is_pwr_option_enabled(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is enabled.

    Args:
        vm_names: List of VMs to interact with
        provider_crud: provider object where vm resides on (optional)
        option: Power option param.

    Raises:
        NoOptionAvailable:
            When unable to find the power option passed
    """
    _method_setup(vm_names, provider_crud)
    try:
        return not toolbar.is_greyed('Power', option)
    except NoSuchElementException:
        raise OptionNotAvailable("No such power option (" + str(option) + ") is available")
def is_pwr_option_enabled(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is enabled.

    Args:
        vm_names: List of VMs to interact with
        provider_crud: provider object where vm resides on (optional)
        option: Power option param.

    Raises:
        NoOptionAvailable:
            When unable to find the power option passed
    """
    _method_setup(vm_names, provider_crud)
    try:
        return not toolbar.is_greyed('Power', option)
    except NoSuchElementException:
        raise OptionNotAvailable("No such power option (" + str(option) + ") is available")
Beispiel #20
0
def is_pwr_option_enabled(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is enabled

    Args:
        vm_names: List of instances to interact with
        provider_crud: provider object where vm resides on (optional)
        option: Power option param; for available power option, see
                :py:class:`EC2Instance` and :py:class:`OpenStackInstance`

    Raises:
        OptionNotAvailable: When unable to find the power option passed
    """
    _method_setup(vm_names, provider_crud)
    try:
        return not toolbar.is_greyed('Power', option)
    except sel.NoSuchElementException:
        raise OptionNotAvailable("No such power option (" + str(option) + ") is available")
Beispiel #21
0
def is_pwr_option_enabled(vm_names, option, provider_crud=None):
    """Returns whether a particular power option is enabled

    Args:
        vm_names: List of instances to interact with
        provider_crud: provider object where vm resides on (optional)
        option: Power option param; for available power option, see
                :py:class:`EC2Instance` and :py:class:`OpenStackInstance`

    Raises:
        OptionNotAvailable: When unable to find the power option passed
    """
    _method_setup(vm_names, provider_crud)
    try:
        return not toolbar.is_greyed('Power', option)
    except sel.NoSuchElementException:
        raise OptionNotAvailable("No such power option (" + str(option) + ") is available")
def finish_appliance_setup(get_appliance, appliance_browser, provider, vm):  # ,listener_info):
    ''' Configure the appliance for smart state analysis '''
    logger.info("Starting finish appliance setup fixture")
    global appliance_list

    # find the vm (needed when appliance already configured for earlier class of tests)
    provider.refresh_provider_relationships()
    vm.wait_to_appear()
    vm.load_details()

    # wait for vm smart state to enable
    logger.info('Waiting for smartstate option to enable...')
    wait_for(lambda prov, prov2: not toolbar.is_greyed(prov, prov2),
             ['Configuration', 'Perform SmartState Analysis'], delay=10, handle_exception=True,
             num_sec=600, fail_func=pytest.sel.refresh)

    # Configure for events
    # setup_for_event_testing(
    #    appliance.ssh_client, None, listener_info, providers.list_infra_providers())
    return appliance_browser
Beispiel #23
0
def finish_appliance_setup(get_appliance, appliance_browser, provider_crud, vm):  # ,listener_info):
    ''' Configure the appliance for smart state analysis '''
    logger.info("Starting finish appliance setup fixture")
    global appliance_list

    # find the vm (needed when appliance already configured for earlier class of tests)
    provider_crud.refresh_provider_relationships()
    vm.wait_to_appear()
    vm.load_details()

    # wait for vm smart state to enable
    logger.info('Waiting for smartstate option to enable...')
    wait_for(lambda prov, prov2: not toolbar.is_greyed(prov, prov2),
             ['Configuration', 'Perform SmartState Analysis'], delay=10, handle_exception=True,
             num_sec=600, fail_func=pytest.sel.refresh)

    # Configure for events
    # setup_for_event_testing(
    #    appliance.ssh_client(), None, listener_info, providers.list_infra_providers())
    return appliance_browser
Beispiel #24
0
def is_pwr_option_enabled(vm_names, provider_crud=None, option=None):
    """Returns whether a particular power option is enabled.

    Args:
        vm_names: List of VMs to interact with
        provider_crud:
        option: Power option param.

    Raises:
        NoOptionAvailable:
            When unable to find the power option passed
        ParmRequired:
            When no power option is passed
    """
    if option is None:
        raise ParmRequired("power option parm is required")
    _method_setup(vm_names, provider_crud)
    try:
        return not toolbar.is_greyed('Power', option)
    except NoSuchElementException:
        raise NoOptionAvailable("No such power option (" + str(option) + ") is available")
def is_pwr_option_enabled(vm_names, provider_crud=None, option=None):
    """Returns whether a particular power option is enabled.

    Args:
        vm_names: List of VMs to interact with
        provider_crud:
        option: Power option param.

    Raises:
        NoOptionAvailable:
            When unable to find the power option passed
        ParmRequired:
            When no power option is passed
    """
    if option is None:
        raise ParmRequired("power option parm is required")
    _method_setup(vm_names, provider_crud)
    try:
        return not toolbar.is_greyed('Power', option)
    except NoSuchElementException:
        raise NoOptionAvailable("No such power option (" + str(option) +
                                ") is available")
def check_power_options(provider, soft_assert, vm, power_state):
    must_be_available = {
        'on': [vm.POWER_OFF, vm.SUSPEND, vm.RESET],
        'off': [vm.POWER_ON]
    }
    mustnt_be_available = {
        'on': [vm.POWER_ON],
        'off': [vm.POWER_OFF, vm.SUSPEND, vm.RESET]
    }
    # VMware and RHEVM have extended power options
    if not provider.one_of(SCVMMProvider):
        must_be_available['on'].extend([vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
        mustnt_be_available['off'].extend(
            [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN])
    if provider.one_of(RHEVMProvider):
        must_be_available['on'].remove(vm.RESET)
        must_be_available['on'].remove(vm.GUEST_RESTART)
    vm.load_details()
    toolbar.pf_select('Power')
    for pwr_option in must_be_available[power_state]:
        soft_assert(
            toolbar.exists('Power', pwr_option),
            "'{}' must be available in current power state - '{}' ".format(
                pwr_option, power_state))
    for pwr_option in mustnt_be_available[power_state]:
        soft_assert(
            not toolbar.exists('Power', pwr_option),
            "'{}' must not be available in current power state - '{}' ".format(
                pwr_option, power_state))
    # check if Guest OS power operations exist and greyed from "on"
    if power_state == vm.STATE_ON and (not provider.one_of(
            SCVMMProvider, RHEVMProvider)):
        for pwr_option in [vm.GUEST_RESTART, vm.GUEST_SHUTDOWN]:
            soft_assert(
                -toolbar.is_greyed('Power', pwr_option),
                "'{}' must be greyed/disabled in current power state - '{}' ".
                format(pwr_option, power_state))