From ff1fa35b7199b2e861d675ff7d9d7c49283198db Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Mon, 11 May 2015 14:08:45 -0700 Subject: [PATCH] Remove dependency on clusterdao This is part of an effort to remove adsal dependencies. Instead of clusterdao we use HashMapDb, as an in memory map-server datastore. Change-Id: Iccf7eccefe83e36fbf98e819b88a6036f7a7d4cf Signed-off-by: Florin Coras --- features/pom.xml | 4 ++-- features/src/main/resources/features.xml | 4 ++-- .../lispflowmapping/implementation/Activator.java | 2 -- .../lispflowmapping/implementation/LispMappingService.java | 5 +++++ .../integrationtest/MappingServiceIntegrationTest.java | 7 ++++--- mappingservice/southbound/pom.xml | 1 - 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/features/pom.xml b/features/pom.xml index 572018d29..415bce715 100644 --- a/features/pom.xml +++ b/features/pom.xml @@ -94,10 +94,10 @@ org.opendaylight.lispflowmapping mappingservice.api - + org.opendaylight.lispflowmapping mappingservice.config diff --git a/features/src/main/resources/features.xml b/features/src/main/resources/features.xml index bc4f278d4..15164ee8b 100644 --- a/features/src/main/resources/features.xml +++ b/features/src/main/resources/features.xml @@ -31,7 +31,7 @@ odl-mdsal-broker odl-mdsal-apidocs odl-adsal-core - odl-adsal-clustering + odl-yangtools-binding odl-yangtools-models mvn:com.google.guava/guava/${guava.version} @@ -39,7 +39,7 @@ mvn:org.opendaylight.lispflowmapping/mappingservice.api/${lispflowmapping.version} mvn:org.opendaylight.lispflowmapping/mappingservice.implementation/${lispflowmapping.version} mvn:org.opendaylight.lispflowmapping/mappingservice.shell/${lispflowmapping.version} - mvn:org.opendaylight.lispflowmapping/mappingservice.clusterdao/${lispflowmapping.version} + mvn:org.opendaylight.lispflowmapping/mappingservice.implementation/${lispflowmapping.version}/xml/config diff --git a/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java b/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java index 0fd4eb85f..ec64d94f5 100644 --- a/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java +++ b/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java @@ -81,8 +81,6 @@ public class Activator extends ComponentActivatorAbstractBase { Dictionary props = new Hashtable(); props.put("name", "mappingservice"); c.setInterface(new String[] { IFlowMapping.class.getName(), IFlowMappingShell.class.getName() }, props); - c.add(createContainerServiceDependency(containerName).setService(ILispDAO.class).setCallbacks("setLispDao", "unsetLispDao") - .setRequired(true)); c.add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true) .setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker")); } diff --git a/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java b/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java index da734cccb..5e994fbf9 100644 --- a/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java +++ b/mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java @@ -19,6 +19,7 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; import org.opendaylight.controller.sal.binding.api.NotificationListener; import org.opendaylight.controller.sal.binding.api.NotificationService; import org.opendaylight.lispflowmapping.implementation.config.ConfigIni; +import org.opendaylight.lispflowmapping.implementation.dao.HashMapDb; import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKey; import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKeyUtil; import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceNoMaskKey; @@ -108,7 +109,11 @@ public class LispMappingService implements CommandProvider, IFlowMapping, IFlowM LOG.debug("BindingAwareBroker set!"); BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); bindingAwareBroker.registerProvider(this, bundleContext); + + // For the time being we initialize variables here. But once we remove the activator, these should + // be moved to the constructor. lfmService = this; + setLispDao(new HashMapDb()); } void unsetBindingAwareBroker(BindingAwareBroker bindingAwareBroker) { diff --git a/mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java b/mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java index 3e8d600a8..ee0c03893 100644 --- a/mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java +++ b/mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java @@ -32,7 +32,6 @@ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; -import java.util.concurrent.TimeUnit; import javax.inject.Inject; @@ -1512,8 +1511,10 @@ public class MappingServiceIntegrationTest { } private void causeEntryToBeCleaned() { - clusterService.setTimeUnit(TimeUnit.NANOSECONDS); - clusterService.cleanOld(); + // TODO for the time being, to keep master and stable/lithium in sync, we need to remove the forceful + // expiration of DAO entries. Once we're past this, we'll have to expose methods to setTimeUnit(TimeUnit) + // and cleanOld() (expired) entries in IFlowMapping (and perhaps ILispDAO) and use them here. + this.lms.clean(); } private void testTTLAfterRegister(MapRequest mapRequest) throws SocketTimeoutException { diff --git a/mappingservice/southbound/pom.xml b/mappingservice/southbound/pom.xml index 01280e36f..b4808dc25 100644 --- a/mappingservice/southbound/pom.xml +++ b/mappingservice/southbound/pom.xml @@ -61,7 +61,6 @@ org.opendaylight.lispflowmapping.type, org.opendaylight.lispflowmapping.type.lisp, org.opendaylight.lispflowmapping.type.sbplugin, - org.opendaylight.controller.clustering.services, org.opendaylight.lispflowmapping.implementation.serializer, org.opendaylight.lispflowmapping.implementation.util, org.opendaylight.controller.sal.binding.api, -- 2.36.6