[AIM] Support sharing of L3Outs

Changes to allow different Neutron external
networks to use the same L3Out in APIC. In the
past we did not prevent such configurations, but
we also did not support it properly. Changes include:
* Delete L3Out only if there are no Neutron external
networks using the L3Out
* Disallow overlapping external subnets in external
networks that share the same L3Out
* Contracts consumed and provided by APIC
external network should use routers
uplinked to all the Neutron external networks that
share an L3Out
* Likewise, external CIDRs on APIC external network
should consider external-cidrs of all Neutron
external networks that share an L3Out

Had to make minor changes to some UTs to avoid situations
that now raise exceptions.

Change-Id: I2f9dd295ec35972dd9b015f117aaf0a6fa33f6a1
Signed-off-by: Amit Bose <amitbose@gmail.com>
(cherry picked from commit 2adc2e2fb9)
This commit is contained in:
Amit Bose
2018-02-20 10:45:06 -08:00
parent 72b45dbe21
commit eb110b4956
5 changed files with 231 additions and 32 deletions

View File

@@ -4195,7 +4195,7 @@ class TestImplicitExternalSegment(AIMBaseTestCase):
def _create_default_es(self, **kwargs):
es_sub = self._make_ext_subnet(
'net1', '90.90.0.0/16',
'net1', kwargs.pop('subnet_cidr', '90.90.0.0/16'),
tenant_id=(kwargs.get('tenant_id') or self._tenant_id),
dn=self._dn_t1_l1_n1)
return self.create_external_segment(name=self._default_es_name,
@@ -4244,11 +4244,12 @@ class TestImplicitExternalSegment(AIMBaseTestCase):
self.assertEqual(1, len(l3p['external_segments']))
# Verify only one visible ES can exist
res = self._create_default_es(expected_res_status=400)
res = self._create_default_es(expected_res_status=400,
subnet_cidr='10.10.0.0/28')
self.assertEqual('DefaultExternalSegmentAlreadyExists',
res['NeutronError']['type'])
def test_impicit_lifecycle(self):
def test_implicit_lifecycle(self):
self._test_implicit_lifecycle()
def test_implicit_lifecycle_shared(self):
@@ -4268,7 +4269,8 @@ class TestImplicitExternalSegment(AIMBaseTestCase):
self.assertEqual(1, len(ep['external_segments']))
res = self._create_default_es(expected_res_status=400,
tenant_id='anothertenant')
tenant_id='anothertenant',
subnet_cidr='10.10.0.0/28')
self.assertEqual('DefaultExternalSegmentAlreadyExists',
res['NeutronError']['type'])
@@ -4566,7 +4568,7 @@ class TestNatPool(AIMBaseTestCase):
sub_id = nat_pool['subnet_id']
sub2 = self._make_ext_subnet('net1', '192.167.0.0/24',
dn='uni/tn-t1/out-l1/instP-n2')
dn='uni/tn-t1/out-l2/instP-n2')
es2 = self.create_external_segment(
name="nondefault", subnet_id=sub2['id'],
external_routes=routes,