Bug 7447: Unexpected flows from T21 to T44 for FIP 25/49925/3
authorOlga Schukin <olga.schukin@hpe.com>
Mon, 2 Jan 2017 08:47:04 +0000 (10:47 +0200)
committerAlon Kochba <alonko@hpe.com>
Thu, 5 Jan 2017 15:41:17 +0000 (15:41 +0000)
The incorrect rules were installed due to not updated DS models

Change-Id: I80b3872c28bc560801e376a158710df70008a2e8
Signed-off-by: Olga Schukin <olga.schukin@hpe.com>
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java
vpnservice/natservice/natservice-impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java

index f308a493f3fb7fd4f481555313f21f84fd0f04ec..11e93f7d590715b1c38930d62e19e361d6ff9d55 100644 (file)
@@ -1493,9 +1493,21 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         String routerName = router.getRouterName();
         try {
             Long routerId = NatUtil.getVpnId(dataBroker, routerName);
+            //Use the NaptMananager removeMapping API to remove the entire list of IP addresses maintained for the router ID.
+            LOG.debug("NAT Service : Remove the Internal to external IP address maintained for the router ID {} in the DS", routerId);
+            naptManager.removeMapping(routerId);
+
+            if (routerFlag) {
+                removeNaptSwitch(routerName);
+            } else {
+                updateNaptSwitch(routerName, BigInteger.ZERO);
+            }
+
+            LOG.debug("NAT Service : Remove the ExternalCounter model for the router ID {}", routerId);
+            naptManager.removeExternalCounter(routerId);
 
             LOG.debug("NAT Service : got primarySwitch as dpnId {}", naptSwitchDpnId);
-            if (naptSwitchDpnId == null || naptSwitchDpnId.equals(BigInteger.ZERO)){
+            if (naptSwitchDpnId == null || naptSwitchDpnId.equals(BigInteger.ZERO)) {
                 LOG.error("NAT Service : Unable to retrieve the primary NAPT switch for the router ID {} from RouterNaptSwitch model", routerId);
                 return;
             }
@@ -1507,18 +1519,6 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                 LOG.debug("Failed to remove fib entries for routerId {} in naptSwitchDpnId {} : {}", routerId, naptSwitchDpnId,ex);
             }
 
-            //Use the NaptMananager removeMapping API to remove the entire list of IP addresses maintained for the router ID.
-            LOG.debug("NAT Service : Remove the Internal to external IP address maintained for the router ID {} in the DS", routerId);
-            naptManager.removeMapping(routerId);
-
-            if(routerFlag) {
-                removeNaptSwitch(routerName);
-            } else {
-                updateNaptSwitch(routerName, BigInteger.ZERO);
-            }
-
-            LOG.debug("NAT Service : Remove the ExternalCounter model for the router ID {}", routerId);
-            naptManager.removeExternalCounter(routerId);
         } catch (Exception ex) {
             LOG.error("Exception while handling disableSNAT : {}", ex);
         }
index 242f4848209c8c4afa07978c2274032135c5847b..2b197f491c787ae9656d6e47a338d7439e6992d6 100644 (file)
@@ -227,7 +227,7 @@ public class NaptEventHandler {
             removeNatFlows(dpnId, NwConstants.INBOUND_NAPT_TABLE, routerId, naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber());
         }
 
-        LOG.info("NAT Service : handleNaptEvent() exited for IP, port, routerID : {}", naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber(), routerId);
+        LOG.info("NAT Service : handleNaptEvent() exited for IP {}, port {}, routerID : {}", naptEntryEvent.getIpAddress(), naptEntryEvent.getPortNumber(), routerId);
         } catch (Exception e){
             LOG.error("NAT Service :Exception in NaptEventHandler.handleEvent() payload {}", naptEntryEvent,e);
         }