natservice dead code removal 91/81091/4
authorStephen Kitt <skitt@redhat.com>
Thu, 21 Mar 2019 13:23:06 +0000 (14:23 +0100)
committerFaseela K <faseela.k@ericsson.com>
Mon, 1 Apr 2019 05:00:14 +0000 (05:00 +0000)
This patch removes unused methods, classes and fields.

Change-Id: I8fcca759a7b6320ca0c1816e0ca535d130fbc00a
Signed-off-by: Stephen Kitt <skitt@redhat.com>
21 files changed:
natservice/api/src/main/java/org/opendaylight/netvirt/natservice/api/NatSwitchCache.java
natservice/api/src/main/java/org/opendaylight/netvirt/natservice/api/SnatServiceManager.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/ha/NatSwitchCacheImpl.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/AbstractSnatService.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ConntrackBasedSnatService.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/EvpnDnatFlowProgrammer.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/ExternalRoutersListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/Ipv6ForwardingService.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NAPTSwitchSelector.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptEventHandler.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptFlowRemovedEventHandler.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptManager.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptPacketInHandler.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NaptSwitchHA.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatArpNotificationHandler.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/NatUtil.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/RouterDpnChangeListener.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/SnatServiceImplFactory.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/SnatServiceManagerImpl.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VipStateTracker.java
natservice/impl/src/main/java/org/opendaylight/netvirt/natservice/internal/VpnFloatingIpHandler.java

index 93aed90d42a8c436b2cb16f4c27c5d3244883f1d..e6fc35ebab0a4b7096a03b6819e9229d7a9b0fed 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.netvirt.natservice.api;
 
 import java.math.BigInteger;
-import java.util.Map;
 import java.util.Set;
 
 public interface NatSwitchCache {
@@ -40,23 +39,11 @@ public interface NatSwitchCache {
      */
     Set<BigInteger> getSwitchesConnectedToExternal(String providerNet);
 
-    /**
-     * Return the switches map with weight.
-     * @return the map of switches
-     */
-    Map<BigInteger,SwitchInfo>  getSwitches();
-
     /**
      * Register for switch added notification.
      * @param centralizedSwitchCacheListener the instance of a listener
      */
     void register(NatSwitchCacheListener centralizedSwitchCacheListener);
 
-    /**
-     * Register for switch removed notification.
-     * @param centralizedSwitchCacheListener the instance of a listener
-     */
-    void deregister(NatSwitchCacheListener centralizedSwitchCacheListener);
-
 
 }
index 9e1a2d5c475a65d1ec3425cd6c93a45a79c72ff1..6084fee367f641a743d67e9ac30037e00207a8d0 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.netvirt.natservice.api;
 
 import java.math.BigInteger;
-
 import java.util.concurrent.ExecutionException;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.genius.infra.Datastore.Configuration;
@@ -29,10 +28,6 @@ public interface SnatServiceManager {
         CNT_ROUTER_DISBL
     }
 
-    void addNatServiceListener(SnatServiceListener aclServiceListner);
-
-    void removeNatServiceListener(SnatServiceListener aclServiceListner);
-
     void notify(TypedReadWriteTransaction<Configuration> confTx, Routers router, @Nullable Routers oldRouter,
         BigInteger primarySwitchId, @Nullable BigInteger dpnId, Action action)
         throws ExecutionException, InterruptedException;
index 25b6fa92b6982d9f8158c3bc437787a6389d6d9e..bde494e8ebad8749f41dc187af4ea6d88b68a1a2 100644 (file)
@@ -15,10 +15,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.netvirt.natservice.api.NatSwitchCache;
 import org.opendaylight.netvirt.natservice.api.NatSwitchCacheListener;
@@ -91,14 +89,4 @@ public class NatSwitchCacheImpl implements NatSwitchCache {
         }
     }
 
-    public void deregister(NatSwitchCacheListener centralizedSwitchCacheListener) {
-        if (centralizedSwitchCacheListener != null) {
-            centralizedSwitchCacheListenerList.remove(centralizedSwitchCacheListener);
-        }
-    }
-
-    @Override
-    public Map<BigInteger,SwitchInfo> getSwitches() {
-        return switchMap;
-    }
 }
