Esempio n. 1
0
def check_fixed_in(fixed_in, version_series):
    # used to check if the bug belongs to that series
    if fixed_in is None:
        return True
    if not isinstance(fixed_in, Version):
        fixed_in = Version(fixed_in)
    return fixed_in.is_in_series(version_series)
Esempio n. 2
0
class ButtonDetailView(AutomateCustomizationView):
    title = Text('#explorer_title_text')

    text = SummaryFormItem(
        'Basic Information', VersionPick({Version.lowest(): 'Button Text', '5.9': 'Text'}),
        text_filter=lambda text: re.sub(r'\s+Display on Button\s*$', '', text))
    hover = SummaryFormItem(
        'Basic Information',
        VersionPick({Version.lowest(): 'Button Hover Text', '5.9': 'Hover Text'}))
    dialog = SummaryFormItem('Basic Information', 'Dialog')

    system = SummaryFormItem('Object Details', 'System/Process/')
    message = SummaryFormItem('Object Details', 'Message')
    request = SummaryFormItem('Object Details', 'Request')

    type = SummaryFormItem('Object Attribute', 'Type')

    show = SummaryFormItem('Visibility', 'Show')

    @property
    def is_displayed(self):
        return (
            self.in_customization and
            self.title.text == 'Button "{}"'.format(self.context['object'].text) and
            not self.buttons.is_dimmed and
            self.buttons.is_opened and
            self.buttons.tree.currently_selected == [
                'Object Types', self.context['object'].group.type,
                self.context['object'].group.text, self.context['object'].text])
Esempio n. 3
0
    class fields(ParametrizedView):  # noqa
        PARAMETERS = ("key", )
        input = Input(id=Parameter("key"))
        param_input = Input(id=ParametrizedString("param_{key}"))
        dropdown = VersionPick({
            Version.lowest():
            BootstrapSelect(Parameter("key")),
            "5.9":
            DialogFieldDropDownList(
                ParametrizedLocator(".//div[@input-id={key|quote}]"))
        })
        param_dropdown = VersionPick({
            Version.lowest():
            BootstrapSelect(ParametrizedString("param_{key}")),
            "5.9":
            DialogFieldDropDownList(
                ParametrizedLocator(".//div[@input-id='param_{key}']"))
        })

        @property
        def visible_widget(self):
            if self.input.is_displayed:
                return self.input
            elif self.dropdown.is_displayed:
                return self.dropdown
            elif self.param_input.is_displayed:
                return self.param_input
            elif self.param_dropdown.is_displayed:
                return self.param_dropdown

        def read(self):
            return self.visible_widget.read()

        def fill(self, value):
            return self.visible_widget.fill(value)
Esempio n. 4
0
    class options(PotentiallyInvisibleTab):  # noqa
        form = ConditionalSwitchableView(reference="type")
        type = VersionPick({
            Version.lowest(): FakeWidget(read_value='Default'),
            '5.9': BootstrapSelect('button_type')
        })

        @form.register('Default')
        class ButtonFormDefaultView(View):  # noqa
            dialog = BootstrapSelect('dialog_id')

        @form.register('Ansible Playbook')
        class ButtonFormAnsibleView(View):  # noqa
            playbook_cat_item = BootstrapSelect('service_template_id')
            inventory = AutomateRadioGroup(
                locator=".//input[@name='inventory']/..")
            hosts = Input(name='hosts')

        text = Input(name='name')
        display = Checkbox(name='display')
        hover = Input(name='description')
        image = VersionPick({
            Version.lowest(): BootstrapSelect('button_image'),
            '5.9': FonticonPicker('button_icon')
        })
        open_url = Checkbox('open_url')
