Need to create node/interface profile for SVI pre-existing l3out

Since we moved node/interface profile creation from
update_port_precommit() phase to create_network_precommit() phase
to reduce those retry-able AIM-DB errors, then we need to take care
of this for the pre-existing l3out case also. Also added UTs to cover
this.

Change-Id: I7d0ffbee66dbafe43b0ed2ab07da47d4fb1e1e84
This commit is contained in:
Kent Wu 2018-04-19 12:04:28 -07:00
parent 426e954bd0
commit 7a5988717f
2 changed files with 40 additions and 0 deletions

View File

@ -528,6 +528,16 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
other_nets.discard(current['id'])
if other_nets:
raise exceptions.PreExistingSVICannotUseSameL3out()
aim_l3out_np = aim_resource.L3OutNodeProfile(
tenant_name=l3out.tenant_name, l3out_name=l3out.name,
name=L3OUT_NODE_PROFILE_NAME)
self.aim.create(aim_ctx, aim_l3out_np, overwrite=True)
aim_l3out_ip = aim_resource.L3OutInterfaceProfile(
tenant_name=l3out.tenant_name, l3out_name=l3out.name,
node_profile_name=L3OUT_NODE_PROFILE_NAME,
name=L3OUT_IF_PROFILE_NAME)
self.aim.create(aim_ctx, aim_l3out_ip, overwrite=True)
# This means no DN is being provided. Then we should try to create
# the l3out automatically
else:

View File

@ -6014,6 +6014,21 @@ class TestPortVlanNetwork(ApicAimTestCase):
vlan_p1 = self._check_binding(p1['port']['id'])
ext_net = aim_resource.ExternalNetwork.from_dn(
net1[DN]['ExternalNetwork'])
l3out_np = aim_resource.L3OutNodeProfile(
tenant_name=ext_net.tenant_name,
l3out_name=ext_net.l3out_name,
name=md.L3OUT_NODE_PROFILE_NAME)
l3out_np = self.aim_mgr.get(aim_ctx, l3out_np)
self.assertEqual(l3out_np.name, md.L3OUT_NODE_PROFILE_NAME)
l3out_ip = aim_resource.L3OutInterfaceProfile(
tenant_name=ext_net.tenant_name,
l3out_name=ext_net.l3out_name,
node_profile_name=md.L3OUT_NODE_PROFILE_NAME,
name=md.L3OUT_IF_PROFILE_NAME)
l3out_ip = self.aim_mgr.get(aim_ctx, l3out_ip)
self.assertEqual(l3out_ip.name, md.L3OUT_IF_PROFILE_NAME)
l3out_if = aim_resource.L3OutInterface(
tenant_name=ext_net.tenant_name,
l3out_name=ext_net.l3out_name,
@ -6145,6 +6160,21 @@ class TestPortVlanNetwork(ApicAimTestCase):
else:
ext_net = aim_resource.ExternalNetwork.from_dn(
net1[DN]['ExternalNetwork'])
l3out_np = aim_resource.L3OutNodeProfile(
tenant_name=ext_net.tenant_name,
l3out_name=ext_net.l3out_name,
name=md.L3OUT_NODE_PROFILE_NAME)
l3out_np = self.aim_mgr.get(aim_ctx, l3out_np)
self.assertEqual(l3out_np.name, md.L3OUT_NODE_PROFILE_NAME)
l3out_ip = aim_resource.L3OutInterfaceProfile(
tenant_name=ext_net.tenant_name,
l3out_name=ext_net.l3out_name,
node_profile_name=md.L3OUT_NODE_PROFILE_NAME,
name=md.L3OUT_IF_PROFILE_NAME)
l3out_ip = self.aim_mgr.get(aim_ctx, l3out_ip)
self.assertEqual(l3out_ip.name, md.L3OUT_IF_PROFILE_NAME)
l3out_node = aim_resource.L3OutNode(
tenant_name=ext_net.tenant_name,
l3out_name=ext_net.l3out_name,