index 9d5a52030829153b84505dc8706ef82db4e2d0aa..a12b02f55f3c713c1bd50203dfe7b7d02fcae203 100644 (file)
@@ -92,22 +92,22 @@ public abstract class AbstractSnatService implements SnatServiceListener {
     protected final ManagedNewTransactionRunner txRunner;
     protected final IMdsalApiManager mdsalManager;
     protected final IdManagerService idManager;
-    protected final NAPTSwitchSelector naptSwitchSelector;
-    protected final ItmRpcService itmManager;
+    private final NAPTSwitchSelector naptSwitchSelector;
+    final ItmRpcService itmManager;
     protected final OdlInterfaceRpcService odlInterfaceRpcService;
     protected final IInterfaceManager interfaceManager;
-    protected final IVpnFootprintService vpnFootprintService;
+    final IVpnFootprintService vpnFootprintService;
     protected final IFibManager fibManager;
-    protected final NatDataUtil natDataUtil;
-    protected final DataTreeEventCallbackRegistrar eventCallbacks;
-
-    protected AbstractSnatService(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
-                                  final ItmRpcService itmManager, final OdlInterfaceRpcService odlInterfaceRpcService,
-                                  final IdManagerService idManager, final NAPTSwitchSelector naptSwitchSelector,
-                                  final IInterfaceManager interfaceManager,
-                                  final IVpnFootprintService vpnFootprintService,
-                                  final IFibManager fibManager, final NatDataUtil natDataUtil,
-                                  final DataTreeEventCallbackRegistrar eventCallbacks) {
+    private final NatDataUtil natDataUtil;
+    private final DataTreeEventCallbackRegistrar eventCallbacks;
+
+    AbstractSnatService(final DataBroker dataBroker, final IMdsalApiManager mdsalManager,
+        final ItmRpcService itmManager, final OdlInterfaceRpcService odlInterfaceRpcService,
+        final IdManagerService idManager, final NAPTSwitchSelector naptSwitchSelector,
+        final IInterfaceManager interfaceManager,
+        final IVpnFootprintService vpnFootprintService,
+        final IFibManager fibManager, final NatDataUtil natDataUtil,
+        final DataTreeEventCallbackRegistrar eventCallbacks) {
         this.dataBroker = dataBroker;
         this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
         this.mdsalManager = mdsalManager;
@@ -126,14 +126,6 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         return dataBroker;
     }
 
-    public void init() {
-        LOG.info("{} init", getClass().getSimpleName());
-    }
-
-    public void close() {
-        LOG.debug("AbstractSnatService Closed");
-    }
-
     @Override
     public boolean addSnatAllSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
         BigInteger primarySwitchId) {
@@ -179,8 +171,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         // Handle non NAPT switches and NAPT switches separately
         if (!dpnId.equals(primarySwitchId)) {
             LOG.info("addSnat : Handle non NAPT switch {} for router {}", dpnId, routers.getRouterName());
-            addSnatCommonEntriesForNonNaptSwitch(confTx, routers, primarySwitchId, dpnId);
-            addSnatSpecificEntriesForNonNaptSwitch(confTx, routers, dpnId);
+            addSnatCommonEntriesForNonNaptSwitch();
+            addSnatSpecificEntriesForNonNaptSwitch();
         } else {
             LOG.info("addSnat : Handle NAPT switch {} for router {}", dpnId, routers.getRouterName());
             addSnatCommonEntriesForNaptSwitch(confTx, routers, dpnId);
@@ -196,8 +188,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         // Handle non NAPT switches and NAPT switches separately
         if (!dpnId.equals(primarySwitchId)) {
             LOG.info("removeSnat : Handle non NAPT switch {} for router {}", dpnId, routers.getRouterName());
-            removeSnatCommonEntriesForNonNaptSwitch(confTx, routers, dpnId);
-            removeSnatSpecificEntriesForNonNaptSwitch(confTx, routers, dpnId);
+            removeSnatCommonEntriesForNonNaptSwitch();
+            removeSnatSpecificEntriesForNonNaptSwitch();
         } else {
             LOG.info("removeSnat : Handle NAPT switch {} for router {}", dpnId, routers.getRouterName());
             removeSnatCommonEntriesForNaptSwitch(confTx, routers, dpnId);
@@ -268,7 +260,7 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         if (!dpnId.equals(primarySwitchId)) {
             LOG.info("removeCentralizedRouter : Handle non NAPT switch {} for router {}",
                     dpnId, routers.getRouterName());
-            removeCommonEntriesForNonNaptSwitch(confTx, routers, primarySwitchId, dpnId);
+            removeCommonEntriesForNonNaptSwitch(confTx, routers, dpnId);
         } else {
             LOG.info("removeCentralizedRouter : Handle NAPT switch {} for router {}", dpnId, routers.getRouterName());
             removeCommonEntriesForNaptSwitch(confTx, routers, dpnId);
@@ -282,13 +274,11 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         return true;
     }
 
-    protected void addCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
-            BigInteger dpnId) {
+    private void addCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
+        BigInteger dpnId) {
         String routerName = routers.getRouterName();
         Long routerId = NatUtil.getVpnId(dataBroker, routerName);
         addDefaultFibRouteForSNAT(confTx, dpnId, routerId);
-        int elanId = NatUtil.getElanInstanceByName(routers.getNetworkId().getValue(), getDataBroker())
-                .getElanTag().intValue();
         for (ExternalIps externalIp : routers.nonnullExternalIps()) {
             if (!NWUtil.isIpv4Address(externalIp.getIpAddress())) {
                 // In this class we handle only IPv4 use-cases.
@@ -297,13 +287,13 @@ public abstract class AbstractSnatService implements SnatServiceListener {
             //The logic now handle only one external IP per router, others if present will be ignored.
             long extSubnetId = NatUtil.getExternalSubnetVpnId(dataBroker, externalIp.getSubnetId());
             addInboundTerminatingServiceTblEntry(confTx, dpnId, routerId, extSubnetId);
-            addTerminatingServiceTblEntry(confTx, dpnId, routerId, elanId);
+            addTerminatingServiceTblEntry(confTx, dpnId, routerId);
             break;
         }
     }
 
-    protected void removeCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
-            BigInteger dpnId) throws ExecutionException, InterruptedException {
+    private void removeCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
+        BigInteger dpnId) throws ExecutionException, InterruptedException {
         String routerName = routers.getRouterName();
         Long routerId = NatUtil.getVpnId(dataBroker, routerName);
         removeDefaultFibRouteForSNAT(confTx, dpnId, routerId);
@@ -318,7 +308,7 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         }
     }
 
-    protected void addSnatCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
+    private void addSnatCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
         BigInteger dpnId) {
         String routerName = routers.getRouterName();
         Long routerId = NatUtil.getVpnId(dataBroker, routerName);
@@ -336,8 +326,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         }
     }
 
-    protected void removeSnatCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-            Routers routers, BigInteger dpnId) throws ExecutionException, InterruptedException {
+    private void removeSnatCommonEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
+        Routers routers, BigInteger dpnId) throws ExecutionException, InterruptedException {
         String routerName = routers.getRouterName();
         Long routerId = NatUtil.getVpnId(confTx, routerName);
         for (ExternalIps externalIp : routers.nonnullExternalIps()) {
@@ -353,29 +343,27 @@ public abstract class AbstractSnatService implements SnatServiceListener {
     }
 
 
-    protected void addCommonEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
-            BigInteger primarySwitchId, BigInteger dpnId) {
+    private void addCommonEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
+        BigInteger primarySwitchId, BigInteger dpnId) {
         String routerName = routers.getRouterName();
         Long routerId = NatUtil.getVpnId(dataBroker, routerName);
         addSnatMissEntry(confTx, dpnId, routerId, routerName, primarySwitchId);
         addDefaultFibRouteForSNAT(confTx, dpnId, routerId);
     }
 
-    protected void removeCommonEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
-            BigInteger primarySwitchId, BigInteger dpnId) throws ExecutionException, InterruptedException {
+    private void removeCommonEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx, Routers routers,
+        BigInteger dpnId) throws ExecutionException, InterruptedException {
         String routerName = routers.getRouterName();
         Long routerId = NatUtil.getVpnId(dataBroker, routerName);
         removeSnatMissEntry(confTx, dpnId, routerId, routerName);
         removeDefaultFibRouteForSNAT(confTx, dpnId, routerId);
     }
 
