Search in sources :

Example 16 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testRemoveTunnel.

@Test
public void testRemoveTunnel() {
    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);
    tunnelManager.onMessagePcInitiate(createRequestsRemove(1), this.session1);
    Mockito.verify(this.session1, Mockito.times(2)).sendReport(Mockito.any(Pcrpt.class));
    Mockito.verify(this.session2, Mockito.times(2)).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)

Example 17 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testOnSessionDownAndDelegateToOther.

@Test
public void testOnSessionDownAndDelegateToOther() throws InterruptedException {
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(1, ADDRESS, 0, -1, TIMER, this.timerHandler);
    tunnelManager.onSessionUp(this.session2);
    checkSessionUp(this.session1, tunnelManager);
    checkSessionDown(this.session1, tunnelManager);
    // wait for re-delegation timeout expires
    Thread.sleep(500);
    Mockito.verify(this.session2, Mockito.times(3)).sendReport(Mockito.any(Pcrpt.class));
    tunnelManager.onSessionUp(this.session1);
    Mockito.verify(this.session1, Mockito.times(4)).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)

Example 18 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testReportToAllUnknownLsp.

@Test
public void testReportToAllUnknownLsp() {
    final PCCTunnelManager tunnelManager = new PCCTunnelManagerImpl(1, ADDRESS, 0, 0, TIMER, this.timerHandler);
    tunnelManager.onSessionUp(this.session1);
    tunnelManager.onMessagePcupd(createUpdateDelegate(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 19 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testReportToAll.

@Test
public void testReportToAll() throws InterruptedException {
    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.session1);
    Mockito.verify(this.session1, Mockito.times(3)).sendReport(Mockito.any(Pcrpt.class));
    Mockito.verify(this.session2, Mockito.times(3)).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)

Example 20 with PCCTunnelManager

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

the class PCCTunnelManagerImplTest method testRemoveTunnelNotDelegated.

@Test
public void testRemoveTunnelNotDelegated() {
    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);
    tunnelManager.onMessagePcInitiate(createRequestsRemove(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)

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