ELAN flows overlap with VPN flows in Table36 91/83091/8
authorKarthikeyan Krishnan <karthikeyangceb007@gmail.com>
Thu, 18 Jul 2019 08:49:17 +0000 (14:19 +0530)
committerFaseela K <faseela.k@ericsson.com>
Wed, 28 Aug 2019 03:58:26 +0000 (03:58 +0000)
Issue:
======
ELAN flows overlap with VPN flows in Table36 as a result
of this issue L3VPN data traffic is lost.

Solution:
=========
This fix here attempts to make the following changes:
1. Make flows programmed by VPN into Table 36 (Terminating Service
Table) to carry a priority of 8 instead of the old priority of 5.

2. Make the floating-ip flows programmed by NAT into Table 36 (Terminating
Service
Table) to carry a priority of 8 instead of the old priority of 5.

3.  NAT does program NAPT-Switch to Non-NAPT-Switch flows into Table 36
with a priority of 10.  We have left this priority remain the same
(i.e., unchanged).

JIRA Ticket : NETVIRT-1619

Change-Id: If451756863b069eac06e788f83fcbad33966a2d3
Signed-off-by: Karthikeyan Krishnan <karthikeyangceb007@gmail.com>
fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/FibConstants.java
fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/FibRpcServiceImpl.java
fibmanager/impl/src/main/java/org/opendaylight/netvirt/fibmanager/VrfEntryListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/EvpnDnatFlowProgrammer.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/EvpnSnatFlowProgrammer.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatConstants.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VpnFloatingIpHandler.java

index a40a4e75bfc1c9e9a5b4965e4ade99547a86d232..4d563c15c0fb9e12340acba188c9859543bd53bf 100644 (file)
@@ -23,6 +23,7 @@ public interface FibConstants {
     String SEPARATOR = ".";
     String DEFAULT_NEXTHOP_IP = "0.0.0.0";
     long INVALID_GROUP_ID = -1;
+    int DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY = 8;
 
     Map<Integer, Class<? extends NxmNxReg>> NXM_REG_MAPPING = ImmutableMap.of(0, NxmNxReg0.class, 1, NxmNxReg1.class);
 }
index 35c16317270551016c7f312e6552b9aed6bb374d..841d3ba1a503ad763199c6021c7e8bf42aaec853 100644 (file)
@@ -7,9 +7,6 @@
  */
 package org.opendaylight.netvirt.fibmanager;
 
-import static org.opendaylight.netvirt.fibmanager.FibConstants.DEFAULT_FIB_FLOW_PRIORITY;
-import static org.opendaylight.netvirt.fibmanager.FibConstants.FLOWID_PREFIX;
-
 import com.google.common.util.concurrent.ListenableFuture;
 import java.math.BigInteger;
 import java.net.InetAddress;
@@ -159,7 +156,7 @@ public class FibRpcServiceImpl implements FibRpcService {
         String flowRef = getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, vpnId, ipAddress);
 
 
-        int priority = DEFAULT_FIB_FLOW_PRIORITY + prefixLength;
+        int priority = FibConstants.DEFAULT_FIB_FLOW_PRIORITY + prefixLength;
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_FIB_TABLE, flowRef,
             priority, flowRef, 0, 0,
             NwConstants.COOKIE_VM_FIB_TABLE, matches, null);
@@ -196,7 +193,7 @@ public class FibRpcServiceImpl implements FibRpcService {
         String flowRef = getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, vpnId, ipAddress);
 
 
-        int priority = DEFAULT_FIB_FLOW_PRIORITY + prefixLength;
+        int priority = FibConstants.DEFAULT_FIB_FLOW_PRIORITY + prefixLength;
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.L3_FIB_TABLE, flowRef,
             priority, flowRef, 0, 0,
             NwConstants.COOKIE_VM_FIB_TABLE, matches, customInstructions);
@@ -206,8 +203,8 @@ public class FibRpcServiceImpl implements FibRpcService {
     }
 
     private String getFlowRef(BigInteger dpnId, short tableId, long id, String ipAddress) {
-        return FLOWID_PREFIX + dpnId + NwConstants.FLOWID_SEPARATOR + tableId + NwConstants.FLOWID_SEPARATOR + id
-                + NwConstants.FLOWID_SEPARATOR + ipAddress;
+        return FibConstants.FLOWID_PREFIX + dpnId + NwConstants.FLOWID_SEPARATOR + tableId
+                + NwConstants.FLOWID_SEPARATOR + id + NwConstants.FLOWID_SEPARATOR + ipAddress;
     }
 
     //TODO: Below Util methods to be removed once VpnUtil methods are exposed in api bundle
index 2c25f72cf84432af9fe45462a273869c9224ec8a..d6246b640c9aac79fe8a84ba4e9dc75a2353311a 100644 (file)
@@ -1030,9 +1030,10 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
 
         FlowEntity terminatingServiceTableFlowEntity =
             MDSALUtil.buildFlowEntity(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE,
-            getTableMissFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, label), 5,
-                String.format("%s:%d", "TST Flow Entry ", label),
-            0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, mkInstructions);
+            getTableMissFlowRef(destDpId, NwConstants.INTERNAL_TUNNEL_TABLE, label),
+                    FibConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY,
+                    String.format("%s:%d", "TST Flow Entry ", label), 0, 0,
+                    COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, mkInstructions);
 
         FlowKey flowKey = new FlowKey(new FlowId(terminatingServiceTableFlowEntity.getFlowId()));
 
