Merge "Bug 6297: Change subscriber's RLOC selection algo"
authorLori Jakab <lorand.jakab@gmail.com>
Fri, 5 Aug 2016 13:24:47 +0000 (13:24 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 5 Aug 2016 13:24:47 +0000 (13:24 +0000)
mappingservice/lisp-proto/pom.xml
mappingservice/neutron/pom.xml
mappingservice/pom.xml
mappingservice/southbound/pom.xml
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPlugin.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/lisp/LispSouthboundHandler.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/lisp/LispXtrSouthboundHandler.java
mappingservice/southbound/src/main/resources/org/opendaylight/blueprint/mappingservice-southbound.xml
mappingservice/southbound/src/test/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPluginTest.java

index efd988e20091fd82f924c206ff7651b722e6b7f6..cea7dbc72f3a3718f9d276bce935f3843d06d31c 100644 (file)
@@ -47,6 +47,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <groupId>org.opendaylight.lispflowmapping</groupId>
       <artifactId>common.unittest.tools</artifactId>
       <version>${project.version}</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>junit-addons</groupId>
index 6875b5a580eb908203beea91e6ddd9b96131c1fa..c4ab77555ea2ca36d2d99482020e5d42df5ccc7f 100644 (file)
       <artifactId>model</artifactId>
       <version>0.7.0-SNAPSHOT</version>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.lispflowmapping</groupId>
+      <artifactId>common.unittest.tools</artifactId>
+    </dependency>
   </dependencies>
 
   <build>
index 81848832439ff239612a01e5795e9fb458e8e1a3..a1d1346cf99cb4d8486a4fcb2d4e7015bdbedb31 100644 (file)
@@ -59,6 +59,7 @@
         <groupId>${project.groupId}</groupId>
         <artifactId>common.unittest.tools</artifactId>
         <version>${project.version}</version>
+        <scope>test</scope>
       </dependency>
       <dependency>
         <groupId>junit-addons</groupId>
index acdfe0f23ef13f5496643c28ac0c99b106b8f6aa..40368ea51e184a245449c98e62f97c67d11b0596 100644 (file)
       <groupId>${project.groupId}</groupId>
       <artifactId>mappingservice.api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>mappingservice.clustering</artifactId>
-    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>mappingservice.inmemorydb</artifactId>
       <groupId>junit-addons</groupId>
       <artifactId>junit-addons</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.lispflowmapping</groupId>
+      <artifactId>common.unittest.tools</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.powermock</groupId>
       <artifactId>powermock-api-mockito</artifactId>
index a437edd6f282be5964cb66b3564e4565487494a5..13e3beef6a3e60aac6aed7d9f599924b5a7eecf3 100644 (file)
@@ -31,10 +31,7 @@ import java.util.concurrent.ThreadFactory;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.lispflowmapping.clustering.ClusterNodeModulSwitcherImpl;
-import org.opendaylight.lispflowmapping.clustering.api.ClusterNodeModuleSwitcher;
 import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispXtrSouthboundHandler;
@@ -46,7 +43,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.OdlLi
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCloseable, ClusterNodeModuleSwitcher {
+public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCloseable {
     protected static final Logger LOG = LoggerFactory.getLogger(LispSouthboundPlugin.class);
 
     private volatile String bindingAddress;
@@ -54,7 +51,6 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
     private long mapRegisterCacheTimeout;
 
     private static Object startLock = new Object();
-    private final ClusterNodeModulSwitcherImpl clusterNodeModulSwitcher;
     private LispSouthboundHandler lispSouthboundHandler;
     private LispXtrSouthboundHandler lispXtrSouthboundHandler;
     private NotificationPublishService notificationPublishService;
@@ -71,12 +67,9 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
     private DataBroker dataBroker;
 
     public LispSouthboundPlugin(final DataBroker dataBroker,
-            final NotificationPublishService notificationPublishService,
-            final EntityOwnershipService entityOwnershipService) {
+            final NotificationPublishService notificationPublishService) {
         this.dataBroker = dataBroker;
         this.notificationPublishService = notificationPublishService;
-        clusterNodeModulSwitcher = new ClusterNodeModulSwitcherImpl(entityOwnershipService);
-        clusterNodeModulSwitcher.setModule(this);
     }
 
     public void init() {
@@ -106,7 +99,6 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
 
             LOG.info("LISP (RFC6830) Southbound Plugin is up!");
         }
-        clusterNodeModulSwitcher.switchModuleByEntityOwnership();
     }
 
     private void start() {
@@ -284,27 +276,4 @@ public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCl
         lispSouthboundHandler.close();
         unloadActions();
     }
-
-    @Override
-    public void stopModule() {
-        if (lispSouthboundHandler != null) {
-            lispSouthboundHandler.setNotificationProvider(null);
-            lispSouthboundHandler.setIsReadFromChannelEnabled(false);
-        }
-        if (lispXtrSouthboundHandler != null) {
-            lispXtrSouthboundHandler.setNotificationProvider(null);
-        }
-    }
-
-    @Override
-    public void startModule() {
-        if (lispSouthboundHandler != null) {
-            lispSouthboundHandler.setNotificationProvider(notificationPublishService);
-            lispSouthboundHandler.restoreDaoFromDatastore();
-            lispSouthboundHandler.setIsReadFromChannelEnabled(true);
-        }
-        if (lispXtrSouthboundHandler != null) {
-            lispXtrSouthboundHandler.setNotificationProvider(notificationPublishService);
-        }
-    }
 }
index 38793b5b6adcf6523c115b181fe09e0ef088cb60..dba899a532b299af0db0a43e37ec82151807d430 100644 (file)
@@ -94,7 +94,6 @@ public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramP
     private SimpleMapCache smc;
     private AuthenticationKeyDataListener authenticationKeyDataListener;
     private DataStoreBackEnd dsbe;
-    private boolean isReadFromChannelEnabled = true;
 
     public LispSouthboundHandler(LispSouthboundPlugin lispSbPlugin) {
         this.lispSbPlugin = lispSbPlugin;
@@ -499,13 +498,11 @@ public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramP
 
     @Override
     protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
-        if (isReadFromChannelEnabled) {
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
-                        msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
-            }
-            handlePacket(msg);
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+                    msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
         }
+        handlePacket(msg);
     }
 
     @Override
