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