Ejemplo n.º 1
0
        query = query.filter(t_msgr.name == name)
    if feed:
        query = query.filter(t_msgr.feed == feed)
    query = query.filter(t_md.name == domain.name)
    return query


def _get_server_groups_page(domain):
    navigate_to(domain, 'DomainServerGroups')


timeout_form = Form(fields=[(
    "timeout",
    Input("timeout", use_id=True)), (
        'suspend_button',
        FormButton("Suspend")), (
            'stop_button',
            FormButton("Stop")), ('cancel_button', FormButton("Cancel"))])


class MiddlewareServerGroup(MiddlewareBase, Taggable, Container, Navigatable):
    """
    MiddlewareServerGroup class provides actions and details on Server Group page.
    Class method available to get existing server groups list

    Args:
        name: name of the server group
        domain: Domain (MiddlewareDomain) object to which belongs server group
        profile: Profile of the server group
        feed: feed of the server group
        db_id: database row id of server group
Ejemplo n.º 2
0
from cfme.infrastructure.host import Host
from cfme.web_ui.menu import nav
import cfme.web_ui.toolbar as tb
from cfme.common.provider import BaseProvider
import utils.conf as conf
from cfme.web_ui import (Region, Quadicon, Form, Select, CheckboxTree, fill,
                         form_buttons, paginator, Input)
from cfme.web_ui.form_buttons import FormButton
from utils.browser import ensure_browser_open
from utils.log import logger
from utils.update import Updateable
from utils.wait import wait_for
from utils import version
from utils.pretty import Pretty

add_infra_provider = FormButton("Add this Infrastructure Provider")

details_page = Region(infoblock_type='detail')

# Forms
discover_form = Form(
    fields=[('rhevm_chk', Input("discover_type_rhevm")
             ), ('vmware_chk', Input("discover_type_virtualcenter")),
            ('scvmm_chk',
             Input("discover_type_scvmm")), ('from_0', Input("from_first")),
            ('from_1', Input("from_second")), ('from_2', Input("from_third")),
            ('from_3', Input("from_fourth")), ('to_3', Input("to_fourth")),
            ('start_button', FormButton("Start the Host Discovery"))])

properties_form = Form(
    fields=[('type_select',
Ejemplo n.º 3
0
        version.LOWEST: Select('select#validate_id'),
        '5.5': AngularSelect('validate_id')
    }),
])

manage_policies_tree = CheckboxTree("//div[@id='protect_treebox']/ul")

drift_table = CheckboxTable({
    version.LOWEST:
    "//table[@class='style3']",
    "5.4":
    "//th[normalize-space(.)='Timestamp']/ancestor::table[1]"
})

host_add_btn = {
    version.LOWEST: FormButton('Add this Host'),
    "5.5": FormButton("Add")
}
default_host_filter_btn = FormButton('Set the current filter as my default')
cfg_btn = partial(tb.select, 'Configuration')
pol_btn = partial(tb.select, 'Policy')
pow_btn = partial(tb.select, 'Power')
lif_btn = partial(tb.select, 'Lifecycle')
mon_btn = partial(tb.select, 'Monitoring')

match_page = partial(match_location, controller='host', title='Hosts')


class InfraHostTimelinesView(TimelinesView, cfme.BaseLoggedInPage):
    @property
    def is_displayed(self):
Ejemplo n.º 4
0
    # The arrow opening/closing the advanced search box
    toggle_advanced={
        "5.3": "//img[@id='adv_search_img']",
        "5.4": "(//button | //a)[@id='adv_search']"
    },

    # Container for the advanced search box
    advanced_search_box={
        "5.3": "//div[@id='advsearchbox']",
        "5.4": "//div[@id='advsearchModal']//div[@class='modal-content']"
    },

    # Buttons on main view
    apply_filter_button={
        "5.3": "//a[@title='Apply the current filter']",
        "5.4": FormButton("Apply the current filter")
    },
    load_filter_button={
        "5.3": "//a[@title='Load a filter']",
        "5.4": FormButton("Load a filter")
    },
    delete_filter_button={
        "5.3": "//a[contains(@title, 'Delete the filter named')]",
        "5.4": FormButton("Delete the filter named", partial_alt=True)
    },
    save_filter_button={
        "5.3": "//a[@title='Save the current filter']",
        "5.4": FormButton("Save the current filter")
    },
    reset_filter_button={
        "5.3": "//a[@title='Reset the filter']",
Ejemplo n.º 5
0
def _get_servers_page(provider=None, server_group=None):
    if provider:  # if provider instance is provided navigate through provider's servers page
        navigate_to(provider, 'ProviderServers')
    elif server_group:
        # if server group instance is provided navigate through it's servers page
        navigate_to(server_group, 'ServerGroupServers')
    else:  # if None(provider) given navigate through all middleware servers page
        navigate_to(MiddlewareServer, 'All')


timeout_form = Form(fields=[(
    "timeout",
    Input("timeout", use_id=True)), (
        'suspend_button',
        FormButton("Suspend")), (
            'shutdown_button',
            FormButton("Shutdown")), ('cancel_button', FormButton("Cancel"))])


class MiddlewareServer(MiddlewareBase, Taggable, Container, Navigatable,
                       UtilizationMixin):
    """
    MiddlewareServer class provides actions and details on Server page.
    Class method available to get existing servers list

    Args:
        name: name of the server
        hostname: Host name of the server
        provider: Provider object (HawkularProvider)
        product: Product type of the server