Esempio n. 5
0
class ButtonGroupDetailView(AutomateCustomizationView):
    title = Text('#explorer_title_text')

    text = SummaryFormItem(
        'Basic Information',
        VersionPick({
            Version.lowest(): 'Button Group Text',
            '5.9': 'Text'
        }),
        text_filter=lambda text: re.sub(r'\s+Display on Button\s*$', '', text))
    hover = SummaryFormItem(
        'Basic Information',
        VersionPick({
            Version.lowest(): 'Button Group Hover Text',
            '5.9': 'Hover Text'
        }))

    @property
    def is_displayed(self):
        return (self.in_customization and self.title.text
                == 'Button Group "{}"'.format(self.context['object'].text)
                and self.buttons.is_opened and not self.buttons.is_dimmed
                and self.buttons.tree.currently_selected == [
                    'Object Types', self.context['object'].type,
                    self.context['object'].text
                ])
Esempio n. 6
0
def check_fixed_in(fixed_in, version_series):
    # used to check if the bug belongs to that series
    if fixed_in is None:
        return True
    if not isinstance(fixed_in, Version):
        fixed_in = Version(fixed_in)
    return fixed_in.is_in_series(version_series)
Esempio n. 7
0
def test_rhsm_registration_check_repo_names(
        temp_appliance_preconfig_funcscope, soft_assert, appliance):
    """ Checks default rpm repos on a fresh appliance

    Polarion:
        assignee: jhenner
        caseimportance: high
        initialEstimate: 1/4h
    """
    ver = temp_appliance_preconfig_funcscope.version.series()
    repos = cfme_data.redhat_updates.repos

    # TODO We need the context manager here as RedHatUpdates doesn't yet support Collections.
    with temp_appliance_preconfig_funcscope:
        repo_names = VersionPicker({
            Version.lowest(): repos.pre_592,
            Version('5.9.3'): repos.post_592,
            Version('5.10.0'): repos.post_510
        }).pick(temp_appliance_preconfig_funcscope.version)
        view = navigate_to(RedHatUpdates, 'Edit')
        soft_assert(
            view.repo_name.read() == 'cf-me-{}-for-rhel-7-rpms {}'.format(ver, repo_names))
        """checks current repo names"""
        view.repo_default_name.click()
        """resets repos with default button and checks they are also correct"""
        soft_assert(
            view.repo_name.read() == 'cf-me-{}-for-rhel-7-rpms {}'.format(ver, repo_names))
Esempio n. 8
0
def test_version(v1, op, v2):
    v1 = Version(v1)
    v2 = Version(v2)
    if op == GT:
        assert v1 > v2
    elif op == LT:
        assert v1 < v2
    elif op == EQ:
        assert v1 == v2
Esempio n. 9
0
class TenantAddForm(View):
    """The form on the Add page"""
    cloud_provider = BootstrapSelect(id='ems_id')
    name = Input('name')
    save_button = VersionPick({
        Version.lowest(): Button('Save'),
        Version.latest(): Button('Add')
    })
    reset_button = Button('Reset')
    cancel_button = Button('Cancel')
Esempio n. 10
0
    class grid_tile_icons(View):    # noqa
        infra_provider_quad = BootstrapSwitch(VersionPicker({Version.lowest(): 'quadicons_ems',
                                                            '5.10': 'quadicons_infra_manager'}))
        cloud_provider_quad = BootstrapSwitch(VersionPicker(
            {Version.lowest(): 'quadicons_ems_cloud', '5.10': 'quadicons_cloud_manager'}))

        containers_provider_quad = BootstrapSwitch('quadicons_container_manager')
        host_quad = BootstrapSwitch('quadicons_host')
        datastore_quad = BootstrapSwitch('quadicons_storage')
        vm_quad = BootstrapSwitch('quadicons_vm')
        template_quad = BootstrapSwitch('quadicons_miq_template')
        long_text = BootstrapSelect('quad_truncate')