-    protected void addSnatCommonEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-        Routers routers, BigInteger primarySwitchId, BigInteger dpnId) {
+    private void addSnatCommonEntriesForNonNaptSwitch() {
         /* Nothing to do here*/
     }
 
-    protected void removeSnatCommonEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-            Routers routers, BigInteger dpnId) throws ExecutionException, InterruptedException {
+    private void removeSnatCommonEntriesForNonNaptSwitch() {
         /* Nothing to do here*/
     }
 
@@ -385,13 +373,11 @@ public abstract class AbstractSnatService implements SnatServiceListener {
     protected abstract void removeSnatSpecificEntriesForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
         Routers routers, BigInteger dpnId) throws ExecutionException, InterruptedException;
 
-    protected abstract void addSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-        Routers routers, BigInteger dpnId);
+    protected abstract void addSnatSpecificEntriesForNonNaptSwitch();
 
-    protected abstract void removeSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-        Routers routers, BigInteger dpnId);
+    protected abstract void removeSnatSpecificEntriesForNonNaptSwitch();
 
-    protected void addInboundFibEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, String externalIp,
+    private void addInboundFibEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId, String externalIp,
         Long routerId, long extSubnetId, String externalNetId, String subNetId, String routerMac) {
 
         List<MatchInfo> matches = new ArrayList<>();
@@ -425,8 +411,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
                 0, null, externalNetId, RouteOrigin.STATIC, null);
     }
 
-    protected void removeInboundFibEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
-            String externalIp, Long routerId, String subNetId) throws ExecutionException, InterruptedException {
+    private void removeInboundFibEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+        String externalIp, Long routerId, String subNetId) throws ExecutionException, InterruptedException {
         String flowRef = getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, routerId);
         flowRef = flowRef + "inbound" + externalIp;
         NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.L3_FIB_TABLE, flowRef);
@@ -437,8 +423,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
     }
 
 
-    protected void addTerminatingServiceTblEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
-        Long routerId, int elanId) {
+    private void addTerminatingServiceTblEntry(TypedWriteTransaction<Configuration> confTx, BigInteger dpnId,
+        Long routerId) {
         LOG.info("addTerminatingServiceTblEntry : creating entry for Terminating Service Table "
                 + "for switch {}, routerId {}", dpnId, routerId);
         List<MatchInfo> matches = new ArrayList<>();
@@ -457,8 +443,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
                 NatConstants.DEFAULT_TS_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
     }
 
-    protected void removeTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
-            Long routerId) throws ExecutionException, InterruptedException {
+    private void removeTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+        Long routerId) throws ExecutionException, InterruptedException {
         LOG.info("removeTerminatingServiceTblEntry : creating entry for Terminating Service Table "
             + "for switch {}, routerId {}", dpnId, routerId);
 
@@ -540,7 +526,7 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.PSNAT_TABLE, flowRef);
     }
 
-    protected void addInboundTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx,
+    private void addInboundTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx,
         BigInteger dpnId, Long routerId, long extSubnetId) {
 
         //Install the tunnel table entry in NAPT switch for inbound traffic to SNAT IP from a non a NAPT switch.
@@ -565,8 +551,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
                 NatConstants.SNAT_FIB_FLOW_PRIORITY, flowRef, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
     }
 
-    protected void removeInboundTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx,
-            BigInteger dpnId, Long routerId) throws ExecutionException, InterruptedException {
+    private void removeInboundTerminatingServiceTblEntry(TypedReadWriteTransaction<Configuration> confTx,
+        BigInteger dpnId, Long routerId) throws ExecutionException, InterruptedException {
         //Install the tunnel table entry in NAPT switch for inbound traffic to SNAT IP from a non a NAPT switch.
         LOG.info("installInboundTerminatingServiceTblEntry : creating entry for Terminating Service Table "
             + "for switch {}, routerId {}", dpnId, routerId);
@@ -574,7 +560,7 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.INTERNAL_TUNNEL_TABLE, flowRef);
     }
 