Ejemplo n.º 6
0
from utils.wait import wait_for
from utils import version
from utils.pretty import Pretty
from utils.varmeth import variable

details_page = Region(infoblock_type='detail')

# Forms
discover_form = Form(
    fields=[('rhevm_chk', Input("discover_type_rhevm")
             ), ('vmware_chk', Input("discover_type_virtualcenter")),
            ('scvmm_chk',
             Input("discover_type_scvmm")), ('from_0', Input("from_first")),
            ('from_1', Input("from_second")), ('from_2', Input("from_third")),
            ('from_3', Input("from_fourth")), ('to_3', Input("to_fourth")),
            ('start_button', FormButton("Start the Host Discovery"))])

properties_form = Form(
    fields=[('type_select', {
        version.LOWEST: Select('select#server_emstype'),
        '5.5': AngularSelect("server_emstype")
    }), ('name_text', Input("name")), ('hostname_text', Input("hostname")),
            ('ipaddress_text', Input("ipaddress"), {
                "removed_since": "5.4.0.0.15"
            }), ('api_port', Input("port")),
            ('sec_protocol', {
                version.LOWEST: Select("select#security_protocol"),
                '5.5': AngularSelect("security_protocol")
            }), ('sec_realm', Input("realm"))])

manage_policies_tree = CheckboxTree("//div[@id='protect_treebox']/ul")
Ejemplo n.º 7
0
import cfme.fixtures.pytest_selenium as sel
from cfme.web_ui import Form, Region, Select, fill, flash
from cfme.web_ui.form_buttons import FormButton

import_form = Form(
    fields=[("file_select", "#upload_file"),
            ("upload_button",
             "//input[@id='upload_atags' or @id='upload_tags']")])

export_form = Form(fields=[
    ("type", Select("select#dbtype")),
    ("available", Select("select#choices_chosen_")),
])

upload_buttons = Region(locators=dict(
    commit_button=FormButton("Commit Import"),
    cancel_button=FormButton("Cancel Import"),
))


def import_file(filename, cancel=False):
    """ Go to Control / Import Export and import given file.

    Args:
        filename: Full path to file to import.
        cancel: Whether to click Cancel instead of commit.
    """
    sel.force_navigate("control_import_export")
    fill(
        import_form,
        {"file_select": filename},
Ejemplo n.º 8
0
    ])

manage_policies_tree = CheckboxTree(
    {
        version.LOWEST: "//div[@id='treebox']/div/table",
        "5.3": "//div[@id='protect_treebox']/ul"
    }
)

drift_table = CheckboxTable({
    version.LOWEST: "//table[@class='style3']",
    "5.4": "//th[normalize-space(.)='Timestamp']/ancestor::table[1]"
})

host_add_btn = {
    version.LOWEST: FormButton('Add this Host'),
    "5.5": FormButton("Add")
}
cfg_btn = partial(tb.select, 'Configuration')
pol_btn = partial(tb.select, 'Policy')
pow_btn = partial(tb.select, 'Power')
lif_btn = partial(tb.select, 'Lifecycle')