Esempio n. 11
0
class VolumeAddForm(View):
    storage_manager = BootstrapSelect(name='storage_manager_id')
    tenant = BootstrapSelect(name='cloud_tenant_id')  # is for openstack block storage only
    volume_name = TextInput(name='name')
    volume_type = BootstrapSelect(name=VersionPicker({Version.lowest(): 'aws_volume_type',
                                                      '5.10': 'volume_type'}))
    volume_size = TextInput(name='size')
    # az is for ec2 block storage only
    az = BootstrapSelect(
        name=VersionPicker(
            {Version.lowest(): 'aws_availability_zone_id', '5.11': 'availability_zone_id'}))
    iops = TextInput(name='aws_iops')  # is for ec2 block storage only
    encryption = BootstrapSwitch(name="aws_encryption")  # is for ec2 block storage only
    add = Button('Add')
    cancel = Button('Cancel')
Esempio n. 12
0
    def is_displayed(self):
        form_title_text = VersionPicker({
            Version.lowest(): 'Migration Plan Wizard',
            '5.10': 'Create Migration Plan'
        })

        return self.title.text == form_title_text.pick()
Esempio n. 13
0
class GenericObjectButtonGroupAddView(GenericObjectDefinitionView):
    title = Text('#explorer_title_text')

    name = Input(name='name')
    display = BootstrapSwitch(name='display')
    description = Input(name='description')
    image = VersionPick({
        Version.lowest(): BootstrapSelect('button_image'),
        '5.9': FonticonPicker('button_icon')})

    add = Button('Add')
    cancel = Button('Cancel')

    @property
    def is_displayed(self):
        return (
            self.title.text == 'GenericObjectButtonGroupAddView' and
            self.name.is_displayed and
            self.in_generic_object_definition
        )

    def after_fill(self, was_change):
        # we need to click somewhere out side the form to get add button active,
        # after icon is filled
        if was_change:
            self.browser.element('//body').click()
Esempio n. 14
0
 def vmdb_version(self):
     res = self.run_command('cat /var/www/miq/vmdb/VERSION')
     if res.failed:
         raise RuntimeError(
             f'Unable to retrieve appliance VMDB version: {res.output}')
     version_string = res.output
     return Version(version_string)
Esempio n. 15
0
class OrderForm(ServicesCatalogView):
    title = Text('#explorer_title_text')
    dialog_title = Text(
        VersionPick({
            Version.lowest(): ".//div[@id='main_div']//h3",
            "5.9": ".//div[@id='main_div']//h2"
        }))

    timeout = Input(name='stack_timeout')
    db_user = Input(name="param_DBUser__protected")
    db_root_password = Input(name='param_DBRootPassword__protected')
    select_instance_type = BootstrapSelect("param_InstanceType")
    stack_name = Input(name='stack_name')
    stack_timeout = Input(name='stack_timeout')
    resource_group = BootstrapSelect("resource_group")
    mode = BootstrapSelect('deploy_mode')
    vm_name = Input(name="param_virtualMachineName")
    vm_user = Input(name='param_adminUserName')
    vm_password = Input(name="param_adminPassword__protected")
    vm_size = BootstrapSelect('param_virtualMachineSize')
    user_image = BootstrapSelect("param_userImageName")
    os_type = BootstrapSelect('param_operatingSystemType')
    key_name = Input(name="param_KeyName")
    ssh_location = Input(name="param_SSHLocation")

    flavor = Input(name='param_flavor')
    image = Input(name="param_image")
    key = Input(name='param_key')
    private_network = Input(name="param_private_network")
    default_select_value = BootstrapSelect('service_level')

    machine_credential = BootstrapSelect("credential")
    hosts = Input(name="hosts")
