Move implementation to the new notification service 56/27956/3
authorLorand Jakab <lojakab@cisco.com>
Thu, 8 Oct 2015 08:25:51 +0000 (11:25 +0300)
committerLorand Jakab <lojakab@cisco.com>
Fri, 9 Oct 2015 09:01:58 +0000 (12:01 +0300)
Change-Id: I22166138718827bc5641fa0d49f29aa24a9f8007
Signed-off-by: Lorand Jakab <lojakab@cisco.com>
mappingservice/implementation/src/main/config/default-config.xml
mappingservice/implementation/src/main/java/org/opendaylight/controller/config/yang/config/lfm/mappingservice/impl/LispMappingServiceModule.java
mappingservice/implementation/src/main/java/org/opendaylight/controller/config/yang/config/lfm/mappingservice/impl/MappingServiceModule.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/LispMappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/MappingService.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/lisp/MapServer.java
mappingservice/implementation/src/main/java/org/opendaylight/lispflowmapping/implementation/mdsal/MappingDataListener.java
mappingservice/implementation/src/main/yang/mappingservice-impl.yang
mappingservice/integrationtest/src/test/java/org/opendaylight/lispflowmapping/integrationtest/MappingServiceIntegrationTest.java

index 6f28314466801eb527e756195eaf42f5b5474493..e2317de2a3645a1441bf2a56d6f7902ade098900 100644 (file)
                       <type xmlns:dao="urn:opendaylight:lfm:mappingservice-dao">dao:mappingservice-dao</type>
                       <name>mappingservice-dao-inmemorydb</name>
                     </dao>
-                    <notification-service>
-                      <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-notification-service</type>
-                      <name>binding-notification-broker</name>
-                    </notification-service>
+                    <notification-publish-service>
+                      <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-new-notification-publish-service</type>
+                      <name>binding-notification-publish-adapter</name>
+                    </notification-publish-service>
                 </module>
                 <module>
                     <type xmlns:shell="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-shell:impl">shell:mappingservice-shell-impl</type>
                       <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-broker-osgi-registry</type>
                       <name>binding-osgi-broker</name>
                     </osgi-broker>
+                    <notification-service>
+                      <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">binding:binding-new-notification-service</type>
+                      <name>binding-notification-adapter</name>
+                    </notification-service>
                     <mappingservice>
                       <type xmlns:ms="urn:opendaylight:lfm:mappingservice">ms:mappingservice</type>
                       <name>mappingservice</name>
index 59ee2727972d72bad93ae9b05db1047497d329af..86e43e3600b97fc50ae9089b6640836bf36e779c 100644 (file)
@@ -28,6 +28,7 @@ public class LispMappingServiceModule extends org.opendaylight.controller.config
 
         lmsService = new LispMappingService();
         lmsService.setBindingAwareBroker(getOsgiBrokerDependency());
+        lmsService.setNotificationService(getNotificationServiceDependency());
         lmsService.setMappingService(getMappingserviceDependency());
         lmsService.initialize();
 
index 48d4a237e218a12edacea93a4b08aee90a0cda4e..af7543383091b9c26df7b267d6ca9cdd15df9cb1 100644 (file)
@@ -28,7 +28,7 @@ public class MappingServiceModule extends org.opendaylight.controller.config.yan
         mappingService.setBindingAwareBroker(getBrokerDependency());
         mappingService.setDataBroker(getDataBrokerDependency());
         mappingService.setRpcProviderRegistry(getRpcRegistryDependency());
-        mappingService.setNotificationService(getNotificationServiceDependency());
+        mappingService.setNotificationPublishService(getNotificationPublishServiceDependency());
         mappingService.setDaoService(getDaoDependency());
         mappingService.initialize();
 
index 9bd31e70ba48cffede7eb8b92ae989d356b4fbea..a091da97b21513b2ea32392604c88cfc0cbb2ba3 100644 (file)
@@ -10,11 +10,10 @@ package org.opendaylight.lispflowmapping.implementation;
 
 import org.apache.commons.lang3.tuple.MutablePair;
 import org.apache.commons.lang3.tuple.Pair;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 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.lispflowmapping.implementation.config.ConfigIni;
 import org.opendaylight.lispflowmapping.implementation.lisp.MapResolver;
 import org.opendaylight.lispflowmapping.implementation.lisp.MapServer;
