Remove mappingservice.implementation activator 79/21479/2
authorFlorin Coras <fcoras@cisco.com>
Sat, 16 May 2015 00:13:16 +0000 (17:13 -0700)
committerFlorin Coras <fcoras@cisco.com>
Mon, 1 Jun 2015 16:50:32 +0000 (09:50 -0700)
Change-Id: I6f5087f62fb129786092639d663a6c41fc2f98f3
Signed-off-by: Florin Coras <fcoras@cisco.com>
mappingservice/implementation/pom.xml
mappingservice/implementation/src/main/config/default-config.xml
mappingservice/implementation/src/main/java/org/opendaylight/controller/config/yang/config/lfm_mappingservice/impl/LfmMappingServiceModule.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/Activator.java [deleted file]
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LfmMappingDatabaseRpc.java [moved from mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/provider/LfmMappingDatabaseProviderRpc.java with 96% similarity]
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/yang/lfm-mappingservice-impl.yang
mappingservice/integrationtest/pom.xml
mappingservice/integrationtest/src/main/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceTestHelper.java
mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java
mappingservice/integrationtest/src/test/resources/controller.xml

index 161ffcd21a19c63c47cac75a80d7a1216fbaec52..dc943b0bf78d36c2dd1d84daa4a2d52878a519d4 100644 (file)
@@ -74,8 +74,6 @@
 
   <build>
      <plugins>
-        <!-- We still need the activator for interacting with services that rely on activators for 
-             service discovery, but it should be deprecated soon -->
        <plugin>
          <groupId>org.apache.felix</groupId>
          <artifactId>maven-bundle-plugin</artifactId>
@@ -87,7 +85,6 @@
                org.opendaylight.lispflowmapping.implementation.serializer,
                org.opendaylight.lispflowmapping.implementation.util
              </Export-Package>
-             <Bundle-Activator>org.opendaylight.lispflowmapping.implementation.Activator</Bundle-Activator>
            </instructions>
          </configuration>
        </plugin>
index 378d09d590d414be8fe597a61e5111ef6feb2596..bce866835582a05edcc32a302ff58589dbdab00f 100644 (file)
@@ -2,14 +2,14 @@
 <snapshot>
     <required-capabilities>
         <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&amp;revision=2013-10-28</capability>
-        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl?module=lfm-mappingservice-impl&amp;revision=2015-05-07</capability>
+        <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl?module=lfm-mappingservice-impl&amp;revision=2015-05-17</capability>
     </required-capabilities>
     <configuration>
         <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
             <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                 <module>
                     <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl">
-                        prefix:lfm-mappingservice
+                        prefix:lfm-mappingservice-impl
                     </type>
                     <name>lfm-mappingservice-default</name>
 
                     </broker>
                 </module>
             </modules>
+            <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+              <service>
+                <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl">prefix:lfm-mappingservice</type>
+                <instance>
+                  <name>lfm-mappingservice</name>
+                  <provider>/modules/module[type='lfm-mappingservice-impl'][name='lfm-mappingservice-default']
+                  </provider>
+                </instance>
+              </service>
+            </services>
         </data>
 
     </configuration>