def appliance_preupdate(old_version, appliance):

    series = appliance.version.series()
    update_url = "update_url_{}".format(series.replace('.', ''))

    """Requests appliance from sprout based on old_versions, edits partitions and adds
    repo file for update"""

    usable = []
    sp = SproutClient.from_config()
    available_versions = set(sp.call_method('available_cfme_versions'))
    for a in available_versions:
        if a.startswith(old_version):
            usable.append(Version(a))
    usable.sort(reverse=True)
    try:
        apps, pool_id = sp.provision_appliances(count=1, preconfigured=True,
            lease_time=180, version=str(usable[0]))
    except Exception as e:
        logger.exception("Couldn't provision appliance with following error:{}".format(e))
        raise SproutException('No provision available')

    apps[0].db.extend_partition()
    urls = process_url(cfme_data['basic_info'][update_url])
    output = build_file(urls)
    with tempfile.NamedTemporaryFile('w') as f:
        f.write(output)
        f.flush()
        os.fsync(f.fileno())
        apps[0].ssh_client.put_file(
            f.name, '/etc/yum.repos.d/update.repo')
    yield apps[0]
    apps[0].ssh_client.close()
    sp.destroy_pool(pool_id)
Esempio n. 17
0
 def is_displayed(self):
     location = VersionPicker({
         Version.lowest(): 'Cloud Providers',
         '5.11': self.context['object'].name
     }).pick()
     return (self.breadcrumb.locations[-2] == location and
             self.entities.title.text == self.breadcrumb.active_location)
Esempio n. 18
0
    def __getattr__(self, attr):
        """This proxies the attribute queries to the Bug object and modifies its result.

        If the field looked up is specified as loose field, it will be converted to Version.
        If the field is string and it has zero length, or the value is specified as "not specified",
        it will return None.
        """
        value = getattr(self._bug, attr)
        if attr in self.loose:
            if isinstance(value,
                          Sequence) and not isinstance(value, basestring):
                value = value[0]
            value = value.strip()
            if not value:
                return None
            if value.lower() in NONE_FIELDS:
                return None
            # We have to strip any leading non-number characters to correctly match
            value = re.sub(r"^[^0-9]+", "", value)
            if not value:
                return None
            return Version(value)
        if isinstance(value, basestring):
            if len(value.strip()) == 0:
                return None
            else:
                return value
        else:
            return value
Esempio n. 19
0
class AddInfrastructureMappingView(InfrastructureMappingForm):
    form_title_text = VersionPicker(
        {
            Version.lowest(): "Infrastructure Mapping Wizard",
            "5.10": "Create Infrastructure Mapping",
        }
    )
Esempio n. 20
0
    def is_displayed(self):
        form_title_text = VersionPicker({
            Version.lowest(): 'Infrastructure Mapping Wizard',
            '5.10': 'Create Infrastructure Mapping'
        })

        return (self.form.title.text == form_title_text.pick())
Esempio n. 21
0
class ActionFormCommon(ControlExplorerView):

    description = Input("description")
    action_type = BootstrapSelect("miq_action_type")
    snapshot_name = Input("snapshot_name")
    analysis_profile = BootstrapSelect("analysis_profile")
    alerts_to_evaluate = MultiBoxSelect()
    snapshot_age = BootstrapSelect("snapshot_age")
    parent_type = BootstrapSelect("parent_type")
    cpu_number = BootstrapSelect("cpu_value")
    memory_amount = Input("memory_value")
    email_sender = Input("from")
    email_recipient = Input("to")
    vcenter_attr_name = Input("attribute")
    vcenter_attr_value = Input("value")
    tag = VersionPicker({
        Version.lowest(): ManageIQTree("action_tags_treebox"),
        "5.11": SectionedBootstrapSelect("tag")
    })
    remove_tag = CheckboxSelect("action_options_div")
    run_ansible_playbook = View.nested(RunAnsiblePlaybookFromView)
    automation_message = Input("object_message")
    automation_request = Input("object_request")
    attribute_value_pair = AttributeValueForm('attribute_', 'value_')
    cancel_button = Button("Cancel")