@@ -28,11 +27,16 @@ import org.opendaylight.lispflowmapping.interfaces.lisp.IMapServerAsync;
 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService;
 import org.opendaylight.lispflowmapping.lisp.util.LispAddressStringifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.AddMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.GotMapNotify;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.GotMapReply;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LispProtoListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapNotify;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapRegister;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapRequest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.RequestMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.XtrReplyMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.XtrRequestMapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.LispAddressContainer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.mapnotifymessage.MapNotifyBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.mapreplymessage.MapReplyBuilder;
@@ -44,12 +48,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendM
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yangtools.yang.binding.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class LispMappingService implements IFlowMapping, BindingAwareProvider, IMapRequestResultHandler,
-        IMapNotifyHandler, AutoCloseable {
+        IMapNotifyHandler, LispProtoListener, AutoCloseable {
     protected static final Logger LOG = LoggerFactory.getLogger(LispMappingService.class);
 
     private volatile boolean shouldAuthenticate = true;
@@ -79,6 +82,10 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
         this.broker = broker;
     }
 
+    public void setNotificationService(NotificationService ns) {
+        this.notificationService = ns;
+    }
+
     public void setMappingService(IMappingService ms) {
         LOG.trace("MappingService set in LispMappingService");
         this.mapService = ms;
@@ -98,8 +105,13 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
         }
     }
 
+    public NotificationService getNotificationService() {
+        return this.notificationService;
+    }
+
     public void initialize() {
         broker.registerProvider(this);
+        notificationService.registerNotificationListener(this);
         mapResolver = new MapResolver(mapService, smr, elpPolicy, this);
         mapServer = new MapServer(mapService, shouldAuthenticate, smr, this, notificationService);
     }
@@ -112,9 +124,6 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
     @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());
         this.session = session;
         LOG.info("LISP (RFC6830) Mapping Service init finished");
     }
@@ -169,44 +178,53 @@ public class LispMappingService implements IFlowMapping, BindingAwareProvider, I
         return shouldAuthenticate;
     }
 
