Search in sources :

Example 6 with PCEPSession

use of org.opendaylight.protocol.pcep.PCEPSession in project bgpcep by opendaylight.

the class PCCSyncAvoidanceProcedureTest method testSessionAvoidanceDesynchronizedEstablishment.

@Test
public void testSessionAvoidanceDesynchronizedEstablishment() throws Exception {
    final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
    final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
    final PCEPSession session = createPCCSession(BigInteger.TEN).get();
    assertNotNull(session);
    final TestingSessionListener pceSessionListener = getListener(factory);
    assertNotNull(pceSessionListener);
    assertNotNull(pceSessionListener.getSession());
    checkResyncSession(Optional.absent(), 11, 11, null, BigInteger.valueOf(10), pceSessionListener);
    channel.close().get();
}
Also used : PCCPeerProposal(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal) PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Channel(io.netty.channel.Channel) Test(org.junit.Test)

Example 7 with PCEPSession

use of org.opendaylight.protocol.pcep.PCEPSession in project bgpcep by opendaylight.

the class PCCTriggeredFullDBResyncTest method testSessionTriggeredFullDBReSync.

@Test
public void testSessionTriggeredFullDBReSync() throws Exception {
    final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
    final int lspQuantity = 3;
    final BigInteger numberOflspAndDBv = BigInteger.valueOf(lspQuantity);
    final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
    final PCEPSession session = createPCCSession(numberOflspAndDBv).get();
    assertNotNull(session);
    final TestingSessionListener pceSessionListener = getListener(factory);
    assertNotNull(pceSessionListener);
    checkSynchronizedSession(lspQuantity, pceSessionListener, numberOflspAndDBv);
    this.pccSessionListener.onMessage(session, createTriggerLspResync());
    final TestingSessionListener sessionListenerAfterReconnect = getListener(factory);
    checkResyncSession(Optional.of(lspQuantity), 4, 8, null, numberOflspAndDBv, sessionListenerAfterReconnect);
    channel.close().get();
}
Also used : PCCPeerProposal(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal) PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Channel(io.netty.channel.Channel) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Example 8 with PCEPSession

use of org.opendaylight.protocol.pcep.PCEPSession in project bgpcep by opendaylight.

the class PCCTriggeredSyncTest method testSessionTriggeredSync.

@Test
public void testSessionTriggeredSync() throws Exception {
    final TestingSessionListenerFactory factory = new TestingSessionListenerFactory();
    final Channel channel = createServer(factory, this.remoteAddress, new PCCPeerProposal());
    final BigInteger numberOflspAndDBv = BigInteger.valueOf(3);
    final PCEPSession session = createPCCSession(numberOflspAndDBv).get();
    assertNotNull(session);
    final TestingSessionListener pceSessionListener = getListener(factory);
    assertNotNull(pceSessionListener);
    checkSynchronizedSession(0, pceSessionListener, BigInteger.ZERO);
    this.pccSessionListener.onMessage(session, createTriggerMsg());
    checkSynchronizedSession(3, pceSessionListener, numberOflspAndDBv);
    channel.close().get();
}
Also used : PCCPeerProposal(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal) PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Channel(io.netty.channel.Channel) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Example 9 with PCEPSession

use of org.opendaylight.protocol.pcep.PCEPSession in project bgpcep by opendaylight.

the class PCCDispatcherImplTest method testClientReconnect.

@Test
public void testClientReconnect() throws Exception {
    final Future<PCEPSession> futureSession = this.dispatcher.createClient(this.serverAddress, 1, new TestingSessionListenerFactory(), this.nf, KeyMapping.getKeyMapping(), this.clientAddress);
    final TestingSessionListenerFactory slf = new TestingSessionListenerFactory();
    doReturn(slf).when(this.dispatcherDependencies).getListenerFactory();
    final ChannelFuture futureServer = this.pcepDispatcher.createServer(this.dispatcherDependencies);
    waitFutureSuccess(futureServer);
    final Channel channel = futureServer.channel();
    Assert.assertNotNull(futureSession.get());
    checkSessionListenerNotNull(slf, this.clientAddress.getHostString());
    final TestingSessionListener sl = checkSessionListenerNotNull(slf, this.clientAddress.getAddress().getHostAddress());
    Assert.assertNotNull(sl.getSession());
    Assert.assertTrue(sl.isUp());
    channel.close().get();
    closeEventLoopGroups();
    this.workerGroup = new NioEventLoopGroup();
    this.bossGroup = new NioEventLoopGroup();
    this.pcepDispatcher = new PCEPDispatcherImpl(ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance().getMessageHandlerRegistry(), this.nf, this.bossGroup, this.workerGroup);
    final TestingSessionListenerFactory slf2 = new TestingSessionListenerFactory();
    doReturn(slf2).when(this.dispatcherDependencies).getListenerFactory();
    final ChannelFuture future2 = this.pcepDispatcher.createServer(this.dispatcherDependencies);
    waitFutureSuccess(future2);
    final Channel channel2 = future2.channel();
    final TestingSessionListener sl2 = checkSessionListenerNotNull(slf2, this.clientAddress.getAddress().getHostAddress());
    Assert.assertNotNull(sl2.getSession());
    Assert.assertTrue(sl2.isUp());
    channel2.close();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) PCEPDispatcherImpl(org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl) PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Channel(io.netty.channel.Channel) NioEventLoopGroup(io.netty.channel.nio.NioEventLoopGroup) Test(org.junit.Test)

Example 10 with PCEPSession

use of org.opendaylight.protocol.pcep.PCEPSession in project bgpcep by opendaylight.

the class StateSynchronizationAvoidanceProcedureTest method testStateSynchronizationSkipped.

@Test
public void testStateSynchronizationSkipped() throws Exception {
    // session up - sync skipped (LSP-DBs match)
    final LspDbVersion lspDbVersion = new LspDbVersionBuilder().setLspDbVersionValue(BigInteger.ONE).build();
    final PCEPSession session = getPCEPSession(getOpen(lspDbVersion), getOpen(lspDbVersion));
    this.listener.onSessionUp(session);
    // check node - synchronized
    readDataOperational(getDataBroker(), this.pathComputationClientIId, pcc -> {
        assertEquals(PccSyncState.Synchronized, pcc.getStateSync());
        return pcc;
    });
}
Also used : PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) LspDbVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion) LspDbVersionBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder) Test(org.junit.Test)

Aggregations

PCEPSession (org.opendaylight.protocol.pcep.PCEPSession)13 Test (org.junit.Test)10 Channel (io.netty.channel.Channel)5 LspDbVersionBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersionBuilder)5 BigInteger (java.math.BigInteger)4 PCCPeerProposal (org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCPeerProposal)4 LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)4 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)4 Collections (java.util.Collections)2 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)2 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)2 ChannelFuture (io.netty.channel.ChannelFuture)1 NioEventLoopGroup (io.netty.channel.nio.NioEventLoopGroup)1 Executor (java.util.concurrent.Executor)1 Before (org.junit.Before)1 PCEPDispatcherImpl (org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl)1 PathComputationClient1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.PathComputationClient1)1 Tlvs3 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3)1 SymbolicPathName (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SymbolicPathName)1 LspIdentifiersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.LspIdentifiersBuilder)1