Bug 7861: No ping response from FIP on 1st router when adding 2nd FIP 22/52322/3
authorkarthikeyan <karthikeyan.k@altencalsoftlabs.com>
Mon, 27 Feb 2017 16:07:03 +0000 (21:37 +0530)
committerVivekanandan Narasimhan <n.vivekanandan@ericsson.com>
Tue, 28 Feb 2017 06:47:47 +0000 (06:47 +0000)
Problem Description:
====================
Table Miss Entry for SNAT/DNAT in FIB Table (table=21->26 flow) is
overriting when multiple router is present instead of creating new entry
for each VPN Instance.

Each router is associated with unique external network and each external
network is associated with unique internet BGP VPN Instance.

Example topology:
router-1/external-network-1/bgp-vpn-1
router-2/external-network-2/bgp-vpn-2

Both router-1 and router-2 are presented on single compute node. In this
scenario router-2 ping traffic only is working as expected. Since table 21
doesn't have the table miss entry for router-1 with bgp-vpn-1 instance.

Solution:
=========

In ExternalNetworkListener while creating table miss entry for SNAT/DNAT
in table 21, added "vpn-id" attribute also in creating flow reference as
same as implemented in the class
SNATDefaultRouteProgrammer.buildDefNATFlowEntity(). After this code change
in table 21 miss entry for SNAT/DNAT is created for each bgp-vpn instance.

Change-Id: Iac909e628f1a4134526e6df0b640149c8d45cd20
Signed-off-by: karthikeyan <karthikeyan.k@altencalsoftlabs.com>
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalNetworkListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatUtil.java

index ab9e8baa273a40f46bf6c0fb34cb6852e9232119..802dad1940ae0ec9a14c42eec0baf8a3eb07d74a 100644 (file)
@@ -178,7 +178,7 @@ public class ExternalNetworkListener extends AsyncDataTreeChangeListenerBase<Net
         List<InstructionInfo> instructions = new ArrayList<>();
         instructions.add(new InstructionGotoTable(NwConstants.PSNAT_TABLE));
 
-        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.L3_FIB_TABLE, defaultIP);
+        String flowRef = NatUtil.getFlowRef(dpId, NwConstants.L3_FIB_TABLE, defaultIP, vpnId);
 
         FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef,
                 NatConstants.DEFAULT_DNAT_FLOW_PRIORITY, flowRef, 0, 0,
@@ -196,6 +196,7 @@ public class ExternalNetworkListener extends AsyncDataTreeChangeListenerBase<Net
                 + "Cannot proceed with installation of Default NAT flow");
             return;
         }
+        LOG.debug("NAT Service : Installing flow {}", flowEntity);
         mdsalManager.installFlow(flowEntity);
     }
 
@@ -206,6 +207,7 @@ public class ExternalNetworkListener extends AsyncDataTreeChangeListenerBase<Net
                 + "Cannot proceed with installation of Default NAT flow");
             return;
         }
+        LOG.debug("NAT Service : Removing flow {}", flowEntity);
         mdsalManager.removeFlow(flowEntity);
     }
 }
index dc55a9b2f6e9a1c2c28f394de917467a2a8c19c2..e51d3dfc5894d887a157bf609b5295ff00d5f065 100644 (file)
@@ -295,14 +295,9 @@ public class NatUtil {
                 .FLOWID_SEPARATOR + routerID + NatConstants.FLOWID_SEPARATOR + ip;
     }
 
-    public static String getFlowRef(BigInteger dpnId, short tableId, InetAddress destPrefix) {
-        return NatConstants.FLOWID_PREFIX + dpnId + NwConstants.FLOWID_SEPARATOR + tableId + NwConstants
-                .FLOWID_SEPARATOR + destPrefix.getHostAddress();
-    }
-
     public static String getFlowRef(BigInteger dpnId, short tableId, InetAddress destPrefix, long vpnId) {
         return NatConstants.NAPT_FLOWID_PREFIX + dpnId + NatConstants.FLOWID_SEPARATOR + tableId + NatConstants
-                .FLOWID_SEPARATOR + vpnId;
+                .FLOWID_SEPARATOR + destPrefix.getHostAddress() + NatConstants.FLOWID_SEPARATOR + vpnId;
     }
 
     public static String getNaptFlowRef(BigInteger dpnId, short tableId, String routerID, String ip, int port) {