-    protected void addDefaultFibRouteForSNAT(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+    private void addDefaultFibRouteForSNAT(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
         Long extNetId) {
 
         List<MatchInfo> matches = new ArrayList<>();
@@ -591,8 +577,8 @@ public abstract class AbstractSnatService implements SnatServiceListener {
                 instructions);
     }
 
-    protected void removeDefaultFibRouteForSNAT(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
-            Long extNetId) throws ExecutionException, InterruptedException {
+    private void removeDefaultFibRouteForSNAT(TypedReadWriteTransaction<Configuration> confTx, BigInteger dpnId,
+        Long extNetId) throws ExecutionException, InterruptedException {
         String flowRef = "DefaultFibRouteForSNAT" + getFlowRef(dpnId, NwConstants.L3_FIB_TABLE, extNetId);
         NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.L3_FIB_TABLE, flowRef);
     }
@@ -620,7 +606,7 @@ public abstract class AbstractSnatService implements SnatServiceListener {
         return "snatmiss." + routerName;
     }
 
-    protected void removeMipAdjacencies(Routers routers) {
+    private void removeMipAdjacencies(Routers routers) {
         LOG.info("removeMipAdjacencies for router {}", routers.getRouterName());
         String externalSubNetId  = null;
         for (ExternalIps externalIp : routers.nonnullExternalIps()) {
index 792b7f17fd3ea516330d41c9fadc894d0be47046..f5c072dfc248bc346418531571655cfebc8e23cb 100644 (file)
@@ -165,14 +165,12 @@ public abstract class ConntrackBasedSnatService extends AbstractSnatService {
     }
 
     @Override
-    protected void addSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-        Routers routers, BigInteger dpnId) {
+    protected void addSnatSpecificEntriesForNonNaptSwitch() {
         // Nothing to to do here
     }
 
     @Override
-    protected void removeSnatSpecificEntriesForNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-        Routers routers, BigInteger dpnId) {
+    protected void removeSnatSpecificEntriesForNonNaptSwitch() {
         // Nothing to to do here
     }
 
index d20bb6c65f271defcd211b652478905847ef677a..9380cdebd00b9a66e1db4c770ee06dc2b11572b2 100644 (file)
@@ -265,7 +265,7 @@ public class EvpnDnatFlowProgrammer {
 
     public void onRemoveFloatingIp(final BigInteger dpnId, final String vpnName, final String externalIp,
                                    final String floatingIpInterface, final String floatingIpPortMacAddress,
-                                   final long routerId, TypedReadWriteTransaction<Configuration> confTx) {
+                                   final long routerId) {
     /*
      *  1) Remove the flow INTERNAL_TUNNEL_TABLE (table=36)-> PDNAT_TABLE (table=25) (SNAT VM on DPN1 is
      *     responding back to FIP VM on DPN2) {SNAT to DNAT traffic on different Hypervisor}
index 8b5e1d57700c8ca00237f9808cae3e0d8602fc86..bfd3b6089b846b7f35a77b3031cf8d95d5eac3cd 100644 (file)
@@ -81,10 +81,7 @@ import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
 import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
-import org.opendaylight.netvirt.natservice.api.CentralizedSwitchScheduler;
-import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
 import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
-import org.opendaylight.serviceutils.upgrade.UpgradeState;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
@@ -178,12 +175,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
     private final IFibManager fibManager;
     private final IVpnManager vpnManager;
     private final EvpnSnatFlowProgrammer evpnSnatFlowProgrammer;
-    private final CentralizedSwitchScheduler  centralizedSwitchScheduler;
     private final NatMode natMode;
-    private final INeutronVpnManager nvpnManager;
     private final IElanService elanManager;
     private final JobCoordinator coordinator;
-    private final UpgradeState upgradeState;
     private final IInterfaceManager interfaceManager;
     private final NatOverVxlanUtil natOverVxlanUtil;
     private final int snatPuntTimeout;
@@ -204,12 +198,9 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
                                    final IFibManager fibManager,
                                    final IVpnManager vpnManager,
                                    final EvpnSnatFlowProgrammer evpnSnatFlowProgrammer,
-                                   final INeutronVpnManager nvpnManager,
-                                   final CentralizedSwitchScheduler centralizedSwitchScheduler,
                                    final NatserviceConfig config,
                                    final IElanService elanManager,
                                    final JobCoordinator coordinator,
-                                   final UpgradeState upgradeState,
                                    final NatOverVxlanUtil natOverVxlanUtil,
                                    final IInterfaceManager interfaceManager) {
         super(Routers.class, ExternalRoutersListener.class);
@@ -230,11 +221,8 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         this.fibManager = fibManager;
         this.vpnManager = vpnManager;
         this.evpnSnatFlowProgrammer = evpnSnatFlowProgrammer;
-        this.nvpnManager = nvpnManager;
         this.elanManager = elanManager;
-        this.centralizedSwitchScheduler = centralizedSwitchScheduler;
         this.coordinator = coordinator;
-        this.upgradeState = upgradeState;
         this.interfaceManager = interfaceManager;
         this.natOverVxlanUtil = natOverVxlanUtil;
         if (config != null) {
@@ -990,15 +978,6 @@ public class ExternalRoutersListener extends AsyncDataTreeChangeListenerBase<Rou
         }
     }
 
-    List<BucketInfo> getBucketInfoForPrimaryNaptSwitch() {
-        List<BucketInfo> listBucketInfo = new ArrayList<>();
-        List<ActionInfo> listActionInfoPrimary = new ArrayList<>();
-        listActionInfoPrimary.add(new ActionNxResubmit(NwConstants.INTERNAL_TUNNEL_TABLE));
-        BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
-        listBucketInfo.add(0, bucketPrimary);
-        return listBucketInfo;
-    }
-
     public void installNaptPfibEntry(BigInteger dpnId, long segmentId,
             @Nullable TypedWriteTransaction<Configuration> confTx) {
         LOG.debug("installNaptPfibEntry : called for dpnId {} and segmentId {} ", dpnId, segmentId);
index dfe21c9d59630e322d71357d47a2b3b8136a1898..aed27b2803291f566a02d88f215b6d4b8a0d4442 100644 (file)
@@ -85,10 +85,6 @@ public class Ipv6ForwardingService implements SnatServiceListener {
         this.ipv6SubnetFlowProgrammer = ipv6SubnetFlowProgrammer;
     }
 
-    public void init() {
-        LOG.info("Ipv6ForwardingService: {} init", getClass().getSimpleName());
-    }
-
     @Override
     public boolean addCentralizedRouterAllSwitch(TypedReadWriteTransaction<Configuration> confTx,
             Routers routers, BigInteger primarySwitchId) {
@@ -331,42 +327,6 @@ public class Ipv6ForwardingService implements SnatServiceListener {
                 NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
     }
 
-    protected void removeIpv6PsNatMissEntryNonNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
-            BigInteger dpnId, Long routerId, String routerName, BigInteger primarySwitchId)
-                    throws ExecutionException, InterruptedException {
-        LOG.debug("installIpv6PsNatMissEntryNonNaptSwitch : On Non-Napt Switch, installing SNAT miss entry in"
-                + " switch {} for router {}", dpnId, routerName);
-        List<ActionInfo> listActionInfoPrimary = new ArrayList<>();
-        List<BucketInfo> listBucketInfo = new ArrayList<>();
-
-        String ifNamePrimary = NatUtil.getTunnelInterfaceName(dpnId, primarySwitchId, itmManager);
-        if (ifNamePrimary != null) {
-            LOG.debug("installIpv6PsNatMissEntryNonNaptSwitch : On Non-Napt Switch, Primary Tunnel interface is {}",
-                    ifNamePrimary);
-            listActionInfoPrimary = NatUtil.getEgressActionsForInterface(odlInterfaceRpcService, itmManager,
-                    interfaceManager, ifNamePrimary, routerId, true);
-        } else {
-            LOG.warn("installIpv6PsNatMissEntryNonNaptSwitch: could not get tunnelInterface for {} on Switch {}",
-                    primarySwitchId, dpnId);
-        }
-
-        BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
-        listBucketInfo.add(0, bucketPrimary);
-
-        LOG.debug("installIpv6PsNatMissEntryNonNaptSwitch : installSnatMissEntry called for dpnId {} with"
-                + " primaryBucket {} ", dpnId, listBucketInfo.get(0));
-
-        long groupId = createGroupIdForIpv6Router(getGroupIdKey(routerName + "IPv6"));
-        GroupEntity groupEntity = MDSALUtil.buildGroupEntity(dpnId, groupId, routerName, GroupTypes.GroupAll,
-                listBucketInfo);
-        LOG.debug("removing the PSNAT to NAPTSwitch GroupEntity:{} with GroupId: {}", groupEntity, groupId);
-        mdsalManager.removeGroup(confTx, groupEntity);
-
-        String flowRef = NatUtil.getIpv6FlowRef(dpnId, NwConstants.PSNAT_TABLE, routerId);
-        NatUtil.removeFlow(confTx, mdsalManager, dpnId, NwConstants.PSNAT_TABLE, flowRef);
-    }
-
-
     protected void addIpv6SnatMissEntryForNaptSwitch(TypedReadWriteTransaction<Configuration> confTx,
             BigInteger dpnId, Long routerId, BigInteger routerMetadata) {
         LOG.debug("installIpv6SnatMissEntryForNaptSwitch {} called for routerId {}", dpnId, routerId);
index 13663d2839442a9b3c96054911ca5ef2631d9c74..98da98b204b234f041256b01c0c39be68baa41b1 100644 (file)
@@ -171,10 +171,6 @@ public class NAPTSwitchSelector {
             return weight;
         }
 
-        public void incrementWeight() {
-            ++weight;
-        }
-
         @Override
         public int compareTo(@NonNull SwitchWeight switchWeight) {
             return weight - switchWeight.getWeight();
index 42215304316ad20481a2d372204fb17000fd783e..32b2dbb8f19a9e19d2b72f41c240553030ad5385 100644 (file)
@@ -68,7 +68,6 @@ import org.opendaylight.genius.mdsalutil.packet.TCP;
 import org.opendaylight.genius.mdsalutil.packet.UDP;
 import org.opendaylight.infrautils.utils.concurrent.JdkFutures;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
-import org.opendaylight.netvirt.natservice.internal.NaptPacketInHandler.NatPacketProcessingState;
 import org.opendaylight.openflowplugin.libraries.liblldp.PacketException;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -307,11 +306,6 @@ public class NaptEventHandler {
                                             internalAddress, externalAddress);
                                 }
                             }, MoreExecutors.directExecutor());
-
-                    NatPacketProcessingState state = naptEntryEvent.getState();
-                    if (state != null) {
-                        state.setFlowInstalledTime(System.currentTimeMillis());
-                    }
                 } else {
                     prepareAndSendPacketOut(naptEntryEvent, routerId);
                 }
index ac3b64f66b64428aaf3c9ae58ae30d8c6f97a4a8..f5d614cb9af990e8830bec4c9bff1366eb16c564 100644 (file)
@@ -10,10 +10,8 @@ package org.opendaylight.netvirt.natservice.internal;
 import java.math.BigInteger;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
-import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
@@ -36,23 +34,12 @@ import org.slf4j.LoggerFactory;
 @Singleton
 public class NaptFlowRemovedEventHandler implements SalFlowListener {
     private static final Logger LOG = LoggerFactory.getLogger(NaptFlowRemovedEventHandler.class);
-    private final DataBroker dataBroker;
-    private final IMdsalApiManager mdsalManager;
+
     private final EventDispatcher naptEventdispatcher;
-    private final NaptPacketInHandler naptPacketInHandler;
-    private final NaptManager naptManager;
 
     @Inject
-    public NaptFlowRemovedEventHandler(final DataBroker dataBroker,
-                                       final IMdsalApiManager mdsalManager,
-                                       final EventDispatcher eventDispatcher,
-                                       final NaptPacketInHandler handler,
-                                       final NaptManager naptManager) {
-        this.dataBroker = dataBroker;
-        this.mdsalManager = mdsalManager;
+    public NaptFlowRemovedEventHandler(final EventDispatcher eventDispatcher) {
         this.naptEventdispatcher = eventDispatcher;
-        this.naptPacketInHandler = handler;
-        this.naptManager = naptManager;
     }
 
     @Override
index 4c18c9a6fd5f82b0c125e0fbfd43be34764550d7..1652631b7c79d9cb7e9f66831dbc03b3cb428c3d 100644 (file)
@@ -376,68 +376,6 @@ public class NaptManager {
         return null;
     }
 
-    /**
-     * Release the existing mapping of internal ip/port to external ip/port pair
-     * if no mapping exist for given internal ip/port, it returns false.
-     *
-     * @param segmentId - Router ID
-     * @param address   - Session Address
-     * @param protocol  - TCP/UDP
-     * @return true if mapping exist and the mapping is removed successfully
-     */
-    // TODO Clean up the exception handling
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    public boolean releaseAddressMapping(long segmentId, SessionAddress address, NAPTEntryEvent.Protocol protocol) {
-        LOG.debug("releaseAddressMapping : called with segmentId {}, internalIP {}, port {}",
-            segmentId, address.getIpAddress(), address.getPortNumber());
-        // delete entry from IpPort Map and IP Map if exists
-        String internalIpPort = address.getIpAddress() + ":" + address.getPortNumber();
-        SessionAddress existingIpPort = checkIpPortMap(segmentId, internalIpPort, protocol);
-        if (existingIpPort != null) {
-            // delete the entry from IpPortMap DS
-            try {
-                removeFromIpPortMapDS(segmentId, internalIpPort, protocol);
-            } catch (Exception e) {
-                LOG.error("releaseAddressMapping : failed, Removal of ipportmap {} for "
-                    + "router {} failed", internalIpPort, segmentId, e);
-                return false;
-            }
-        } else {
-            LOG.error("releaseAddressMapping : failed, segmentId {} and internalIpPort {} "
-                + "not found in IpPortMap DS", segmentId, internalIpPort);
-            return false;
-        }
-        String existingIp = checkIpMap(segmentId, address.getIpAddress());
-        if (existingIp != null) {
-            // delete the entry from IpMap DS
-            try {
-                removeFromIpMapDS(segmentId, address.getIpAddress());
-            } catch (Exception e) {
-                LOG.error("releaseAddressMapping : Removal of  ipmap {} for router {} failed",
-                    address.getIpAddress(), segmentId, e);
-                return false;
-            }
-            //delete the entry from snatIntIpportinfo
-            try {
-                removeFromSnatIpPortDS(segmentId, address.getIpAddress());
-            } catch (Exception e) {
-                LOG.error("releaseAddressMapping : failed, Removal of snatipportmap {} for "
-                    + "router {} failed", address.getIpAddress(), segmentId, e);
-                return false;
-            }
-        } else {
-            LOG.error("releaseAddressMapping : failed, segmentId {} and internalIpPort {} "
-                + "not found in IpMap DS", segmentId, internalIpPort);
-            return false;
-        }
-        // Finally release port from idmanager
-        removePortFromPool(internalIpPort, existingIpPort.getIpAddress());
-
-        LOG.debug("releaseAddressMapping : Exited successfully for segmentId {} and internalIpPort {}",
-                segmentId, internalIpPort);
-        return true;
-    }
-
     // TODO Clean up the exception handling
     @SuppressWarnings("checkstyle:IllegalCatch")
     protected void releaseIpExtPortMapping(long segmentId, SessionAddress address, NAPTEntryEvent.Protocol protocol) {
index 4b1ac6f9781132c46f5e19ee06b0b121f4dd11f1..1fcda14dc6e305df5a78bc9f096b4d972267ca16 100644 (file)
@@ -122,7 +122,7 @@ public class NaptPacketInHandler implements PacketProcessingListener {
 
                     NatPacketProcessingState state = INCOMING_PKT_MAP.get(sourceIPPortKey);
                     if (state == null) {
-                        state = new NatPacketProcessingState(System.currentTimeMillis(), -1);
+                        state = new NatPacketProcessingState(System.currentTimeMillis());
                         INCOMING_PKT_MAP.put(sourceIPPortKey, state);
                         LOG.trace("onPacketReceived : Processing new SNAT({}) Packet", sourceIPPortKey);
 
@@ -166,23 +166,16 @@ public class NaptPacketInHandler implements PacketProcessingListener {
 
     static class NatPacketProcessingState {
         private final long firstPacketInTime;
-        private volatile long flowInstalledTime;
 
-        NatPacketProcessingState(long firstPacketInTime, long flowInstalledTime) {
+        NatPacketProcessingState(long firstPacketInTime) {
             this.firstPacketInTime = firstPacketInTime;
-            this.flowInstalledTime = flowInstalledTime;
         }
 
         long getFirstPacketInTime() {
             return firstPacketInTime;
         }
 
-        long getFlowInstalledTime() {
-            return flowInstalledTime;
-        }
-
-        void setFlowInstalledTime(long flowInstalledTime) {
-            this.flowInstalledTime = flowInstalledTime;
+        void setFlowInstalledTime() {
         }
     }
 }
index 4dce44ee4f1c6abcd7d5f561bb10e723b64a1724..ca6336a0cb44262e1f0c373e934b26bad4022bea 100644 (file)
@@ -38,7 +38,6 @@ import org.opendaylight.genius.mdsalutil.MatchInfo;
 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
 import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.actions.ActionGroup;
-import org.opendaylight.genius.mdsalutil.actions.ActionNxResubmit;
 import org.opendaylight.genius.mdsalutil.actions.ActionSetFieldTunnelId;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionApplyActions;
 import org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable;
@@ -686,15 +685,6 @@ public class NaptSwitchHA {
         return NatConstants.INVALID_ID;
     }
 
-    public List<BucketInfo> handleGroupInPrimarySwitch() {
-        List<BucketInfo> listBucketInfo = new ArrayList<>();
-        List<ActionInfo> listActionInfoPrimary = new ArrayList<>();
-        listActionInfoPrimary.add(new ActionNxResubmit(NwConstants.INTERNAL_TUNNEL_TABLE));
-        BucketInfo bucketPrimary = new BucketInfo(listActionInfoPrimary);
-        listBucketInfo.add(bucketPrimary);
-        return listBucketInfo;
-    }
-
     @NonNull
     public List<BucketInfo> handleGroupInNeighborSwitches(BigInteger dpnId, String routerName, long routerId,
             BigInteger naptSwitch) {
index 90770d9d08c51b3e6699556dff6edda6f9541be4..833db729280d22f3010ee9e31d027319e76a15c0 100644 (file)
@@ -11,7 +11,6 @@ import java.util.List;
 import java.util.Objects;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
@@ -100,7 +99,7 @@ public class NatArpNotificationHandler implements OdlArputilListener {
         }
 
         VipState newVipState = this.vipStateTracker.buildVipState(srcIp.getIpv4Address().getValue(),
-                                    notification.getSrcMac().getValue(), notification.getDpnId(), targetIfc.getName());
+            notification.getDpnId(), targetIfc.getName());
         VipState cachedState = null;
         try {
             cachedState = this.vipStateTracker.get(newVipState.getIp()).orNull();
index 03394c9a4fb1544a1d26750f8268674fa3dfa193..c53b27fb6396a3ee6e2cf95d08f94dd78351c30f 100644 (file)
@@ -37,7 +37,6 @@ import org.apache.commons.net.util.SubnetUtils;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -260,7 +259,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.re
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.OpenvswitchOtherConfigs;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
@@ -492,14 +490,6 @@ public final class NatUtil {
         }
     }
 
-    @NonNull
-    public static List<Uuid> getRouterIdsfromNetworkId(DataBroker broker, Uuid networkId) {
-        InstanceIdentifier<Networks> id = buildNetworkIdentifier(networkId);
-        return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
-                LogicalDatastoreType.CONFIGURATION, id).toJavaUtil().map(Networks::getRouterIds).orElse(
-                emptyList());
-    }
-
     @Nullable
     static String getAssociatedExternalNetwork(DataBroker dataBroker, String routerId) {
         InstanceIdentifier<Routers> id = NatUtil.buildRouterIdentifier(routerId);
@@ -581,11 +571,6 @@ public final class NatUtil {
                 .build();
     }
 
-    public static long getIpAddress(byte[] rawIpAddress) {
-        return ((rawIpAddress[0] & 0xFF) << 3 * 8) + ((rawIpAddress[1] & 0xFF) << 2 * 8)
-            + ((rawIpAddress[2] & 0xFF) << 1 * 8) + (rawIpAddress[3] & 0xFF) & 0xffffffffL;
-    }
-
     @Nullable
     public static String getEndpointIpAddressForDPN(DataBroker broker, BigInteger dpnId) {
         String nextHopIp = null;
@@ -651,13 +636,6 @@ public final class NatUtil {
             .child(VpnInterface.class, new VpnInterfaceKey(vpnInterfaceName)).build();
     }
 
-    @Nullable
-    static VpnInterface getConfiguredVpnInterface(DataBroker broker, String interfaceName) {
-        InstanceIdentifier<VpnInterface> interfaceId = getVpnInterfaceIdentifier(interfaceName);
-        return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
-                LogicalDatastoreType.CONFIGURATION, interfaceId).orNull();
-    }
-
     @Nullable
     public static String getDpnFromNodeConnectorId(NodeConnectorId portId) {
         /*
@@ -2041,17 +2019,6 @@ public final class NatUtil {
         return tx.read(getVpnInstanceIdentifier(vpnName)).get().toJavaUtil().map(NatUtil::getPrimaryRd).orElse(null);
     }
 
-    public static String getPrimaryRd(DataBroker dataBroker, String vpnName) {
-        InstanceIdentifier<VpnInstance> id  = getVpnInstanceIdentifier(vpnName);
-        Optional<VpnInstance> vpnInstance =
-                SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
-                        LogicalDatastoreType.CONFIGURATION, id);
-        if (vpnInstance.isPresent()) {
-            return getPrimaryRd(vpnInstance.get());
-        }
-        return vpnName;
-    }
-
     @Nullable
     public static String getPrimaryRd(@Nullable VpnInstance vpnInstance) {
         if (vpnInstance == null) {
@@ -2073,17 +2040,6 @@ public final class NatUtil {
                 vpnConfig.getRouteDistinguisher()) : new ArrayList<>();
     }
 
-    public static long getVpnIdFromExternalSubnet(DataBroker dataBroker, String routerName, String externalIpAddress) {
-        if (routerName != null) {
-            Routers extRouter = NatUtil.getRoutersFromConfigDS(dataBroker, routerName);
-            if (extRouter != null) {
-                return getExternalSubnetVpnIdForRouterExternalIp(dataBroker, externalIpAddress, extRouter);
-            }
-        }
-
-        return NatConstants.INVALID_ID;
-    }
-
     public static String validateAndAddNetworkMask(String ipAddress) {
         return ipAddress.contains("/32") ? ipAddress : ipAddress + "/32";
     }
@@ -2094,13 +2050,6 @@ public final class NatUtil {
         new VpnInterfaceOpDataEntryKey(vpnInterfaceName, vpnName)).build();
     }
 
-    @Nullable
-    public static VpnInstanceOpDataEntry getVpnInstanceOpData(DataBroker broker, String rd) {
-        InstanceIdentifier<VpnInstanceOpDataEntry> id = NatUtil.getVpnInstanceOpDataIdentifier(rd);
-        return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(
-                 broker, LogicalDatastoreType.OPERATIONAL, id).orNull();
-    }
-
     public static boolean checkForRoutersWithSameExtNetAndNaptSwitch(DataBroker broker, Uuid networkId,
                                                                      String routerName, BigInteger dpnId) {
         InstanceIdentifier<Networks> id = buildNetworkIdentifier(networkId);
@@ -2353,30 +2302,6 @@ public final class NatUtil {
         }
     }
 
-    public static DpnInterfaces getElanInterfaceInfoByElanDpn(String elanInstanceName, BigInteger dpId,
-            DataBroker broker) {
-        InstanceIdentifier<DpnInterfaces> elanDpnInterfacesId =
-                getElanDpnInterfaceOperationalDataPath(elanInstanceName, dpId);
-        DpnInterfaces dpnInterfaces = null;
-        try {
-            dpnInterfaces = SingleTransactionDataBroker.syncRead(broker, LogicalDatastoreType.OPERATIONAL,
-                    elanDpnInterfacesId);
-        }
-        catch (ReadFailedException e) {
-            LOG.warn("Failed to read ElanDpnInterfacesList with error {}", e.getMessage());
-        }
-        return dpnInterfaces;
-    }
-
-    public static <T extends DataObject> Optional<T> read(DataBroker broker, LogicalDatastoreType datastoreType,
-            InstanceIdentifier<T> path) {
-        try (ReadOnlyTransaction tx = broker.newReadOnlyTransaction()) {
-            return tx.read(datastoreType, path).get();
-        } catch (InterruptedException | ExecutionException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
     public static boolean isLastExternalRouter(String networkid, String routerName, NatDataUtil natDataUtil) {
         Set<Map.Entry<String,Routers>> extRouter = natDataUtil.getAllRouters();
         for (Map.Entry<String,Routers> router : extRouter) {
@@ -2388,12 +2313,6 @@ public final class NatUtil {
         return true;
     }
 
-    public static InstanceIdentifier<ExtRouters> buildExtRouters() {
-        InstanceIdentifier<ExtRouters> extRouterInstanceIndentifier = InstanceIdentifier.builder(ExtRouters.class)
-                .build();
-        return extRouterInstanceIndentifier;
-    }
-
     @Nullable
     public static LearntVpnVipToPortData getLearntVpnVipToPortData(DataBroker dataBroker) {
         try {
@@ -2644,10 +2563,6 @@ public final class NatUtil {
         return null;
     }
 
-    public static String getIpv6JobKey(String routerName) {
-        return "Ipv6." + routerName;
-    }
-
     static ReentrantLock lockForNat(final BigInteger dataPath) {
         // FIXME: wrap this in an Identifier
         return JvmGlobalLocks.getLockForString(NatConstants.NAT_DJC_PREFIX + dataPath);
index 6d5e526517cb3afbeea657180f419e7cd7e66797..188658ee90d1a309a6c5b146abf3883448e7dca2 100644 (file)
@@ -35,7 +35,6 @@ import org.opendaylight.genius.mdsalutil.NwConstants;
 import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
 import org.opendaylight.infrautils.jobcoordinator.JobCoordinator;
 import org.opendaylight.infrautils.utils.concurrent.ListenableFutures;
-import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.netvirt.natservice.api.SnatServiceManager;
 import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
 import org.opendaylight.serviceutils.upgrade.UpgradeState;
@@ -66,7 +65,6 @@ public class RouterDpnChangeListener
     private final IdManagerService idManager;
     private final INeutronVpnManager nvpnManager;
     private final ExternalNetworkGroupInstaller extNetGroupInstaller;
-    private final IElanService elanManager;
     private final JobCoordinator coordinator;
     private final SnatServiceManager natServiceManager;
     private final NatMode natMode;
@@ -81,7 +79,6 @@ public class RouterDpnChangeListener
                                    final INeutronVpnManager nvpnManager,
                                    final SnatServiceManager natServiceManager,
                                    final NatserviceConfig config,
-                                   final IElanService elanManager,
                                    final JobCoordinator coordinator,
                                    final UpgradeState upgradeState) {
         super(DpnVpninterfacesList.class, RouterDpnChangeListener.class);
@@ -93,7 +90,6 @@ public class RouterDpnChangeListener
         this.idManager = idManager;
         this.extNetGroupInstaller = extNetGroupInstaller;
         this.nvpnManager = nvpnManager;
-        this.elanManager = elanManager;
         this.natServiceManager = natServiceManager;
         this.coordinator = coordinator;
         this.natMode = config != null ? config.getNatMode() : NatMode.Controller;
@@ -211,7 +207,7 @@ public class RouterDpnChangeListener
                                         LOG.error("add : External Network Provider Type missing");
                                         return;
                                     }
-                                    handleSNATForDPN(dpnId, routerUuid, routerId, vpnId, confTx, extNwProvType);
+                                    handleSNATForDPN(dpnId, routerUuid, routerId, vpnId, confTx);
                                 } else {
                                     LOG.info("add : SNAT is not enabled for router {} to handle addDPN event {}",
                                         routerUuid, dpnId);
@@ -322,7 +318,7 @@ public class RouterDpnChangeListener
     }
 
     void handleSNATForDPN(BigInteger dpnId, String routerName, long routerId, Long routerVpnId,
-        TypedReadWriteTransaction<Configuration> confTx, ProviderTypes extNwProvType) {
+        TypedReadWriteTransaction<Configuration> confTx) {
        //Check if primary and secondary switch are selected, If not select the role
         //Install select group to NAPT switch
         //Install default miss entry to NAPT switch
index 86659abc774cb540706a5608b8541d1763dbcb69..7da7b391a8d8ad3eb5b5a43cc4cf2248892a6aa6 100644 (file)
@@ -18,7 +18,6 @@ import org.opendaylight.infrautils.inject.AbstractLifecycle;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
 import org.opendaylight.netvirt.natservice.ha.NatDataUtil;
-import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
 import org.opendaylight.netvirt.vpnmanager.api.IVpnFootprintService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
@@ -40,7 +39,6 @@ public class SnatServiceImplFactory extends AbstractLifecycle {
     private final IdManagerService idManager;
     private final NAPTSwitchSelector naptSwitchSelector;
     private final NatMode natMode;
-    private final INeutronVpnManager nvpnManager;
     private final ExternalRoutersListener externalRouterListener;
     private final IElanService elanManager;
     private final IInterfaceManager interfaceManager;
@@ -58,7 +56,6 @@ public class SnatServiceImplFactory extends AbstractLifecycle {
                                   final IdManagerService idManager,
                                   final NAPTSwitchSelector naptSwitchSelector,
                                   final NatserviceConfig config,
-                                  final INeutronVpnManager nvpnManager,
                                   final ExternalRoutersListener externalRouterListener,
                                   final IElanService elanManager,
                                   final IInterfaceManager interfaceManager,
@@ -79,7 +76,6 @@ public class SnatServiceImplFactory extends AbstractLifecycle {
         } else {
             this.natMode = null;
         }
-        this.nvpnManager = nvpnManager;
         this.externalRouterListener = externalRouterListener;
         this.elanManager = elanManager;
         this.interfaceManager = interfaceManager;
index dcd828d6fc7d9faced8465e8fba15deed43881f5..c4ad93c38b1c24bcbbcf50d28565e01d626a402f 100644 (file)
@@ -41,16 +41,10 @@ public class SnatServiceManagerImpl implements SnatServiceManager {
         }
     }
 
-    @Override
-    public void addNatServiceListener(SnatServiceListener natServiceListner) {
+    private void addNatServiceListener(SnatServiceListener natServiceListner) {
         snatServiceListeners.add(natServiceListner);
     }
 
-    @Override
-    public void removeNatServiceListener(SnatServiceListener natServiceListner) {
-        snatServiceListeners.remove(natServiceListner);
-    }
-
     @Override
     public void notify(TypedReadWriteTransaction<Datastore.Configuration> confTx,
             Routers router,  Routers oldRouter, BigInteger primarySwitchId, BigInteger dpnId, Action action)
index 77c19d34fc71411fce5443aaf833aa45e4ed9ad1..5658d2bf0ec1aeacba4766753680d0eb56f0f1f3 100644 (file)
@@ -13,7 +13,6 @@ import com.google.common.util.concurrent.FluentFuture;
 import java.math.BigInteger;
 import javax.inject.Inject;
 import javax.inject.Singleton;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.genius.infra.ManagedNewTransactionRunner;
@@ -44,7 +43,7 @@ public class VipStateTracker extends DataObjectCache<String, VipState> {
         this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
     }
 
-    public VipState buildVipState(String ip, String mac, BigInteger dpnId, String ifcName) {
+    public VipState buildVipState(String ip, BigInteger dpnId, String ifcName) {
         return new VipStateBuilder().setIp(ip).setDpnId(dpnId).setIfcName(ifcName).build();
     }
 
index 9348678054621ef3fdd8dc6ec437733949968450..1a1f1e1016e405a774359cda7d742bb04d42a3bf 100644 (file)
@@ -50,7 +50,6 @@ import org.opendaylight.netvirt.bgpmanager.api.IBgpManager;
 import org.opendaylight.netvirt.elanmanager.api.IElanService;
 import org.opendaylight.netvirt.fibmanager.api.IFibManager;
 import org.opendaylight.netvirt.fibmanager.api.RouteOrigin;
-import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
 import org.opendaylight.netvirt.vpnmanager.api.IVpnManager;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
@@ -106,7 +105,6 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
     private final OdlArputilService arpUtilService;
     private final IElanService elanService;
     private final EvpnDnatFlowProgrammer evpnDnatFlowProgrammer;
-    private final INeutronVpnManager nvpnManager;
     private final NatServiceCounters natServiceCounters;
     private final NatOverVxlanUtil natOverVxlanUtil;
 
@@ -120,7 +118,6 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
                                 final IVpnManager vpnManager,
                                 final IElanService elanService,
                                 final EvpnDnatFlowProgrammer evpnDnatFlowProgrammer,
-                                final INeutronVpnManager nvpnManager,
                                 final NatOverVxlanUtil natOverVxlanUtil,
                                 NatServiceCounters natServiceCounters) {
         this.dataBroker = dataBroker;
@@ -134,7 +131,6 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
         this.vpnManager = vpnManager;
         this.elanService = elanService;
         this.evpnDnatFlowProgrammer = evpnDnatFlowProgrammer;
-        this.nvpnManager = nvpnManager;
         this.natServiceCounters = natServiceCounters;
         this.natOverVxlanUtil = natOverVxlanUtil;
     }
@@ -331,7 +327,7 @@ public class VpnFloatingIpHandler implements FloatingIPHandler {
         if (provType == ProviderTypes.VXLAN) {
             Uuid floatingIpInterface = NatEvpnUtil.getFloatingIpInterfaceIdFromFloatingIpId(dataBroker, floatingIpId);
             evpnDnatFlowProgrammer.onRemoveFloatingIp(dpnId, vpnName, externalIp, floatingIpInterface.getValue(),
-                    floatingIpPortMacAddress, routerId, confTx);
+                    floatingIpPortMacAddress, routerId);
             return;
         }
         cleanupFibEntries(dpnId, vpnName, externalIp, label, confTx, provType);