Search in sources :

Example 1 with PCCTunnelManager

use of org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager 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 PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testReturnDelegationNonDelegatedLsp.

@Test
public void testReturnDelegationNonDelegatedLsp() {
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(1, ADDRESS, 0, 0, TIMER, this.timerHandler);
    tunnelManager.onSessionUp(this.session1);
    tunnelManager.onSessionUp(this.session2);
    tunnelManager.onMessagePcupd(createUpdate(1), this.session2);
    Mockito.verify(this.session2, Mockito.times(1)).sendError(Mockito.any(Pcerr.class));
    assertEquals(PCEPErrors.UPDATE_REQ_FOR_NON_LSP, this.errorsSession2.get(0));
}
Also used : PCCTunnelManager(org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager) Pcerr(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr) Test(org.junit.Test)

Example 3 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testReportToAllNonDelegatedLsp.

@Test
public void testReportToAllNonDelegatedLsp() {
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(1, ADDRESS, 0, 0, TIMER, this.timerHandler);
    tunnelManager.onSessionUp(this.session1);
    tunnelManager.onSessionUp(this.session2);
    tunnelManager.onMessagePcupd(createUpdateDelegate(1), this.session2);
    Mockito.verify(this.session2, Mockito.times(1)).sendError(Mockito.any(Pcerr.class));
    assertEquals(PCEPErrors.UPDATE_REQ_FOR_NON_LSP, this.errorsSession2.get(0));
}
Also used : PCCTunnelManager(org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager) Pcerr(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr) Test(org.junit.Test)

Example 4 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testReturnDelegationUnknownLsp.

@Test
public void testReturnDelegationUnknownLsp() {
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(1, ADDRESS, 0, 0, TIMER, this.timerHandler);
    tunnelManager.onSessionUp(this.session1);
    tunnelManager.onMessagePcupd(createUpdate(2), this.session1);
    Mockito.verify(this.session1, Mockito.times(1)).sendError(Mockito.any(Pcerr.class));
    assertEquals(PCEPErrors.UNKNOWN_PLSP_ID, this.errorsSession1.get(0));
}
Also used : PCCTunnelManager(org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager) Pcerr(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr) Test(org.junit.Test)

Example 5 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testAddTunnel.

@Test
public void testAddTunnel() {
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(0, ADDRESS, 0, 0, TIMER, this.timerHandler);
    tunnelManager.onSessionUp(this.session1);
    tunnelManager.onSessionUp(this.session2);
    tunnelManager.onMessagePcInitiate(createRequests(1), this.session1);
    Mockito.verify(this.session1, Mockito.times(1)).sendReport(Mockito.any(Pcrpt.class));
    Mockito.verify(this.session2, Mockito.times(1)).sendReport(Mockito.any(Pcrpt.class));
}
Also used : PCCTunnelManager(org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager) Pcrpt(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt) Test(org.junit.Test)

Aggregations

PCCTunnelManager (org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager)20 Test (org.junit.Test)18 Pcerr (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr)9 Pcrpt (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Pcrpt)8 PCCDispatcherImpl (org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl)2 HashedWheelTimer (io.netty.util.HashedWheelTimer)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 PCEPSessionImpl (org.opendaylight.protocol.pcep.impl.PCEPSessionImpl)1 PCCSessionListener (org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener)1