index e6e884171e302d0d1c670d36b049787b269a3071..fe59f3fa6174cf247b0a6821710e063558dee30c 100644 (file)
@@ -8,16 +8,13 @@
 
 package org.opendaylight.controller.config.yang.config.lfm_mappingservice.impl;
 
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.lispflowmapping.implementation.provider.LfmMappingDatabaseProviderRpc;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.LfmMappingDatabaseService;
+import org.opendaylight.lispflowmapping.implementation.LispMappingService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class LfmMappingServiceModule extends org.opendaylight.controller.config.yang.config.lfm_mappingservice.impl.AbstractLfmMappingServiceModule {
     private static final Logger LOG = LoggerFactory.getLogger(LfmMappingServiceModule.class);
-
+    private LispMappingService lfmService;
     public LfmMappingServiceModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
@@ -33,24 +30,15 @@ public class LfmMappingServiceModule extends org.opendaylight.controller.config.
 
     @Override
     public java.lang.AutoCloseable createInstance() {
-        LOG.info("LfmMappingService Module up!");
-        DataBroker dataBrokerService = getDataBrokerDependency();
-
-        LfmMappingDatabaseProviderRpc mappingDbProviderRpc = new LfmMappingDatabaseProviderRpc(dataBrokerService);
-        final BindingAwareBroker.RpcRegistration<LfmMappingDatabaseService> lfmDbRpc = getRpcRegistryDependency()
-                .addRpcImplementation(LfmMappingDatabaseService.class, mappingDbProviderRpc);
-
-        final class AutoClosableLfmMappingService implements AutoCloseable {
-
-            @Override
-            public void close() throws Exception {
-                LOG.info("LfmMappingService Module Closing!");
+        LOG.debug("LfmMappingService Module up!");
 
-                lfmDbRpc.close();
-            }
-        }
+        lfmService = new LispMappingService();
+        lfmService.setDataBrokerService(getDataBrokerDependency());
+        lfmService.setRpcProviderRegistry(getRpcRegistryDependency());
+        lfmService.setBindingAwareBroker(getBrokerDependency());
+        lfmService.initialize();
 
-        return new AutoClosableLfmMappingService();
+        return lfmService;
     }
 
-}
+}
\ No newline at end of file
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
deleted file mode 100644 (file)
index 2788941..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-
-package org.opendaylight.lispflowmapping.implementation;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.apache.felix.dm.DependencyActivatorBase;
-import org.apache.felix.dm.DependencyManager;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
-import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMappingShell;
-import org.osgi.framework.BundleContext;
-
-/**
- * Main application activator class for registering the dependencies and
- * initialising the Mapping Service application.
- *
- */
-
-public class Activator extends DependencyActivatorBase {
-
-    @Override
-    public void init(BundleContext context, DependencyManager manager) throws Exception {
-        Dictionary<String, String> props = new Hashtable<String, String>();
-        props.put("name", "mappingservice");
-        manager.add(createComponent().setInterface(new String[] { IFlowMapping.class.getName(), IFlowMappingShell.class.getName() }, props)
-                .setImplementation(LispMappingService.class)
-                .add(createServiceDependency().setService(BindingAwareBroker.class).setRequired(true)
-                        .setCallbacks("setBindingAwareBroker", "unsetBindingAwareBroker")));
-
-    }
-
-    @Override
-    public void destroy(BundleContext context, DependencyManager manager) throws Exception {
-        // TODO Auto-generated method stub
-
-    }
-}
@@ -5,12 +5,11 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.lispflowmapping.implementation.provider;
+package org.opendaylight.lispflowmapping.implementation;
 
 import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.lispflowmapping.implementation.LispMappingService;
 import org.opendaylight.lispflowmapping.implementation.mdsal.DataStoreBackEnd;
 import org.opendaylight.lispflowmapping.implementation.util.MapServerMapResolverUtil;
 import org.opendaylight.lispflowmapping.implementation.util.RPCInputConvertorUtil;
@@ -45,8 +44,8 @@ import com.google.common.util.concurrent.Futures;
  * @author Florin Coras
  *
  */
