<groupId>org.opendaylight.lispflowmapping</groupId>
<artifactId>common.unittest.tools</artifactId>
<version>${project.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<artifactId>model</artifactId>
<version>0.7.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>common.unittest.tools</artifactId>
+ </dependency>
</dependencies>
<build>
<groupId>${project.groupId}</groupId>
<artifactId>common.unittest.tools</artifactId>
<version>${project.version}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>junit-addons</groupId>
<groupId>${project.groupId}</groupId>
<artifactId>mappingservice.api</artifactId>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>mappingservice.clustering</artifactId>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mappingservice.inmemorydb</artifactId>
<groupId>junit-addons</groupId>
<artifactId>junit-addons</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.lispflowmapping</groupId>
+ <artifactId>common.unittest.tools</artifactId>
+ </dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
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.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
-import org.opendaylight.lispflowmapping.clustering.ClusterNodeModulSwitcherImpl;
-import org.opendaylight.lispflowmapping.clustering.api.ClusterNodeModuleSwitcher;
import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler;
import org.opendaylight.lispflowmapping.southbound.lisp.LispXtrSouthboundHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCloseable, ClusterNodeModuleSwitcher {
+public class LispSouthboundPlugin implements IConfigLispSouthboundPlugin, AutoCloseable {
protected static final Logger LOG = LoggerFactory.getLogger(LispSouthboundPlugin.class);
private volatile String bindingAddress;
private long mapRegisterCacheTimeout;
private static Object startLock = new Object();
- private final ClusterNodeModulSwitcherImpl clusterNodeModulSwitcher;
private LispSouthboundHandler lispSouthboundHandler;
private LispXtrSouthboundHandler lispXtrSouthboundHandler;
private NotificationPublishService notificationPublishService;
private DataBroker dataBroker;
public LispSouthboundPlugin(final DataBroker dataBroker,
- final NotificationPublishService notificationPublishService,
- final EntityOwnershipService entityOwnershipService) {
+ final NotificationPublishService notificationPublishService) {
this.dataBroker = dataBroker;
this.notificationPublishService = notificationPublishService;
- clusterNodeModulSwitcher = new ClusterNodeModulSwitcherImpl(entityOwnershipService);
- clusterNodeModulSwitcher.setModule(this);
}
public void init() {
LOG.info("LISP (RFC6830) Southbound Plugin is up!");
}
- clusterNodeModulSwitcher.switchModuleByEntityOwnership();
}
private void start() {
lispSouthboundHandler.close();
unloadActions();
}
-
- @Override
- public void stopModule() {
- if (lispSouthboundHandler != null) {
- lispSouthboundHandler.setNotificationProvider(null);
- lispSouthboundHandler.setIsReadFromChannelEnabled(false);
- }
- if (lispXtrSouthboundHandler != null) {
- lispXtrSouthboundHandler.setNotificationProvider(null);
- }
- }
-
- @Override
- public void startModule() {
- if (lispSouthboundHandler != null) {
- lispSouthboundHandler.setNotificationProvider(notificationPublishService);
- lispSouthboundHandler.restoreDaoFromDatastore();
- lispSouthboundHandler.setIsReadFromChannelEnabled(true);
- }
- if (lispXtrSouthboundHandler != null) {
- lispXtrSouthboundHandler.setNotificationProvider(notificationPublishService);
- }
- }
}
private SimpleMapCache smc;
private AuthenticationKeyDataListener authenticationKeyDataListener;
private DataStoreBackEnd dsbe;
- private boolean isReadFromChannelEnabled = true;
public LispSouthboundHandler(LispSouthboundPlugin lispSbPlugin) {
this.lispSbPlugin = lispSbPlugin;
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
- if (isReadFromChannelEnabled) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
- msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
- }
- handlePacket(msg);
+ if (LOG.isTraceEnabled()) {
+ LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+ msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
}
+ handlePacket(msg);
}
@Override
dsbe = new DataStoreBackEnd(dataBroker);
}
- public void setIsReadFromChannelEnabled(boolean isReadFromChannelEnabled) {
- this.isReadFromChannelEnabled = isReadFromChannelEnabled;
- }
-
public void setMapRegisterCacheTimeout(long mapRegisterCacheTimeout) {
this.mapRegisterCacheTimeout = mapRegisterCacheTimeout;
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
if (LOG.isTraceEnabled()) {
- LOG.trace("Received UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
+ LOG.trace("Received xTR UDP packet from {}:{} with content:\n{}", msg.sender().getHostString(),
msg.sender().getPort(), ByteBufUtil.prettyHexDump(msg.content()));
}
handlePacket(msg);
odl:type="pingpong" />
<reference id="notificationPublishService"
interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" />
- <reference id="entityOwnershipService"
- interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService" />
<cm:property-placeholder persistent-id="org.opendaylight.lispflowmapping" update-strategy="none">
init-method="init" destroy-method="close">
<argument ref="dataBroker" />
<argument ref="notificationPublishService" />
- <argument ref="entityOwnershipService" />
<property name="bindingAddress" value="${bindingAddressProperty}"/>
<property name="mapRegisterCacheEnabled" value="${mapRegisterCacheEnabledProperty}"/>
<property name="mapRegisterCacheTimeout" value="${mapRegisterCacheTimeoutProperty}"/>
import org.mockito.Mockito;
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.clustering.EntityOwnershipService;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.lispflowmapping.lisp.type.LispMessage;
import org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler;
public void init() throws NoSuchFieldException, IllegalAccessException, InterruptedException {
lispSouthboundPlugin = new LispSouthboundPlugin(
Mockito.mock(DataBroker.class),
- Mockito.mock(NotificationPublishService.class),
- Mockito.mock(EntityOwnershipService.class));
+ Mockito.mock(NotificationPublishService.class));
lispSouthboundPlugin.setBindingAddress(ADDRESS_1);
lispSouthboundPlugin.setMapRegisterCacheEnabled(false);
channel = PowerMockito.mock(NioDatagramChannel.class);