Bug 7423: Clean unnecessary leaked flows and fibEntries 74/50074/2
authorMiguel Perez <francisco.miguel.perez@ericsson.com>
Wed, 21 Dec 2016 17:50:51 +0000 (18:50 +0100)
committerAlon Kochba <alonko@hpe.com>
Sat, 7 Jan 2017 17:09:41 +0000 (17:09 +0000)
 + Method 'leakExtraRoutesToVpnEndpoint' had been deprecated by method
   'handleStaticRoutes' but hadn't been 'switched off', so we had
   similar code being executed twice.

Change-Id: I09a3b4e97c26137e8a4dbf593bea403f92428ae9
Signed-off-by: Miguel Perez <francisco.miguel.perez@ericsson.com>
vpnservice/vpnmanager/vpnmanager-impl/src/main/java/org/opendaylight/netvirt/vpnmanager/intervpnlink/InterVpnLinkListener.java

index 18d8b1d8cfef0b8a27a47508238d3011ac8baac8..3006486ead6f1e8dd6f156e6197b6ad218c2745d 100755 (executable)
@@ -391,12 +391,6 @@ public class InterVpnLinkListener extends AsyncDataTreeChangeListenerBase<InterV
             // 2nd Endpoint ==> 1st endpoint
             leakRoutes(vpnLink, vpn2Uuid, vpn1Uuid, originsToConsider);
         }
-
-        // Static routes in Vpn1 pointing to Vpn2's endpoint
-        leakExtraRoutesToVpnEndpoint(vpnLink, vpn1Uuid, vpn2Uuid);
-
-        // Static routes in Vpn2 pointing to Vpn1's endpoint
-        leakExtraRoutesToVpnEndpoint(vpnLink, vpn2Uuid, vpn1Uuid);
     }
 
     private void leakRoutes(InterVpnLink vpnLink, String srcVpnUuid, String dstVpnUuid,
@@ -417,36 +411,6 @@ public class InterVpnLinkListener extends AsyncDataTreeChangeListenerBase<InterV
         }
     }
 
-    /*
-     * Checks if there are static routes in Vpn1 whose nexthop is Vpn2's endpoint. Those routes must be leaked to Vpn1.
-     *
-     * @param vpnLink
-     * @param vpn1Uuid
-     * @param vpn2Uuid
-     */
-    private void leakExtraRoutesToVpnEndpoint(InterVpnLink vpnLink, String vpn1Uuid, String vpn2Uuid) {
-
-        String vpn1Rd = VpnUtil.getVpnRd(dataBroker, vpn1Uuid);
-        String vpn2Endpoint = vpnLink.getSecondEndpoint().getIpAddress().getValue();
-        List<VrfEntry> allVpnVrfEntries = VpnUtil.getAllVrfEntries(dataBroker, vpn1Rd);
-        for ( VrfEntry vrfEntry : allVpnVrfEntries ) {
-            if ( vrfEntry.getNextHopAddressList() != null
-                && vrfEntry.getNextHopAddressList().contains(vpn2Endpoint) ) {
-                // Vpn1 has a route pointing to Vpn2's endpoint. Forcing the leaking of the route will update the
-                // BGP accordingly
-                long label = VpnUtil.getUniqueId(idManager, VpnConstants.VPN_IDPOOL_NAME,
-                                                  VpnUtil.getNextHopLabelKey(vpn1Rd, vrfEntry.getDestPrefix()));
-                if (label == VpnConstants.INVALID_LABEL) {
-                    LOG.error("Unable to fetch label from Id Manager. Bailing out of leaking extra routes for InterVpnLink {} rd {} prefix {}",
-                              vpnLink.getName(), vpn1Rd, vrfEntry.getDestPrefix());
-                    continue;
-                }
-                InterVpnLinkUtil.leakRoute(dataBroker, bgpManager, vpnLink, vpn2Uuid, vpn1Uuid, vrfEntry.getDestPrefix(),
-                                           label, RouteOrigin.value(vrfEntry.getOrigin()));
-            }
-        }
-    }
-
     private boolean checkVpnAvailability(InterVpnLinkKey key, Uuid vpnId) {
         Preconditions.checkNotNull(vpnId);