l3vpn app data clean up on vm delete. 95/67095/5
authorDeepthi V V <deepthi.v.v@ericsson.com>
Fri, 12 Jan 2018 07:13:33 +0000 (12:43 +0530)
committerSam Hague <shague@redhat.com>
Sat, 10 Feb 2018 16:58:26 +0000 (16:58 +0000)
L3VPN application data is not cleaned up on vm delete and
dissociate network/router scenarios. This review fixes the issue.

Change-Id: Id1d7c89206c5bea77925320b67c0e12d6ffbf2bf
Signed-off-by: Deepthi V V <deepthi.v.v@ericsson.com>
vpnservice/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/netvirt/fibmanager/VrfEntryListener.java

index 40ff1c8a511c22e63d45e8da6dda613432760bf6..996040bcab7ee4d0fb4c0c6d299d93cfde72c75a 100755 (executable)
@@ -1335,27 +1335,27 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
                         tx.delete(LogicalDatastoreType.CONFIGURATION,
                                 VpnExtraRouteHelper.getUsedRdsIdentifier(vpnId, vrfEntry.getDestPrefix()));
                     }
-                    Optional<AdjacenciesOp> optAdjacencies =
-                            MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL,
-                                    FibUtil.getAdjListPathOp(ifName, vpnName));
-                    int numAdj = 0;
-                    if (optAdjacencies.isPresent()) {
-                        numAdj = optAdjacencies.get().getAdjacency().size();
-                    }
-                    //remove adjacency corr to prefix
-                    if (numAdj > 1) {
-                        LOG.info("cleanUpOpDataForFib: remove adjacency for prefix: {} {} vpnName {}", vpnId,
-                                vrfEntry.getDestPrefix(), vpnName);
-                        tx.delete(LogicalDatastoreType.OPERATIONAL,
-                                FibUtil.getAdjacencyIdentifierOp(ifName, vpnName, vrfEntry.getDestPrefix()));
-                    } else {
-                        //this is last adjacency (or) no more adjacency left for this vpn interface, so
-                        //clean up the vpn interface from DpnToVpn list
-                        LOG.info("Clean up vpn interface {} from dpn {} to vpn {} list.",
-                                ifName, prefixInfo.getDpnId(), rd);
-                        tx.delete(LogicalDatastoreType.OPERATIONAL,
-                                FibUtil.getVpnInterfaceOpDataEntryIdentifier(ifName, vpnName));
-                    }
+                }
+                Optional<AdjacenciesOp> optAdjacencies =
+                    MDSALUtil.read(dataBroker, LogicalDatastoreType.OPERATIONAL,
+                                   FibUtil.getAdjListPathOp(ifName, vpnName));
+                int numAdj = 0;
+                if (optAdjacencies.isPresent()) {
+                    numAdj = optAdjacencies.get().getAdjacency().size();
+                }
+                //remove adjacency corr to prefix
+                if (numAdj > 1) {
+                    LOG.info("cleanUpOpDataForFib: remove adjacency for prefix: {} {} vpnName {}", vpnId,
+                             vrfEntry.getDestPrefix(), vpnName);
+                    tx.delete(LogicalDatastoreType.OPERATIONAL,
+                              FibUtil.getAdjacencyIdentifierOp(ifName, vpnName, vrfEntry.getDestPrefix()));
+                } else {
+                    //this is last adjacency (or) no more adjacency left for this vpn interface, so
+                    //clean up the vpn interface from DpnToVpn list
+                    LOG.info("Clean up vpn interface {} from dpn {} to vpn {} list.",
+                             ifName, prefixInfo.getDpnId(), rd);
+                    tx.delete(LogicalDatastoreType.OPERATIONAL,
+                              FibUtil.getVpnInterfaceOpDataEntryIdentifier(ifName, vpnName));
                 }
             }));
         }