from widgetastic.widget import View, Text, Select
from widgetastic_patternfly import (Dropdown, Accordion, Button, TextInput,
BootstrapSwitch, BootstrapSelect)
from cfme.base.login import BaseLoggedInPage
from cfme.common.provider_views import ProviderAddView, ProviderEditView
from widgetastic_manageiq import (ManageIQTree, SummaryTable, ItemsToolBarViewSelector,
BaseEntitiesView, ParametrizedSummaryTable)
[docs]class NetworkProviderEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class NetworkProviderAddView(ProviderAddView):
"""
represents Network Provider Add View
"""
prov_type = BootstrapSelect(id='ems_type')
api_version = BootstrapSelect(id='api_version')
@property
def is_displayed(self):
return (super(NetworkProviderAddView, self).is_displayed and
self.navigation.currently_selected == [
'Networks', 'Providers'] and
self.title.text == 'Add New Network Provider')
[docs]class NetworkProviderView(BaseLoggedInPage):
""" Represents whole All NetworkProviders page """
toolbar = View.nested(NetworkProviderToolBar)
sidebar = View.nested(NetworkProviderSideBar)
including_entities = View.include(NetworkProviderEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.entities.title.text == 'Network Managers')
[docs]class NetworkProviderDetailsView(BaseLoggedInPage):
""" Represents detail view of network provider """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(NetworkProviderDetailsToolBar)
sidebar = View.nested(NetworkProviderDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
# TODO: remove all SummaryTables in favor of ParametrizedSummaryTable when safe
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
status = SummaryTable(title="Status")
overview = SummaryTable(title="Overview")
smart_management = SummaryTable(title="Smart Management")
summary = ParametrizedSummaryTable
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class NetworkProviderEditView(ProviderEditView):
""" Represents Network Provider Edit View """
@property
def is_displayed(self):
return (super(NetworkProviderEditView, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text.startswith('Edit Network Provider'))
[docs]class BalancerEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class BalancerView(BaseLoggedInPage):
""" Represents whole All NetworkProviders page """
toolbar = View.nested(BalancerToolBar)
sidebar = View.nested(BalancerSideBar)
including_entities = View.include(NetworkProviderEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Load Balancers'] and
self.entities.title.text == 'Load Balancers')
[docs]class BalancerDetailsView(BaseLoggedInPage):
""" Represents detail view of network provider """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(BalancerDetailsToolBar)
sidebar = View.nested(BalancerDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Load Balancers'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class CloudNetworkEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class CloudNetworkView(BaseLoggedInPage):
""" Represents whole All Cloud network page """
toolbar = View.nested(CloudNetworkToolBar)
sidebar = View.nested(CloudNetworkSideBar)
including_entities = View.include(NetworkProviderEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Networks'] and
self.entities.title.text == 'Cloud Networks')
[docs]class CloudNetworkDetailsView(BaseLoggedInPage):
""" Represents detail view of cloud network """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(NetworkProviderDetailsToolBar)
sidebar = View.nested(NetworkProviderDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Networks'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class CloudNetworkAddView(BaseLoggedInPage):
""" Represents Add view of cloud network """
title = Text('//div[@id="main-content"]//h1')
network_manager = Select(id='ems_id')
cloud_tenant = Select(name='cloud_tenant_id')
network_type = Select(name='provider_network_type')
network_name = TextInput(name='name')
ext_router = BootstrapSwitch(id='cloud_network_external_facing')
administrative_state = BootstrapSwitch(id='cloud_network_enabled')
shared = BootstrapSwitch(id='cloud_network_shared')
add = Button('Add')
@property
def is_displayed(self):
return False
[docs]class CloudNetworkEditView(BaseLoggedInPage):
""" Represents Edit view of cloud network """
title = Text('//div[@id="main-content"]//h1')
network_name = TextInput(name='name')
ext_router = BootstrapSwitch(id='cloud_network_external_facing')
administrative_state = BootstrapSwitch(id='cloud_network_enabled')
shared = BootstrapSwitch(id='cloud_network_shared')
save = Button('Save')
@property
def is_displayed(self):
return False
[docs]class NetworkPortEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class NetworkPortView(BaseLoggedInPage):
""" Represents whole All NetworkPorts page """
toolbar = View.nested(NetworkPortToolBar)
sidebar = View.nested(NetworkPortSideBar)
including_entities = View.include(NetworkPortEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Network Ports'] and
self.entities.title.text == 'Network Ports')
[docs]class NetworkPortDetailsView(BaseLoggedInPage):
""" Represents detail view of network provider """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(NetworkPortDetailsToolBar)
sidebar = View.nested(NetworkPortDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Network Ports'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class NetworkRouterEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class NetworkRouterView(BaseLoggedInPage):
""" Represents whole All NetworkRouters page """
toolbar = View.nested(NetworkRouterToolBar)
sidebar = View.nested(NetworkRouterSideBar)
including_entities = View.include(NetworkRouterEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Network Routers'] and
self.entities.title.text == 'Network Routers')
[docs]class NetworkRouterDetailsView(BaseLoggedInPage):
""" Represents detail view of network provider """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(NetworkRouterDetailsToolBar)
sidebar = View.nested(NetworkRouterDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class NetworkRouterAddView(BaseLoggedInPage):
""" Represents Add NetworkRouters page """
network_manager = Select(id='ems_id')
router_name = TextInput(name='name')
ext_gateway = BootstrapSwitch(id='network_router_external_gateway')
network_name = Select(name='cloud_network_id')
subnet_name = Select(name='cloud_subnet_id')
cloud_tenant = Select(name='cloud_tenant_id')
add = Button('Add')
@property
def is_displayed(self):
return False
[docs]class NetworkRouterEditView(BaseLoggedInPage):
""" Represents Edit NetworkRouters page """
router_name = TextInput(name='name')
ext_gateway = BootstrapSwitch(id='network_router_external_gateway')
network_name = Select(name='cloud_network_id')
subnet_name = Select(name='cloud_subnet_id')
save = Button('Save')
@property
def is_displayed(self):
return False
[docs]class NetworkRouterAddInterfaceView(BaseLoggedInPage):
""" Represents Add Interface to Network Router page """
subnet_name = Select(id='cloud_subnet_id')
add = Button('Add')
@property
def is_displayed(self):
return False
[docs]class SecurityGroupEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class SecurityGroupView(BaseLoggedInPage):
""" Represents whole All SecurityGroups page """
toolbar = View.nested(SecurityGroupToolBar)
sidebar = View.nested(SecurityGroupSideBar)
including_entities = View.include(SecurityGroupEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Security Groups'] and
self.entities.title.text == 'Security Groups')
[docs]class ProviderSecurityGroupAllView(SecurityGroupView):
@property
def is_displayed(self):
return (
self.logged_in_as_current_user and
self.navigation.currently_selected == ['Compute', 'Clouds', 'Providers'] and
self.entities.title.text == '{} (All Security Groups)'.format(
self.context['object'].name)
)
[docs]class SecurityGroupDetailsView(BaseLoggedInPage):
""" Represents detail view of network provider """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(SecurityGroupDetailsToolBar)
sidebar = View.nested(SecurityGroupDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class SubnetAddView(BaseLoggedInPage):
""" Represents Add view of subnet """
title = Text('//div[@id="main-content"]//h1')
network_manager = Select(id='ems_id')
cloud_tenant = Select(name='cloud_tenant_id')
network = Select(name='network_id')
subnet_name = TextInput(name='name')
subnet_cidr = TextInput(name='cidr')
gateway = TextInput(name='gateway_ip')
add = Button('Add')
@property
def is_displayed(self):
return False
[docs]class SubnetEditView(BaseLoggedInPage):
""" Represents Edit view of subnet """
title = Text('//div[@id="main-content"]//h1')
subnet_name = TextInput(name='name')
gateway = TextInput(name='gateway_ip')
save = Button('Save')
@property
def is_displayed(self):
return False
[docs]class SubnetEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class SubnetView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(SubnetToolBar)
sidebar = View.nested(SubnetSideBar)
including_entities = View.include(SubnetEntities, use_parent=True)
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Subnets'] and
self.entities.title.text == 'Cloud Subnets')
[docs]class SubnetDetailsView(BaseLoggedInPage):
""" Represents detail view of network provider """
title = Text('//div[@id="main-content"]//h1')
toolbar = View.nested(SubnetDetailsToolBar)
sidebar = View.nested(SubnetDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Subnets'] and
self.title.text == '{name} (Summary)'.format(name=self.context['object'].name))
[docs]class OneProviderSubnetView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(OneProviderComponentsToolbar)
sidebar = View.nested(SubnetSideBar)
including_entities = View.include(SubnetEntities, use_parent=True)
@property
def is_displayed(self):
title = '{name} (All Cloud Subnets)'.format(name=self.context['object'].name)
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == title)
[docs]class OneProviderBalancerView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(OneProviderComponentsToolbar)
sidebar = View.nested(BalancerSideBar)
including_entities = View.include(BalancerEntities, use_parent=True)
@property
def is_displayed(self):
title = '{name} (All Balancers)'.format(name=self.context['object'].name)
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == title)
[docs]class OneProviderNetworkPortView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(OneProviderComponentsToolbar)
sidebar = View.nested(NetworkPortSideBar)
including_entities = View.include(NetworkPortEntities, use_parent=True)
@property
def is_displayed(self):
title = '{name} (All Network Ports)'.format(name=self.context['object'].name)
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == title)
[docs]class OneProviderCloudNetworkView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(OneProviderComponentsToolbar)
sidebar = View.nested(CloudNetworkSideBar)
including_entities = View.include(CloudNetworkEntities, use_parent=True)
@property
def is_displayed(self):
title = '{name} (All Cloud Networks)'.format(name=self.context['object'].name)
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == title)
[docs]class OneProviderNetworkRouterView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(OneProviderComponentsToolbar)
sidebar = View.nested(NetworkRouterSideBar)
including_entities = View.include(NetworkRouterEntities, use_parent=True)
@property
def is_displayed(self):
title = '{name} (All Network Routers)'.format(name=self.context['object'].name)
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == title)
[docs]class OneProviderSecurityGroupView(BaseLoggedInPage):
""" Represents whole All Subnets page """
toolbar = View.nested(OneProviderComponentsToolbar)
sidebar = View.nested(SecurityGroupSideBar)
including_entities = View.include(SecurityGroupEntities, use_parent=True)
@property
def is_displayed(self):
title = '{name} (All Security Groups)'.format(name=self.context['object'].name)
return (super(BaseLoggedInPage, self).is_displayed and
self.navigation.currently_selected == ['Networks', 'Providers'] and
self.title.text == title)
[docs]class FloatingIpEntities(BaseEntitiesView):
""" Represents central view where all QuadIcons, etc are displayed """
pass
[docs]class FloatingIpView(BaseLoggedInPage):
""" Represents whole All FloatingIP page """
toolbar = View.nested(FloatingIpToolBar)
including_entities = View.include(FloatingIpEntities, use_parent=True)
@property
def is_displayed(self):
return (self.navigation.currently_selected == ['Networks', 'Floating IPs'] and
self.entities.title.text == 'Floating IPs')
[docs]class FloatingIpDetailsView(BaseLoggedInPage):
""" Represents detail view of floating ip """
toolbar = View.nested(FloatingIpDetailsToolBar)
sidebar = View.nested(FloatingIpDetailsSideBar)
@View.nested
class entities(View): # noqa
""" Represents details page when it's switched to Summary/Table view """
properties = SummaryTable(title="Properties")
relationships = SummaryTable(title="Relationships")
smart_management = SummaryTable(title="Smart Management")
@property
def is_displayed(self):
return (self.navigation.currently_selected == ['Networks', 'Floating IPs'] and
self.title.text == '{} (Summary)'.format(self.context['object'].address))