Skip to content
This repository has been archived by the owner on Apr 7, 2022. It is now read-only.

[1LP][RFR] Fix test_sdn_nsg_firewall_rules, update to wrapanapi changes. #7616

Merged
merged 1 commit into from
Oct 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions cfme/networks/security_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def network_provider(self):
view = navigate_to(self, 'Details')
try:
prov_name = view.entities.relationships.get_text_of("Network Manager")
collection = self.appliance.collections.network_provider
return collection.instantiate(name=prov_name)
net_prov_collection = self.appliance.collections.network_provider
return net_prov_collection.instantiate(name=prov_name)
except ItemNotFound: # BZ 1480577
return None

Expand All @@ -54,6 +54,7 @@ def all(self):
else:
view = navigate_to(self, 'All')
list_networks_obj = view.entities.get_all(surf_pages=True)

return [self.instantiate(name=s.name) for s in list_networks_obj]


Expand Down
29 changes: 21 additions & 8 deletions cfme/tests/networks/test_sdn_inventory_collection.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fauxfactory
import pytest
from wait_for import wait_for

from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
Expand Down Expand Up @@ -109,7 +110,10 @@ def secgroup_with_rule(provider):
res_group = provider.data['provisioning']['resource_group']
secgroup_name = 'secgroup_with_rule_{}'.format(fauxfactory.gen_alpha(8).lower())
provider.mgmt.create_netsec_group(secgroup_name, res_group)
provider.mgmt.create_netsec_group_port_allow(secgroup_name, 22, res_group)
provider.mgmt.create_netsec_group_port_allow(secgroup_name,
'Tcp', '*', '*', 'Allow', 'Inbound', description='Allow port 22',
source_port_range='*', destination_port_range='22', priority=100,
name='Port_22_allow', resource_group=res_group)
provider.refresh_provider_relationships()
yield secgroup_name
provider.mgmt.remove_netsec_group(secgroup_name, res_group)
Expand All @@ -125,16 +129,25 @@ def test_sdn_nsg_firewall_rules(provider, appliance, secgroup_with_rule):
"""

# Navigate to network provider.
collection = appliance.collections.network_providers.filter({'provider': provider})
network_provider = collection.all()[0]
prov_collection = appliance.collections.network_providers.filter({'provider': provider})
network_provider = prov_collection.all()[0]
network_provider.refresh_provider_relationships()
wait_for(network_provider.is_refreshed, func_kwargs=dict(refresh_delta=10), timeout=600)
view = navigate_to(network_provider, 'Details')
parent_name = view.entities.relationships.get_text_of("Parent Cloud Provider")
assert parent_name == provider.name

# Navigate to secgroup.
collection = appliance.collections.network_security_groups.filter({'name': secgroup_with_rule})
secgroup = collection.all()[0]
secgrp_collection = appliance.collections.network_security_groups
secgroup = [i for i in secgrp_collection.all() if i.name == secgroup_with_rule][0]
view = navigate_to(secgroup, 'Details')

assert 'Port' == view.entities.firewall_rules[0][3].text
assert '22' == view.entities.firewall_rules[1][3].text
if appliance.version < '5.10':
# The table has one header row. The first non-header row has column
# names.
assert 'Port' == view.entities.firewall_rules[1][3].text
assert '22' == view.entities.firewall_rules[2][3].text
else:
# The table has two header rows. We cannot access the second one with
# widgetastic. So let's hope the column of index 3 is the Port Range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get an issue written against wt.core for handling two header tables

# column.
assert '22' == view.entities.firewall_rules[1][3].text