-    public <T extends Notification> void registerNotificationListener(Class<T> notificationType,
-            NotificationListener<T> listener) {
-        notificationService.registerNotificationListener(notificationType, listener);
+    @Override
+    public void onAddMapping(AddMapping mapRegisterNotification) {
+        MapNotify mapNotify = handleMapRegister(mapRegisterNotification.getMapRegister());
+        if (mapNotify != null) {
+            TransportAddressBuilder tab = new TransportAddressBuilder();
+            tab.setIpAddress(mapRegisterNotification.getTransportAddress().getIpAddress());
+            tab.setPort(new PortNumber(LispMessage.PORT_NUM));
+            SendMapNotifyInputBuilder smnib = new SendMapNotifyInputBuilder();
+            smnib.setMapNotify(new MapNotifyBuilder(mapNotify).build());
+            smnib.setTransportAddress(tab.build());
+            getLispSB().sendMapNotify(smnib.build());
+        } else {
+            LOG.warn("got null map notify");
+        }
     }
 
-    private class MapRegisterNotificationHandler implements NotificationListener<AddMapping> {
-
-        @Override
-        public void onNotification(AddMapping mapRegisterNotification) {
-            MapNotify mapNotify = handleMapRegister(mapRegisterNotification.getMapRegister());
-            if (mapNotify != null) {
-                TransportAddressBuilder tab = new TransportAddressBuilder();
-                tab.setIpAddress(mapRegisterNotification.getTransportAddress().getIpAddress());
-                tab.setPort(new PortNumber(LispMessage.PORT_NUM));
-                SendMapNotifyInputBuilder smnib = new SendMapNotifyInputBuilder();
-                smnib.setMapNotify(new MapNotifyBuilder(mapNotify).build());
-                smnib.setTransportAddress(tab.build());
-                getLispSB().sendMapNotify(smnib.build());
-            } else {
-                LOG.warn("got null map notify");
-            }
+    @Override
+    public void onRequestMapping(RequestMapping mapRequestNotification) {
+        MapReply mapReply = handleMapRequest(mapRequestNotification.getMapRequest());
+        if (mapReply != null) {
+            SendMapReplyInputBuilder smrib = new SendMapReplyInputBuilder();
+            smrib.setMapReply((new MapReplyBuilder(mapReply).build()));
+            smrib.setTransportAddress(mapRequestNotification.getTransportAddress());
+            getLispSB().sendMapReply(smrib.build());
+        } else {
+            LOG.warn("got null map reply");
         }
     }
 
-    private class MapRequestNotificationHandler implements NotificationListener<RequestMapping> {
-
-        @Override
-        public void onNotification(RequestMapping mapRequestNotification) {
-            MapReply mapReply = handleMapRequest(mapRequestNotification.getMapRequest());
-            if (mapReply != null) {
-                SendMapReplyInputBuilder smrib = new SendMapReplyInputBuilder();
-                smrib.setMapReply((new MapReplyBuilder(mapReply).build()));
-                smrib.setTransportAddress(mapRequestNotification.getTransportAddress());
-                getLispSB().sendMapReply(smrib.build());
-            } else {
-                LOG.warn("got null map reply");
-            }
-        }
+    @Override
+    public void onGotMapReply(GotMapReply notification) {
+        LOG.debug("Received GotMapReply notification, ignoring");
+    }
+
+    @Override
+    public void onGotMapNotify(GotMapNotify notification) {
+        LOG.debug("Received GotMapNotify notification, ignoring");
+    }
+
+    @Override
+    public void onXtrRequestMapping(XtrRequestMapping notification) {
+        LOG.debug("Received XtrRequestMapping notification, ignoring");
+    }
+
+    @Override
+    public void onXtrReplyMapping(XtrReplyMapping notification) {
+        LOG.debug("Received XtrReplyMapping notification, ignoring");
     }
 
     private LispSbService getLispSB() {
index 6539c3ea0f75ec6e0d821db0369d79bb9864468e..237b8ff318d3daacdd6d2bb82f48bbe5faa077f3 100644 (file)
@@ -11,10 +11,10 @@ import java.util.Arrays;
 import java.util.concurrent.Future;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.lispflowmapping.implementation.config.ConfigIni;
@@ -87,7 +87,7 @@ public class MappingService implements MappingserviceService, IMappingService, B
     private DataBroker dataBroker;
     private RpcProviderRegistry rpcRegistry;
     private BindingAwareBroker bindingAwareBroker;
-    private NotificationProviderService notificationService;
+    private NotificationPublishService notificationPublishService;
 
     private static final ConfigIni configIni = new ConfigIni();
     private boolean overwritePolicy = configIni.mappingOverwriteIsSet();
@@ -110,8 +110,8 @@ public class MappingService implements MappingserviceService, IMappingService, B
         this.bindingAwareBroker = broker;
     }
 
-    public void setNotificationService(NotificationProviderService notification) {
-        this.notificationService = notification;
+    public void setNotificationPublishService(NotificationPublishService nps) {
+        this.notificationPublishService = nps;
     }
 
     public void setDaoService(ILispDAO dao) {
@@ -137,7 +137,7 @@ public class MappingService implements MappingserviceService, IMappingService, B
         mappingSystem.initialize();
 
         keyListener = new AuthenticationKeyDataListener(dataBroker, mappingSystem);
-        mappingListener = new MappingDataListener(dataBroker, mappingSystem, notificationService);
+        mappingListener = new MappingDataListener(dataBroker, mappingSystem, notificationPublishService);
     }
 
     @Override
index b22e9f8437c71b94d746d6ac91f336b062a42730..e473079dad7d8fdabca81e576c6a1516910450b8 100644 (file)
@@ -17,8 +17,7 @@ import java.util.Set;
 
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.opendaylight.controller.sal.binding.api.NotificationListener;
-import org.opendaylight.controller.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.lispflowmapping.implementation.authentication.LispAuthenticationUtil;
 import org.opendaylight.lispflowmapping.interfaces.dao.SubKeys;
 import org.opendaylight.lispflowmapping.interfaces.dao.SubscriberRLOC;
@@ -42,13 +41,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.ma
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChange;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingserviceListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.SiteId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Preconditions;
 
-public class MapServer implements IMapServerAsync {
+public class MapServer implements IMapServerAsync, MappingserviceListener {
 
     protected static final Logger LOG = LoggerFactory.getLogger(MapServer.class);
     private IMappingService mapService;
@@ -66,7 +66,7 @@ public class MapServer implements IMapServerAsync {
         this.notifyHandler = notifyHandler;
         this.notificationService = notificationService;
         if (notificationService != null) {
-            subscribeToMappingNotifications();
+            notificationService.registerNotificationListener(this);
         }
     }
 
@@ -125,23 +125,17 @@ public class MapServer implements IMapServerAsync {
         return (mapRegister.getSiteId() != null) ? new SiteId(mapRegister.getSiteId()) : null;
     }
 
-    private class MappingChangedNotificationHandler implements NotificationListener<MappingChanged> {
-        @Override
-        public void onNotification(MappingChanged notification) {
-            if (subscriptionService) {
-                sendSmrs(new EidToLocatorRecordBuilder(notification.getMapping()).build(), getSubscribers(notification
-                        .getMapping().getLispAddressContainer()));
-                if (notification.getChange().equals(MappingChange.Removed)) {
-                    removeSubscribers(notification.getMapping().getLispAddressContainer());
-                }
+    @Override
+    public void onMappingChanged(MappingChanged notification) {
+        if (subscriptionService) {
+            sendSmrs(new EidToLocatorRecordBuilder(notification.getMapping()).build(), getSubscribers(notification
+                    .getMapping().getLispAddressContainer()));
+            if (notification.getChange().equals(MappingChange.Removed)) {
+                removeSubscribers(notification.getMapping().getLispAddressContainer());
             }
         }
     }
 
-    private void subscribeToMappingNotifications() {
-        notificationService.registerNotificationListener(MappingChanged.class, new MappingChangedNotificationHandler());
-    }
-
     private void sendSmrs(EidToLocatorRecord record, Set<SubscriberRLOC> subscribers) {
         LispAddressContainer eid = record.getLispAddressContainer();
         handleSmr(record, subscribers, notifyHandler);
index 7b24932e30ef19031c8daafcf2181d3b40478aff..600515353e34cb0ac576d99bb5497a45f2def425 100644 (file)
@@ -11,8 +11,8 @@ import java.util.Map;
 import java.util.Set;
 
 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.data.AsyncDataChangeEvent;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.lispflowmapping.implementation.util.MSNotificationInputUtil;
 import org.opendaylight.lispflowmapping.interfaces.mapcache.IMappingSystem;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.eidtolocatorrecords.EidToLocatorRecordBuilder;
@@ -35,20 +35,20 @@ import org.slf4j.LoggerFactory;
 public class MappingDataListener extends AbstractDataListener {
     private static final Logger LOG = LoggerFactory.getLogger(MappingDataListener.class);
     private IMappingSystem mapSystem;
-    private NotificationProviderService notificationProvider;
+    private NotificationPublishService notificationPublishService;
 
-    public MappingDataListener(DataBroker broker, IMappingSystem msmr, NotificationProviderService notificationProvider) {
+    public MappingDataListener(DataBroker broker, IMappingSystem msmr, NotificationPublishService nps) {
         setBroker(broker);
         setMappingSystem(msmr);
-        setNotificationProviderService(notificationProvider);
+        setNotificationProviderService(nps);
         setPath(InstanceIdentifier.create(MappingDatabase.class).child(InstanceId.class)
                 .child(Mapping.class));
         LOG.trace("Registering Mapping listener.");
         registerDataChangeListener();
     }
 
-    public void setNotificationProviderService(NotificationProviderService notificationProvider) {
-        this.notificationProvider = notificationProvider;
+    public void setNotificationProviderService(NotificationPublishService nps) {
+        this.notificationPublishService = nps;
     }
 
     @Override
@@ -82,7 +82,11 @@ public class MappingDataListener extends AbstractDataListener {
 
                 mapSystem.addMapping(mapping.getOrigin(), mapping.getLispAddressContainer(),
                         new EidToLocatorRecordBuilder(mapping).build());
-                notificationProvider.publish(MSNotificationInputUtil.toMappingChanged(mapping, MappingChange.Updated));
+                try {
+                    notificationPublishService.putNotification(MSNotificationInputUtil.toMappingChanged(mapping, MappingChange.Updated));
+                } catch (InterruptedException e) {
+                    LOG.warn("Notification publication interrupted!");
+                }
             }
         }
 
@@ -98,7 +102,11 @@ public class MappingDataListener extends AbstractDataListener {
                 LOG.trace("Value: {}", dataObject);
 
                 mapSystem.removeMapping(mapping.getOrigin(), mapping.getLispAddressContainer());
-                notificationProvider.publish(MSNotificationInputUtil.toMappingChanged(mapping, MappingChange.Removed));
+                try {
+                    notificationPublishService.putNotification(MSNotificationInputUtil.toMappingChanged(mapping, MappingChange.Removed));
+                } catch (InterruptedException e) {
+                    LOG.warn("Notification publication interrupted!");
+                }
             }
         }
     }
index 26bd1f8514e5cdc119a814c177a21ae15297adf4..70bcd050258e5f94849fb94137c3613dac2d7753 100644 (file)
@@ -7,6 +7,7 @@ module mappingservice-impl {
     import config { prefix config; revision-date 2013-04-05; }
     import rpc-context { prefix rpcx; revision-date 2013-06-17; }
     import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+    import opendaylight-sal-binding-broker-impl { prefix sal-broker; revision-date 2013-10-28; }
     import mappingservice { prefix mappingservice; revision-date 2015-09-06; }
     import mappingservice-dao { prefix ms-dao; revision-date 2015-10-07; }
 
@@ -70,11 +71,11 @@ module mappingservice-impl {
                     }
                 }
             }
-            container notification-service {
+            container notification-publish-service {
                 uses config:service-ref {
                     refine type {
                         mandatory true;
-                        config:required-identity mdsal:binding-notification-service;
+                        config:required-identity sal-broker:binding-new-notification-publish-service;
                     }
                 }
             }
@@ -89,6 +90,14 @@ module mappingservice-impl {
                     }
                 }
             }
+            container notification-service {
+                uses config:service-ref {
+                    refine type {
+                        mandatory true;
+                        config:required-identity sal-broker:binding-new-notification-service;
+                    }
+                }
+            }
             container mappingservice {
                 uses config:service-ref {
                     refine type {
index d73ea09a51d386122b314705d58f08b3090df286..4885c3c56a8206bb0f5797ea1ea4f6052ba76fef 100644 (file)
@@ -48,7 +48,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.opendaylight.controller.mdsal.it.base.AbstractMdsalTestBase;
-import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.lispflowmapping.implementation.LispMappingService;
 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService;
@@ -61,7 +60,10 @@ import org.opendaylight.lispflowmapping.lisp.serializer.MapRegisterSerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.MapReplySerializer;
 import org.opendaylight.lispflowmapping.lisp.serializer.MapRequestSerializer;
 import org.opendaylight.lispflowmapping.type.sbplugin.IConfigLispSouthboundPlugin;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.AddMapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.EidToLocatorRecord.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.GotMapNotify;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.GotMapReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LcafApplicationDataAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LcafListAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LcafSegmentAddress;
@@ -69,11 +71,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.Lc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LispAFIAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LispIpv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LispMacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.LispProtoListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapNotify;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapRegister;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.MapRequest;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.ReencapHop;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.RequestMapping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.XtrReplyMapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.XtrRequestMapping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.eidrecords.EidRecord;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.eidrecords.EidRecordBuilder;
@@ -1696,6 +1701,34 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
 
     }
 
+    private class XtrRequestMappingListener implements LispProtoListener {
+
+        @Override
+        public void onGotMapReply(GotMapReply notification) {
+        }
+
+        @Override
+        public void onAddMapping(AddMapping notification) {
+        }
+
+        @Override
+        public void onXtrReplyMapping(XtrReplyMapping notification) {
+        }
+
+        @Override
+        public void onRequestMapping(RequestMapping notification) {
+        }
+
+        @Override
+        public void onGotMapNotify(GotMapNotify notification) {
+        }
+
+        @Override
+        public void onXtrRequestMapping(XtrRequestMapping notification) {
+        }
+
+    }
+
     public void testRecievingNonProxyOnXtrPort() throws SocketTimeoutException, SocketException, Throwable {
         cleanUP();
         configLispPlugin.shouldListenOnXtrPort(true);
@@ -1710,10 +1743,10 @@ public class MappingServiceIntegrationTest extends AbstractMdsalTestBase {
                         new org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lcafapplicationdataaddress.AddressBuilder().setPrimitiveAddress(
                                 LispAFIConvertor.asPrimitiveIPAfiAddress(rloc)).build()).setLocalPortLow(new PortNumber(port)).build();
         final MapRequest mapRequest = createNonProxyMapRequest(eid, adLcaf);
-        ((LispMappingService) lms).registerNotificationListener(XtrRequestMapping.class, new NotificationListener<XtrRequestMapping>() {
+        ((LispMappingService) lms).getNotificationService().registerNotificationListener(new XtrRequestMappingListener() {
 
             @Override
-            public void onNotification(XtrRequestMapping notification) {
+            public void onXtrRequestMapping(XtrRequestMapping notification) {
                 assertEquals(((org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.Ipv4) mapRequest.getEidRecord().get(0).getLispAddressContainer().getAddress()).getIpv4Address().getIpv4Address().getValue(),
                         eid);
                 notificationCalled = true;