nav.add_branch('infrastructure_hosts',
               {'infrastructure_host_new': lambda _: cfg_btn(
                   version.pick({version.LOWEST: 'Add a New Host',
                                 '5.4': 'Add a New item'})),
                'infrastructure_host_discover': lambda _: cfg_btn(
                    'Discover Hosts'),
                'infrastructure_host': [lambda ctx: sel.click(Quadicon(ctx['host'].name,
                                                                      'host')),
Ejemplo n.º 9
0
    # The icon buttons for searching
    search_icon={
        "5.4":
        "//div[@id='searchbox']//div[contains(@class, 'form-group')]"
        "/*[self::a or (self::button and @type='submit')]"
    },

    # The arrow opening/closing the advanced search box
    toggle_advanced="(//button | //a)[@id='adv_search']",

    # Container for the advanced search box
    advanced_search_box=
    "//div[@id='advsearchModal']//div[@class='modal-content']",

    # Buttons on main view
    apply_filter_button=FormButton("Apply the current filter"),
    load_filter_button=FormButton("Load a filter"),
    delete_filter_button=FormButton("Delete the filter named",
                                    partial_alt=True),
    save_filter_button=FormButton("Save the current filter"),
    reset_filter_button=FormButton("Reset the filter"),
    close_button=
    "//div[@id='advsearchModal']/div//button/span[normalize-space(.)='×']",

    # Buttons in the "next step"
    load_filter_dialog_button=FormButton("Load the filter shown above"),
    cancel_load_filter_dialog_button=FormButton("Cancel the load"),
    save_filter_dialog_button=FormButton("Save the current search"),
    cancel_save_filter_dialog_button=FormButton("Cancel the save"),

    # If user input requested, this window appears
Ejemplo n.º 10
0
from cfme.fixtures import pytest_selenium as sel
from cfme.web_ui import (Quadicon, Region, listaccordion as list_acc, toolbar
                         as tb, flash, InfoBlock, match_location, fill,
                         paginator, accordion)
from cfme.web_ui.form_buttons import FormButton
from utils.appliance import Navigatable
from utils.appliance.implementations.ui import navigator, CFMENavigateStep, navigate_to
from utils.pretty import Pretty
from utils.providers import get_crud
from utils.wait import wait_for

details_page = Region(infoblock_type='detail')

page_title_loc = '//div[@id="center_div" or @id="main-content"]//h1'

default_datastore_filter_btn = FormButton(
    'Set the current filter as my default')

cfg_btn = partial(tb.select, 'Configuration')
pol_btn = partial(tb.select, 'Policy')

match_page = partial(match_location, controller='storage', title='Datastores')

# todo: to make provider a mandatory param.
# maybe it might be better of getting this param from db or appliance w/o making it mandatory.


class Datastore(Pretty, Navigatable):
    """ Model of an infrastructure datastore in cfme

    Args:
        name: Name of the datastore.
Ejemplo n.º 11
0
    ("//div[@id='list_grid']/div[1]//tbody", 1),
    ("//div[@id='list_grid']/div[2]//tbody", 1),
    header_checkbox_locator="#masterToggle"
)

details_page = Region(infoblock_type='detail')

form = Form(
    fields=[
        ('name', Input('repo_name')),
        ('path', Input('repo_path')),
    ]
)

add_btn = {
    LOWEST: FormButton('Add this Repository'),
    # wonky upstream locator
    '5.4': '//button[.="Add"]'
}
save_btn = {
    LOWEST: form_buttons.save,
    '5.4': '//button[.="Save"]'
}
cfg_btn = partial(tb.select, 'Configuration')
pol_btn = partial(tb.select, 'Policy')


def _repo_row(name):
    for page in pages():
        row = repo_list.find_row('Name', name)
        if row:
Ejemplo n.º 12
0
    ('ipmi_address_text', "//*[@id='ipmi_address']"),
    ('mac_address_text', "//*[@id='mac_address']"),
])

credential_form = Form(
    fields=[('default_button',
             "//div[@id='auth_tabs']/ul/li/a[@href='#default']"
             ), ('default_principal', "//*[@id='default_userid']"
                 ), ('default_secret', "//*[@id='default_password']"
                     ), ('default_verify_secret', "//*[@id='default_verify']"),
            ('ipmi_button', "//div[@id='auth_tabs']/ul/li/a[@href='#ipmi']"
             ), ('ipmi_principal', "//*[@id='ipmi_userid']"
                 ), ('ipmi_secret', "//*[@id='ipmi_password']"
                     ), ('ipmi_verify_secret', "//*[@id='ipmi_verify']"),
            ('validate_btn',
             FormButton('Validate the credentials by logging into the Server',
                        dimmed_alt="Validate"))])

manage_policies_tree = CheckboxTree(
    version.pick({
        "default": "//div[@id='treebox']/div/table",
        "5.3": "//div[@id='protect_treebox']/ul"
    }))

host_add_btn = FormButton('Add this Host')

cfg_btn = partial(tb.select, 'Configuration')
pol_btn = partial(tb.select, 'Policy')
pow_btn = partial(tb.select, 'Power')

nav.add_branch(
    'infrastructure_hosts', {
Ejemplo n.º 13
0
    search_icon='(//button | //a)[(@type="submit" or @data-submit="searchbox") '
    'and span[contains(@class, "fa-search")]]',

    # The arrow opening/closing the advanced search box
    toggle_advanced="(//button | //a)[@id='adv_search']",

    # Container for the advanced search box
    # class changes when visible or hidden, first locator does not indicate visibility
    advanced_search_box=
    "//div[@id='advsearchModal']//div[@class='modal-content']",
    advanced_search_box_visible=
    "//div[@id='advsearchModal' and @class='modal fade in']"
    "//div[@class='modal-content']",

    # Buttons on main view
    apply_filter_button=FormButton(alt="Apply the current filter",
                                   dimmed_alt='No filter available'),
    load_filter_button=FormButton(
        alt="Load a filter",
        dimmed_alt="No saved filters or report filters are "
        "available to load"),
    delete_filter_button=FormButton("Delete the filter named",
                                    partial_alt=True),
    # No dimmed state for delete button, its removed/added to UI as it becomes relevant
    save_filter_button=FormButton(alt="Save the current filter",
                                  dimmed_alt='No filter available'),
    reset_filter_button=FormButton(alt="Reset the filter",
                                   dimmed_alt='No filter available'),

    # There are multiple close button divs, and they swap visibility with @style none/block
    close_button="//div[(@id='advsearchModal' or 'quicksearchbox') "
    "and (normalize-space(@style)='display: block;')]//button[@class='close']"
Ejemplo n.º 14
0

def _get_servers_page(provider=None, server_group=None):
    if provider:  # if provider instance is provided navigate through provider's servers page
        navigate_to(provider, 'ProviderServers')
    elif server_group:
        # if server group instance is provided navigate through it's servers page
        navigate_to(server_group, 'ServerGroupServers')
    else:  # if None(provider) given navigate through all middleware servers page
        navigate_to(MiddlewareServer, 'All')


timeout_form = Form(
    fields=[
        ("timeout", Input("timeout", use_id=True)),
        ('suspend_button', FormButton("Suspend")),
        ('shutdown_button', FormButton("Shutdown")),
        ('cancel_button', FormButton("Cancel"))
    ]
)


class MiddlewareServer(MiddlewareBase, Taggable, Container, Navigatable, UtilizationMixin):
    """
    MiddlewareServer class provides actions and details on Server page.
    Class method available to get existing servers list

    Args:
        name: name of the server
        hostname: Host name of the server
        provider: Provider object (HawkularProvider)
Ejemplo n.º 15
0
    ('validate_host', Select('select#validate_id')),
])

manage_policies_tree = CheckboxTree({
    version.LOWEST: "//div[@id='treebox']/div/table",
    "5.3": "//div[@id='protect_treebox']/ul"
})

drift_table = CheckboxTable({
    version.LOWEST:
    "//table[@class='style3']",
    "5.4":
    "//th[normalize-space(.)='Timestamp']/ancestor::table[1]"
})

host_add_btn = FormButton('Add this Host')
forced_saved = FormButton("Save Changes", dimmed_alt="Save", force_click=True)
cfg_btn = partial(tb.select, 'Configuration')
pol_btn = partial(tb.select, 'Policy')
pow_btn = partial(tb.select, 'Power')
lif_btn = partial(tb.select, 'Lifecycle')

nav.add_branch(
    'infrastructure_hosts', {
        'infrastructure_host_new':
        lambda _: cfg_btn(
            version.pick({
                version.LOWEST: 'Add a New Host',
                '5.4': 'Add a New item'
            })),
        'infrastructure_host_discover':
Ejemplo n.º 16
0
import cfme.fixtures.pytest_selenium as sel
import cfme.web_ui.flash as flash
import cfme.web_ui.menu  # so that menu is already loaded before grafting onto it
import cfme.web_ui.toolbar as tb
import utils.conf as conf
from cfme.exceptions import HostStatsNotContains, ProviderHasNoProperty, ProviderHasNoKey
from cfme.web_ui import Region, Quadicon, Form, Select, CheckboxTree, fill, form_buttons, paginator
from cfme.web_ui import Timelines
from cfme.web_ui.form_buttons import FormButton
from utils.log import logger
from utils.providers import provider_factory
from utils.update import Updateable
from utils.wait import wait_for
from utils import version

add_infra_provider = FormButton("Add this Infrastructure Provider")

details_page = Region(infoblock_type='detail')

prov_timeline = Timelines('//div[@id="miq_timeline"]')

# Forms
discover_form = Form(fields=[
    ('rhevm_chk', "//input[@id='discover_type_rhevm']"),
    ('vmware_chk', "//input[@id='discover_type_virtualcenter']"),
    ('from_0', "//*[@id='from_first']"),
    ('from_1', "//*[@id='from_second']"),
    ('from_2', "//*[@id='from_third']"),
    ('from_3', "//*[@id='from_fourth']"),
    ('to_3', "//*[@id='to_fourth']"),
    ('start_button', "//input[@name='start']"),