@@ -567,10 +564,6 @@ public class LispSouthboundHandler extends SimpleChannelInboundHandler<DatagramP
         dsbe = new DataStoreBackEnd(dataBroker);
     }
 
-    public void setIsReadFromChannelEnabled(boolean isReadFromChannelEnabled) {
-        this.isReadFromChannelEnabled = isReadFromChannelEnabled;
-    }
-
     public void setMapRegisterCacheTimeout(long mapRegisterCacheTimeout) {
         this.mapRegisterCacheTimeout = mapRegisterCacheTimeout;
     }
index 668c116752f283375c71550084cb396bb063e950..eaff645ee968fc2a72c6813dc04c3ea4eda64f3b 100644 (file)
@@ -110,7 +110,7 @@ public class LispXtrSouthboundHandler extends SimpleChannelInboundHandler<Datagr
     @Override
     protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
         if (LOG.isTraceEnabled()) {
-            LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+            LOG.trace("Received xTR UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
                     msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
         }
         handlePacket(msg);
index 712a07ce909a6fa0ed312a8c9b104c180390a5fc..43b7bc4f79ae5c86930f29dc4ce311b032a556bd 100644 (file)
@@ -10,8 +10,6 @@
     odl:type="pingpong" />
   <reference id="notificationPublishService"
     interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" />
-  <reference id="entityOwnershipService"
-     interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService" />
 
 
   <cm:property-placeholder persistent-id="org.opendaylight.lispflowmapping" update-strategy="none">
@@ -27,7 +25,6 @@
     init-method="init" destroy-method="close">
     <argument ref="dataBroker" />
     <argument ref="notificationPublishService" />
-    <argument ref="entityOwnershipService" />
     <property name="bindingAddress" value="${bindingAddressProperty}"/>
     <property name="mapRegisterCacheEnabled" value="${mapRegisterCacheEnabledProperty}"/>
     <property name="mapRegisterCacheTimeout" value="${mapRegisterCacheTimeoutProperty}"/>
index c7add0d734d59f5fd3205d463270935bd09e340f..9242172f6bf1a637cbe2e38deedfb36d975eb2cd 100644 (file)
@@ -28,7 +28,6 @@ import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler;
@@ -74,8 +73,7 @@ public class LispSouthboundPluginTest {
     public void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException {
         lispSouthboundPlugin = new LispSouthboundPlugin(
                 Mockito.mock(DataBroker.class),
-                Mockito.mock(NotificationPublishService.class),
-                Mockito.mock(EntityOwnershipService.class));
+                Mockito.mock(NotificationPublishService.class));
         lispSouthboundPlugin.setBindingAddress(ADDRESS_1);
         lispSouthboundPlugin.setMapRegisterCacheEnabled(false);
         channel = PowerMockito.mock(NioDatagramChannel.class);