use of org.opendaylight.yangtools.yang.common.RpcResult in project bgpcep by opendaylight.
the class BgpPeerRpcTest method testRouteRefreshRequestSuccessRequest.
@Test
public void testRouteRefreshRequestSuccessRequest() throws InterruptedException, ExecutionException {
final RouteRefreshRequestInput input = new RouteRefreshRequestInputBuilder().setAfi(Ipv4AddressFamily.class).setSafi(SubsequentAddressFamily.class).setPeerRef(this.peer).build();
final Future<RpcResult<Void>> result = this.rpc.routeRefreshRequest(input);
assertTrue(result.get().getErrors().isEmpty());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project bgpcep by opendaylight.
the class BgpPeerRpcTest method testResetSessionRequestSuccessRequest.
@Test
public void testResetSessionRequestSuccessRequest() throws InterruptedException, ExecutionException {
Mockito.doReturn(Futures.immediateFuture(null)).when(this.peerRpcs).releaseConnection();
final ResetSessionInput input = new ResetSessionInputBuilder().setPeerRef(this.peer).build();
final Future<RpcResult<Void>> result = this.rpc.resetSession(input);
assertTrue(result.get().getErrors().isEmpty());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project bgpcep by opendaylight.
the class Stateful07TopologySessionListenerTest method testOnErrorMessage.
@Test
public void testOnErrorMessage() throws InterruptedException, ExecutionException {
final Message errorMsg = MsgBuilderUtil.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, 1L);
this.listener.onSessionUp(this.session);
final Future<RpcResult<AddLspOutput>> futureOutput = this.topologyRpcs.addLsp(createAddLspInput());
this.listener.onMessage(this.session, errorMsg);
final AddLspOutput output = futureOutput.get().getResult();
assertEquals(FailureType.Failed, output.getFailure());
assertEquals(1, output.getError().size());
final ErrorObject err = output.getError().get(0).getErrorObject();
assertEquals(PCEPErrors.NON_ZERO_PLSPID.getErrorType(), err.getType().shortValue());
assertEquals(PCEPErrors.NON_ZERO_PLSPID.getErrorValue(), err.getValue().shortValue());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project bgpcep by opendaylight.
the class Stateful07TopologySessionListenerTest method testOnSessionDown.
@Test
public void testOnSessionDown() throws InterruptedException, ExecutionException {
this.listener.onSessionUp(this.session);
// send request
final Future<RpcResult<AddLspOutput>> futureOutput = this.topologyRpcs.addLsp(createAddLspInput());
assertFalse(this.session.isClosed());
this.listener.onSessionDown(this.session, new IllegalArgumentException());
assertTrue(this.session.isClosed());
final AddLspOutput output = futureOutput.get().getResult();
// deal with unsent request after session down
assertEquals(FailureType.Unsent, output.getFailure());
}
use of org.opendaylight.yangtools.yang.common.RpcResult in project bgpcep by opendaylight.
the class Stateful07TopologySessionListenerTest method testOnServerSessionManagerUnstarted.
/**
* Verify the PCEP session should not be up when server session manager is down,
* otherwise it would be a problem when the session is up while it's not registered with session manager.
*/
@Test
public void testOnServerSessionManagerUnstarted() throws InterruptedException, ExecutionException, TransactionCommitFailedException, ReadFailedException {
stopSessionManager();
assertFalse(this.session.isClosed());
this.listener.onSessionUp(this.session);
// verify the session was NOT added to topology
checkNotPresentOperational(getDataBroker(), TOPO_IID);
// verify the session is closed due to server session manager is closed
assertTrue(this.session.isClosed());
// send request
final Future<RpcResult<AddLspOutput>> futureOutput = this.topologyRpcs.addLsp(createAddLspInput());
final AddLspOutput output = futureOutput.get().getResult();
// deal with unsent request after session down
assertEquals(FailureType.Unsent, output.getFailure());
}
Aggregations