use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.
the class FlowRerouteServiceTest method shouldMoveFlowToDegradedIfPathWithRequiredLatencyNotFound.
@Test
public void shouldMoveFlowToDegradedIfPathWithRequiredLatencyNotFound() throws Exception {
Flow origin = makeFlow();
origin.setTargetPathComputationStrategy(MAX_LATENCY);
setupFlowRepositorySpy().findById(origin.getFlowId()).ifPresent(foundPath -> foundPath.setTargetPathComputationStrategy(MAX_LATENCY));
when(pathComputer.getPath(makeFlowArgumentMatch(origin.getFlowId()), any(Collection.class))).thenReturn(make3SwitchesPathPair(true));
FlowRerouteService service = makeService();
IslEndpoint affectedEndpoint = extractIslEndpoint(origin);
FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, true, false, Collections.singleton(affectedEndpoint), null, false);
service.handleRequest(currentRequestKey, request, commandContext);
verifyFlowStatus(origin.getFlowId(), FlowStatus.IN_PROGRESS);
FlowSegmentRequest speakerRequest;
while ((speakerRequest = requests.poll()) != null) {
produceAsyncResponse(service, speakerRequest);
}
Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.DEGRADED);
verifyPathReplace(origin, result);
assertEquals(MAX_LATENCY, result.getPathComputationStrategy());
assertNull(result.getTargetPathComputationStrategy());
}
use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.
the class FlowCacheServiceTest method createFlow.
private Flow createFlow() {
FlowEndpoint flowSource = new FlowEndpoint(SRC_SWITCH, IN_PORT);
FlowEndpoint flowDestination = new FlowEndpoint(DST_SWITCH, OUT_PORT);
IslDirectionalReference islDirectionalReference = new IslDirectionalReference(new IslEndpoint(SRC_SWITCH, ISL_SRC_PORT), new IslEndpoint(DST_SWITCH, ISL_DST_PORT));
return dummyFactory.makeFlow(flowSource, flowDestination, islDirectionalReference);
}
Aggregations