[aim] Send default route for Neutron ports' RPC

Change-Id: Ifb678a232ef0f07f4f74c88181d9aa04ecdcb578
This commit is contained in:
Ivar Lazzaro 2016-10-05 20:36:31 -07:00
parent 702a83e8dc
commit d45d31cad6
No known key found for this signature in database
GPG Key ID: 4A319E8712CE0874
2 changed files with 8 additions and 3 deletions

View File

@ -1062,7 +1062,7 @@ class AIMMappingDriver(nrd.CommonNeutronBase, aim_rpc.AIMMappingRPCMixin):
default_route = route
if route['destination'] == dhcp.METADATA_DEFAULT_CIDR:
metadata_route = route
if not l2p or not l2p['inject_default_route']:
if l2p and not l2p['inject_default_route']:
# In this case we do not want to send the default route
# and the metadata route. We also do not want to send
# the gateway_ip for the subnet.

View File

@ -887,7 +887,7 @@ class TestPolicyTarget(AIMBaseTestCase):
def _verify_gbp_details_assertions(self, mapping, req_mapping, port_id,
expected_epg_name, expected_epg_tenant,
subnet):
subnet, default_route=None):
self.assertEqual(mapping, req_mapping['gbp_details'])
self.assertEqual(port_id, mapping['port_id'])
self.assertEqual(expected_epg_name, mapping['endpoint_group_name'])
@ -898,6 +898,11 @@ class TestPolicyTarget(AIMBaseTestCase):
self.assertEqual(1, len(mapping['subnets']))
self.assertEqual(subnet['subnet']['cidr'],
mapping['subnets'][0]['cidr'])
if default_route:
self.assertTrue(
{'destination': '0.0.0.0/0', 'nexthop': default_route} in
mapping['subnets'][0]['host_routes'],
"Default route missing in %s" % mapping['subnets'][0])
# Verify Neutron details
self.assertEqual(port_id, req_mapping['neutron_details']['port_id'])
@ -984,7 +989,7 @@ class TestPolicyTarget(AIMBaseTestCase):
self._verify_gbp_details_assertions(
mapping, req_mapping, port_id, epg_name, epg_tenant,
subnet)
subnet, default_route='1.1.2.1')
vrf_name = self.name_mapper.address_scope(
self._neutron_context.session, address_scope['id'],
address_scope['name'])