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();
}
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();
}
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();
}
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();
}
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;
});
}
Aggregations