moved xtr config to ilispconfig 15/7315/1
authorDavid Goldberg <david.goldberg@contextream.com>
Wed, 21 May 2014 16:45:02 +0000 (19:45 +0300)
committerDavid Goldberg <david.goldberg@contextream.com>
Wed, 21 May 2014 16:45:02 +0000 (19:45 +0300)
Change-Id: I85a9832db007da1353e3758fae5e65bcd9f1711a
Signed-off-by: David Goldberg <david.goldberg@contextream.com>
mappingservice/api/src/main/java/org/opendaylight/lispflowmapping/interfaces/lisp/IFlowMapping.java
mappingservice/api/src/main/java/org/opendaylight/lispflowmapping/type/sbplugin/IConfigLispSouthboundPlugin.java [moved from mappingservice/api/src/main/java/org/opendaylight/lispflowmapping/type/sbplugin/IConfigLispPlugin.java with 75% similarity]
mappingservice/config/src/main/java/org/opendaylight/lispflowmapping/config/yang/LispConfigContextSetterImpl.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/southbound/src/main/java/org/opendaylight/lispflowmapping/southbound/LispSouthboundPlugin.java
mappingservice/yangmodel/.gitignore
mappingservice/yangmodel/src/main/yang/mappingservice.yang

index 663beb8033c20de05fbdc6f1b159db373a06e678..a127b6d6d296e6e6073b8224c609f49eaf8207bb 100644 (file)
@@ -19,14 +19,10 @@ public interface IFlowMapping extends IMapResolver, IMapServer {
 
     public void clean();
 
-    public void shouldListenOnXtrPort(boolean listenOnXtrPort);
-
     public void setShouldUseSmr(boolean smr);
 
     public boolean shouldUseSmr();
 
-    public void setXtrPort(int port);
-
     public MapNotify handleMapRegister(MapRegister mb);
 
     public MapReply handleMapRequest(MapRequest mr);
similarity index 75%
rename from mappingservice/api/src/main/java/org/opendaylight/lispflowmapping/type/sbplugin/IConfigLispPlugin.java
rename to mappingservice/api/src/main/java/org/opendaylight/lispflowmapping/type/sbplugin/IConfigLispSouthboundPlugin.java
index ea2bf372dd869ece9070936344e013fbca045a09..931baec580651f871fb2a196d362c20e384d63d8 100644 (file)
@@ -10,6 +10,9 @@ package org.opendaylight.lispflowmapping.type.sbplugin;
 /**
  * An interface for configuring the lisp plugin address.
  */
-public interface IConfigLispPlugin {
+public interface IConfigLispSouthboundPlugin {
     public void setLispAddress(String address);
+
+    public void shouldListenOnXtrPort(boolean shouldListenOnXtrPort);
+    public void setXtrPort(int port);
 }
index 47a58700766d8172f9faea8140b26c4eea6b2c6d..291d2796b517bedc4b73954b107c31609565bb54 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.lispflowmapping.config.yang;
 import java.io.Closeable;
 import java.io.IOException;
 
-import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispPlugin;
+import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.FrameworkUtil;
 
@@ -18,8 +18,8 @@ public class LispConfigContextSetterImpl implements Closeable {
 
     public void updateContext(LispConfigModule module) {
         BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
-        IConfigLispPlugin service = (IConfigLispPlugin) bundleContext
-                .getService(bundleContext.getServiceReference(IConfigLispPlugin.class.getName()));
+        IConfigLispSouthboundPlugin service = (IConfigLispSouthboundPlugin) bundleContext
+                .getService(bundleContext.getServiceReference(IConfigLispSouthboundPlugin.class.getName()));
         service.setLispAddress(module.getBindAddress());
     }
 
index 986cf7ca8f282243c10f73ba7b334c609aa47e90..631dc3d7e09160dea1d8b57ee2836e1b202b04cb 100644 (file)
@@ -43,8 +43,6 @@ import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.RequestMapping;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SendMapNotifyInputBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SendMapReplyInputBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SendMapRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SetXtrPortInputBuilder;
-import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.ShouldListenOnXtrPortInputBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainer;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.LispAddressContainerBuilder;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.lispaddress.lispaddresscontainer.Address;
@@ -359,14 +357,4 @@ public class LispMappingService implements CommandProvider, IFlowMapping, Bindin
         mapServer.setOverwrite(overwrite);
     }
 
-    @Override
-    public void shouldListenOnXtrPort(boolean listenOnXtrPort) {
-        getLispSB().shouldListenOnXtrPort(new ShouldListenOnXtrPortInputBuilder().setShouldListenOnXtrPort(listenOnXtrPort).build());
-    }
-
-    @Override
-    public void setXtrPort(int port) {
-        getLispSB().setXtrPort(new SetXtrPortInputBuilder().setXtrPort(new PortNumber(port)).build());
-    }
-
 }
index 72f4816fe0a2c6d949a552e31746d5746321783c..ccd9c0daf2a94705d37e4ffde1026e088907df1c 100644 (file)
@@ -57,7 +57,7 @@ import org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
 import org.opendaylight.lispflowmapping.type.AddressFamilyNumberEnum;
 import org.opendaylight.lispflowmapping.type.LispCanonicalAddressFormatEnum;
-import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispPlugin;
+import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.EidToLocatorRecord.Action;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafApplicationDataAddress;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LcafKeyValueAddress;
@@ -135,7 +135,7 @@ public class MappingServiceIntegrationTest {
     private byte[] mapRequestPacket;
     private byte[] mapRegisterPacketWithNotify;
     private byte[] mapRegisterPacketWithoutNotify;
-    private IConfigLispPlugin configLispPlugin;
+    private IConfigLispSouthboundPlugin configLispPlugin;
     String lispBindAddress = "127.0.0.1";
     String ourAddress = "127.0.0.2";
     private LispAFIAddress locatorEid;
@@ -1422,7 +1422,7 @@ public class MappingServiceIntegrationTest {
 
     public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
         cleanUP();
-        lms.shouldListenOnXtrPort(true);
+        configLispPlugin.shouldListenOnXtrPort(true);
         notificationCalled = false;
         final String eid = "10.10.10.10";
         String rloc = "127.0.0.3";
@@ -1660,12 +1660,12 @@ public class MappingServiceIntegrationTest {
         }
 
         assertNotNull(ILispDAO.class.getName() + " service wasn't found in bundle context ", this.clusterService);
-        r = bc.getServiceReference(IConfigLispPlugin.class.getName());
+        r = bc.getServiceReference(IConfigLispSouthboundPlugin.class.getName());
         if (r != null) {
-            this.configLispPlugin = (IConfigLispPlugin) bc.getService(r);
+            this.configLispPlugin = (IConfigLispSouthboundPlugin) bc.getService(r);
         }
 
-        assertNotNull(IConfigLispPlugin.class.getName() + " service wasn't found in bundle context ", this.configLispPlugin);
+        assertNotNull(IConfigLispSouthboundPlugin.class.getName() + " service wasn't found in bundle context ", this.configLispPlugin);
         configLispPlugin.setLispAddress(lispBindAddress);
 
         // Uncomment this code to Know which services were actually loaded to
@@ -1702,7 +1702,7 @@ public class MappingServiceIntegrationTest {
     private void cleanUP() {
         after();
         lms.clean();
-        lms.shouldListenOnXtrPort(false);
+        configLispPlugin.shouldListenOnXtrPort(false);
         socket = initSocket(socket, LispMessage.PORT_NUM);
 
     }
index 1594044ffcd986fd57b42be11c82a7e921a27da9..311d19aae398454ec68813fa967a3407604e20dc 100644 (file)
@@ -29,13 +29,11 @@ import org.opendaylight.lispflowmapping.implementation.serializer.MapRequestSeri
 import org.opendaylight.lispflowmapping.southbound.lisp.ILispSouthboundService;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundService;
 import org.opendaylight.lispflowmapping.southbound.lisp.LispXtrSouthboundService;
-import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispPlugin;
+import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.LispflowmappingService;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SendMapNotifyInput;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SendMapReplyInput;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SendMapRequestInput;
-import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.SetXtrPortInput;
-import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.ShouldListenOnXtrPortInput;
 import org.opendaylight.yang.gen.v1.lispflowmapping.rev131031.transportaddress.TransportAddress;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.osgi.framework.BundleContext;
@@ -45,7 +43,7 @@ import org.slf4j.LoggerFactory;
 
 import com.google.common.net.InetAddresses;
 
-public class LispSouthboundPlugin extends AbstractBindingAwareProvider implements IConfigLispPlugin, CommandProvider, LispflowmappingService {
+public class LispSouthboundPlugin extends AbstractBindingAwareProvider implements IConfigLispSouthboundPlugin, CommandProvider, LispflowmappingService {
     protected static final Logger logger = LoggerFactory.getLogger(LispSouthboundPlugin.class);
 
     private static Object startLock = new Object();
@@ -67,7 +65,7 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
     private void registerWithOSGIConsole() {
         BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
         bundleContext.registerService(CommandProvider.class.getName(), this, null);
-        bundleContext.registerService(IConfigLispPlugin.class.getName(), this, null);
+        bundleContext.registerService(IConfigLispSouthboundPlugin.class.getName(), this, null);
     }
 
     protected void stopImpl(BundleContext context) {
@@ -312,29 +310,22 @@ public class LispSouthboundPlugin extends AbstractBindingAwareProvider implement
     }
 
     @Override
-    public Future<RpcResult<Void>> shouldListenOnXtrPort(ShouldListenOnXtrPortInput input) {
-       logger.debug("got a call to shouldListenOnXtrPort");
-        if (listenOnXtrPort == input.isShouldListenOnXtrPort()) {
-           logger.debug("no action done, ond and new value are identical, " + listenOnXtrPort); 
-            return null;
-        }
-        listenOnXtrPort = input.isShouldListenOnXtrPort();
+    public void shouldListenOnXtrPort(boolean shouldListenOnXtrPort) {
+        listenOnXtrPort = shouldListenOnXtrPort;
         if (listenOnXtrPort) {
-           logger.debug("restarting xtr thread");
+            logger.debug("restarting xtr thread");
             restartXtrThread();
         } else {
-           logger.debug("terminating thread");
+            logger.debug("terminating thread");
             stopXtrThread();
         }
-        return null;
     }
 
     @Override
-    public Future<RpcResult<Void>> setXtrPort(SetXtrPortInput input) {
-        this.xtrPort = input.getXtrPort().getValue();
+    public void setXtrPort(int port) {
+        this.xtrPort = port;
         if (listenOnXtrPort) {
             restartXtrThread();
         }
-        return null;
     }
 }
index ff7de55d35abb064d80477126511e948d4be9ecb..ce9b0867321c2265a8578f01438a09a8abaa7233 100644 (file)
@@ -8,3 +8,4 @@
 /target
 /target
 /target
+/target
index fea73786ab511fb50ff91f72ef7a33517219d443..3445e13a81b906f746e92f9e67346563208a9398 100755 (executable)
        }
     }
     
-    rpc shouldListenOnXtrPort {
-       input {
-               leaf shouldListenOnXtrPort {
-               type boolean;
-               }
-       }
-    }
-    
-    rpc setXtrPort {
-       input {
-               leaf xtrPort {
-               type inet:port-number;
-               }
-       }
-    }
-    
     notification addMapping {
        uses MapRegisterNotification;
     }