-public class LfmMappingDatabaseProviderRpc implements LfmMappingDatabaseService {
-    protected static final Logger LOG = LoggerFactory.getLogger(LfmMappingDatabaseProviderRpc.class);
+public class LfmMappingDatabaseRpc implements LfmMappingDatabaseService {
+    protected static final Logger LOG = LoggerFactory.getLogger(LfmMappingDatabaseRpc.class);
     private static final String NOT_FOUND_TAG = "data-missing";
     private static final String DATA_EXISTS_TAG = "data-exists";
 
@@ -54,7 +53,7 @@ public class LfmMappingDatabaseProviderRpc implements LfmMappingDatabaseService
     private DataBroker dataBroker;
     private DataStoreBackEnd dsbe;
 
-    public LfmMappingDatabaseProviderRpc(DataBroker dataBroker) {
+    public LfmMappingDatabaseRpc(DataBroker dataBroker) {
         this.lispMappingService = LispMappingService.getLispMappingService();
         this.dataBroker = dataBroker;
         this.dsbe = new DataStoreBackEnd(this.dataBroker);
index 76eb968cdec4fe08a25685ad53f07b9a5ab23efe..5ffe7acee697fdd36188766af50b698671c6137c 100644 (file)
@@ -15,11 +15,12 @@ import org.apache.commons.lang3.tuple.Pair;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 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.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.lispflowmapping.implementation.config.ConfigIni;
 import org.opendaylight.lispflowmapping.implementation.dao.HashMapDb;
 import org.opendaylight.lispflowmapping.implementation.dao.MappingServiceKey;
@@ -60,6 +61,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.maprequestmessage.MapRequestBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.transportaddress.TransportAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.control.plane.rev150314.transportaddress.TransportAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.LfmMappingDatabaseService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.db.instance.Mapping;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
@@ -71,7 +73,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class LispMappingService implements CommandProvider, IFlowMapping, IFlowMappingShell, BindingAwareProvider,
-        IMapRequestResultHandler, IMapNotifyHandler {
+        IMapRequestResultHandler, IMapNotifyHandler, AutoCloseable {
     protected static final Logger LOG = LoggerFactory.getLogger(LispMappingService.class);
 
     private static final ConfigIni configIni = new ConfigIni();
@@ -88,12 +90,53 @@ public class LispMappingService implements CommandProvider, IFlowMapping, IFlowM
     private ThreadLocal<Pair<MapRequest, TransportAddress>> tlsMapRequest = new ThreadLocal<Pair<MapRequest, TransportAddress>>();
 
     private LfmControlPlaneService lispSB = null;
-
     private ProviderContext session;
 
     private DataStoreBackEnd dsbe;
     private NotificationService notificationService;
     private static LispMappingService lfmService = null;
+    private BindingAwareBroker.RpcRegistration<LfmMappingDatabaseService> lfmDbRpc;
+    private DataBroker dataBrokerService;
+    private RpcProviderRegistry rpcRegistry;
+    private BindingAwareBroker broker;
+
+    public LispMappingService() {
+        LOG.debug("LispMappingService Module starting!");
+        lfmService = this;
+    }
+
+    public void setDataBrokerService(DataBroker dataBrokerService) {
+        this.dataBrokerService = dataBrokerService;
+    }
+
+    public void setRpcProviderRegistry(RpcProviderRegistry rpcRegistry) {
+        this.rpcRegistry = rpcRegistry;
+    }
+
+    public void setBindingAwareBroker(BindingAwareBroker broker) {
+        this.broker = broker;
+    }
+
+    public void initialize() {
+        broker.registerProvider(this);
+
+        LfmMappingDatabaseRpc mappingDbProviderRpc = new LfmMappingDatabaseRpc(dataBrokerService);
+        lfmDbRpc = rpcRegistry.addRpcImplementation(LfmMappingDatabaseService.class, mappingDbProviderRpc);
+
+        setLispDao(new HashMapDb());
+        registerWithOSGIConsole();
+    }
+
+    @Override
+    public void onSessionInitiated(ProviderContext session) {
+        LOG.info("Lisp Consumer session initialized!");
+        notificationService = session.getSALService(NotificationService.class);
+        registerNotificationListener(AddMapping.class, new MapRegisterNotificationHandler());
+        registerNotificationListener(RequestMapping.class, new MapRequestNotificationHandler());
+        registerDataListeners(session.getSALService(DataBroker.class));
+        this.session = session;
+        LOG.info("LISP (RFC6830) Mapping Service init finished");
+    }
 
     class LispIpv4AddressInMemoryConverter implements ILispTypeConverter<Ipv4Address, Integer> {
     }
@@ -111,22 +154,6 @@ public class LispMappingService implements CommandProvider, IFlowMapping, IFlowM
         return lfmService;
     }
 
-    void setBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
-        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) {
-        LOG.debug("BindingAwareBroker was unset in LispMappingService");
-        lfmService = null;
-    }
-
     public void basicInit(ILispDAO dao) {
         lispDao = dao;
         mapResolver = new MapResolver(dao);
@@ -145,20 +172,15 @@ public class LispMappingService implements CommandProvider, IFlowMapping, IFlowM
         lispDao = null;
     }
 
-    public void init() {
+    private void registerWithOSGIConsole() {
         try {
-            registerWithOSGIConsole();
-            LOG.info("LISP (RFC6830) Mapping Service init finished");
+            BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
+            bundleContext.registerService(CommandProvider.class.getName(), this, null);
         } catch (Exception e) {
             LOG.error(e.getStackTrace().toString());
         }
     }
 
-    private void registerWithOSGIConsole() {
-        BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()).getBundleContext();
-        bundleContext.registerService(CommandProvider.class.getName(), this, null);
-    }
-
     public void destroy() {
         LOG.info("LISP (RFC6830) Mapping Service is destroyed!");
         mapResolver = null;
@@ -316,17 +338,6 @@ public class LispMappingService implements CommandProvider, IFlowMapping, IFlowM
         return shouldAuthenticate;
     }
 
-    @Override
-    public void onSessionInitiated(ProviderContext session) {
-        LOG.info("Lisp Consumer session initialized!");
-        notificationService = session.getSALService(NotificationService.class);
-        dsbe = new DataStoreBackEnd(session.getSALService(DataBroker.class));
-        registerNotificationListener(AddMapping.class, new MapRegisterNotificationHandler());
-        registerNotificationListener(RequestMapping.class, new MapRequestNotificationHandler());
-        registerDataListeners(session.getSALService(DataBroker.class));
-        this.session = session;
-    }
-
     private void registerDataListeners(DataBroker broker) {
         keyListener = new AuthenticationKeyDataListener(broker, this);
         mappingListener = new MappingDataListener(broker, this);
@@ -424,4 +435,10 @@ public class LispMappingService implements CommandProvider, IFlowMapping, IFlowM
     public void setOverwrite(boolean overwrite) {
         mapServer.setOverwrite(overwrite);
     }
+
+    @Override
+    public void close() throws Exception {
+        lfmDbRpc.close();
+        destroy();
+    }
 }
index 131ddf26593c37e0c87ef7768b355acf0b8243fc..fca8565d52d801ddadfe3fdb07b0c89ef906c8d1 100644 (file)
@@ -13,24 +13,30 @@ module lfm-mappingservice-impl {
       "This module contains the base YANG definitions for
       mappingservice implementation.";
 
-  revision "2015-05-07" {
+  revision "2015-05-17" {
       description
           "Initial revision.";
   }
 
-  // This is the definition of the service implementation as a module identity
+  // This is the definition of lfm-mappingservice interface identity.
   identity lfm-mappingservice {
+      base config:service-type;
+      config:java-class "org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping";
+  }
+  
+  // This is the definition of the lfm-mappingservice implementation as a module identity
+  identity lfm-mappingservice-impl {
       base config:module-type;
 
       // Specifies the prefix for generated java classes.
       config:java-name-prefix LfmMappingService;
+      config:provided-service lfm-mappingservice;
   }
 
-
   // Augments the 'configuration' choice node under modules/module.
   augment "/config:modules/config:module/config:configuration" {
-    case lfm-mappingservice {
-      when "/config:modules/config:module/config:type = 'lfm-mappingservice'";
+    case lfm-mappingservice-impl {
+      when "/config:modules/config:module/config:type = 'lfm-mappingservice-impl'";
 
       //wires in the data-broker service
       container data-broker {
index 492211857f57e300a8caaaf5b3fe692ba3f5d757..49cc781d6f8539e437348c0416a206b99a6eef81 100644 (file)
       <artifactId>commons.northbound</artifactId>
     </dependency>
     -->
+    <dependency>
+      <groupId>org.openexi</groupId>
+      <artifactId>nagasena</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.openexi</groupId>
+      <artifactId>nagasena-rta</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-api</artifactId>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-persister-file-xml-adapter</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-persister-api</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>config-persister-impl</artifactId>
+      <scope>test</scope>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>configuration</artifactId>
index f97b712857069ac5812435cdeb68d1c5baef0fdd..d194e5ca7f61fa7057d19bd4eb7d5797114bea4d 100644 (file)
@@ -23,6 +23,7 @@ public class MappingServiceTestHelper {
     public static final String LISP = "org.opendaylight.lispflowmapping";
     public static final String YANG = "org.opendaylight.yangtools";
     public static final String JERSEY = "com.sun.jersey";
+    public static final String YANGTOOLS = "org.opendaylight.yangtools";
 
     public static Option mappingServiceBundles() {
         return new DefaultCompositeOption(
@@ -123,21 +124,25 @@ public class MappingServiceTestHelper {
                 mavenBundle("org.codehaus.jettison", "jettison").versionAsInProject(),
 
                 // Our bundles
-                mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(),
-                mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(),
-                mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),
-                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.config").versionAsInProject(),
-                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.api").versionAsInProject(),
-                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.implementation").versionAsInProject(),
-                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.southbound").versionAsInProject(),
-
+                mavenBundle("org.opendaylight.controller", "clustering.stub").versionAsInProject(), //
+                mavenBundle("org.opendaylight.controller", "clustering.services").versionAsInProject(), //
+                mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(), //
+                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.config").versionAsInProject(), //
+                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.api").versionAsInProject(), //
+                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.implementation").versionAsInProject(), //
+                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.southbound").versionAsInProject(), //
+                mavenBundle("org.openexi", "nagasena").versionAsInProject(),
+                mavenBundle("org.openexi", "nagasena-rta").versionAsInProject(),
+                mavenBundle(YANGTOOLS + ".thirdparty", "antlr4-runtime-osgi-nohead").versionAsInProject(),
+                // Set fail if unresolved bundle present
+                systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
                 junitBundles());
     }
 
     public static Option mappingServiceBundlesWithClusterDAO() {
         return new DefaultCompositeOption( //
-                mappingServiceBundles(), //
-                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.clusterdao").versionAsInProject() //
+                mappingServiceBundles() //
+//                mavenBundle("org.opendaylight.lispflowmapping", "mappingservice.clusterdao").versionAsInProject() //
         );
     }
 
index a7b5ae69e61b2a7e1474f00b7f47f3ac45d3369b..9e08503d1f8e60d283ee5becd63b3ae0e08c755a 100644 (file)
@@ -119,7 +119,6 @@ import org.slf4j.LoggerFactory;
 @RunWith(PaxExam.class)
 public class MappingServiceIntegrationTest {
 
-    private IFlowMapping lms;
     protected static final Logger LOG = LoggerFactory.getLogger(MappingServiceIntegrationTest.class);
     private byte[] mapRequestPacket;
     private byte[] mapRegisterPacketWithNotify;
@@ -244,6 +243,10 @@ public class MappingServiceIntegrationTest {
     private BundleContext bc;
     private HttpURLConnection connection;
     protected static boolean notificationCalled;
+
+    @Inject @Filter(timeout=10000)
+    private IFlowMapping lms;
+
     @Inject @Filter(timeout=10000)
     private IConfigLispSouthboundPlugin configLispPlugin;
 
@@ -1805,6 +1808,11 @@ public class MappingServiceIntegrationTest {
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
     private void areWeReady() throws InvalidSyntaxException {
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+        }
+
         assertNotNull(bc);
         boolean debugit = false;
         Bundle b[] = bc.getBundles();
@@ -1839,34 +1847,19 @@ public class MappingServiceIntegrationTest {
         }
         // assertNotNull(broker);
 
-        int retry = 0;
         ServiceReference r = null;
-        while (this.lms == null && retry < MAX_SERVICE_LOAD_RETRIES) {
-
-            r = bc.getServiceReference(IFlowMapping.class.getName());
-            // r.getPropertyKeys();
-            if (r != null) {
-                this.lms = (IFlowMapping) bc.getService(r);
-            } else {
-                try {
-                    Thread.sleep(1000);
-                } catch (InterruptedException e) {
-                }
-            }
-            retry += 1;
-        }
-
-        assertNotNull(IFlowMapping.class.getName() + " service wasn't found in bundle context ", this.lms);
-
         configLispPlugin.setLispAddress(lispBindAddress);
 
         // Uncomment this code to Know which services were actually loaded to
         // BundleContext
+
         /*
-         * for (ServiceReference sr : bc.getAllServiceReferences(null, null)) {
-         * LOG.trace(sr.getBundle().getSymbolicName());
-         * LOG.trace(sr.toString()); }
-         */
+        for (ServiceReference sr : bc.getAllServiceReferences(null, null)) {
+            LOG.info(sr.getBundle().getSymbolicName());
+            LOG.info(sr.toString());
+        }
+        */
+
         try {
             Thread.sleep(1000);
         } catch (InterruptedException e) {
index ff2c0be01508e5f6f7b9356a3a6922a8e325564d..15a04038f7db7d2ac64191b8fcdd6ed6c534f00b 100644 (file)
@@ -32,7 +32,7 @@
                     urn:opendaylight:params:xml:ns:yang:controller:md:sal:common?module=opendaylight-md-sal-common&amp;revision=2013-10-28
                 </capability>
                 <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice-sb:impl?module=lfm-mappingservice-sb-impl&amp;revision=2015-05-17</capability>
-
+                <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl?module=lfm-mappingservice-impl&amp;revision=2015-05-17</capability>
             </required-capabilities>
             <configuration>
 
                             <name>binding-notification-broker</name>
                           </notification-service>
                         </module>
+                        <!-- mappingservice.implementation module -->
+                        <module>
+                          <type
+                            xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl">
+                            prefix:lfm-mappingservice-impl
+                          </type>
+                          <name>lfm-mappingservice-default</name>
+
+                          <rpc-registry>
+                            <type
+                              xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+                            <name>binding-rpc-broker</name>
+                          </rpc-registry>
+
+                          <data-broker>
+                            <type
+                              xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+                            <name>binding-data-broker</name>
+                          </data-broker>
+
+                          <broker>
+                            <type
+                              xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
+                            <name>binding-osgi-broker</name>
+                          </broker>
+                        </module>
                     </modules>
 
                     <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
                                 <provider>/modules/module[type='pingpong-data-broker'][name='pingpong-data-broker']</provider>
                             </instance>
                         </service>
+
                         <!-- lfm mappingservice southbound -->
                         <service>
                           <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice-sb:impl">prefix:lfm-mappingservice-sb</type>
                             <provider>/modules/module[type='lfm-mappingservice-sb-impl'][name='lfm-mappingservice-sb-impl-default']</provider>
                           </instance>
                         </service>
+                        <!-- lfm mappingservice implementation -->
+                        <service>
+                          <type
+                            xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice:impl">prefix:lfm-mappingservice</type>
+                          <instance>
+                            <name>lfm-mappingservice</name>
+                            <provider>/modules/module[type='lfm-mappingservice-impl'][name='lfm-mappingservice-default']
+                            </provider>
+                          </instance>
+                        </service>
+
                     </services>
                 </data>