Search in sources :

Example 1 with DataStoreBackEnd

use of org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd in project lispflowmapping by opendaylight.

the class MappingService method initialize.

public void initialize() {
    LOG.info("Mapping Service initializing...");
    dsbe = new DataStoreBackEnd(dataBroker);
    mappingSystem = new MappingSystem(dao, iterateMask, notificationPublishService, mappingMergePolicy);
    mappingSystem.setDataStoreBackEnd(dsbe);
    mappingSystem.initialize();
    keyListener = new AuthenticationKeyDataListener(dataBroker, mappingSystem);
    mappingListener = new MappingDataListener(dataBroker, mappingSystem, notificationPublishService);
    LOG.info("Mapping Service loaded.");
}
Also used : DataStoreBackEnd(org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd) AuthenticationKeyDataListener(org.opendaylight.lispflowmapping.implementation.mdsal.AuthenticationKeyDataListener) MappingDataListener(org.opendaylight.lispflowmapping.implementation.mdsal.MappingDataListener)

Example 2 with DataStoreBackEnd

use of org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd 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]);
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) EventLoopGroup(io.netty.channel.EventLoopGroup) DataStoreBackEnd(org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd) Channel(io.netty.channel.Channel) NioDatagramChannel(io.netty.channel.socket.nio.NioDatagramChannel) LispSouthboundHandler(org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 3 with DataStoreBackEnd

use of org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd 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!");
    }
}
Also used : AuthKeyDb(org.opendaylight.lispflowmapping.mapcache.AuthKeyDb) AuthenticationKeyDataListener(org.opendaylight.lispflowmapping.southbound.lisp.AuthenticationKeyDataListener) DataStoreBackEnd(org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd) LispXtrSouthboundHandler(org.opendaylight.lispflowmapping.southbound.lisp.LispXtrSouthboundHandler) EpollEventLoopGroup(io.netty.channel.epoll.EpollEventLoopGroup) LispSouthboundHandler(org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler) HashMapDb(org.opendaylight.lispflowmapping.inmemorydb.HashMapDb) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup)

Aggregations

DataStoreBackEnd (org.opendaylight.lispflowmapping.dsbackend.DataStoreBackEnd)3 LispSouthboundHandler (org.opendaylight.lispflowmapping.southbound.lisp.LispSouthboundHandler)2 Channel (io.netty.channel.Channel)1 ChannelFuture (io.netty.channel.ChannelFuture)1 EventLoopGroup (io.netty.channel.EventLoopGroup)1 EpollEventLoopGroup (io.netty.channel.epoll.EpollEventLoopGroup)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 NioDatagramChannel (io.netty.channel.socket.nio.NioDatagramChannel)1 Test (org.junit.Test)1 AuthenticationKeyDataListener (org.opendaylight.lispflowmapping.implementation.mdsal.AuthenticationKeyDataListener)1 MappingDataListener (org.opendaylight.lispflowmapping.implementation.mdsal.MappingDataListener)1 HashMapDb (org.opendaylight.lispflowmapping.inmemorydb.HashMapDb)1 AuthKeyDb (org.opendaylight.lispflowmapping.mapcache.AuthKeyDb)1 AuthenticationKeyDataListener (org.opendaylight.lispflowmapping.southbound.lisp.AuthenticationKeyDataListener)1 LispXtrSouthboundHandler (org.opendaylight.lispflowmapping.southbound.lisp.LispXtrSouthboundHandler)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1