Esempio n. 22
0
 def is_displayed(self):
     return (self.in_tower_explorer and self.title.text == VersionPicker(
         {
             Version.lowest(): 'All Ansible Tower Job Templates',
             '5.10': 'All Ansible Tower Templates'
         }).pick(self.browser.product_version)
             and self.sidebar.job_templates.is_opened)
Esempio n. 23
0
def infra_mapping_default_data(source_provider, provider):
    """
    Default data for infrastructure mapping form.
    It is used in other methods to recursive update the data according
    to parameters in tests.

    Args:
        source_provider: Vmware provider
        provider: Target rhev/OSP provider
    """
    plan_type = VersionPicker({Version.lowest(): None,
                               "5.10": "rhv" if provider.one_of(RHEVMProvider) else "osp"}).pick()
    infra_mapping_data = {
        "name": fauxfactory.gen_alphanumeric(15, start="infra_map_"),
        "description": f"migration with vmware to {plan_type}",
        "plan_type": plan_type,
        "clusters": [component_generator("clusters", source_provider, provider)],
        "datastores": [component_generator(
            "datastores", source_provider, provider,
            get_data(source_provider, "datastores", "nfs").type,
            get_data(provider, "datastores", "nfs").type)],
        "networks": [
            component_generator("vlans", source_provider, provider,
                                get_data(source_provider, "vlans", "VM Network"),
                                get_data(provider, "vlans", "ovirtmgmt"))
        ],
    }
    return infra_mapping_data
Esempio n. 24
0
def test_rhsm_registration_check_repo_names(
        temp_appliance_preconfig_funcscope, soft_assert, appliance):
    """ Checks default rpm repos on a fresh appliance

    Polarion:
        assignee: jhenner
        caseimportance: high
        initialEstimate: 1/4h
    """
    ver = temp_appliance_preconfig_funcscope.version.series()
    repos = cfme_data.redhat_updates.repos

    # TODO We need the context manager here as RedHatUpdates doesn't yet support Collections.
    with temp_appliance_preconfig_funcscope:
        repo_names = VersionPicker({
            Version.lowest(): repos.pre_592,
            Version('5.9.3'): repos.post_592,
            Version('5.10.0'): repos.post_510
        }).pick(temp_appliance_preconfig_funcscope.version)
        view = navigate_to(RedHatUpdates, 'Edit')
        soft_assert(
            view.repo_name.read() == 'cf-me-{}-for-rhel-7-rpms {}'.format(ver, repo_names))
        """checks current repo names"""
        view.repo_default_name.click()
        """resets repos with default button and checks they are also correct"""
        soft_assert(
            view.repo_name.read() == 'cf-me-{}-for-rhel-7-rpms {}'.format(ver, repo_names))
def infra_mapping_default_data(source_provider, provider):
    """
    Default data for infrastructure mapping form.
    It is used in other methods to recursive update the data according
    to parameters in tests.

    Args:
        source_provider: Vmware provider
        provider: Target rhev/OSP provider
    """
    plan_type = VersionPicker({Version.lowest(): None,
                               "5.10": "rhv" if provider.one_of(RHEVMProvider) else "osp"}).pick()
    infra_mapping_data = {
        "name": "infra_map_{}".format(fauxfactory.gen_alphanumeric()),
        "description": "Single Datastore migration of VM from {ds_type1} to {ds_type2}".format(
            ds_type1="nfs", ds_type2="nfs"
        ),
        "plan_type": plan_type,
        "clusters": [component_generator("clusters", source_provider, provider)],
        "datastores": [component_generator(
            "datastores", source_provider, provider,
            get_data(source_provider, "datastores", "nfs").type,
            get_data(provider, "datastores", "nfs").type)],
        "networks": [
            component_generator("vlans", source_provider, provider,
                                get_data(source_provider, "vlans", "VM Network"),
                                get_data(provider, "vlans", "ovirtmgmt"))
        ],
    }
    return infra_mapping_data
