Bug 8474: Local FIB entries for VxLAN VPN interfaces not programmed 69/57269/6
authorAbhinav Gupta <abhinav.gupta@ericsson.com>
Wed, 17 May 2017 11:57:07 +0000 (17:27 +0530)
committerSam Hague <shague@redhat.com>
Thu, 18 May 2017 18:03:22 +0000 (18:03 +0000)
Local FIB entries for VxLAN networks on router-based VPNs are not getting
programmed when VNI flag is turned to true, as makeConnectedRoute() wasn't
being called.
This commit fixes the same for create and delete cycles.

Change-Id: Ib81ac9aa1270921c11fc35cfb3352afdd5aff577
Signed-off-by: Abhinav Gupta <abhinav.gupta@ericsson.com>
Signed-off-by: Sam Hague <shague@redhat.com>
vpnservice/fibmanager/fibmanager-impl/src/main/java/org/opendaylight/netvirt/fibmanager/VrfEntryListener.java

index 3bc2d1ec2ed167c4a74a7b6c7a44a8da049e1cc8..abc014c404a44685843e165530f8abc32f68263f 100755 (executable)
@@ -827,23 +827,23 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
             }
             if (groupId == FibConstants.INVALID_GROUP_ID) {
                 LOG.error("Unable to create Group for local prefix {} on rd {} for vpninterface {} on Node {}",
-                    prefix, rd, interfaceName, dpnId.toString());
+                        prefix, rd, interfaceName, dpnId.toString());
                 return BigInteger.ZERO;
             }
             final List<InstructionInfo> instructions = Collections.singletonList(
-                new InstructionApplyActions(
-                    Collections.singletonList(new ActionGroup(groupId))));
+                    new InstructionApplyActions(
+                            Collections.singletonList(new ActionGroup(groupId))));
             final List<InstructionInfo> lfibinstructions = Collections.singletonList(
-                new InstructionApplyActions(
-                    Arrays.asList(new ActionPopMpls(), new ActionGroup(groupId))));
+                    new InstructionApplyActions(
+                            Arrays.asList(new ActionPopMpls(), new ActionGroup(groupId))));
             java.util.Optional<Long> optLabel = FibUtil.getLabelFromRoutePaths(vrfEntry);
             List<String> nextHopAddressList = FibHelper.getNextHopListFromRoutePaths(vrfEntry);
-            if (!FibUtil.enforceVxlanDatapathSemanticsforInternalRouterVpn(dataBroker, localNextHopInfo
-                    .getSubnetId(), vpnName, rd)) {
-                DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
-                dataStoreCoordinator.enqueueJob(jobKey, () -> {
-                    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
-                    makeConnectedRoute(dpnId, vpnId, vrfEntry, rd, instructions, NwConstants.ADD_FLOW, tx);
+            DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
+            dataStoreCoordinator.enqueueJob(jobKey, () -> {
+                WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+                makeConnectedRoute(dpnId, vpnId, vrfEntry, rd, instructions, NwConstants.ADD_FLOW, tx);
+                if (!FibUtil.enforceVxlanDatapathSemanticsforInternalRouterVpn(dataBroker,
+                        localNextHopInfo.getSubnetId(), vpnName, rd)) {
                     optLabel.ifPresent(label -> {
                         if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.SELF_IMPORTED) {
                             LOG.debug("Installing LFIB and tunnel table entry on dpn {} for interface {} with label "
@@ -854,20 +854,20 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
                                     NwConstants.ADD_FLOW, tx);
                             makeTunnelTableEntry(dpnId, label, localGroupId, tx);
                         } else {
-                            LOG.debug("Route with rd {} prefix {} label {} nexthop {} for vpn {} is an imported route. "
-                                            + "LFib and Terminating table entries will not be created.",
+                            LOG.debug("Route with rd {} prefix {} label {} nexthop {} for vpn {} is an imported "
+                                            + "route. LFib and Terminating table entries will not be created.",
                                     rd, vrfEntry.getDestPrefix(), optLabel, nextHopAddressList, vpnId);
                         }
                     });
-                    List<ListenableFuture<Void>> futures = new ArrayList<>();
-                    futures.add(tx.submit());
-                    return futures;
-                });
-            }
+                }
+                List<ListenableFuture<Void>> futures = new ArrayList<>();
+                futures.add(tx.submit());
+                return futures;
+            });
             return dpnId;
         }
-        LOG.error("localNextHopInfo received is null for prefix {} on rd {} on vpn {}",
-                vrfEntry.getDestPrefix(), rd, vpnName);
+        LOG.error("localNextHopInfo received is null for prefix {} on rd {} on vpn {}", vrfEntry.getDestPrefix(), rd,
+                vpnName);
         return BigInteger.ZERO;
     }
 
@@ -1048,26 +1048,25 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
                                                 final VrfEntry vrfEntry) {
         if (localNextHopInfo != null) {
             final BigInteger dpnId = localNextHopInfo.getDpnId();
-            if (!FibUtil.enforceVxlanDatapathSemanticsforInternalRouterVpn(dataBroker, localNextHopInfo
-                    .getSubnetId(), vpnId, rd)) {
-                DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
-                dataStoreCoordinator.enqueueJob("FIB-" + vpnId.toString() + "-" + dpnId.toString() + "-" + vrfEntry
-                        .getDestPrefix(), () -> {
-                        WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
-                        makeConnectedRoute(dpnId, vpnId, vrfEntry, rd, null /* instructions */, NwConstants.DEL_FLOW,
-                              tx);
+            DataStoreJobCoordinator dataStoreCoordinator = DataStoreJobCoordinator.getInstance();
+            dataStoreCoordinator.enqueueJob("FIB-" + vpnId.toString() + "-" + dpnId.toString() + "-" + vrfEntry
+                .getDestPrefix(), () -> {
+                    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+                    makeConnectedRoute(dpnId, vpnId, vrfEntry, rd, null /* instructions */, NwConstants.DEL_FLOW, tx);
+                    if (!FibUtil.enforceVxlanDatapathSemanticsforInternalRouterVpn(dataBroker,
+                        localNextHopInfo.getSubnetId(), vpnId, rd)) {
                         if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.SELF_IMPORTED) {
                             FibUtil.getLabelFromRoutePaths(vrfEntry).ifPresent(label -> {
                                 makeLFibTableEntry(dpnId, label, null /* instructions */, DEFAULT_FIB_FLOW_PRIORITY,
-                                        NwConstants.DEL_FLOW, tx);
+                                    NwConstants.DEL_FLOW, tx);
                                 removeTunnelTableEntry(dpnId, label, tx);
                             });
                         }
-                        List<ListenableFuture<Void>> futures = new ArrayList<>();
-                        futures.add(tx.submit());
-                        return futures;
-                    });
-            }
+                    }
+                    List<ListenableFuture<Void>> futures = new ArrayList<>();
+                    futures.add(tx.submit());
+                    return futures;
+                });
             //TODO: verify below adjacency call need to be optimized (?)
             deleteLocalAdjacency(dpnId, vpnId, localNextHopIP, vrfEntry.getDestPrefix());
             return dpnId;