@@ -1055,8 +1056,9 @@ public class VrfEntryListener extends AsyncDataTreeChangeListenerBase<VrfEntry,
         flowEntity = MDSALUtil.buildFlowEntity(dpId,
             NwConstants.INTERNAL_TUNNEL_TABLE,
             getTableMissFlowRef(dpId, NwConstants.INTERNAL_TUNNEL_TABLE, (int) label),
-            5, String.format("%s:%d", "TST Flow Entry ", label), 0, 0,
-            COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, null);
+                FibConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY,
+                String.format("%s:%d", "TST Flow Entry ", label), 0, 0,
+                COOKIE_TUNNEL.add(BigInteger.valueOf(label)), mkMatches, null);
         Node nodeDpn = FibUtil.buildDpnNode(flowEntity.getDpnId());
         FlowKey flowKey = new FlowKey(new FlowId(flowEntity.getFlowId()));
         InstanceIdentifier<Flow> flowInstanceId = InstanceIdentifier.builder(Nodes.class)
index 9380cdebd00b9a66e1db4c770ee06dc2b11572b2..de7ae9c305bb225a3f24d2d50dc4269f4b044189 100644 (file)
@@ -373,7 +373,8 @@ public class EvpnDnatFlowProgrammer {
         List<MatchInfo> mkMatches = new ArrayList<>();
         mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
         Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
-                NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.DNAT_FLOW_NAME), 6,
+                NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.DNAT_FLOW_NAME),
+                NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY + 1,
                 String.format("%s:%d", "TST Flow Entry ", l3Vni),
                 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, customInstructions);
         mdsalManager.addFlow(confTx, dpnId, terminatingServiceTableFlowEntity);
@@ -390,7 +391,8 @@ public class EvpnDnatFlowProgrammer {
         mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.DNAT_FLOW_NAME),
-                6, String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0,
+                NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY + 1,
+                String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0,
                 COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, null);
         mdsalManager.removeFlow(confTx, dpnId, flowEntity);
         LOG.debug("removeTunnelTableEntry : Successfully removed terminating service table flow {} on DpnId {}",
index 946018f45e34f85c4fb1ddbd59a189602e88685b..eb4f2860d7fbc33e8e59b77c39edbae0d8912dbd 100644 (file)
@@ -270,7 +270,8 @@ public class EvpnSnatFlowProgrammer {
         mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
 
         Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
-                NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.SNAT_FLOW_NAME), 5,
+                NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.SNAT_FLOW_NAME),
+                NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY,
                 String.format("%s:%d", "TST Flow Entry ", l3Vni),
                 0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, customInstructions);
         mdsalManager.addFlow(confTx, dpnId, terminatingServiceTableFlowEntity);
@@ -288,7 +289,8 @@ public class EvpnSnatFlowProgrammer {
         mkMatches.add(new MatchTunnelId(BigInteger.valueOf(l3Vni)));
         Flow flowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
                 NatEvpnUtil.getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, l3Vni, NatConstants.SNAT_FLOW_NAME),
-                5, String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0,
+                NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY,
+                String.format("%s:%d", "TST Flow Entry ", l3Vni), 0, 0,
                 COOKIE_TUNNEL.add(BigInteger.valueOf(l3Vni)), mkMatches, null);
         mdsalManager.removeFlow(confTx, dpnId, flowEntity);
         LOG.debug("removeTunnelTableEntry : Successfully removed terminating service table flow {} on DpnId {}",
index 9cfeb808997543efbd60a975e60150842b0c7c93..1d978d65c19d29b3f8fe1c635f00717efe1623a7 100644 (file)
@@ -1202,9 +1202,10 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         }
 
         Flow terminatingServiceTableFlowEntity = MDSALUtil.buildFlowNew(NwConstants.INTERNAL_TUNNEL_TABLE,
-            getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""), 5,
-            String.format("%s:%d", "TST Flow Entry ", serviceId),
-            0, 0, COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, customInstructions);
+            getFlowRef(dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, serviceId, ""),
+                NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY,
+                String.format("%s:%d", "TST Flow Entry ", serviceId), 0, 0,
+                COOKIE_TUNNEL.add(BigInteger.valueOf(serviceId)), mkMatches, customInstructions);
 
         mdsalManager.addFlow(confTx, dpnId, terminatingServiceTableFlowEntity);
     }
index 49796997694f3afc852cdfa682fad3704f462a9f..4b631dfefc44fac39df1b66194c97c4522fb1a4b 100644 (file)
@@ -49,6 +49,7 @@ public interface NatConstants {
     int SNAT_PACKET_RETRY_THEADPOOL_SIZE = 15;
     String NAT_DJC_PREFIX = "NAT-";
     int NAT_DJC_MAX_RETRIES = 3;
+    int DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY = 8;
     // Flow Actions
     int ADD_FLOW = 0;
     int DEL_FLOW = 1;
index 1a1f1e1016e405a774359cda7d742bb04d42a3bf..1340bf975538a3a7a012497c7a55e9bc4b76edd6 100644 (file)
@@ -417,13 +417,13 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
         List<MatchInfo> mkMatches = new ArrayList<>();
 
         LOG.info("makeTunnelTableEntry on DpnId = {} and serviceId = {}", dpnId, serviceId);
-        int flowPriority = 5;
+        int flowPriority = NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY;
         // Increased the 36->25 flow priority. If SNAT is also configured on the same
         // DPN, then the traffic will be hijacked to DNAT and if there are no DNAT match,
         // then handled back to using using flow 25->44(which will be installed as part of SNAT)
         if (NatUtil.isOpenStackVniSemanticsEnforcedForGreAndVxlan(elanService, provType)) {
             mkMatches.add(new MatchTunnelId(natOverVxlanUtil.getInternetVpnVni(vpnName, serviceId)));
-            flowPriority = 6;
+            flowPriority = NatConstants.DEFAULT_VPN_INTERNAL_TUNNEL_TABLE_PRIORITY + 1;
         } else {
             mkMatches.add(new MatchTunnelId(BigInteger.valueOf(serviceId)));
         }