def add_nav_branches(): nav.add_branch('toplevel', { 'my_settings': lambda _: click_top_right('My Settings'), 'tasks': lambda _: click_top_right('Tasks'), 'configuration': lambda _: click_top_right('Configuration'), 'about': lambda _: click_top_right('About') }, add_to_stack=False)
nav.add_branch('infrastructure_pxe', {'infrastructure_pxe_servers': [lambda _: pxe_tree(), {'infrastructure_pxe_server_new': lambda _: cfg_btn('Add a New PXE Server'), 'infrastructure_pxe_server': [lambda ctx: pxe_tree(ctx.pxe_server.name), {'infrastructure_pxe_server_edit': lambda _: cfg_btn('Edit this PXE Server')}]}], 'infrastructure_pxe_templates': [lambda _: template_tree(), {'infrastructure_pxe_template_new': lambda _: cfg_btn('Add a New Customization Template'), 'infrastructure_pxe_template': [lambda ctx: template_tree(ctx.pxe_template.image_type, ctx.pxe_template.name), {'infrastructure_pxe_template_edit': lambda _: cfg_btn('Edit this Customization Template')}]}], 'infrastructure_pxe_image_types': [lambda _: image_tree(), {'infrastructure_pxe_image_type_new': lambda _: cfg_btn('Add a new System Image Type'), 'infrastructure_pxe_image_type': [lambda ctx: image_table.click_cell('name', ctx.pxe_image_type.name), {'infrastructure_pxe_image_type_edit': lambda _: cfg_btn('Edit this System Image Type')}]}], 'infrastructure_iso_datastores': [lambda _: iso_tree(), {'infrastructure_iso_datastore_new': lambda _: cfg_btn('Add a New ISO Datastore'), 'infrastructure_iso_datastore': lambda ctx: iso_tree(ctx.pxe_iso_datastore.provider)}]})
return sch elif isinstance(sch, Schedule): return sch.name else: return str(sch) nav.add_branch( "reports", { "schedules": [ lambda ctx: accordion.tree("Schedules", "All Schedules"), { "schedule_add": lambda ctx: cfg_btn("Add a new Schedule") } ], "schedule": [ lambda ctx: accordion.tree("Schedules", "All Schedules", get_sch_name(ctx["schedule"])), { "schedule_edit": lambda ctx: cfg_btn("Edit this Schedule") } ], } ) class Schedule(Updateable): """Represents a schedule in Intelligence/Reports/Schedules. Args:
nav.add_branch( 'configuration', { 'cfg_accesscontrol_users': [ lambda d: accordion.tree("Access Control", server_region_string(), "Users"), { 'cfg_accesscontrol_user_add': lambda d: tb_select("Add a new User") } ], 'cfg_accesscontrol_user_ed': [ lambda ctx: accordion.tree("Access Control", server_region_string( ), "Users", ctx.user.name), { 'cfg_accesscontrol_user_edit': lambda d: tb_select('Edit this User') } ], 'cfg_accesscontrol_groups': [ lambda d: accordion.tree("Access Control", server_region_string( ), "Groups"), { 'cfg_accesscontrol_group_add': lambda d: tb_select("Add a new Group"), 'cfg_accesscontrol_group_edit_seq': lambda d: tb_select( 'Edit Sequence of User Groups for LDAP Look Up') } ], 'cfg_accesscontrol_group_ed': [ lambda ctx: accordion.tree("Access Control", server_region_string( ), "Groups", ctx.group.description), { 'cfg_accesscontrol_group_edit': lambda d: tb_select('Edit this Group') } ], 'cfg_accesscontrol_Roles': [ lambda d: accordion.tree("Access Control", server_region_string(), "Roles"), { 'cfg_accesscontrol_role_add': lambda d: tb_select("Add a new Role") } ], 'cfg_accesscontrol_role_ed': [ lambda ctx: accordion.tree("Access Control", server_region_string( ), "Roles", ctx.role.name), { 'cfg_accesscontrol_role_edit': lambda d: tb_select('Edit this Role') } ], 'chargeback_assignments': nav.fn(partial(accordion.click, "Assignments")) })
prop_region = Region(locators={"properties_form": {version.LOWEST: properties_form, "5.6": properties_form_56}}) manage_policies_tree = CheckboxTree("//div[@id='protect_treebox']/ul") cfg_btn = partial(tb.select, "Configuration") pol_btn = partial(tb.select, "Policy") mon_btn = partial(tb.select, "Monitoring") nav.add_branch( "infrastructure_providers", { "infrastructure_provider_new": lambda _: cfg_btn("Add a New Infrastructure Provider"), "infrastructure_provider_discover": lambda _: cfg_btn("Discover Infrastructure Providers"), "infrastructure_provider": [ lambda ctx: sel.click(Quadicon(ctx["provider"].name, "infra_prov")), { "infrastructure_provider_edit": lambda _: cfg_btn("Edit this Infrastructure Provider"), "infrastructure_provider_policy_assignment": lambda _: pol_btn("Manage Policies"), "infrastructure_provider_timelines": lambda _: mon_btn("Timelines"), }, ], }, ) @CloudInfraProvider.add_base_type class InfraProvider(Pretty, CloudInfraProvider): """ Abstract model of an infrastructure provider in cfme. See VMwareProvider or RHEVMProvider. Args:
server.summary.reload() if server.summary.relationships.middleware_datasources.value == 0: return server.summary.relationships.middleware_datasources.click() elif provider: # if provider instance is provided navigate through provider page provider.summary.reload() if provider.summary.relationships.middleware_datasources.value == 0: return provider.summary.relationships.middleware_datasources.click() else: # if None(provider and server) given navigate through all middleware datasources page sel.force_navigate('middleware_datasources') nav.add_branch( 'middleware_datasources', { 'middleware_datasource': lambda ctx: list_tbl.select_row('Datasource Name', ctx['name']), }) class MiddlewareDatasource(MiddlewareBase, Taggable): """ MiddlewareDatasource class provides details on datasource page. Class methods available to get existing datasources list Args: name: Name of the datasource provider: Provider object (HawkularProvider) nativeid: Native id (internal id) of datasource server: Server object of the datasource (MiddlewareServer) properties: Datasource driver name, connection URL and JNDI name
nav.add_branch( "reports", { "reports_default_dashboard": [ go_to_default_func, { "reports_default_dashboard_edit": lambda _: toolbar.select("Configuration", "Edit this Dashboard") } ], "reports_dashboards": [ lambda ctx: accordion.tree("Dashboards", "All Dashboards", "All Groups", ctx["group"]), { "reports_dashboard_add": lambda _: toolbar.select("Configuration", "Add a new Dashboard") } ], "reports_dashboard": [ lambda ctx: accordion.tree( "Dashboards", "All Dashboards", "All Groups", ctx["dashboard"].group, ctx["dashboard"].name ), { "reports_dashboard_edit": lambda _: toolbar.select("Configuration", "Edit this Dashboard"), } ], } )
nav.add_branch( "reports", { "reports_widgets_menus": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "Menus"), { "reports_widgets_menu_add": lambda _: toolbar.select("Configuration", "Add a new Widget") } ], "reports_widgets_menu": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "Menus", ctx["widget"].title), { "reports_widgets_menu_delete": lambda _: toolbar.select("Configuration", "Delete this Widget from the Database"), "reports_widgets_menu_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), } ], "reports_widgets_reports": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "Reports"), { "reports_widgets_report_add": lambda _: toolbar.select("Configuration", "Add a new Widget") } ], "reports_widgets_report": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "Reports", ctx["widget"].title), { "reports_widgets_report_delete": lambda _: toolbar.select("Configuration", "Delete this Widget from the Database"), "reports_widgets_report_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), } ], "reports_widgets_charts": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "Charts"), { "reports_widgets_chart_add": lambda _: toolbar.select("Configuration", "Add a new Widget") } ], "reports_widgets_chart": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "Charts", ctx["widget"].title), { "reports_widgets_chart_delete": lambda _: toolbar.select("Configuration", "Delete this Widget from the Database"), "reports_widgets_chart_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), } ], "reports_widgets_rss_feeds": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "RSS Feeds"), { "reports_widgets_rss_feed_add": lambda _: toolbar.select("Configuration", "Add a new Widget") } ], "reports_widgets_rss_feed": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "RSS Feeds", ctx["widget"].title), { "reports_widgets_rss_feed_delete": lambda _: toolbar.select("Configuration", "Delete this Widget from the Database"), "reports_widgets_rss_feed_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), } ], } )
nav.add_branch( 'automate_explorer', { 'automate_explorer_tree_path': [ lambda context: context.tree_item.navigate_tree() if context.tree_item is not None else tree.click_path('Datastore'), { 'automate_explorer_table_select': [ lambda ctx: table_select(ctx['table_item'].name_in_table), { 'automate_explorer_edit': lambda context: context.tree_item.nav_edit(), 'automate_explorer_delete': lambda _: cfg_btn('Remove selected Items', invokes_alert=True) } ], 'automate_explorer_namespace_new': lambda _: cfg_btn('Add a New Namespace'), 'automate_explorer_domain_new': lambda _: cfg_btn('Add a New Domain'), 'automate_explorer_class_new': lambda _: cfg_btn('Add a New Class'), "automate_explorer_domain_edit": lambda _: cfg_btn("Edit this Domain"), 'automate_explorer_method_edit': lambda _: cfg_btn('Edit this Method'), 'automate_explorer_instance_edit': lambda _: cfg_btn('Edit this Instance'), 'automate_explorer_methods': [ lambda _: select_tab('Methods'), { 'automate_explorer_method_new': lambda _: cfg_btn('Add a New Method'), 'automate_explorer_method_table_select': lambda ctx: table_select(ctx['table_item']. name_in_table) } ], 'automate_explorer_instances': [ lambda _: select_tab('Instances'), { 'automate_explorer_instance_new': lambda _: cfg_btn('Add a New Instance'), 'automate_explorer_instance_table_select': lambda ctx: table_select(ctx['table_item']. name_in_table) } ], 'automate_explorer_schema': [ lambda _: select_tab("Schema"), { 'automate_explorer_schema_edit': lambda _: cfg_btn("Edit selected Schema") } ] } ], "automate_explorer_domain_order": open_order_dialog_func, })
return query def _get_servers_page(provider): if provider: # if provider instance is provided navigate through provider's servers page provider.summary.reload() if provider.summary.relationships.middleware_servers.value == 0: return provider.summary.relationships.middleware_servers.click() else: # if None(provider) given navigate through all middleware servers page sel.force_navigate('middleware_servers') nav.add_branch( 'middleware_servers', { 'middleware_server': lambda ctx: list_tbl.select_row('Server Name', ctx['name']), }) class MiddlewareServer(MiddlewareBase, Taggable): """ 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 feed: feed of the server
details_page = Region(infoblock_type='detail') cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') def nav_to_cluster_through_provider(context): sel.force_navigate('infrastructure_provider', context=context) list_acc.select('Relationships', 'Clusters', by_title=False, partial=True) sel.click(Quadicon(context['cluster'].name, 'cluster')) nav.add_branch( 'infrastructure_clusters', { 'infrastructure_cluster': lambda ctx: sel.click(Quadicon(ctx['cluster'].name, 'cluster')) if 'provider' not in ctx else nav_to_cluster_through_provider(ctx) }) class Cluster(Pretty): """ Model of an infrastructure cluster in cfme Args: name: Name of the cluster. provider_key: Name of the provider this cluster is attached to. Note: If given a provider_key, it will navigate through ``Infrastructure/Providers`` instead of the direct path through ``Infrastructure/Clusters``. """
from cfme.web_ui.menu import nav from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import Quadicon, Region, toolbar as tb from functools import partial from utils.pretty import Pretty from utils.providers import get_crud from utils.wait import wait_for details_page = Region(infoblock_type='detail') cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') nav.add_branch( 'infrastructure_resource_pools', { 'infrastructure_resource_pool': lambda ctx: sel.click( Quadicon(ctx['resource_pool'].name, 'resource_pool')) }) class ResourcePool(Pretty): """ Model of an infrastructure Resource pool in cfme Args: name: Name of the Resource pool. provider_key: Name of the provider this resource pool is attached to. Note: If given a provider_key, it will navigate through ``Infrastructure/Providers`` instead of the direct path through ``Infrastructure/Resourcepool``. """
"5.4": Select("select#provider_id"), "5.5": AngularSelect("provider_id")}), ]) details_page = Region(infoblock_type='detail') cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') mon_btn = partial(tb.select, 'Monitoring') nav.add_branch('clouds_providers', {'clouds_provider_new': lambda _: cfg_btn('Add a New Cloud Provider'), 'clouds_provider_discover': lambda _: cfg_btn('Discover Cloud Providers'), 'clouds_provider': [lambda ctx: sel.click(Quadicon(ctx['provider'].name, 'cloud_prov')), {'clouds_provider_edit': lambda _: cfg_btn('Edit this Cloud Provider'), 'clouds_provider_policy_assignment': lambda _: pol_btn('Manage Policies'), 'cloud_provider_timelines': lambda _: mon_btn('Timelines')}]}) class Provider(Pretty, CloudInfraProvider): """ Abstract model of a cloud provider in cfme. See EC2Provider or OpenStackProvider. Args: name: Name of the provider. details: a details record (see EC2Details, OpenStackDetails inner class). credentials (Credential): see Credential inner class.
get_tab_my = lambda: pick({ LOWEST: "My VM Analysis Tasks", '5.6': "My VM and Container Analysis Tasks", }) get_tab_all = lambda: pick({ LOWEST: "All VM Analysis Tasks", '5.6': "All VM and Container Analysis Tasks", }) nav.add_branch("tasks", dict( tasks_my_vm=lambda _: tabs.select_tab(get_tab_my()), tasks_my_other_ui=lambda _: tabs.select_tab("My Other UI Tasks"), tasks_all_vm=lambda _: tabs.select_tab(get_tab_all()), tasks_all_other=lambda _: tabs.select_tab("All Other Tasks"), ) ) buttons = Region( locators=dict( default={LOWEST: "//*[@id='buttons_off']/li[3]/a/img", '5.4': "//*[@id='buttons_off']/a"}, apply={LOWEST: "//*[@id='buttons_on']/li[1]/a/img", '5.4': "//*[@id='buttons_on']/a[1]"}, reset={LOWEST: "//*[@id='buttons_on']/li[2]/a/img", '5.4': "//*[@id='buttons_on']/a[2]"} ) )
nav.add_branch( "chargeback", { "chargeback_rates": [ nav.fn(partial(accordion.click, "Rates")), { "chargeback_rates_compute": [ lambda d: rate_tree.click_path("Rates", "Compute"), {"chargeback_rates_compute_new": tb_select_new_chargeback}, ], "chargeback_rates_compute_named": [ lambda d: rate_tree.click_path("Rates", "Compute", d["chargeback"].description), {"chargeback_rates_compute_edit": tb_select_edit_chargeback}, ], "chargeback_rates_storage": [ lambda d: rate_tree.click_path("Rates", "Storage"), {"chargeback_rates_storage_new": tb_select_new_chargeback}, ], "chargeback_rates_storage_named": [ lambda d: rate_tree.click_path("Rates", "Storage", d["chargeback"].description), {"chargeback_rates_storage_edit": tb_select_edit_chargeback}, ], }, ], "chargeback_assignments": nav.fn(partial(accordion.click, "Assignments")), }, )
"5.4": "//div[@id='cb_assignment_div']/table[contains(@class, 'table')]", })), ('save_button', form_buttons.save)]) nav.add_branch('chargeback', {'chargeback_rates': [nav.fn(partial(accordion.click, "Rates")), {'chargeback_rates_compute': [lambda d: rate_tree.click_path('Rates', 'Compute'), {'chargeback_rates_compute_new': tb_select_new_chargeback}], 'chargeback_rates_compute_named': [lambda d: rate_tree.click_path('Rates', 'Compute', d['chargeback'].description), {'chargeback_rates_compute_edit': tb_select_edit_chargeback}], 'chargeback_rates_storage': [lambda d: rate_tree.click_path('Rates', 'Storage'), {'chargeback_rates_storage_new': tb_select_new_chargeback}], 'chargeback_rates_storage_named': [lambda d: rate_tree.click_path('Rates', 'Storage', d['chargeback'].description), {'chargeback_rates_storage_edit': tb_select_edit_chargeback}]}], 'chargeback_assignments': [nav.fn(partial(accordion.click, "Assignments")), {'chargeback_assignments_compute': lambda d: assignment_tree.click_path('Assignments', 'Compute'), 'chargeback_assignments_storage': lambda d: assignment_tree.click_path('Assignments', 'Storage')}]}) HOURLY = 'hourly' DAILY = 'daily' WEEKLY = 'weekly'
if template: sel.click(template) # In order to mitigate the sometimes very long spinner timeout, raise the timeout with sel.ajax_timeout(90): if current_version() < "5.4": sel.click(submit_button) else: sel.click(form_buttons.FormButton("Continue", force_click=True)) else: raise TemplateNotFound('Unable to find template "{}" for provider "{}"'.format( template_name, provider.key)) return f nav.add_branch('infra_vm_and_templates', { 'infrastructure_provision_vms': generate_nav_function("Provision VMs"), }) nav.add_branch('clouds_instances_by_provider', { 'clouds_provision_instances': generate_nav_function("Provision Instances"), }) def do_vm_provisioning(template_name, provider, vm_name, provisioning_data, request, smtp_test, num_sec=1500, wait=True): # generate_tests makes sure these have values sel.force_navigate('infrastructure_provision_vms', context={ 'provider': provider, 'template_name': template_name, })
from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import toolbar as tb, CheckboxTable from cfme.web_ui.menu import nav from . import details_page list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") nav.add_branch( 'containers_services', { 'containers_service': lambda ctx: list_tbl.select_row_by_cells( { 'Name': ctx['service'].name, 'Provider': ctx['service'].provider.name }), 'containers_service_detail': lambda ctx: list_tbl.click_row_by_cells( { 'Name': ctx['service'].name, 'Provider': ctx['service'].provider.name }), }) class Service(Taggable, SummaryMixin): def __init__(self, name, provider): self.name = name self.provider = provider def _on_detail_page(self):
nav.add_branch( 'containers_providers', { 'containers_provider_new': lambda _: cfg_btn('Add a New Containers Provider'), 'containers_provider': [ lambda ctx: sel.check(Quadicon(ctx['provider'].name, None).checkbox), { 'containers_provider_edit': lambda _: cfg_btn('Edit Selected Containers Provider'), 'containers_provider_edit_tags': lambda _: pol_btn('Edit Tags') }], 'containers_provider_detail': [ lambda ctx: sel.click(Quadicon(ctx['provider'].name, None)), { 'containers_provider_edit_detail': lambda _: cfg_btn('Edit this Containers Provider'), 'containers_provider_timelines_detail': lambda _: mon_btn('Timelines'), 'containers_provider_edit_tags_detail': lambda _: pol_btn('Edit Tags'), 'containers_provider_topology_detail': lambda _: sel.click(InfoBlock('Overview', 'Topology')) }] } )
""" Module dealing with Configure/Tasks section. Todo: Finish the rest of the things. """ import cfme.fixtures.pytest_selenium as sel import cfme.web_ui.tabstrip as tabs from cfme.web_ui import Form, Region, Select, CheckboxTable, fill, paginator from cfme.web_ui.menu import nav from utils.timeutil import parsetime from utils.wait import wait_for, TimedOutError nav.add_branch( "tasks", dict( tasks_my_vm=lambda _: tabs.select_tab("My VM Analysis Tasks"), tasks_my_other_ui=lambda _: tabs.select_tab("My Other UI Tasks"), tasks_all_vm=lambda _: tabs.select_tab("All VM Analysis Tasks"), tasks_all_other=lambda _: tabs.select_tab("All Other Tasks"), )) buttons = Region(locators=dict(default="//*[@id='buttons_off']/li[3]/a/img", apply="//*[@id='buttons_on']/li[1]/a/img", reset="//*[@id='buttons_on']/li[2]/a/img")) filter_form = Form(fields=[ ("zone", Select("//select[@id='chosen_zone']")), ("user", Select("//select[@id='user_choice']")), ("time_period", Select("//select[@id='time_period']")), ("task_status_queued", "//input[@id='queued']"), ("task_status_running", "//input[@id='running']"), ("task_status_ok", "//input[@id='ok']"),
from . import cfg_btn, mon_btn, pol_btn, MiddlewareBase details_page = Region(infoblock_type='detail') nav.add_branch( 'middleware_providers', { 'middleware_provider_new': lambda _: cfg_btn('Add a New Middleware Provider'), 'middleware_provider': [ lambda ctx: sel.check(Quadicon(ctx['provider'].name).checkbox), { 'middleware_provider_edit': lambda _: cfg_btn('Edit Selected Middleware Provider'), 'middleware_provider_edit_tags': lambda _: pol_btn('Edit Tags') } ], 'middleware_provider_detail': [ lambda ctx: sel.click(Quadicon(ctx['provider'].name)), { 'middleware_provider_edit_detail': lambda _: cfg_btn('Edit this Middleware Provider'), 'middleware_provider_timelines_detail': lambda _: mon_btn('Timelines'), 'middleware_provider_edit_tags_detail': lambda _: pol_btn('Edit Tags'), } ] }) properties_form = Form(fields=[( 'type_select', AngularSelect('server_emstype')), (
nav.add_branch( 'infrastructure_config_management', { 'infrastructure_config_managers': [ lambda _: (accordion.tree('Providers', version.pick({version.LOWEST: 'All Red Hat Satellite Providers', '5.6': 'All Configuration Manager Providers'})), tb.select('Grid View')), { 'infrastructure_config_manager_new': lambda _: cfg_btn('Add a new Provider'), 'infrastructure_config_manager': [ lambda ctx: sel.check( Quadicon( '{} Configuration Manager' .format(ctx['manager'].name), None).checkbox()), { 'infrastructure_config_manager_edit': lambda _: cfg_btn('Edit Selected item'), 'infrastructure_config_manager_refresh': lambda _: cfg_btn('Refresh Relationships and Power states', invokes_alert=True), 'infrastructure_config_manager_remove': lambda _: cfg_btn('Remove selected items from the VMDB', invokes_alert=True) } ], 'infrastructure_config_manager_detail': [ lambda ctx: sel.click( Quadicon('{} Configuration Manager'.format(ctx['manager'].name), None)), { 'infrastructure_config_manager_edit_detail': lambda _: cfg_btn('Edit this Provider'), 'infrastructure_config_manager_refresh_detail': lambda _: cfg_btn('Refresh Relationships and Power states', invokes_alert=True), 'infrastructure_config_manager_remove_detail': lambda _: cfg_btn('Remove this Provider from the VMDB', invokes_alert=True), 'infrastructure_config_manager_config_profile': lambda ctx: (tb.select('List View'), page.list_table_config_profiles.click_cell( 'Description', ctx['profile'].name)) } ] } ], 'infrastructure_config_systems': [ lambda _: accordion.tree('Configured Systems', version.pick({version.LOWEST: 'All Red Hat Satellite Configured Systems', '5.6': 'All Configured Systems'})), { 'infrastructure_config_system': [ lambda ctx: (tb.select('Grid View'), sel.click(Quadicon(ctx['system'].name, None))), { 'infrastructure_config_system_provision': lambda _: cfg_btn('Provision Configured System'), 'infrastructure_config_system_edit_tags': lambda _: cfg_btn('Edit Tags') } ] } ] } )
# Better exception? raise ValueError( 'Navigation failed: Unable to find template "%s" for provider "%s"' % (template_name, provider.name)) nav.add_branch( 'clouds_instances', { 'clouds_instances_by_provider': [ nav.partial(accordion.click, 'Instances by Provider'), { 'clouds_all_instances': [ lambda _: instances_by_provider_tree.click_path( 'Instances by Provider'), # select root { 'clouds_provision_instances': lambda c: _nav_to_provision_form(c), 'clouds_instance': lambda ctx: paginator.click_element( ui.Quadicon(ctx['instance'].name, 'instance')) } ] } ] }) class Template(object): def __init__(self, name): self.name = name
nav.add_branch( "automate_customization", { "host_provision_dialogs": lambda _: acc_tree("All Dialogs", "Host Provision"), "host_provision_dialog": [ lambda ctx: acc_tree("All Dialogs", "Host Provision", get_dialog_name(ctx["dialog"])), { "host_provision_dialog_edit": lambda _: cfg_btn("Edit this Dialog") } ], "vm_migrate_dialogs": lambda _: acc_tree("All Dialogs", "VM Migrate"), "vm_migrate_dialog": [ lambda ctx: acc_tree("All Dialogs", "VM Migrate", get_dialog_name(ctx["dialog"])), { "vm_migrate_dialog_edit": lambda _: cfg_btn("Edit this Dialog") } ], "vm_provision_dialogs": lambda _: acc_tree("All Dialogs", "VM Provision"), "vm_provision_dialog": [ lambda ctx: acc_tree("All Dialogs", "VM Provision", get_dialog_name(ctx["dialog"])), { "vm_provision_dialog_edit": lambda _: cfg_btn("Edit this Dialog") } ], })
from cfme.web_ui.menu import nav from . import list_tbl, pol_btn nav.add_branch( 'containers_image_registries', { 'containers_image_registry': [ lambda ctx: list_tbl.select_row_by_cells( {'Host': ctx['image_registry'].host, 'Provider': ctx['provider'].name}), { 'containers_image_registry_edit_tags': lambda _: pol_btn('Edit Tags'), } ], 'containers_image_registry_detail': [ lambda ctx: list_tbl.click_row_by_cells( {'Host': ctx['image_registry'].host, 'Provider': ctx['provider'].name}), { 'containers_image_registry_edit_tags_detail': lambda _: pol_btn('Edit Tags'), } ] } ) class ImageRegistry(Taggable):
t_mds.ems_ref, t_ms.name, t_ems.name, t_mds.properties).join(t_ms, t_mds.server_id == t_ms.id).join(t_ems, t_mds.ems_id == t_ems.id) if name: query = query.filter(t_mds.name == name) if server: query = query.filter(t_mds.nativeid.like('%{}%'.format(server))) if provider: query = query.filter(t_ems.name == provider) return query nav.add_branch( 'middleware_datasources', { 'middleware_datasource': lambda ctx: list_tbl.select_row('Datasource Name', ctx['name']), 'middleware_datasource_detail': lambda ctx: list_tbl.click_row_by_cells({'Datasource Name': ctx['name']}), } ) class MiddlewareDatasource(MiddlewareBase, Taggable): """ MiddlewareDatasource class provides details on datasource page. Class methods available to get existing datasources list Args: name: Name of the datasource provider: Provider object (HawkularProvider) id: Native id (internal id) of datasource server: Server name of the datasource
if server: # if server instance is provided navigate through server page server.summary.reload() if server.summary.relationships.middleware_deployments.value == 0: return server.summary.relationships.middleware_deployments.click() elif provider: # if provider instance is provided navigate through provider page provider.summary.reload() if provider.summary.relationships.middleware_deployments.value == 0: return provider.summary.relationships.middleware_deployments.click() else: # if None(provider and server) given navigate through all middleware deployments page sel.force_navigate('middleware_deployments') nav.add_branch( 'middleware_deployments', { 'middleware_deployment': lambda ctx: list_tbl.select_row('Deployment Name', ctx['name']), } ) class MiddlewareDeployment(MiddlewareBase, Taggable): """ MiddlewareDeployment class provides details on deployment page. Class methods available to get existing deployments list Args: name: Name of the deployment provider: Provider object (HawkularProvider) server: Server object of the deployment (MiddlewareServer) nativeid: Native id (internal id) of deployment db_id: database row id of deployment
nav.add_branch( "clouds_instances", { "clouds_instances_by_provider": [ lambda _: accordion.tree("Instances by Provider", "Instances by Provider"), { "clouds_instances_provider_branch": [ lambda ctx: visible_tree.click_path(ctx["provider_name"]), { "availability_zone_branch": [ lambda ctx: visible_tree.click_path(ctx["availability_zone"]), { "clouds_instance_obj": lambda ctx: visible_tree.click_path(ctx["instance_name"]) } ] } ], "clouds_instances_archived_branch": [ lambda ctx: visible_tree.click_path('<Archived>'), { "clouds_instance_archive_obj": lambda ctx: visible_tree.click_path(ctx["archive_name"]), } ], "clouds_instances_orphaned_branch": [ lambda ctx: visible_tree.click_path('<Orphaned>'), { "clouds_instance_orphan_obj": lambda ctx: visible_tree.click_path(ctx["orphan_name"]), } ], } ], "clouds_images_by_provider": [ lambda _: accordion.tree("Images by Provider", "Images by Provider"), { "clouds_images_provider_branch": [ lambda ctx: visible_tree.click_path(ctx["provider_name"]), { "availability_zone_branch": [ lambda ctx: visible_tree.click_path(ctx["availability_zone"]), { "clouds_image_obj": lambda ctx: visible_tree.click_path(ctx["image_name"]) } ] } ], "clouds_images_archived_branch": [ lambda ctx: visible_tree.click_path('<Archived>'), { "clouds_image_archive_obj": lambda ctx: visible_tree.click_path(ctx["archive_name"]), } ], "clouds_images_orphaned_branch": [ lambda ctx: visible_tree.click_path('<Orphaned>'), { "clouds_image_orphan_obj": lambda ctx: visible_tree.click_path(ctx["orphan_name"]), } ], } ], "clouds_instances": [ lambda _: accordion.tree("Instances", "All Instances"), { "clouds_instances_filter_folder": [ lambda ctx: visible_tree.click_path(ctx["folder_name"]), { "clouds_instances_filter": lambda ctx: visible_tree.click_path(ctx["filter_name"]) } ] } ], "clouds_images": [ lambda _: (accordion.tree("Images", "All Images")), { "clouds_images_filter_folder": [ lambda ctx: visible_tree.click_path(ctx["folder_name"]), { "clouds_images_filter": lambda ctx: visible_tree.click_path(ctx["filter_name"]) } ] } ] } )
nav.add_branch( 'infrastructure_pxe', { 'infrastructure_pxe_servers': [ lambda _: pxe_tree(), { 'infrastructure_pxe_server_new': lambda _: cfg_btn('Add a New PXE Server'), 'infrastructure_pxe_server': [ lambda ctx: pxe_tree(ctx.pxe_server.name), { 'infrastructure_pxe_server_edit': lambda _: cfg_btn('Edit this PXE Server') } ] } ], 'infrastructure_pxe_templates': [ lambda _: template_tree(), { 'infrastructure_pxe_template_new': lambda _: cfg_btn('Add a New Customization Template'), 'infrastructure_pxe_template': [ lambda ctx: template_tree(ctx.pxe_template.image_type, ctx. pxe_template.name), { 'infrastructure_pxe_template_edit': lambda _: cfg_btn('Edit this Customization Template') } ] } ], 'infrastructure_pxe_image_types': [ lambda _: image_tree(), { 'infrastructure_pxe_image_type_new': lambda _: cfg_btn('Add a new System Image Type'), 'infrastructure_pxe_image_type': [ lambda ctx: image_table.click_cell( 'name', ctx.pxe_image_type.name), { 'infrastructure_pxe_image_type_edit': lambda _: cfg_btn('Edit this System Image Type') } ] } ], 'infrastructure_iso_datastores': [ lambda _: iso_tree(), { 'infrastructure_iso_datastore_new': lambda _: cfg_btn('Add a New ISO Datastore'), 'infrastructure_iso_datastore': lambda ctx: iso_tree(ctx.pxe_iso_datastore.provider) } ] })
# -*- coding: utf-8 -*- from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import CheckboxTable, toolbar as tb from cfme.web_ui.menu import nav from . import details_page list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") nav.add_branch( 'containers_containers', { 'containers_container': lambda ctx: list_tbl.select_row_by_cells( {'Name': ctx['container'].name, 'Pod Name': ctx['container'].pod.name}), 'containers_container_detail': lambda ctx: list_tbl.click_row_by_cells( {'Name': ctx['container'].name, 'Pod Name': ctx['container'].pod.name}), } ) class Container(Taggable, SummaryMixin): def __init__(self, name, pod): self.name = name self.pod = pod def _on_detail_page(self): return sel.is_displayed(
nav.add_branch( 'automate_explorer', { 'automate_explorer_tree_path': [ lambda ctx: nav_tree_item(get_path(ctx['tree_item'])), { 'automate_explorer_table_select': [ lambda ctx: table_select(ctx['table_item'].name), { 'automate_explorer_edit': lambda ctx: nav_edit(get_path(ctx['tree_item'])), 'automate_explorer_delete': lambda _: cfg_btn('Remove selected Items', invokes_alert=True) } ], 'automate_explorer_namespace_new': lambda _: cfg_btn('Add a New Namespace'), 'automate_explorer_class_new': lambda _: cfg_btn('Add a New Class'), 'automate_explorer_method_edit': lambda _: cfg_btn('Edit this Method'), 'automate_explorer_instance_edit': lambda _: cfg_btn('Edit this Instance'), 'automate_explorer_methods': [ lambda _: select_tab('Methods'), { 'automate_explorer_method_new': lambda _: cfg_btn('Add a New Method'), 'automate_explorer_method_table_select': lambda ctx: table_select(ctx['table_item'].name) } ], 'automate_explorer_instances': [ lambda _: select_tab('Instances'), { 'automate_explorer_instance_new': lambda _: cfg_btn('Add a New Instance'), 'automate_explorer_instance_table_select': lambda ctx: table_select(ctx['table_item'].name) } ], 'automate_explorer_schema': [ lambda _: select_tab("Schema"), { 'automate_explorer_schema_edit': lambda _: cfg_btn("Edit selected Schema") } ] } ] })
# -*- coding: utf-8 -*- # added new list_tbl definition from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import toolbar as tb, CheckboxTable from cfme.web_ui.menu import nav from . import details_page list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") nav.add_branch( 'containers_services', { 'containers_service': lambda ctx: list_tbl.select_row_by_cells( {'Name': ctx['service'].name, 'Provider': ctx['service'].provider.name}), 'containers_service_detail': lambda ctx: list_tbl.click_row_by_cells( {'Name': ctx['service'].name, 'Provider': ctx['service'].provider.name}), } ) class Service(Taggable, SummaryMixin): def __init__(self, name, provider): self.name = name self.provider = provider def _on_detail_page(self): return sel.is_displayed(
from . import cfg_btn, mon_btn, pol_btn, details_page nav.add_branch( 'containers_providers', { 'containers_provider_new': lambda _: cfg_btn('Add a New Containers Provider'), 'containers_provider': [ lambda ctx: sel.check( Quadicon(ctx['provider'].name, None).checkbox), { 'containers_provider_edit': lambda _: cfg_btn('Edit Selected Containers Provider'), 'containers_provider_edit_tags': lambda _: pol_btn('Edit Tags') } ], 'containers_provider_detail': [ lambda ctx: sel.click(Quadicon(ctx['provider'].name, None)), { 'containers_provider_edit_detail': lambda _: cfg_btn('Edit this Containers Provider'), 'containers_provider_timelines_detail': lambda _: mon_btn('Timelines'), 'containers_provider_edit_tags_detail': lambda _: pol_btn('Edit Tags'), 'containers_provider_topology_detail': lambda _: sel.click(InfoBlock('Overview', 'Topology')) } ] }) properties_form = Form(fields=[( 'type_select',
nav.add_branch( "reports", { "reports_all": [ lambda ctx: accordion.tree("Reports", "All Reports"), { "report_add": lambda ctx: cfg_btn("Add a new Report"), } ], "report_canned": [ lambda ctx: accordion.tree("Reports", "All Reports", *ctx["path"]), { "report_canned_info": [ lambda ctx: tabstrip.select_tab("Report Info"), { # Empty for now }, ], "report_canned_saved": lambda ctx: tabstrip.select_tab("Saved Reports"), } ], "reports_custom": lambda ctx: accordion.tree( "Reports", "All Reports", "{} (All EVM Groups)".format( db.get_yaml_config("vmdb")["server"]["company"] ), "Custom", ), "report_custom": [ lambda ctx: accordion.tree( "Reports", "All Reports", "{} (All EVM Groups)".format( db.get_yaml_config("vmdb")["server"]["company"] ), "Custom", get_report_name(ctx["report"]) ), { "report_custom_info": [ lambda ctx: tabstrip.select_tab("Report Info"), { "report_custom_edit": lambda ctx: cfg_btn("Edit this Report"), }, ], "report_custom_saved": lambda ctx: tabstrip.select_tab("Saved Reports"), } ], "saved_report_custom": lambda ctx: accordion.tree( "Reports", "All Reports", "{} (All EVM Groups)".format( db.get_yaml_config("vmdb")["server"]["company"]), "Custom", get_report_name(ctx["report"]), ctx["datetime"] ), "saved_report_canned": lambda ctx: accordion.tree( "Reports", *(["All Reports"] + ctx["path"] + [ctx["datetime"]]) ), } )
# -*- coding: utf-8 -*- from cfme import web_ui as ui from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import Region, accordion, fill, flash, form_buttons from cfme.web_ui.menu import nav nav.add_branch( "reports", { "import_export": lambda ctx: accordion.tree("Import/Export", "Import / Export"), }) form = Region(locators=dict( export_select=ui.Select("//select[@id='choices_chosen']", multi=True), export_button=form_buttons.FormButton("Download Report to YAML"), import_overwrite=ui.Input('overwrite'), import_file=ui.Input('upload_file'), import_submit=ui.Input('upload_atags'))) export_select = ui.Select("//select[@id='choices_chosen']", multi=True) export_button = form_buttons.FormButton("Download Report to YAML") def export_reports(*custom_report_names): sel.force_navigate("import_export") fill(form.export_select, custom_report_names) sel.click(form.export_button) def import_reports(filename, overwrite=False):
from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import CheckboxTable, toolbar as tb from cfme.web_ui.menu import nav from . import details_page list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") nav.add_branch( 'containers_containers', { 'containers_container': lambda ctx: list_tbl.select_row_by_cells( { 'Name': ctx['container'].name, 'Pod Name': ctx['container'].pod.name }), 'containers_container_detail': lambda ctx: list_tbl.click_row_by_cells( { 'Name': ctx['container'].name, 'Pod Name': ctx['container'].pod.name }), }) class Container(Taggable, SummaryMixin): def __init__(self, name, pod): self.name = name self.pod = pod def _on_detail_page(self):
from cfme.web_ui.menu import nav from . import list_tbl, pol_btn nav.add_branch( 'containers_replicators', { 'containers_replicator': [ lambda ctx: list_tbl.select_row_by_cells( {'Name': ctx['replicator'].name, 'Provider': ctx['provider'].name}), { 'containers_replicator_edit_tags': lambda _: pol_btn('Edit Tags'), } ], 'containers_replicator_detail': [ lambda ctx: list_tbl.click_row_by_cells( {'Name': ctx['replicator'].name, 'Provider': ctx['provider'].name}), { 'containers_replicator_edit_tags_detail': lambda _: pol_btn('Edit Tags'), } ] } ) class Replicator(Taggable):
provider.summary.reload() if provider.summary.relationships.middleware_servers.value == 0: return provider.summary.relationships.middleware_servers.click() elif server_group: # if server group instance is provided navigate through it's servers page server_group.summary.reload() if server_group.summary.relationships.middleware_servers.value == 0: return server_group.summary.relationships.middleware_servers.click() else: # if None(provider) given navigate through all middleware servers page sel.force_navigate('middleware_servers') nav.add_branch( 'middleware_servers', { 'middleware_server': lambda ctx: list_tbl.select_row('Server Name', ctx['name']), } ) 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): """
if server: # if server instance is provided navigate through server page server.summary.reload() if server.summary.relationships.middleware_deployments.value == 0: return server.summary.relationships.middleware_deployments.click() elif provider: # if provider instance is provided navigate through provider page provider.summary.reload() if provider.summary.relationships.middleware_deployments.value == 0: return provider.summary.relationships.middleware_deployments.click() else: # if None(provider and server) given navigate through all middleware deployments page sel.force_navigate('middleware_deployments') nav.add_branch( 'middleware_deployments', { 'middleware_deployment': lambda ctx: list_tbl.select_row('Deployment Name', ctx['name']), } ) class MiddlewareDeployment(MiddlewareBase): """ MiddlewareDeployment class provides details on deployment page. Class methods available to get existing deployments list Args: name: Name of the deployment provider: Provider object (HawkularProvider) server: Server object of the deployment (MiddlewareServer) nativeid: Native id (internal id) of deployment
'Name': template_name, 'Provider': provider.name }) if template: sel.click(template) sel.click(template_select_form.continue_button) else: # Better exception? raise ValueError('Navigation failed: Unable to find template "%s" for provider "%s"' % (template_name, provider.name)) nav.add_branch( 'clouds_instances', { 'clouds_instances_by_provider': [nav.partial(accordion.click, 'Instances by Provider'), {'clouds_all_instances': [lambda _: instances_by_provider_tree.click_path('Instances by Provider'), # select root {'clouds_provision_instances': lambda c: _nav_to_provision_form(c), 'clouds_instance': lambda ctx: paginator.click_element(ui.Quadicon(ctx['instance'].name, 'instance'))}]}]}) class Template(object): def __init__(self, name): self.name = name class Instance(Updateable): '''Represents an instance (or vm) in CFME. * provider_mgmt should be those returned by utils.mgmt_system.provider_factory
nav.add_branch( 'automate_explorer', { 'automate_explorer_tree_path': [lambda context: context.tree_item.navigate_tree() if context.tree_item is not None else datastore_tree(), { 'automate_explorer_table_select': [lambda ctx: table_select(ctx['table_item'].name_in_table), { 'automate_explorer_edit': lambda context: context.tree_item.nav_edit(), 'automate_explorer_delete': lambda _: cfg_btn('Remove selected Items', invokes_alert=True)}], 'automate_explorer_namespace_new': lambda _: cfg_btn('Add a New Namespace'), 'automate_explorer_domain_new': lambda _: cfg_btn('Add a New Domain'), 'automate_explorer_class_new': lambda _: cfg_btn('Add a New Class'), "automate_explorer_domain_edit": lambda _: cfg_btn("Edit this Domain"), 'automate_explorer_method_edit': lambda _: cfg_btn('Edit this Method'), 'automate_explorer_instance_edit': lambda _: cfg_btn('Edit this Instance'), 'automate_explorer_methods': [lambda _: select_tab('Methods'), { 'automate_explorer_method_new': lambda _: cfg_btn('Add a New Method'), 'automate_explorer_method_table_select': lambda ctx: table_select(ctx['table_item'].name_in_table)}], 'automate_explorer_instances': [lambda _: select_tab('Instances'), { 'automate_explorer_instance_new': lambda _: cfg_btn('Add a New Instance'), 'automate_explorer_instance_table_select': lambda ctx: table_select(ctx['table_item'].name_in_table)}], 'automate_explorer_schema': [lambda _: select_tab("Schema"), { 'automate_explorer_schema_edit': lambda _: cfg_btn("Edit selected Schema") }]}], "automate_explorer_domain_order": open_order_dialog_func, })
nav.add_branch( "reports", { "reports_default_dashboard": [ go_to_default_func, { "reports_default_dashboard_edit": lambda _: toolbar.select("Configuration", "Edit this Dashboard" ) } ], "reports_dashboards": [ lambda ctx: accordion. tree("Dashboards", "All Dashboards", "All Groups", ctx["group"]), { "reports_dashboard_add": lambda _: toolbar.select("Configuration", "Add a new Dashboard" ) } ], "reports_dashboard": [ lambda ctx: accordion.tree("Dashboards", "All Dashboards", "All Groups", ctx["dashboard"].group, ctx["dashboard"].name), { "reports_dashboard_edit": lambda _: toolbar.select( "Configuration", "Edit this Dashboard"), } ], })
# -*- coding: utf-8 -*- # added new list_tbl definition from cfme.common import SummaryMixin, Taggable from cfme.fixtures import pytest_selenium as sel from cfme.web_ui import toolbar as tb, CheckboxTable from cfme.web_ui.menu import nav from . import details_page list_tbl = CheckboxTable(table_locator="//div[@id='list_grid']//table") nav.add_branch( 'containers_replicators', { 'containers_replicator': lambda ctx: list_tbl.select_row_by_cells( {'Name': ctx['replicator'].name, 'Provider': ctx['replicator'].provider.name}), 'containers_replicator_detail': lambda ctx: list_tbl.click_row_by_cells( {'Name': ctx['replicator'].name, 'Provider': ctx['replicator'].provider.name}), } ) class Replicator(Taggable, SummaryMixin): def __init__(self, name, provider): self.name = name self.provider = provider def _on_detail_page(self): return sel.is_displayed('//div//h1[contains(., "{} (Summary)")]'.format(self.name))
} ) manage_policies_tree = CheckboxTree("//div[@id='protect_treebox']/ul") cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') mon_btn = partial(tb.select, 'Monitoring') nav.add_branch('infrastructure_providers', {'infrastructure_provider_new': lambda _: cfg_btn( 'Add a New Infrastructure Provider'), 'infrastructure_provider_discover': lambda _: cfg_btn( 'Discover Infrastructure Providers'), 'infrastructure_provider': [lambda ctx: sel.click(Quadicon(ctx['provider'].name, 'infra_prov')), {'infrastructure_provider_edit': lambda _: cfg_btn('Edit this Infrastructure Provider'), 'infrastructure_provider_policy_assignment': lambda _: pol_btn('Manage Policies'), 'infrastructure_provider_timelines': lambda _: mon_btn('Timelines')}]}) @CloudInfraProvider.add_base_type class Provider(Pretty, CloudInfraProvider): """ Abstract model of an infrastructure provider in cfme. See VMwareProvider or RHEVMProvider. Args: name: Name of the provider.
)), ('api_port', Input("port")), ]) details_page = Region(infoblock_type='detail') cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') mon_btn = partial(tb.select, 'Monitoring') nav.add_branch('clouds_providers', {'clouds_provider_new': lambda _: cfg_btn('Add a New Cloud Provider'), 'clouds_provider_discover': lambda _: cfg_btn('Discover Cloud Providers'), 'clouds_provider': [lambda ctx: sel.click(Quadicon(ctx['provider'].name, 'cloud_prov')), {'clouds_provider_edit': lambda _: cfg_btn('Edit this Cloud Provider'), 'clouds_provider_policy_assignment': lambda _: pol_btn('Manage Policies'), 'cloud_provider_timelines': lambda _: mon_btn('Timelines')}]}) class Provider(Updateable, Pretty, BaseProvider): """ Abstract model of a cloud provider in cfme. See EC2Provider or OpenStackProvider. Args: name: Name of the provider. details: a details record (see EC2Details, OpenStackDetails inner class). credentials (Credential): see Credential inner class.
sel.force_navigate('middleware_providers') nav.add_branch( 'middleware_providers', { 'middleware_provider_new': lambda _: cfg_btn('Add a New Middleware Provider'), 'middleware_provider': [ lambda ctx: sel.check(Quadicon(ctx['provider'].name, "middleware").checkbox), { 'middleware_provider_edit': lambda _: cfg_btn('Edit Selected Middleware Provider'), 'middleware_provider_edit_tags': lambda _: pol_btn('Edit Tags') }], 'middleware_provider_detail': [ lambda ctx: sel.click(Quadicon(ctx['provider'].name, "middleware")), { 'middleware_provider_edit_detail': lambda _: cfg_btn('Edit this Middleware Provider'), 'middleware_provider_timelines_detail': lambda _: mon_btn('Timelines'), 'middleware_provider_edit_tags_detail': lambda _: pol_btn('Edit Tags'), }] } ) properties_form = Form(
"5.3": "//div[@id='protect_treebox']/ul" }) cfg_btn = partial(tb.select, 'Configuration') pol_btn = partial(tb.select, 'Policy') mon_btn = partial(tb.select, 'Monitoring') nav.add_branch( 'infrastructure_providers', { 'infrastructure_provider_new': lambda _: cfg_btn('Add a New Infrastructure Provider'), 'infrastructure_provider_discover': lambda _: cfg_btn('Discover Infrastructure Providers'), 'infrastructure_provider': [ lambda ctx: sel.click(Quadicon(ctx[ 'provider'].name, 'infra_prov')), { 'infrastructure_provider_edit': lambda _: cfg_btn('Edit this Infrastructure Provider'), 'infrastructure_provider_policy_assignment': lambda _: pol_btn('Manage Policies'), 'infrastructure_provider_timelines': lambda _: mon_btn('Timelines') } ] }) class Provider(Updateable, Pretty, BaseProvider): """ Abstract model of an infrastructure provider in cfme. See VMwareProvider or RHEVMProvider. Args:
""" from cfme import web_ui as ui import cfme.fixtures.pytest_selenium as sel import cfme.web_ui.tabstrip as tabs from cfme.web_ui import Form, Region, CheckboxTable, fill, paginator from cfme.web_ui.menu import nav from utils.timeutil import parsetime from utils.wait import wait_for, TimedOutError from utils.version import LOWEST nav.add_branch("tasks", dict( tasks_my_vm=lambda _: tabs.select_tab("My VM Analysis Tasks"), tasks_my_other_ui=lambda _: tabs.select_tab("My Other UI Tasks"), tasks_all_vm=lambda _: tabs.select_tab("All VM Analysis Tasks"), tasks_all_other=lambda _: tabs.select_tab("All Other Tasks"), ) ) buttons = Region( locators=dict( default={LOWEST: "//*[@id='buttons_off']/li[3]/a/img", '5.4': "//*[@id='buttons_off']/a"}, apply={LOWEST: "//*[@id='buttons_on']/li[1]/a/img", '5.4': "//*[@id='buttons_on']/a[1]"}, reset={LOWEST: "//*[@id='buttons_on']/li[2]/a/img", '5.4': "//*[@id='buttons_on']/a[2]"} ) )
('provision_start_min', Select('//select[@id="start_min"]')), ('retirement', Select('//select[@id="schedule__retirement"]')), ('retirement_warning', Select('//select[@id="schedule__retirement_warn"]')), ]) ]) ) # Nav targets and helpers def _nav_to_provision_form(context): toolbar.select('Lifecycle', 'Provision VMs') provider = context['provider'] template_name = context['template_name'] template = template_select_form.template_table.find_row_by_cells({ 'Name': template_name, 'Provider': provider.name }) if template: sel.click(template) sel.click(template_select_form.continue_button) return else: # Better exception? raise ValueError('Navigation failed: Unable to find template "%s" for provider "%s"' % (template_name, provider.key)) nav.add_branch('infrastructure_virtual_machines', { 'infrastructure_provision_vms': _nav_to_provision_form })
def _all_catalogitems_add_new(context): accordion.tree('Catalog Items', 'All Catalog Items') tb_select('Add a New Catalog Item') provider_type = context['provider_type'] sel.select("//select[@id='st_prov_type']", provider_type) def _all_catalogbundle_add_new(context): sel.click("//div[@id='sandt_tree_div']//td[normalize-space(.)='All Catalog Items']") tb_select('Add a New Catalog Bundle') nav.add_branch( 'services_catalogs', {'catalog_items': [nav.partial(accordion.click, 'Catalog Items'), {'catalog_item_new': _all_catalogitems_add_new, 'catalog_item': [lambda ctx: accordion.tree('Catalog Items', 'All Catalog Items', ctx['catalog'], ctx['catalog_item'].name), {'catalog_item_edit': nav.partial(tb_select, "Edit this Item")}]}]}) class Template(Pretty): pretty_attrs = ['name'] def __init__(self, name): self.name = name class Instance(Updateable, Pretty): pretty_attrs = ['name', 'item_type', 'catalog', 'vm_name', 'instance_type', 'availability_zone']
) details_page = Region(infoblock_type="detail") cfg_btn = partial(tb.select, "Configuration") pol_btn = partial(tb.select, "Policy") mon_btn = partial(tb.select, "Monitoring") nav.add_branch( "clouds_providers", { "clouds_provider_new": lambda _: cfg_btn("Add a New Cloud Provider"), "clouds_provider_discover": lambda _: cfg_btn("Discover Cloud Providers"), "clouds_provider": [ lambda ctx: sel.click(Quadicon(ctx["provider"].name, "cloud_prov")), { "clouds_provider_edit": lambda _: cfg_btn("Edit this Cloud Provider"), "clouds_provider_policy_assignment": lambda _: pol_btn("Manage Policies"), "cloud_provider_timelines": lambda _: mon_btn("Timelines"), }, ], }, ) class Provider(Pretty, CloudInfraProvider): """ Abstract model of a cloud provider in cfme. See EC2Provider or OpenStackProvider. Args: name: Name of the provider.
from . import list_tbl, mon_btn, pol_btn, details_page nav.add_branch( 'containers_pods', { 'containers_pod': [ lambda ctx: list_tbl.select_row_by_cells( {'Name': ctx['pod'].name, 'Provider': ctx['provider'].name}), { 'containers_pod_edit_tags': lambda _: pol_btn('Edit Tags'), } ], 'containers_pod_detail': [ lambda ctx: list_tbl.click_row_by_cells( {'Name': ctx['pod'].name, 'Provider': ctx['provider'].name}), { 'containers_pod_timelines_detail': lambda _: mon_btn('Timelines'), 'containers_pod_edit_tags_detail': lambda _: pol_btn('Edit Tags'), } ] } ) class Pod(Taggable):
nav.add_branch( "reports", { "reports_widgets_menus": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "Menus"), {"reports_widgets_menu_add": lambda _: toolbar.select("Configuration", "Add a new Widget")}, ], "reports_widgets_menu": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "Menus", ctx["widget"].title), { "reports_widgets_menu_delete": lambda _: toolbar.select( "Configuration", "Delete this Widget from the Database" ), "reports_widgets_menu_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), }, ], "reports_widgets_reports": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "Reports"), {"reports_widgets_report_add": lambda _: toolbar.select("Configuration", "Add a new Widget")}, ], "reports_widgets_report": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "Reports", ctx["widget"].title), { "reports_widgets_report_delete": lambda _: toolbar.select( "Configuration", "Delete this Widget from the Database" ), "reports_widgets_report_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), }, ], "reports_widgets_charts": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "Charts"), {"reports_widgets_chart_add": lambda _: toolbar.select("Configuration", "Add a new Widget")}, ], "reports_widgets_chart": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "Charts", ctx["widget"].title), { "reports_widgets_chart_delete": lambda _: toolbar.select( "Configuration", "Delete this Widget from the Database" ), "reports_widgets_chart_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), }, ], "reports_widgets_rss_feeds": [ lambda _: accordion.tree("Dashboard Widgets", "All Widgets", "RSS Feeds"), {"reports_widgets_rss_feed_add": lambda _: toolbar.select("Configuration", "Add a new Widget")}, ], "reports_widgets_rss_feed": [ lambda ctx: accordion.tree("Dashboard Widgets", "All Widgets", "RSS Feeds", ctx["widget"].title), { "reports_widgets_rss_feed_delete": lambda _: toolbar.select( "Configuration", "Delete this Widget from the Database" ), "reports_widgets_rss_feed_edit": lambda _: toolbar.select("Configuration", "Edit this Widget"), }, ], }, )
from cfme.web_ui.menu import nav from . import list_tbl, pol_btn nav.add_branch( 'containers_replicators', { 'containers_replicator': [ lambda ctx: list_tbl.select_row_by_cells( { 'Name': ctx['replicator'].name, 'Provider': ctx['provider'].name }), { 'containers_replicator_edit_tags': lambda _: pol_btn('Edit Tags'), } ], 'containers_replicator_detail': [ lambda ctx: list_tbl.click_row_by_cells( { 'Name': ctx['replicator'].name, 'Provider': ctx['provider'].name }), { 'containers_replicator_edit_tags_detail': lambda _: pol_btn('Edit Tags'), } ] }) class Replicator(Taggable): def __init__(self, name, provider):
nav.add_branch( "clouds_instances", { "clouds_instances_by_provider": [ lambda _: accordion. tree("Instances by Provider", "Instances by Provider"), { "clouds_instances_provider_branch": [ lambda ctx: visible_tree.click_path(ctx["provider_name"]), { "availability_zone_branch": [ lambda ctx: visible_tree.click_path(ctx[ "availability_zone"]), { "clouds_instance_obj": lambda ctx: visible_tree.click_path(ctx[ "instance_name"]) } ] } ], "clouds_instances_archived_branch": [ lambda ctx: visible_tree.click_path('<Archived>'), { "clouds_instance_archive_obj": lambda ctx: visible_tree.click_path(ctx["archive_name"] ), } ], "clouds_instances_orphaned_branch": [ lambda ctx: visible_tree.click_path('<Orphaned>'), { "clouds_instance_orphan_obj": lambda ctx: visible_tree.click_path(ctx["orphan_name"] ), } ], } ], "clouds_images_by_provider": [ lambda _: accordion. tree("Images by Provider", "Images by Provider"), { "clouds_images_provider_branch": [ lambda ctx: visible_tree.click_path(ctx["provider_name"]), { "availability_zone_branch": [ lambda ctx: visible_tree.click_path(ctx[ "availability_zone"]), { "clouds_image_obj": lambda ctx: visible_tree.click_path(ctx[ "image_name"]) } ] } ], "clouds_images_archived_branch": [ lambda ctx: visible_tree.click_path('<Archived>'), { "clouds_image_archive_obj": lambda ctx: visible_tree.click_path(ctx["archive_name"] ), } ], "clouds_images_orphaned_branch": [ lambda ctx: visible_tree.click_path('<Orphaned>'), { "clouds_image_orphan_obj": lambda ctx: visible_tree.click_path(ctx["orphan_name"] ), } ], } ], "clouds_instances": [ lambda _: accordion.tree("Instances", "All Instances"), { "clouds_instances_filter_folder": [ lambda ctx: visible_tree.click_path(ctx["folder_name"]), { "clouds_instances_filter": lambda ctx: visible_tree.click_path(ctx["filter_name"]) } ] } ], "clouds_images": [ lambda _: (accordion.tree("Images", "All Images")), { "clouds_images_filter_folder": [ lambda ctx: visible_tree.click_path(ctx["folder_name"]), { "clouds_images_filter": lambda ctx: visible_tree.click_path(ctx["filter_name"]) } ] } ] })