<classifier>features</classifier>
<type>xml</type>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>features-base</artifactId>
- <version>${commons.opendaylight.version}</version>
- <classifier>features</classifier>
- <type>xml</type>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-mdsal</artifactId>
<repository>mvn:org.opendaylight.netconf/features-restconf/${restconf.version}/xml/features</repository>
<!-- Needed for odl-config-api -->
<repository>mvn:org.opendaylight.controller/features-config/${config.version}/xml/features</repository>
- <!-- TODO features-base should be removed when we get rid of Activators, hopefully soon -->
- <repository>mvn:org.opendaylight.controller/features-base/${commons.opendaylight.version}/xml/features</repository>
<repository>mvn:org.opendaylight.neutron/features-neutron/${neutron.version}/xml/features</repository>
<repository>mvn:org.opendaylight.dlux/features-dlux/${dlux.core.version}/xml/features</repository>
</feature>
<feature name="odl-lispflowmapping-neutron" description="OpenDaylight :: LISP Flow Mapping :: Neutron Integration" version='${project.version}'>
- TODO felix-dm should be removed when we get rid of Activators, hopefully soon
- <feature>odl-base-felix-dm</feature>
<feature version="${neutron.version}">odl-neutron-service</feature>
<feature version="${project.version}">odl-lispflowmapping-mappingservice</feature>
<bundle>mvn:org.opendaylight.lispflowmapping/mappingservice.neutron/${project.version}</bundle>
-module lfm-ms-dao {
+module mappingservice-dao {
yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:config:lfm:ms:dao";
+ namespace "urn:opendaylight:lfm:mappingservice-dao";
prefix "ms-dao";
import config { prefix config; revision-date 2013-04-05; }
description
"Service definition for Mapping Service DAO.";
- revision "2015-07-13" {
+ revision "2015-10-07" {
description
- "Initial revision";
+ "Module renamed from lfm-ms-dao.";
}
- identity ms-dao {
+ identity mappingservice-dao {
base "config:service-type";
config:java-class "org.opendaylight.lispflowmapping.interfaces.dao.ILispDAO";
}
-}
\ No newline at end of file
+}
<?xml version="1.0" encoding="UTF-8"?>
<snapshot>
<required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:ms:dao?module=lfm-ms-dao&revision=2015-07-13</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:impl?module=mappingservice-impl&revision=2015-09-06</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:shell:impl?module=mappingservice-shell-impl&revision=2015-09-25</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-shell:impl?module=mappingservice-shell-impl&revision=2015-09-25</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-dao:inmemorydb?module=mappingservice-dao-inmemorydb&revision=2015-10-07</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:mappingservice-impl</type>
+ <type xmlns:msi="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:impl">msi:mappingservice-impl</type>
<name>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-osgi-broker</name>
</broker>
<dao>
- <type xmlns:dao="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:ms:dao">dao:ms-dao</type>
- <name>lfm-ms-inmemorydb</name>
+ <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:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:shell:impl">prefix:mappingservice-shell-impl</type>
+ <type xmlns:shell="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-shell:impl">shell:mappingservice-shell-impl</type>
<name>mappingservice-shell-default</name>
- <broker>
+ <osgi-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>
+ </osgi-broker>
<mappingservice>
- <type xmlns:prefix="urn:opendaylight:lfm:mappingservice">prefix:mappingservice</type>
+ <type xmlns:ms="urn:opendaylight:lfm:mappingservice">ms:mappingservice</type>
<name>mappingservice</name>
</mappingservice>
</module>
<module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:impl">prefix:lisp-mappingservice-impl</type>
+ <type xmlns:ms="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:impl">ms:lisp-mappingservice-impl</type>
<name>lisp-mappingservice-default</name>
<osgi-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>
</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:prefix="urn:opendaylight:lfm:mappingservice">prefix:mappingservice</type>
+ <type xmlns:ms="urn:opendaylight:lfm:mappingservice">ms:mappingservice</type>
<name>mappingservice</name>
</mappingservice>
</module>
</services>
</data>
</configuration>
-</snapshot>
\ No newline at end of file
+</snapshot>
lmsService = new LispMappingService();
lmsService.setBindingAwareBroker(getOsgiBrokerDependency());
+ lmsService.setNotificationService(getNotificationServiceDependency());
lmsService.setMappingService(getMappingserviceDependency());
lmsService.initialize();
mappingService.setBindingAwareBroker(getBrokerDependency());
mappingService.setDataBroker(getDataBrokerDependency());
mappingService.setRpcProviderRegistry(getRpcRegistryDependency());
- mappingService.setNotificationService(getNotificationServiceDependency());
+ mappingService.setNotificationPublishService(getNotificationPublishServiceDependency());
mappingService.setDaoService(getDaoDependency());
mappingService.initialize();
--- /dev/null
+package org.opendaylight.controller.config.yang.config.lfm.mappingservice_shell.impl;
+
+import org.opendaylight.lispflowmapping.implementation.MappingServiceShell;
+
+public class MappingServiceShellModule extends org.opendaylight.controller.config.yang.config.lfm.mappingservice_shell.impl.AbstractMappingServiceShellModule {
+ private MappingServiceShell mappingServiceShell;
+
+ public MappingServiceShellModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public MappingServiceShellModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.lfm.mappingservice_shell.impl.MappingServiceShellModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ mappingServiceShell = new MappingServiceShell();
+ mappingServiceShell.setBindingAwareBroker(getOsgiBrokerDependency());
+ mappingServiceShell.setMappingService(getMappingserviceDependency());
+ return mappingServiceShell;
+ }
+
+}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: mappingservice-shell-impl yang module local name: mappingservice-shell-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Oct 07 15:26:43 EEST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.lfm.mappingservice_shell.impl;
+public class MappingServiceShellModuleFactory extends org.opendaylight.controller.config.yang.config.lfm.mappingservice_shell.impl.AbstractMappingServiceShellModuleFactory {
+
+}
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;
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;
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;
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;
}
}
+ 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);
}
@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");
}
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() {
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;
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();
this.bindingAwareBroker = broker;
}
- public void setNotificationService(NotificationProviderService notification) {
- this.notificationService = notification;
+ public void setNotificationPublishService(NotificationPublishService nps) {
+ this.notificationPublishService = nps;
}
public void setDaoService(ILispDAO dao) {
mappingSystem.initialize();
keyListener = new AuthenticationKeyDataListener(dataBroker, mappingSystem);
- mappingListener = new MappingDataListener(dataBroker, mappingSystem, notificationService);
+ mappingListener = new MappingDataListener(dataBroker, mappingSystem, notificationPublishService);
}
@Override
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;
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;
this.notifyHandler = notifyHandler;
this.notificationService = notificationService;
if (notificationService != null) {
- subscribeToMappingNotifications();
+ notificationService.registerNotificationListener(this);
}
}
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);
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;
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
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!");
+ }
}
}
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!");
+ }
}
}
}
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 lfm-ms-dao { prefix ms-dao; revision-date 2015-07-13; }
+ import mappingservice-dao { prefix ms-dao; revision-date 2015-10-07; }
description
"This module contains the base YANG definitions for
uses config:service-ref {
refine type {
mandatory true;
- config:required-identity ms-dao:ms-dao;
+ config:required-identity ms-dao:mappingservice-dao;
}
}
}
- 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;
}
}
}
}
}
}
+ 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 {
module mappingservice-shell-impl {
yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice:shell:impl";
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-shell:impl";
prefix "mappingservice-shell-impl";
import config { prefix config; revision-date 2013-04-05; }
augment "/config:modules/config:module/config:configuration" {
case mappingservice-shell-impl {
when "/config:modules/config:module/config:type = 'mappingservice-shell-impl'";
- container broker {
+ container osgi-broker {
uses config:service-ref {
refine type {
mandatory true;
<?xml version="1.0" encoding="UTF-8"?>
<snapshot>
<required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:ms:dao?module=lfm-ms-dao&revision=2015-07-13</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-dao:inmemorydb?module=mappingservice-dao-inmemorydb&revision=2015-10-07</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:ms:dao:inmemorydb">
- prefix:lfm-ms-inmemorydb
+ <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-dao:inmemorydb">
+ prefix:mappingservice-dao-inmemorydb
</type>
- <name>lfm-ms-inmemorydb-default</name>
+ <name>mappingservice-dao-inmemorydb-default</name>
<record-timeout>240</record-timeout>
</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:ms:dao">prefix:ms-dao</type>
+ <type xmlns:dao="urn:opendaylight:lfm:mappingservice-dao">dao:mappingservice-dao</type>
<instance>
- <name>lfm-ms-inmemorydb</name>
- <provider>/modules/module[type='lfm-ms-inmemorydb'][name='lfm-ms-inmemorydb-default']
+ <name>mappingservice-dao-inmemorydb</name>
+ <provider>/modules/module[type='mappingservice-dao-inmemorydb'][name='mappingservice-dao-inmemorydb-default']
</provider>
</instance>
</service>
</services>
</data>
</configuration>
-</snapshot>
\ No newline at end of file
+</snapshot>
-package org.opendaylight.controller.config.yang.config.lfm.ms.dao.inmemorydb;
+package org.opendaylight.controller.config.yang.config.lfm.mappingservice_dao.inmemorydb;
import org.opendaylight.lispflowmapping.inmemorydb.HashMapDb;
-public class InMemoryDbModule extends org.opendaylight.controller.config.yang.config.lfm.ms.dao.inmemorydb.AbstractInMemoryDbModule {
+public class InMemoryDbModule extends org.opendaylight.controller.config.yang.config.lfm.mappingservice_dao.inmemorydb.AbstractInMemoryDbModule {
public InMemoryDbModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
- public InMemoryDbModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.lfm.ms.dao.inmemorydb.InMemoryDbModule oldModule, java.lang.AutoCloseable oldInstance) {
+ public InMemoryDbModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.lfm.mappingservice_dao.inmemorydb.InMemoryDbModule oldModule, java.lang.AutoCloseable oldInstance) {
super(identifier, dependencyResolver, oldModule, oldInstance);
}
hashMapDb.setRecordTimeOut(getRecordTimeout());
return hashMapDb;
}
+
}
--- /dev/null
+/*
+* Generated file
+*
+* Generated from: yang module name: mappingservice-dao-inmemorydb yang module local name: mappingservice-dao-inmemorydb
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Oct 07 00:21:06 EEST 2015
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.controller.config.yang.config.lfm.mappingservice_dao.inmemorydb;
+public class InMemoryDbModuleFactory extends org.opendaylight.controller.config.yang.config.lfm.mappingservice_dao.inmemorydb.AbstractInMemoryDbModuleFactory {
+
+}
+++ /dev/null
-/*
-* Generated file
-*
-* Generated from: yang module name: lfm-ms-inmemorydb yang module local name: lfm-ms-inmemorydb
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Mon Jul 13 12:44:05 CEST 2015
-*
-* Do not modify this file unless it is present under src/main directory
-*/
-package org.opendaylight.controller.config.yang.config.lfm.ms.dao.inmemorydb;
-public class InMemoryDbModuleFactory extends org.opendaylight.controller.config.yang.config.lfm.ms.dao.inmemorydb.AbstractInMemoryDbModuleFactory {
-
-}
+++ /dev/null
-module lfm-ms-inmemorydb {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:config:lfm:ms:dao:inmemorydb";
- prefix "inmemorydb";
-
- import config { prefix config; revision-date 2013-04-05; }
- import lfm-ms-dao { prefix ms-dao; revision-date 2015-07-13; }
-
- description
- "Service definition for Mapping Service DAO.";
-
- revision "2015-07-13" {
- description
- "Initial revision";
- }
-
- identity lfm-ms-inmemorydb {
- base config:module-type;
- config:provided-service ms-dao:ms-dao;
- config:java-name-prefix InMemoryDb;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case lfm-ms-inmemorydb {
- when "/config:modules/config:module/config:type = 'lfm-ms-inmemorydb'";
- leaf record-timeout {
- type uint16;
- description
- "Mapping record timeout";
- }
- }
- }
-}
\ No newline at end of file
--- /dev/null
+module mappingservice-dao-inmemorydb {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:config:lfm:mappingservice-dao:inmemorydb";
+ prefix "inmemorydb";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import mappingservice-dao { prefix ms-dao; revision-date 2015-10-07; }
+
+ description
+ "InMemoryDb Mapping Service DAO implementation.";
+
+ revision "2015-10-07" {
+ description
+ "Module renamed from lfm-ms-inmemorydb";
+ }
+
+ identity mappingservice-dao-inmemorydb {
+ base config:module-type;
+ config:provided-service ms-dao:mappingservice-dao;
+ config:java-name-prefix InMemoryDb;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case mappingservice-dao-inmemorydb {
+ when "/config:modules/config:module/config:type = 'mappingservice-dao-inmemorydb'";
+ leaf record-timeout {
+ type uint16;
+ description
+ "Mapping record timeout";
+ }
+ }
+ }
+}
</dependency>
-->
</dependencies>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <!-- Temporarily override the odlparent checkstyle configuration.
+ We want to enforce some simple rules and add more as we clean up code -->
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>checkstyle/java_rules.xml</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+ <failsOnError>true</failsOnError>
+ <consoleOutput>true</consoleOutput>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>common.build.tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>process-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
</project>
import static org.junit.Assert.fail;
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
-import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
-import java.net.URL;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
-import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import javax.inject.Inject;
-import org.apache.commons.codec.binary.Base64;
//import org.codehaus.jettison.json.JSONException;
//import org.codehaus.jettison.json.JSONObject;
//import org.codehaus.jettison.json.JSONTokener;
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;
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;
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;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lcaftrafficengineeringaddress.Hops;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lcaftrafficengineeringaddress.HopsBuilder;
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.lispaddress.LispAddressContainerBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.LcafKeyValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.LcafSourceDest;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.LcafSourceDestBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.ipv4.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcafapplicationdata.LcafApplicationDataAddr;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcafapplicationdata.LcafApplicationDataAddrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcafkeyvalue.LcafKeyValueAddressAddrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcaflist.LcafListAddrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcafsegment.LcafSegmentAddrBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcafsourcedest.LcafSourceDestAddr;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcafsourcedest.LcafSourceDestAddrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.lcaftrafficengineering.LcafTrafficEngineeringAddrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.no.NoAddressBuilder;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Inject
private BundleContext bc;
- private HttpURLConnection connection;
+ //private HttpURLConnection connection;
protected static boolean notificationCalled;
@Inject @Filter(timeout=60000)
mapReply = receiveMapReply();
assertCorrectMapReplyTTLAndAction(mapReply, 15, Action.NativelyForward);
}
-
+/*
private void testTTLAfterAutherize(MapRequest mapRequest) throws SocketTimeoutException {
MapReply mapReply;
sendMapRequest(mapRequest);
mapReply = receiveMapReply();
assertCorrectMapReplyTTLAndAction(mapReply, 1, Action.NativelyForward);
}
-
+*/
private void assertCorrectMapReplyTTLAndAction(MapReply mapReply, int expectedTTL, Action expectedAction) {
assertEquals(expectedTTL, mapReply.getEidToLocatorRecord().get(0).getRecordTtl().intValue());
assertEquals(expectedAction, mapReply.getEidToLocatorRecord().get(0).getAction());
}
+ 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);
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;
}
}
- @SuppressWarnings({ "rawtypes", "unchecked" })
private void areWeReady() throws InvalidSyntaxException {
try {
Thread.sleep(5000);
}
// assertNotNull(broker);
- ServiceReference r = null;
configLispPlugin.setLispAddress(lispBindAddress);
// Uncomment this code to Know which services were actually loaded to
private void cleanUP() {
after();
- mapService.cleanCachedMappings();;
+ mapService.cleanCachedMappings();
configLispPlugin.shouldListenOnXtrPort(false);
socket = initSocket(socket, LispMessage.PORT_NUM);
<!-- Temporarily disable compiling non-generated code, like serializers, which won't build for now -->
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <!-- Temporarily override the odlparent checkstyle configuration.
+ We want to enforce some simple rules and add more as we clean up code -->
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>checkstyle/java_rules.xml</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
+ <failsOnError>true</failsOnError>
+ <consoleOutput>true</consoleOutput>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>common.build.tools</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ <phase>process-sources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.MacBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.distinguishedname.DistinguishedNameAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.ipv4.Ipv4AddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispsimpleaddress.primitiveaddress.mac.MacAddressBuilder;
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;
<version>1.3.0-SNAPSHOT</version>
</parent>
- <groupId>org.opendaylight.lispflowmapping</groupId>
<artifactId>mappingservice.neutron</artifactId>
- <version>1.3.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Mapping Service Neutron APIs</name>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>checkstyle/java_rules.xml</configLocation>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
<excludes>org/opendaylight/yang/gen/**,**/config/yang/**</excludes>
<failsOnError>true</failsOnError>
<consoleOutput>true</consoleOutput>
<version>1.3.0-SNAPSHOT</version>
</parent>
- <groupId>org.opendaylight.lispflowmapping</groupId>
<artifactId>mappingservice.shell</artifactId>
- <version>1.3.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Mapping Service Karaf Shell Commands</name>
<snapshot>
<required-capabilities>
<capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding?module=opendaylight-md-sal-binding&revision=2013-10-28</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl?module=opendaylight-sal-binding-broker-impl&revision=2013-10-28</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:config:lfm-mappingservice-sb:impl?module=lfm-mappingservice-sb-impl&revision=2015-05-17</capability>
</required-capabilities>
<configuration>
<name>binding-osgi-broker</name>
</broker>
- <notification-service>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
- binding:binding-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-broker</name>
- </notification-service>
+ <name>binding-notification-publish-adapter</name>
+ </notification-publish-service>
</module>
</modules>
</configuration>
-</snapshot>
\ No newline at end of file
+</snapshot>
package org.opendaylight.controller.config.yang.config.lfm_mappingservice_sb.impl;
-import java.net.DatagramPacket;
-
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.lispflowmapping.southbound.LispSouthboundPlugin;
-import org.opendaylight.lispflowmapping.southbound.LispSouthboundRPC;
-import org.opendaylight.lispflowmapping.southbound.lisp.ILispSouthboundService;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
LOG.debug("LfmMappingServiceSb Module up!");
sbPlugin = new LispSouthboundPlugin();
- sbPlugin.setNotificationProviderService(getNotificationServiceDependency());
+ sbPlugin.setNotificationPublishService(getNotificationPublishServiceDependency());
sbPlugin.setRpcRegistryDependency(getRpcRegistryDependency());
sbPlugin.setBindingAwareBroker(getBrokerDependency());
sbPlugin.init();
import java.nio.ByteBuffer;
import org.apache.commons.lang3.exception.ExceptionUtils;
+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.lispflowmapping.lisp.type.LispMessage;
import org.opendaylight.lispflowmapping.southbound.lisp.ILispSouthboundService;
private LispIoThread xtrThread;
private LispSouthboundService lispSouthboundService;
private LispXtrSouthboundService lispXtrSouthboundService;
- private NotificationProviderService notificationService;
+ private NotificationPublishService notificationPublishService;
private RpcProviderRegistry rpcRegistry;
private BindingAwareBroker broker;
private volatile DatagramSocket socket = null;
synchronized (startLock) {
lispSouthboundService = new LispSouthboundService(this);
lispXtrSouthboundService = new LispXtrSouthboundService();
- lispSouthboundService.setNotificationProvider(this.notificationService);
- lispXtrSouthboundService.setNotificationProvider(this.notificationService);
+ lispSouthboundService.setNotificationProvider(this.notificationPublishService);
+ lispXtrSouthboundService.setNotificationProvider(this.notificationPublishService);
if (bindingAddress == null) {
setLispAddress("0.0.0.0");
}
}
}
- public void setNotificationProviderService(NotificationProviderService notificationService) {
- this.notificationService = notificationService;
+ public void setNotificationPublishService(NotificationPublishService notificationService) {
+ this.notificationPublishService = notificationService;
}
public void setRpcRegistryDependency(RpcProviderRegistry rpcRegistry) {
import java.net.InetAddress;
import java.nio.ByteBuffer;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.lispflowmapping.southbound.LispSouthboundPlugin;
import org.opendaylight.lispflowmapping.southbound.LispSouthboundStats;
import org.opendaylight.lispflowmapping.southbound.util.LispNotificationHelper;
import org.slf4j.LoggerFactory;
public class LispSouthboundService implements ILispSouthboundService {
- private NotificationProviderService notificationProvider;
+ private NotificationPublishService notificationPublishService;
protected static final Logger LOG = LoggerFactory.getLogger(LispSouthboundService.class);
private final LispSouthboundPlugin lispSbPlugin;
}
}
- public void setNotificationProvider(NotificationProviderService nps) {
- this.notificationProvider = nps;
+ public void setNotificationProvider(NotificationPublishService nps) {
+ this.notificationPublishService = nps;
}
public void handlePacket(DatagramPacket packet) {
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(finalSourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
requestMappingBuilder.setTransportAddress(transportAddressBuilder.build());
- if (notificationProvider != null) {
- notificationProvider.publish(requestMappingBuilder.build());
+ if (notificationPublishService != null) {
+ notificationPublishService.putNotification(requestMappingBuilder.build());
LOG.trace("MapRequest was published!");
} else {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
+ } catch (InterruptedException e) {
+ LOG.warn("Notification publication interrupted!");
}
}
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(sourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
addMappingBuilder.setTransportAddress(transportAddressBuilder.build());
- if (notificationProvider != null) {
- notificationProvider.publish(addMappingBuilder.build());
+ if (notificationPublishService != null) {
+ notificationPublishService.putNotification(addMappingBuilder.build());
LOG.trace("MapRegister was published!");
} else {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Register (len=" + inBuffer.capacity() + ")", re);
+ } catch (InterruptedException e) {
+ LOG.warn("Notification publication interrupted!");
}
}
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(sourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
gotMapNotifyBuilder.setTransportAddress(transportAddressBuilder.build());
- if (notificationProvider != null) {
- notificationProvider.publish(gotMapNotifyBuilder.build());
+ if (notificationPublishService != null) {
+ notificationPublishService.putNotification(gotMapNotifyBuilder.build());
LOG.trace("MapNotify was published!");
} else {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Notify (len=" + inBuffer.capacity() + ")", re);
+ } catch (InterruptedException e) {
+ LOG.warn("Notification publication interrupted!");
}
}
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(sourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
gotMapReplyBuilder.setTransportAddress(transportAddressBuilder.build());
- if (notificationProvider != null) {
- notificationProvider.publish(gotMapReplyBuilder.build());
+ if (notificationPublishService != null) {
+ notificationPublishService.putNotification(gotMapReplyBuilder.build());
LOG.trace("MapReply was published!");
} else {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Reply (len=" + inBuffer.capacity() + ")", re);
+ } catch (InterruptedException e) {
+ LOG.warn("Notification publication interrupted!");
}
}
import java.net.InetAddress;
import java.nio.ByteBuffer;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.lispflowmapping.southbound.util.LispNotificationHelper;
import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
import org.opendaylight.lispflowmapping.lisp.type.LispMessageEnum;
import org.slf4j.LoggerFactory;
public class LispXtrSouthboundService implements ILispSouthboundService {
- private NotificationProviderService notificationProvider;
+ private NotificationPublishService notificationPublishService;
protected static final Logger LOG = LoggerFactory.getLogger(LispXtrSouthboundService.class);
- public void setNotificationProvider(NotificationProviderService nps) {
- this.notificationProvider = nps;
+ public void setNotificationProvider(NotificationPublishService nps) {
+ this.notificationPublishService = nps;
}
public void handlePacket(DatagramPacket packet) {
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressFromInetAddress(finalSourceAddress));
transportAddressBuilder.setPort(new PortNumber(LispMessage.PORT_NUM));
requestMappingBuilder.setTransportAddress(transportAddressBuilder.build());
- if (notificationProvider != null) {
- notificationProvider.publish(requestMappingBuilder.build());
+ if (notificationPublishService != null) {
+ notificationPublishService.putNotification(requestMappingBuilder.build());
LOG.trace("MapRequest was published!");
} else {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
+ } catch (InterruptedException e) {
+ LOG.warn("Notification publication interrupted!");
}
}
XtrReplyMappingBuilder replyMappingBuilder = new XtrReplyMappingBuilder();
replyMappingBuilder.setMapReply(LispNotificationHelper.convertMapReply(reply));
- if (notificationProvider != null) {
- notificationProvider.publish(replyMappingBuilder.build());
+ if (notificationPublishService != null) {
+ notificationPublishService.putNotification(replyMappingBuilder.build());
LOG.trace("MapReply was published!");
} else {
LOG.warn("Notification Provider is null!");
}
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Reply (len=" + buffer.capacity() + ")", re);
+ } catch (InterruptedException e) {
+ LOG.warn("Notification publication interrupted!");
}
-
}
}
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 lisp-sb { prefix lisp-sb; revision-date 2015-09-04; }
description
}
}
- 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;
}
}
}
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.lispflowmapping.lisp.type.AddressFamilyNumberEnum;
import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
import org.opendaylight.lispflowmapping.lisp.type.LispMessageEnum;
import org.opendaylight.lispflowmapping.tools.junit.BaseTestCase;
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.LispAFIAddress;
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.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.eidtolocatorrecords.EidToLocatorRecord;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.eidtolocatorrecords.EidToLocatorRecordBuilder;
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.lispaddress.lispaddresscontainer.address.ipv4.Ipv4AddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.lispaddress.lispaddresscontainer.address.ipv6.Ipv6AddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.locatorrecords.LocatorRecord;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev150820.locatorrecords.LocatorRecordBuilder;
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;
-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;
import org.opendaylight.yangtools.yang.binding.Notification;
public class LispSouthboundServiceTest extends BaseTestCase {
private LispSouthboundService testedLispService;
- private NotificationProviderService nps;
+ private NotificationPublishService nps;
private byte[] mapRequestPacket;
private byte[] mapRegisterPacket;
private ValueSaverAction<Notification> lispNotificationSaver;
// mapResolver = context.mock(IMapResolver.class);
// mapServer = context.mock(IMapServer.class);
testedLispService = new LispSouthboundService(null);
- nps = context.mock(NotificationProviderService.class);
+ nps = context.mock(NotificationPublishService.class);
testedLispService.setNotificationProvider(nps);
lispNotificationSaver = new ValueSaverAction<Notification>();
// mapRegisterSaver = new ValueSaverAction<MapRegister>();
+ "0060 ff 00 00 05 00 01 0a 01 00 6e 06 64 ff 00 00 05 " //
+ "0070 00 01 c0 a8 88 33"));
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
handleMapRegisterPacket(mapRegisterPacket);
+ "0060 01 92 00 00 00 00 00 00 00 01 01 64 ff 00 00 05 " //
+ "0070 00 01 0a 00 3a 9c"));
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
handleMapRegisterPacket(mapRegisterPacket);
@Test
public void mapRegister__VerifyBasicFields() throws Exception {
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
handleMapRegisterPacket(mapRegisterPacket);
EidToLocatorRecord eidToLocator = lastMapRegister().getEidToLocatorRecord().get(0);
@Test
@Ignore
public void mapRegister__NoResponseFromMapServerShouldReturnNullPacket() throws Exception {
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
mapNotifyBuilder = null;
assertNull(handleMapRegisterPacket(mapRegisterPacket));
@Test
public void mapRequest__VerifyBasicFields() throws Exception {
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
handleMapRequestAsByteArray(mapRequestPacket);
List<EidRecord> eids = lastMapRequest().getEidRecord();
assertEquals(1, eids.size());
+ "00a0 00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 " //
+ "00b0 00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c"));
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
// ret(mapReply);
handleMapRequestAsByteArray(mapRequestPacket);
+ "0090 00 00 00 00 00 02 00 00 00 0a 01 80 10 00 00 00 " //
+ "00a0 00 02 26 10 00 d0 ff ff 01 92 00 00 00 00 00 00 " //
+ "00b0 00 01 01 64 ff 00 00 05 00 01 0a 00 3a 9c"));
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
// ret(mapReply);
DatagramPacket replyPacket = handleMapRequestPacket(mapRequestPacket);
+ "0070 10 00 00 00 00 01 99 10 fe 01 01 64 ff 00 00 05 " //
+ "0080 00 01 0a 00 01 26"));
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
// ret(mapReply);
handleMapRequestAsByteArray(mapRequestPacket);
+ "0080 01 64 ff 00 00 05 00 01 0a 01 00 6f 06 64 ff 00 " //
+ "0090 00 05 00 01 c0 a8 88 33"));
- oneOf(nps).publish(with(lispNotificationSaver));
+ oneOf(nps).putNotification(with(lispNotificationSaver));
handleMapRequestAsByteArray(mapRequestPacket);
}
private void stubMapRegister(final boolean setNotifyFromRegister) {
- allowing(nps).publish(with(lispNotificationSaver));
+ try {
+ allowing(nps).putNotification(with(lispNotificationSaver));
+ } catch (InterruptedException e) {
+ }
will(new SimpleAction() {
@Override
}
private void stubHandleRequest() {
- allowing(nps).publish(wany(Notification.class));
+ try {
+ allowing(nps).putNotification(wany(Notification.class));
+ } catch (InterruptedException e) {
+ }
}
private byte[] handleMapRequestAsByteArray(byte[] inPacket) {
// + "40 05 c0 a8 88 0a 01 02 " // MAC (ITR-RLOC #1 of 2)
// + "00 01 01 02 03 04 " // IP (ITR-RLOC #2 of 2)
// + "00 20 00 01 01 02 03 04").array();
- // oneOf(nps).publish(with(lispNotificationSaver));
+ // oneOf(nps).putNotification(with(lispNotificationSaver));
// // ret(mapReply);
// DatagramPacket packet = handleMapRequestPacket(mapRequestPacket);
// assertEquals(2, lastMapRequest().getItrRlocs().size());
// + "00 01 01 02 03 04 " // IP (ITR-RLOC #1 of 2)
// + "00 01 c0 a8 88 0a " // MAC (ITR-RLOC #2 of 2)
// + "00 20 00 01 01 02 03 04").array();
- // oneOf(nps).publish(with(lispNotificationSaver));
+ // oneOf(nps).putNotification(with(lispNotificationSaver));
// // ret(mapReply);
// DatagramPacket packet = handleMapRequestPacket(mapRequestPacket);
// assertEquals(2, lastMapRequest().getItrRloc().size());