Esempio n. 26
0
 def is_displayed(self):
     return (
         self.in_tower_explorer and
         self.title.text == VersionPicker({Version.lowest(): 'All Ansible Tower Job Templates',
             '5.10': 'All Ansible Tower Templates'}).pick(self.browser.product_version) and
         self.sidebar.job_templates.is_opened
     )
def appliance_preupdate(old_version, appliance):

    series = appliance.version.series()
    update_url = "update_url_{}".format(series.replace('.', ''))
    """Requests appliance from sprout based on old_versions, edits partitions and adds
    repo file for update"""

    usable = []
    sp = SproutClient.from_config()
    available_versions = set(sp.call_method('available_cfme_versions'))
    for a in available_versions:
        if a.startswith(old_version):
            usable.append(Version(a))
    usable.sort(reverse=True)
    try:
        apps, pool_id = sp.provision_appliances(count=1,
                                                preconfigured=True,
                                                lease_time=180,
                                                version=str(usable[0]))
    except Exception as e:
        logger.exception(
            "Couldn't provision appliance with following error:{}".format(e))
        raise SproutException('No provision available')

    apps[0].db.extend_partition()
    urls = cfme_data["basic_info"][update_url]
    apps[0].ssh_client.run_command(
        "curl {} -o /etc/yum.repos.d/update.repo".format(urls))
    logger.info(
        'Appliance update.repo file: \n%s', apps[0].ssh_client.run_command(
            'cat /etc/yum.repos.d/update.repo').output)
    yield apps[0]
    apps[0].ssh_client.close()
    sp.destroy_pool(pool_id)
Esempio n. 28
0
    class fields(ParametrizedView):  # noqa
        PARAMETERS = ("key", )
        input = Input(id=Parameter("key"))
        select = Select(id=Parameter("key"))
        param_input = Input(id=ParametrizedString("param_{key}"))
        dropdown = VersionPick({
            Version.lowest():
            BootstrapSelect(Parameter("key")),
            "5.9":
            BootstrapSelect(locator=ParametrizedLocator(
                './/div[contains(@class, "bootstrap-select")]/select[@id={key|quote}]/..'
            ))
        })
        param_dropdown = VersionPick({
            Version.lowest():
            BootstrapSelect(ParametrizedString("param_{key}")),
            "5.9":
            BootstrapSelect(locator=ParametrizedLocator(
                ".//div[contains(@class, 'bootstrap-select')]/select[@id='param_{key}']/.."
            ))
        })

        @property
        def visible_widget(self):
            if self.browser.wait_for_element(self.input.locator,
                                             exception=False):
                return self.input
            elif self.browser.wait_for_element(self.dropdown.locator,
                                               exception=False):
                return self.dropdown
            elif self.browser.wait_for_element(self.param_input.locator,
                                               exception=False):
                return self.param_input
            elif self.browser.wait_for_element(self.param_dropdown.locator,
                                               exception=False):
                return self.param_dropdown
            elif self.browser.wait_for_element(self.select.locator,
                                               exception=False):
                return self.select
            else:
                raise ItemNotFound("Visible widget is not found")

        def read(self):
            return self.visible_widget.read()

        def fill(self, value):
            return self.visible_widget.fill(value)
