class customize(WaitTab): # noqa username = SummaryFormItem('Credentials', 'Username') ip_mode = SummaryFormItem('IP Address Information', 'Address Mode') hostname = SummaryFormItem('IP Address Information', 'Address Mode') subnet_mask = SummaryFormItem('IP Address Information', 'Subnet Mask') gateway = SummaryFormItem('IP Address Information', 'Gateway') dns_server_list = SummaryFormItem('DNS', 'DNS Server list') dns_suffix_list = SummaryFormItem('DNS', 'DNS Suffix list') subnet_mask = SummaryFormItem('IP Address Information', 'Subnet Mask') customize_template = SummaryFormItem('Customize Template', 'Script Name')
class ButtonGroupDetailView(ServicesCatalogView): title = Text("#explorer_title_text") text = SummaryFormItem( "Basic Information", "Text", text_filter=lambda text: re.sub(r"\s+Display on Button\s*$", "", text), ) hover = SummaryFormItem("Basic Information", "Hover Text") @property def is_displayed(self): return (self.in_explorer and self.catalog_items.is_opened and "Button Group" in self.title.text)
class ButtonDetailView(AutomateCustomizationView): title = Text('#explorer_title_text') text = SummaryFormItem( 'Basic Information', 'Button Text', text_filter=lambda text: re.sub(r'\s+Display on Button\s*$', '', text)) hover = SummaryFormItem('Basic Information', 'Button 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 ])
class ActionDetailsView(ControlExplorerView): title = Text("#explorer_title_text") type = SummaryFormItem("Basic Information", "Action Type") analysis_profile = SummaryFormItem("Analysis Profile", "Assigned Analysis Profile") @property def is_displayed(self): return (self.in_control_explorer and self.title.text == 'Action "{}"'.format(self.context["object"].description) and self.actions.is_opened and self.actions.tree.currently_selected == ["All Actions", self.context["object"].description])
class DashboardWidgetDetailsView(DashboardWidgetsView): title = Text("#explorer_title_text") status_info = SummaryFormItem("Status", "Current Status") last_run_time = SummaryFormItem("Status", "Last Run Time") reload_button = Button(title='Refresh this page') @property def is_displayed(self): return (self.in_dashboard_widgets and self.title.text == '{} Widget "{}"'.format( self.context["object"].TITLE, self.context["object"].title) and self.dashboard_widgets.tree.currently_selected == [ "All Widgets", self.context["object"].TYPE, self.context["object"].title ])
class GroupForm(ConfigurationView): """ Group Form in CFME UI.""" ldap_groups_for_user = BootstrapSelect(id='ldap_groups_user') description_txt = Input(name='description') lookup_ldap_groups_chk = Checkbox(name='lookup') role_select = BootstrapSelect(id='group_role') group_tenant = BootstrapSelect(id='group_tenant') user_to_look_up = Input(name='user') username = Input(name='user_id') password = Input(name='password') tag = SummaryFormItem('Smart Management', 'My Company Tags') cancel_button = Button('Cancel') retrieve_button = Button('Retrieve') @View.nested class my_company_tags(Tab): # noqa """ Represents 'My company tags' tab in Group Form """ TAB_NAME = "My Company Tags" tag_tree = CheckableBootstrapTreeview('tags_treebox') @View.nested class hosts_and_clusters(Tab): # noqa """ Represents 'Hosts and Clusters' tab in Group Form """ TAB_NAME = "Hosts & Clusters" hosts_clusters_tree = CheckableBootstrapTreeview('hac_treebox') @View.nested class vms_and_templates(Tab): # noqa """ Represents 'VM's and Templates' tab in Group Form """ TAB_NAME = "VMs & Templates" vms_templates_tree = CheckableBootstrapTreeview('vat_treebox')
class ServerCollectLogsView(ServerDiagnosticsView): toolbar = View.nested(ServerCollectLogsToolbar) log_depot_uri = SummaryFormItem('Basic Info', 'Log Depot URI') last_log_collection = SummaryFormItem('Basic Info', 'Last Log Collection') last_log_message = SummaryFormItem('Basic Info', 'Last Message') @property def is_displayed(self): return (self.in_server_collect_logs and self.title.text == 'Diagnostics Server "{} [{}]" (current)'.format( self.context['object'].name, self.context['object'].sid)) @property def in_server_collect_logs(self): return (self.collectlogs.is_displayed and self.collectlogs.is_active())
class DiagnosticsCollectLogsView(ServerDiagnosticsView): edit = Button(title="Edit the Log Depot settings for the selected Server") collect = Dropdown( VersionPick({ Version.lowest(): 'Collect Logs', '5.7': 'Collect' })) log_depot_uri = SummaryFormItem('Basic Info', 'Log Depot URI') last_log_collection = SummaryFormItem('Basic Info', 'Last Log Collection') last_log_message = SummaryFormItem('Basic Info', 'Last Message') @property def is_displayed(self): return (super(DiagnosticsCollectLogsView, self).is_displayed and self.view.collectlogs.is_displayed and self.view.collectlogs.is_active)
class ServerCollectLogsView(ServerDiagnosticsView): toolbar = View.nested(ServerCollectLogsToolbar) log_depot_uri = SummaryFormItem('Basic Info', 'Log Depot URI') last_log_collection = SummaryFormItem('Basic Info', 'Last Log Collection') last_log_message = SummaryFormItem('Basic Info', 'Last Message') title_template = 'Diagnostics Server "{name} [{sid}]"{current}' def form_expected_title(self, name, sid, current): return self.title_template.format(name=name, sid=sid, current=current) @property def is_displayed(self): tree = self.accordions.diagnostics.tree.currently_selected # tree is a list with 3 values: Region, Zone and Server, so we are taking the last # Server value is like 'Server: EVM [1] (current)', # so we are taking the actual name of the server without the 'Server: ' selected_server = tree[-1].split(': ')[-1] if 'current' in selected_server: name, sid, current = selected_server.split() else: # no (current) if this is not the server associated with the current appliance name, sid = selected_server.split() current = None try: # output 'title_template' is '[[1]]' which is not intended. # stripping square brackets to get the correct output sid = sid.strip('[]') except ValueError: pass return ( self.in_server_collect_logs and # compare with the selection in accordion as it can be another server self.title.text == self.form_expected_title( name=name, sid=sid, current='' if current is None else ' (current)') ) @property def in_server_collect_logs(self): return ( self.collectlogs.is_displayed and self.collectlogs.is_active() )
class ButtonGroupDetailView(AutomateCustomizationView): title = Text('#explorer_title_text') text = SummaryFormItem( 'Basic Information', 'Button Text', text_filter=lambda text: re.sub(r'\s+Display on Button\s*$', '', text)) hover = SummaryFormItem('Basic Information', 'Button 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 ])
class catalog(Tab): # noqa TAB_NAME = 'Catalog' filter_template = SummaryFormItem('Select', 'Filter') name = SummaryFormItem('Select', 'Name') provision_type = SummaryFormItem('Select', 'Provision Type') linked_clone = Checkbox(id='service__linked_clone') vm_count = SummaryFormItem('Number of VMs', 'Count') instance_count = SummaryFormItem('Number of Instances', 'Count') vm_name = SummaryFormItem('Naming', 'VM Name') instance_name = SummaryFormItem('Naming', 'Instance Name') vm_description = SummaryFormItem('Naming', 'VM Description')
class DiagnosticsCollectLogsView(ServerDiagnosticsView): title = Text('#explorer_title_text') edit = Button(title="Edit the Log Depot settings for the selected Server") collect = Dropdown(VersionPick({Version.lowest(): 'Collect Logs', '5.7': 'Collect'})) log_depot_uri = SummaryFormItem('Basic Info', 'Log Depot URI') last_log_collection = SummaryFormItem('Basic Info', 'Last Log Collection') last_log_message = SummaryFormItem('Basic Info', 'Last Message') @property def is_displayed(self): return ( super(DiagnosticsCollectLogsView, self).is_displayed and self.collectlogs.is_displayed and self.collectlogs.is_active and self.title.text == 'Diagnostics Server "{} [{}]" (current)'.format( self.context['object'].name, self.context['object'].sid))
class MethodDetailsView(AutomateExplorerView): title = Text('#explorer_title_text') fqdn = SummaryFormItem( 'Main Info', 'Fully Qualified Name', text_filter=lambda text: [item.strip() for item in text.strip().lstrip('/').split('/')]) name = SummaryFormItem('Main Info', 'Name') display_name = SummaryFormItem('Main Info', 'Display Name') location = SummaryFormItem('Main Info', 'Location') created_on = SummaryFormItem('Main Info', 'Created On', text_filter=parsetime.from_iso_with_utc) @property def is_displayed(self): return ( self.in_explorer and self.title.text.startswith('Automate Method [{}'.format( self.context['object'].display_name or self.context['object'].name)) and self.fqdn.is_displayed and # We need to chop off the leading Domain name. self.fqdn.text == self.context['object'].tree_path_name_only[1:])
class PolicyDetailsView(ControlExplorerView): title = Text("#explorer_title_text") type = SummaryFormItem("Basic Information", "Action Type") analysis_profile = SummaryFormItem("Analysis Profile", "Assigned Analysis Profile") @property def is_displayed(self): return (self.in_control_explorer and self.title.text == '{} {} Policy "{}"'.format( self.context["object"].PRETTY, self.context["object"].TYPE, self.context["object"].description) and self.policies.is_opened and self.policies.tree.currently_selected == [ "All Policies", "{} Policies".format( self.context["object"].TYPE), "{} {} Policies".format( self.context["object"].TREE_NODE, self.context["object"].TYPE), self.context["object"].description ])
class ServerCollectLogsView(ServerDiagnosticsView): toolbar = View.nested(ServerCollectLogsToolbar) log_depot_uri = SummaryFormItem('Basic Info', 'Log Depot URI') last_log_collection = SummaryFormItem('Basic Info', 'Last Log Collection') last_log_message = SummaryFormItem('Basic Info', 'Last Message') title_template = 'Diagnostics Server "{name} [{sid}]"{current}' def form_expected_title(self, name, sid, current): return self.title_template.format(name=name, sid=sid, current=current) @property def is_displayed(self): tree = self.accordions.diagnostics.tree.currently_selected # tree is a list with 3 values: Region, Zone and Server, so we are taking the last # Server value is like 'Server: EVM [1] (current)', # so we are taking the actual name of the server without the 'Server: ' selected_server = tree[-1].split(': ')[-1] if 'current' in selected_server: name, sid, current = selected_server.split() else: # no (current) for slave servers name, sid = selected_server.split() current = None return ( self.in_server_collect_logs and # compare with the selection in accordion as it can be a slave server self.title.text == self.form_expected_title(name=name, sid=sid, current='' if current is None else ' (current)') ) @property def in_server_collect_logs(self): return ( self.collectlogs.is_displayed and self.collectlogs.is_active() )
class MethodDetailsView(AutomateExplorerView): title = Text('#explorer_title_text') fqdn = SummaryFormItem( 'Main Info', 'Fully Qualified Name', text_filter=lambda text: [item.strip() for item in text.strip().lstrip('/').split('/')]) name = SummaryFormItem('Main Info', 'Name') display_name = SummaryFormItem('Main Info', 'Display Name') location = SummaryFormItem('Main Info', 'Location') created_on = SummaryFormItem('Main Info', 'Created On', text_filter=parsetime.from_iso_with_utc) inputs = Table(locator='#params_grid', assoc_column='Input Name') @property def is_displayed(self): return ( self.in_explorer and self.title.text.startswith('Automate Method [{}'.format( self.context['object'].display_name or self.context['object'].name)) and self.fqdn.is_displayed and # We check namespace separately as in tree there is status included self.fqdn.text[0] in self.context['object'].tree_path_name_only[1] and # We need to chop off the leading Domain name and namespace(cheecked in previous line) self.fqdn.text[1:] == self.context['object'].tree_path_name_only[2:])
class DashboardDetailsView(CloudIntelReportsView): SAMPLE_DASHBOARD_ROOT = ".//div[@id='modules']" ITEM_TITLE_LOCATOR = ".//h3[contains(@class, 'panel-title')]" title = Text("#explorer_title_text") name = SummaryFormItem("Basic Information", "Name") tab_title = SummaryFormItem("Basic Information", "Tab Title") @property def selected_items(self): items = [] for el in self.browser.elements(self.ITEM_TITLE_LOCATOR, self.SAMPLE_DASHBOARD_ROOT): items.append(self.browser.text(el)) return items @property def is_displayed(self): return (self.in_intel_reports and self.title.text == 'Dashboard "{} ({})"'.format( self.context["object"].title, self.context["object"].name) and self.dashboards.is_opened and self.correct_tree_item_selected())
class report_info(WaitTab): # noqa TAB_NAME = "Report Info" # Keeping `group_title` empty since the summary form has no title report_id = SummaryFormItem("", "ID") title = SummaryFormItem("", "Title") primary_filter = SummaryFormItem("", "Primary (Record) Filter") secondary_filter = SummaryFormItem("", "Secondary (Display) Filter") sort_by = SummaryFormItem("", "Sort By") based_on = SummaryFormItem("", "Based On") user = SummaryFormItem("", "User") group = SummaryFormItem("", "EVM Group") updated_on = SummaryFormItem("", "Updated On") # xpath is defined based on the value of the second title head of table report_schedule_data = Table( '//*[@id="report_info"]//th[contains(text(), "Name")]' '/parent::tr/parent::thead/parent::table') report_widgets_data = Table( '//*[@id="report_info"]//th[contains(text(), "Title")]' '/parent::tr/parent::thead/parent::table') queue_button = Button("Queue")
class ButtonGroupDetailView(AutomateCustomizationView): title = Text('#explorer_title_text') text = SummaryFormItem( 'Basic Information', 'Text', text_filter=lambda text: re.sub(r'\s+Display on Button\s*$', '', text)) hover = SummaryFormItem('Basic Information', 'Hover Text') @property def is_displayed(self): # Unassigned Buttons is default group for each custom button object expected_title = ('{} Button Group "Unassigned Buttons"'.format( self.context["object"].type) if self.context["object"].text == "[Unassigned Buttons]" else 'Button Group "{}"'.format( self.context["object"].text)) return (self.in_customization and self.title.text == expected_title 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 ])
class DashboardWidgetDetailsView(DashboardWidgetsView): title = Text("#explorer_title_text") status_info = SummaryFormItem("Status", "Current Status") reload_button = Button(title=VersionPick({ Version.lowest(): 'Reload current display', '5.9': 'Refresh this page' })) @property def is_displayed(self): return (self.in_dashboard_widgets and self.title.text == '{} Widget "{}"'.format( self.context["object"].TITLE, self.context["object"].title) and self.dashboard_widgets.tree.currently_selected == [ "All Widgets", self.context["object"].TYPE, self.context["object"].title ])
class RedHatUpdatesView(RegionView): """Red Hat Updates details view""" title = Text('//div[@id="main-content"]//h3[1]') available_update_version = Text('//td[contains(text(), "Available Product version:")]') edit_registration = Button('Edit Registration') refresh = Button('Refresh List') check_for_updates = Button('Check for Updates') register = Button('Register') apply_cfme_update = Button('Apply CFME Update') updates_table = Table('.table.table-striped.table-bordered') repository_names_info = SummaryFormItem('Red Hat Software Updates', 'Repository Name(s)') @property def is_displayed(self): return ( self.redhat_updates.is_active() and self.edit_registration.is_displayed and self.title.text == 'Red Hat Software Updates' )
class ScheduleDetailsView(ConfigurationView): """ Schedule details page view """ toolbar = View.nested(ScheduleToolbar) description = SummaryFormItem('', 'Description') active = SummaryFormItem('', 'Active') action = SummaryFormItem('', 'Action') filter = SummaryFormItem('', 'Filter') run_at = SummaryFormItem('', 'Run At') last_run_time = SummaryFormItem('', 'Last Run Time') next_run_time = SummaryFormItem('', 'Next Run Time') zone = SummaryFormItem('', 'Zone') @property def is_displayed(self): return (self.in_configuration and self.accordions.settings.tree.currently_selected == [ self.context['object'].zone.region.settings_string, 'Schedules', self.context['object'].name ] and self.title == 'Settings Schedule "{}"'.format( self.context['object'].name))
class hardware(Tab): # noqa num_cpus = SummaryFormItem('Hardware', 'Number of CPUS') memory = SummaryFormItem('Hardware', 'Startup Memory (MB)') dynamic_memory = SummaryFormItem('Hardware', 'Dynamic Memory') vm_limit_cpu = SummaryFormItem('VM Limits', 'CPU (%)') vm_reserve_cpu = SummaryFormItem('VM Reservations', 'CPU (%)')
class environment(Tab): # noqa TAB_NAME = 'Environment' automatic_placement = Checkbox(name='environment__placement_auto') # Azure virtual_private_cloud = SummaryFormItem('Placement - Options', 'Virtual Private Cloud') cloud_subnet = SummaryFormItem('Placement - Options', 'Cloud Subnet') security_groups = SummaryFormItem('Placement - Options', 'Security Groups') resource_groups = SummaryFormItem('Placement - Options', 'Resource Groups') public_ip_address = SummaryFormItem('Placement - Options', 'Public IP Address ') # GCE availability_zone = SummaryFormItem('Placement - Options', 'Availability Zones') cloud_network = SummaryFormItem('Placement - Options', 'Cloud Network') # Infra datacenter = SummaryFormItem('Datacenter', 'Name') cluster = SummaryFormItem('Cluster', 'Name') resource_pool = SummaryFormItem('Resource Pool', 'Name') folder = SummaryFormItem('Folder', 'Name') host_filter = SummaryFormItem('Host', 'Filter') host_name = SummaryFormItem('Host', 'Name') datastore_storage_profile = SummaryFormItem('Datastore', 'Storage Profile') datastore_filter = SummaryFormItem('Datastore', 'Filter') datastore_name = SummaryFormItem('Datastore', 'Name')
class ButtonDetailView(AutomateCustomizationView): title = Text("#explorer_title_text") button_type = SummaryFormItem("Basic Information", "Button Type") playbook_cat_item = SummaryFormItem("Basic Information", "Ansible Playbook") target = SummaryFormItem("Basic Information", "Target") text = SummaryFormItem( "Basic Information", "Text", text_filter=lambda text: re.sub(r"\s+Display on Button\s*$", "", text), ) hover = SummaryFormItem("Basic Information", "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, ] )
class volumes(WaitTab): # noqa volume_name = SummaryFormItem('Volumes', 'Volume Name') volume_size = SummaryFormItem('Volumes', 'Size (gigabytes)') delete_on_terminate = Checkbox(name='volumes__delete_on_terminate_1')
class summary(Tab): # noqa TAB_NAME = "Summary" started_on = SummaryFormItem('EVM', 'Started On')
class network(Tab): # noqa vlan = SummaryFormItem('Network Adapter Information', 'vLan')
class properties(Tab): # noqa instance_type = SummaryFormItem('Properties', 'Instance Type') boot_disk_size = SummaryFormItem('Properties', 'Boot Disk Size ') is_preemtible = Checkbox(name='hardware__is_preemptible')
class schedule(WaitTab): # noqa when_provision = SummaryFormItem('Schedule Info', 'When to Provision') stateless = Checkbox(name='shedule__stateless') power_on = SummaryFormItem('Lifespan', 'Power on virtual machines after creation') retirement = SummaryFormItem('Lifespan', 'Time until Retirement') retirement_warning = SummaryFormItem('Lifespan', 'Retirement Warning')