Remote FIB entry missing for NAT Prefixes 80/92280/2
authorSomashekar Byrappa <somashekar.b@altencalsoftlabs.com>
Wed, 19 Aug 2020 07:50:02 +0000 (13:20 +0530)
committerKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Fri, 18 Sep 2020 04:19:37 +0000 (04:19 +0000)
Issue:
=======
Remote FIB entries for NAT prefixes were not programmed when new DPN
gets added in VPN footprint.

Solution:
==========
For NAT prefix, "prefix-to-interface" DS will not hold vpninterface at
all. Also such NAT prefixes tend to use remote-flows without destMac
filled.
Validations are done to address this case.

Signed-off-by: Somashekar Byrappa <somashekar.b@altencalsoftlabs.com>
Change-Id: I6b1d9b51db184d24fa8e31529928c7f2522d3c7c

fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/BaseVrfEntryHandler.java
fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/FibRpcServiceImpl.java

index f533f4b94b9603ab51826350f0573f2f96696961..619a6919b9864d7bbd1037f3099df56efc0c1eea 100644 (file)
@@ -333,6 +333,12 @@ public class BaseVrfEntryHandler implements AutoCloseable {
                 return;
             }
         }
+        if (prefixInfo.getPrefixCue() == Prefixes.PrefixCue.Nat) {
+            /* natprefix prefix-to-interface will not hold vpninterface at all. Also such natprefixes
+             * tend to use remote-flows without destMac filled. Hence just return here.
+             */
+            return;
+        }
         String ipPrefix = prefixInfo.getIpAddress();
         String ifName = prefixInfo.getVpnInterfaceName();
         if (ifName == null) {
index a1b54a2d596b41dcb0a587ee556526164682036f..42694c762384ca4c23d9e185a0ffcef56c539b1a 100644 (file)
@@ -85,17 +85,18 @@ public class FibRpcServiceImpl implements FibRpcService {
 
         Uint64 dpnId = input.getSourceDpid();
         String vpnName = input.getVpnName();
-        Uint32 vpnId = getVpnId(dataBroker, vpnName);
         String vpnRd = getVpnRd(dataBroker, vpnName);
         String ipAddress = input.getIpAddress();
         LOG.info("Create custom FIB entry - {} on dpn {} for VPN {} ", ipAddress, dpnId, vpnName);
         Map<InstructionKey, Instruction> instructionMap = input.nonnullInstruction();
         LOG.info("ADD: Adding Custom Fib Entry rd {} prefix {} label {}", vpnRd, ipAddress, input.getServiceId());
-        makeLocalFibEntry(vpnId, dpnId, ipAddress, new ArrayList<Instruction>(instructionMap.values()));
         IpAddresses.IpAddressSource ipAddressSource = IpAddresses.IpAddressSource
                 .forValue(input.getIpAddressSource().getIntValue());
         vpnFootprintService.updateVpnToDpnMapping(dpnId, vpnName, vpnRd, null /* interfaceName*/,
                 new ImmutablePair<>(ipAddressSource, ipAddress), true /*add*/);
+
+        Uint32 vpnId = getVpnId(dataBroker, vpnName);
+        makeLocalFibEntry(vpnId, dpnId, ipAddress, new ArrayList<Instruction>(instructionMap.values()));
         LOG.info("ADD: Added Custom Fib Entry rd {} prefix {} label {}", vpnRd, ipAddress, input.getServiceId());
         return RpcResultBuilder.success(new CreateFibEntryOutputBuilder().build()).buildFuture();
     }