def pytest_generate_tests(metafunc):
    argnames, argvalues, idlist = testgen.providers_by_class(
        metafunc, [VMwareProvider])
    argnames = argnames + ["_host_provider"]

    new_idlist = []
    new_argvalues = []

    for i, argvalue_tuple in enumerate(argvalues):
        args = dict(zip(argnames, argvalue_tuple))
        # TODO
        # All this should be replaced with a proper ProviderFilter passed to testgen.providers()
        if args['provider'].type != "virtualcenter":
            continue
        hosts = args['provider'].data.get("hosts", [])
        if not hosts:
            continue

        version = args['provider'].data.get("version")
        if version is None:
            # No version, no test
            continue
        if Version(version) < "5.0":
            # Ignore lesser than 5
            continue

        host = hosts[0]
        ip_address = resolve_hostname(host["name"])
        endpoint = VirtualCenterEndpoint(
            credentials=host["credentials"]["default"],
            hostname=host["name"],
            ip_address=ip_address)
        # Mock provider data
        provider_data = {}
        provider_data.update(args['provider'].data)
        provider_data["name"] = host["name"]
        provider_data["hostname"] = host["name"]
        provider_data["ipaddress"] = ip_address
        provider_data.pop("host_provisioning", None)
        provider_data["hosts"] = [host]
        provider_data["discovery_range"] = {}
        provider_data["discovery_range"]["start"] = ip_address
        provider_data["discovery_range"]["end"] = ip_address
        appliance = find_appliance(metafunc, require=False)
        host_provider = appliance.collections.infra_providers.instantiate(
            prov_class=VMwareProvider,
            name=host["name"],
            endpoints=endpoint,
            provider_data=provider_data)
        argvalues[i].append(host_provider)
        idlist[i] = "{}/{}".format(args['provider'].key, host["name"])
        new_idlist.append(idlist[i])
        new_argvalues.append(argvalues[i])

    testgen.parametrize(metafunc,
                        argnames,
                        new_argvalues,
                        ids=new_idlist,
                        scope="module")
Esempio n. 30
0
class BalancerDetailsToolBar(BalancerToolBar):
    """ Represents details toolbar of balancer summary """
    download = VersionPicker({
        Version.lowest():
        Button(title='Download summary in PDF format'),
        "5.10":
        Button(title='Print or export summary')
    })
Esempio n. 31
0
 class form(View):  # noqa
     tags = VersionPicker({
         Version.lowest(): Table("//div[@id='assignments_div']//table"),
         "5.11": ParametrizedView.nested(AssignedTags)
     })
     tag_category = VersionPicker({
         Version.lowest(): BootstrapSelect(id='tag_cat'),
         "5.11": ReactSelect(locator='.//div[@id="tag_cat"]')
     })
     tag_name = VersionPicker({
         Version.lowest(): BootstrapSelect(id='tag_add'),
         "5.11": ReactSelect(locator='.//div[@id="cat_tags_div"]')
     })
     entities = View.nested(BaseNonInteractiveEntitiesView)
     save = Button('Save')
     reset = Button('Reset')
     cancel = Button('Cancel')
Esempio n. 32
0
    class filters(Accordion):  # noqa
        ACCORDION_NAME = VersionPicker({
            Version.lowest(): 'Filters',
            '5.11': 'Global Filters'
        })

        navigation = BootstrapNav('.//div/ul')
        tree = ManageIQTree()
Esempio n. 33
0
class NetworkProviderDetailsToolBar(NetworkProviderToolBar):
    """ Represents provider details toolbar """
    monitoring = Dropdown(text='Monitoring')
    download = VersionPicker({
        Version.lowest():
        Button(title='Download summary in PDF format'),
        "5.10":
        Button(title='Print or export summary')
    })
Esempio n. 34
0
class FloatingIpDetailsToolBar(View):
    """ Represents toolbar of summary of port """
    policy = Dropdown(text='Policy')
    download = VersionPicker({
        Version.lowest():
        Button(title='Download summary in PDF format'),
        "5.10":
        Button(title='Print or export summary')
    })
