BGPVPN subnet disassociation fails 74/91674/2
authorKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Mon, 27 Jul 2020 05:03:10 +0000 (10:33 +0530)
committerKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Mon, 27 Jul 2020 12:04:55 +0000 (12:04 +0000)
Issue:
======
Having a single HOT template to create/delete network, subnet, bgpvpn and
then to associate/dissassociate network to bgpvpn was leading to subnet
delete triggered by neutron out of order.
This fix improves resiliency of ODL incase such an orchestration is made.
The right mode of orchestration would be to have separate templates for
network/subnets and bgpvpns.

Solution:
=========
handleNeutronSubnetDeleted() method has been changed
properly to process BGPVPN disassociate from the network

Signed-off-by: Karthikeyan Krishnan <karthikeyangceb007@gmail.com>
Change-Id: I5de5c5b246f4ad925043d1a3d16d1b62ec75a242

neutronvpn/impl/src/main/java/org/opendaylight/netvirt/neutronvpn/NeutronSubnetChangeListener.java

index 71fb1ae2547013de6fb9d7e7fe7d61b0a075bc9f..edaa797d21d7224d26aa938d3b20872ceb631d45 100644 (file)
@@ -127,6 +127,7 @@ public class NeutronSubnetChangeListener extends AbstractAsyncDataTreeChangeList
     private void handleNeutronSubnetDeleted(Uuid subnetId, Uuid networkId, String subnetCidr) {
         Uuid vpnId = neutronvpnUtils.getVpnForNetwork(networkId);
         if (vpnId != null) {
+            Set<VpnTarget> routeTargets = vpnManager.getRtListForVpn(vpnId.getValue());
             LOG.warn("Subnet {} deleted without disassociating network {} from VPN {}. Ideally, please disassociate "
                     + "network from VPN before deleting neutron subnet.", subnetId.getValue(), networkId.getValue(),
                     vpnId.getValue());
@@ -136,9 +137,8 @@ public class NeutronSubnetChangeListener extends AbstractAsyncDataTreeChangeList
             } else {
                 LOG.error("Subnetmap for subnet {} not found", subnetId.getValue());
             }
-            Set<VpnTarget> routeTargets = vpnManager.getRtListForVpn(vpnId.getValue());
             if (!routeTargets.isEmpty()) {
-                vpnManager.removeRouteTargetsToSubnetAssociation(routeTargets, subnetCidr, subnetId.getValue());
+                vpnManager.removeRouteTargetsToSubnetAssociation(routeTargets, subnetCidr, vpnId.getValue());
             }
         }
         if (networkId != null) {