NSX|V3: validate if 'destination' exists

Some tempest tests did not configure the host_routes
correctly. This would result in a exception from the plugin
when trying to access the destination IP for host routes.

This also skips tests that are problematic:
1. no agents
2. only can create one subnet per network

A luta continua!!

Change-Id: Ie8732c08f362db3b8fdbe552db46f26b73ac3422
This commit is contained in:
Shih-Hao Li 2016-08-18 09:13:52 -07:00
parent d6a3e77acd
commit 2c393582cd
2 changed files with 11 additions and 5 deletions

View File

@ -24,7 +24,13 @@ r="$r(?:tempest\.api\.network\.test_extensions\.ExtensionsTestJSON.*)"
r="$r|(?:tempest\.api\.network\.test_routers\.DvrRoutersTest.*)"
r="$r|(?:tempest\.api\.network\.test_routers_negative\.DvrRoutersNegativeTest.*)"
r="$r|(?:tempest\.api\.network\.test_allowed_address_pair\.AllowedAddressPairTestJSON\.test_update_port_with_cidr_address_pair*)"
r="$r|(?:tempest\.api\.network\.test_allowed_address_pair\.AllowedAddressPairTestJSON\.test_update_port_with_cidr_address_pair.*)"
#Native DHCP has no agents
r="$r|(?:tempest\.api\.network\.admin\.test_agent_management\.AgentManagementTestJSON.*)"
#Can not create more than one DHCP-enabled subnet
r="$r|(?:tempest\.api\.network\.test_ports\.PortsTestJSON\.test_create_update_port_with_second_ip.*)"
r="$r|(?:tempest\.api\.network\.test_ports\.PortsTestJSON\.test_update_port_with_security_group_and_extra_attributes.*)"
r="$r|(?:tempest\.api\.network\.test_ports\.PortsTestJSON\.test_update_port_with_two_security_groups_and_extra_attributes.*)"
# End list of exclusions.
r="$r)"

View File

@ -39,12 +39,12 @@ def build_dhcp_server_config(network, subnet, port, project_name):
host_routes = [{'network': subnet['cidr'], 'next_hop': '0.0.0.0'}]
# Copy routes from subnet host_routes attribute.
for hr in subnet['host_routes']:
if hr.destination == constants.IPv4_ANY:
if hr['destination'] == constants.IPv4_ANY:
if not gateway_ip:
gateway_ip = hr.nexthop
gateway_ip = hr['nexthop']
else:
host_routes.append({'network': hr.destination,
'next_hop': hr.nexthop})
host_routes.append({'network': hr['destination'],
'next_hop': hr['nexthop']})
# If gateway_ip is defined, add default route via this gateway.
if gateway_ip:
host_routes.append({'network': constants.IPv4_ANY,