use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.AddLspOutput 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.AddLspOutput 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.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.AddLspOutput 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.AddLspOutput in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testOnErrorMessage.
@Test
public void testOnErrorMessage() throws InterruptedException, ExecutionException {
final Message errorMsg = MsgBuilderUtil.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, Uint32.ONE);
listener.onSessionUp(session);
final Future<RpcResult<AddLspOutput>> futureOutput = topologyRpcs.addLsp(createAddLspInput());
listener.onMessage(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());
assertEquals(PCEPErrors.NON_ZERO_PLSPID.getErrorValue(), err.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.AddLspOutput in project bgpcep by opendaylight.
the class PCEPTopologySessionListenerTest method testOnSessionDown.
@Test
public void testOnSessionDown() throws InterruptedException, ExecutionException {
listener.onSessionUp(session);
// send request
final Future<RpcResult<AddLspOutput>> futureOutput = topologyRpcs.addLsp(createAddLspInput());
assertFalse(session.isClosed());
listener.onSessionDown(session, new IllegalArgumentException());
assertTrue(session.isClosed());
final AddLspOutput output = futureOutput.get().getResult();
// deal with unsent request after session down
assertEquals(FailureType.Unsent, output.getFailure());
}
Aggregations