Search in sources :

Example 1 with PCCSessionListener

use of org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener in project bgpcep by opendaylight.

the class PCCMockCommon method createPCCSession.

Future<PCEPSession> createPCCSession(final BigInteger dbVersion) {
    final PCCDispatcherImpl pccDispatcher = new PCCDispatcherImpl(this.messageRegistry);
    final PCEPSessionNegotiatorFactory<PCEPSessionImpl> snf = getSessionNegotiatorFactory();
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(3, this.localAddress.getAddress(), 0, -1, new HashedWheelTimer(), Optional.absent());
    return pccDispatcher.createClient(this.remoteAddress, -1, () -> {
        this.pccSessionListener = new PCCSessionListener(1, tunnelManager, false);
        return this.pccSessionListener;
    }, snf, KeyMapping.getKeyMapping(), this.localAddress, dbVersion);
}
Also used : PCCDispatcherImpl(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl) PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) PCCTunnelManager(org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager) PCEPSessionImpl(org.opendaylight.protocol.pcep.impl.PCEPSessionImpl) HashedWheelTimer(io.netty.util.HashedWheelTimer)

Example 2 with PCCSessionListener

use of org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener in project bgpcep by opendaylight.

the class PCCSessionListenerTest method testGetId.

@Test
public void testGetId() {
    final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, false);
    Assert.assertEquals(1, listener.getId());
}
Also used : PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) Test(org.junit.Test)

Example 3 with PCCSessionListener

use of org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener in project bgpcep by opendaylight.

the class PCCSessionListenerTest method testOnSessionDown.

@Test
public void testOnSessionDown() {
    final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, false);
    listener.onSessionDown(this.mockedSession, new Exception());
    verify(this.tunnelManager).onSessionDown(Mockito.any(PCCSession.class));
}
Also used : PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) PCCSession(org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession) Test(org.junit.Test)

Example 4 with PCCSessionListener

use of org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener in project bgpcep by opendaylight.

the class PCCSessionListenerTest method testOnSessionUp.

@Test
public void testOnSessionUp() {
    final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, false);
    listener.onSessionUp(this.mockedSession);
    verify(this.tunnelManager).onSessionUp(Mockito.any(PCCSession.class));
}
Also used : PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) PCCSession(org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession) Test(org.junit.Test)

Example 5 with PCCSessionListener

use of org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener in project bgpcep by opendaylight.

the class PCCSessionListenerTest method testOnMessageErrorMode.

@Test
public void testOnMessageErrorMode() {
    final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, true);
    listener.onMessage(this.mockedSession, createUpdMsg(true));
    verify(this.mockedSession).sendMessage(Mockito.any(Message.class));
}
Also used : PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) PcinitiateMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.PcinitiateMessage) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message) Test(org.junit.Test)

Aggregations

PCCSessionListener (org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener)8 Test (org.junit.Test)7 PCCSession (org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession)3 HashedWheelTimer (io.netty.util.HashedWheelTimer)1 PCEPSessionImpl (org.opendaylight.protocol.pcep.impl.PCEPSessionImpl)1 PCCTunnelManager (org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager)1 PCCDispatcherImpl (org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl)1 PcinitiateMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.PcinitiateMessage)1 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests)1 Updates (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates)1 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message)1