Esempio n. 35
0
def setup_ha_env(cfme_version, provider_type, provider, lease, desc):
    lease_time = tot_time(lease)
    provider_type = None if provider else provider_type
    """multi appliance setup consisting of dedicated primary and standy databases with a single
    UI appliance."""
    print("Provisioning and configuring HA environment")
    apps, request_id = provision_appliances(count=3, cfme_version=cfme_version,
        provider_type=provider_type, provider=provider, lease_time=lease_time)
    sprout_client = SproutClient.from_config()
    sprout_client.set_pool_description(request_id, desc)
    ip0 = apps[0].hostname
    ip1 = apps[1].hostname
    ip2 = apps[2].hostname
    opt = '5' if cfme_version >= "5.8" else '8'
    rep = '6' if cfme_version >= "5.8" else '9'
    mon = VersionPicker({
        Version.lowest(): '12',
        '5.8': '9',
        '5.9.3': '8'
    }).pick(cfme_version)
    port = (ip0, '') if cfme_version >= "5.8" else (ip0,)
    command_set0 = ('ap', '', opt, '1', '1', '1', 'y', pwd, TimedCommand(pwd, 360), '')
    apps[0].appliance_console.run_commands(command_set0)
    wait_for(lambda: apps[0].db.is_dedicated_active)
    print("Dedicated database provisioned and configured {}".format(ip0))
    command_set1 = ('ap', '', opt, '1', '2', '1', 'y') + port + ('', '', pwd,
        TimedCommand(pwd, 360), '')
    apps[1].appliance_console.run_commands(command_set1)
    apps[1].evmserverd.wait_for_running()
    apps[1].wait_for_web_ui()
    print("Non-VMDB appliance provisioned and region created {}".format(ip1))
    command_set2 = ('ap', '', rep, '1', '1', '', '', pwd, pwd, ip0, 'y', '')
    apps[0].appliance_console.run_commands(command_set2)
    print("Primary HA node configured {}".format(ip0))
    command_set3 = ('ap', '', rep, '2', '1', '2', '', '', pwd, pwd, ip0, ip2, 'y',
        TimedCommand('y', 300), '')
    apps[2].appliance_console.run_commands(command_set3)
    print("Secondary HA node provision and configured {}".format(ip2))
    command_set4 = ('ap', '', mon, '1', '')
    apps[1].appliance_console.run_commands(command_set4)
    print("HA configuration complete")
    print("Appliance pool lease time is {}".format(lease))
Esempio n. 36
0
def get_dialog_service_name(appliance, service_request, *item_names):
    """Helper to DRY this VersionPicker when tests need to determine a dialog service name

    In gaprindashvili+ its available in the service_request options
    In earlier versions it has to be parsed from the message
    """
    def _regex_parse_name(items, message):
        for item in items:
            match = re.search(r'\[({}[0-9-]*)\] '.format(item), message)
            if match:
                return match.group(1)
            else:
                continue
        else:
            raise ValueError('Could not match name from items in given service request message')

    return VersionPicker({
        Version.lowest(): lambda: _regex_parse_name(item_names, service_request.message),
        '5.10': lambda: service_request.options.get('dialog', {}).get('dialog_service_name', '')
    }).pick(appliance.version)()  # run lambda after picking
def pytest_generate_tests(metafunc):
    """
    Build a list of tuples containing (group_name, context)
    Returns:
        tuple containing (group_name, context)
        where group_name is a string and context is ViaUI/SSUI
    """
    appliance = find_appliance(metafunc)
    parameter_list = []
    id_list = []
    # TODO: Include SSUI role_access dict and VIASSUI context
    role_access_ui = VersionPicker({
        Version.lowest(): role_access_ui_59z,
        '5.10': role_access_ui_510z
    }).pick(appliance.version)
    logger.info('Using the role access dict: %s', role_access_ui)
    roles_and_context = [(
        role_access_ui, ViaUI)
    ]
    for role_access, context in roles_and_context:
        for group in role_access.keys():
            parameter_list.append((group, role_access, context))
            id_list.append('{}-{}'.format(group, context))
    metafunc.parametrize('group_name, role_access, context', parameter_list)
Esempio n. 38
0
 def step(self, *args, **kwargs):
     self.view.sidebar.job_templates.tree.click_path(VersionPicker({Version.lowest():
         'All Ansible Tower Job Templates', '5.10': 'All Ansible Tower Templates'}).pick(
         self.view.browser.product_version))