- String egressInterface = resolveAdjacency(localDpnId, remoteDpnId, vpnId, vrfEntry, rd);
- if(egressInterface == null) {
- LOG.error("Could not get nexthop group id for nexthop: {} in vpn {}",
- vrfEntry.getNextHopAddress(), rd);
- LOG.warn("Failed to delete Route: {} in vpn: {}",
- vrfEntry.getDestPrefix(), rd);
- return;
+ boolean isRemoteRoute = true;
+ if (localDpnId == null) {
+ // localDpnId is not known when clean up happens for last vm for a vpn on a dpn
+ VpnNexthop localNextHopInfo = nextHopManager.getVpnNexthop(vpnId, vrfEntry.getDestPrefix());
+ if(localNextHopInfo == null) {
+ //Is this fib route an extra route? If yes, get the nexthop which would be an adjacency in the vpn
+ Extraroute extra_route = getVpnToExtraroute(rd, vrfEntry.getDestPrefix());
+ if (extra_route != null) {
+ localNextHopInfo = nextHopManager.getVpnNexthop(vpnId, extra_route.getNexthopIp());
+ }
+ }
+ isRemoteRoute = ((localNextHopInfo != null) && (!remoteDpnId.equals(localNextHopInfo.getDpnId())));
+ }
+ if (isRemoteRoute) {
+ makeConnectedRoute(remoteDpnId, vpnId, vrfEntry, rd, null, NwConstants.DEL_FLOW);
+ LOG.debug("Successfully delete fib entry for "+ vrfEntry.getDestPrefix() + " vpnId "+vpnId);
+ } else{
+ LOG.debug("Did not delete fib entry rd: {} =, prefix: {} as it is local to dpn {}", rd, vrfEntry.getDestPrefix(), remoteDpnId);