use of org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler in project lispflowmapping by opendaylight.
the class LispSouthboundPluginTest method closeTest.
/**
* Tests {@link LispSouthboundPlugin#close} method.
*/
@Test
@SuppressWarnings("unchecked")
public void closeTest() throws Exception {
EventLoopGroup elgMock = Mockito.mock(EventLoopGroup.class);
LispSouthboundPluginTest.injectField("eventLoopGroup", elgMock);
DataStoreBackEnd dsbeMock = Mockito.mock(DataStoreBackEnd.class);
LispSouthboundPluginTest.injectField("dsbe", dsbeMock);
LispSouthboundHandler handlerMock = Mockito.mock(LispSouthboundHandler.class);
LispSouthboundPluginTest.injectField("lispSouthboundHandler", handlerMock);
Mockito.when(channel.close()).thenReturn(Mockito.mock(ChannelFuture.class));
lispSouthboundPlugin.close();
Mockito.verify(channel).close();
Mockito.verify(elgMock).shutdownGracefully();
Mockito.verify(handlerMock).close();
assertNull(getField("lispSouthboundHandler"));
assertNull(getField("lispXtrSouthboundHandler"));
Channel[] channels = getField("channel");
assertNull(channels[0]);
}
use of org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler in project lispflowmapping by opendaylight.
the class LispSouthboundPlugin method init.
public void init() {
LOG.info("LISP (RFC6830) Southbound Plugin is initializing...");
synchronized (startLock) {
this.akdb = new AuthKeyDb(new HashMapDb());
this.authenticationKeyDataListener = new AuthenticationKeyDataListener(dataBroker, akdb);
this.dsbe = new DataStoreBackEnd(dataBroker);
restoreDaoFromDatastore();
LispSouthboundHandler lsbh = new LispSouthboundHandler(this);
this.lispSouthboundHandler = lsbh;
LispXtrSouthboundHandler lxsbh = new LispXtrSouthboundHandler(this);
this.lispXtrSouthboundHandler = lxsbh;
if (Epoll.isAvailable()) {
eventLoopGroup = new EpollEventLoopGroup(numChannels, threadFactory);
channelType = EpollDatagramChannel.class;
bootstrap.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
bootstrap.option(EpollChannelOption.SO_REUSEPORT, true);
LOG.debug("Using Netty Epoll for UDP sockets");
} else {
eventLoopGroup = new NioEventLoopGroup(0, threadFactory);
channelType = NioDatagramChannel.class;
LOG.debug("Using Netty I/O (non-Epoll) for UDP sockets");
}
bootstrap.group(eventLoopGroup);
bootstrap.channel(channelType);
bootstrap.handler(lsbh);
xtrBootstrap.group(eventLoopGroup);
xtrBootstrap.channel(channelType);
xtrBootstrap.handler(lxsbh);
start();
startXtr();
clusterSingletonService.registerClusterSingletonService(this);
LOG.info("LISP (RFC6830) Southbound Plugin is up!");
}
}
Aggregations