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 testOnServerSessionManagerRestartAndSessionRecovery.
@Test
public void testOnServerSessionManagerRestartAndSessionRecovery() throws Exception {
// close server session manager first
stopSessionManager();
assertFalse(session.isClosed());
listener.onSessionUp(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(session.isClosed());
// send request
final Future<RpcResult<AddLspOutput>> futureOutput = topologyRpcs.addLsp(createAddLspInput());
final AddLspOutput output = futureOutput.get().getResult();
// deal with unsent request after session down
assertEquals(FailureType.Unsent, output.getFailure());
// PCC client is not there
checkNotPresentOperational(getDataBroker(), pathComputationClientIId);
// reset received message queue
receivedMsgs.clear();
// now we restart the session manager
startSessionManager();
// try to start the session again
// notice since the session was terminated before, it is not usable anymore.
// we need to get a new session instance. the new session will have the same local / remote preference
session = getPCEPSession(getLocalPref(), getRemotePref());
assertFalse(session.isClosed());
listener.onSessionUp(session);
assertFalse(session.isClosed());
// create node
topologyRpcs.addLsp(createAddLspInput());
final Pcinitiate pcinitiate = (Pcinitiate) receivedMsgs.get(0);
final Requests req = pcinitiate.getPcinitiateMessage().getRequests().get(0);
final Uint32 srpId = req.getSrp().getOperationId().getValue();
final Tlvs tlvs = createLspTlvs(req.getLsp().getPlspId().getValue(), true, testAddress, testAddress, testAddress, Optional.empty());
final Pcrpt pcRpt = MsgBuilderUtil.createPcRtpMessage(new LspBuilder(req.getLsp()).setTlvs(tlvs).setSync(TRUE).setRemove(FALSE).setOperational(OperationalStatus.Active).build(), Optional.of(MsgBuilderUtil.createSrp(srpId)), MsgBuilderUtil.createPath(req.getEro().getSubobject()));
listener.onMessage(session, pcRpt);
readDataOperational(getDataBroker(), TOPO_IID, topology -> {
assertEquals(1, topology.nonnullNode().size());
return topology;
});
}
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 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 {
stopSessionManager();
assertFalse(session.isClosed());
listener.onSessionUp(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(session.isClosed());
// send request
final Future<RpcResult<AddLspOutput>> futureOutput = topologyRpcs.addLsp(createAddLspInput());
final AddLspOutput output = futureOutput.get().getResult();
// deal with unsent request after session down
assertEquals(FailureType.Unsent, output.getFailure());
}
Aggregations