Search in sources :

Example 6 with PCCSessionListener

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

the class PCCSessionListenerTest method testSendError.

@Test
public void testSendError() {
    final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, false);
    listener.onSessionUp(this.mockedSession);
    listener.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.ATTEMPT_2ND_SESSION, 0));
    verify(this.mockedSession).sendMessage(Mockito.any());
}
Also used : PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) Test(org.junit.Test)

Example 7 with PCCSessionListener

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

the class PCCSessionListenerTest method testSendReport.

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

Example 8 with PCCSessionListener

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

the class PCCSessionListenerTest method testOnMessage.

@Test
public void testOnMessage() {
    final PCCSessionListener listener = new PCCSessionListener(1, this.tunnelManager, false);
    listener.onMessage(this.mockedSession, createUpdMsg(true));
    verify(this.tunnelManager).onMessagePcupd(Mockito.any(Updates.class), Mockito.any(PCCSession.class));
    verify(this.tunnelManager, Mockito.never()).onMessagePcInitiate(Mockito.any(Requests.class), Mockito.any(PCCSession.class));
    listener.onMessage(this.mockedSession, createUpdMsg(false));
    verify(this.tunnelManager, Mockito.times(2)).onMessagePcupd(Mockito.any(Updates.class), Mockito.any(PCCSession.class));
    verify(this.tunnelManager, Mockito.never()).onMessagePcInitiate(Mockito.any(Requests.class), Mockito.any(PCCSession.class));
    listener.onMessage(this.mockedSession, createInitMsg(false, true));
    verify(this.tunnelManager, Mockito.times(2)).onMessagePcupd(Mockito.any(Updates.class), Mockito.any(PCCSession.class));
    verify(this.tunnelManager).onMessagePcInitiate(Mockito.any(Requests.class), Mockito.any(PCCSession.class));
    listener.onMessage(this.mockedSession, createInitMsg(true, false));
    verify(this.tunnelManager, Mockito.times(2)).onMessagePcupd(Mockito.any(Updates.class), Mockito.any(PCCSession.class));
    verify(this.tunnelManager, Mockito.times(2)).onMessagePcInitiate(Mockito.any(Requests.class), Mockito.any(PCCSession.class));
    listener.onMessage(this.mockedSession, createInitMsg(false, false));
    verify(this.tunnelManager, Mockito.times(2)).onMessagePcupd(Mockito.any(Updates.class), Mockito.any(PCCSession.class));
    verify(this.tunnelManager, Mockito.times(3)).onMessagePcInitiate(Mockito.any(Requests.class), Mockito.any(PCCSession.class));
}
Also used : PCCSessionListener(org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener) PCCSession(org.opendaylight.protocol.pcep.pcc.mock.api.PCCSession) Updates(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcupd.message.pcupd.message.Updates) Requests(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.pcinitiate.message.pcinitiate.message.Requests) 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