Search in sources :

Example 26 with IslEndpoint

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());
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) FlowSegmentRequest(org.openkilda.floodlight.api.request.FlowSegmentRequest) Collection(java.util.Collection) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 27 with IslEndpoint

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);
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) FlowEndpoint(org.openkilda.model.FlowEndpoint) IslDirectionalReference(org.openkilda.persistence.dummy.IslDirectionalReference)

Aggregations

IslEndpoint (org.openkilda.model.IslEndpoint)27 Test (org.junit.Test)13 Flow (org.openkilda.model.Flow)9 FlowThrottlingData (org.openkilda.wfm.topology.reroute.model.FlowThrottlingData)8 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)7 HashSet (java.util.HashSet)6 YFlowRerouteRequest (org.openkilda.messaging.command.yflow.YFlowRerouteRequest)6 FlowPath (org.openkilda.model.FlowPath)6 SwitchId (org.openkilda.model.SwitchId)5 PathNode (org.openkilda.messaging.info.event.PathNode)4 TimedExecution (org.openkilda.wfm.share.metrics.TimedExecution)4 RerouteQueue (org.openkilda.wfm.topology.reroute.model.RerouteQueue)4 Values (org.apache.storm.tuple.Values)3 YFlowRequest (org.openkilda.messaging.command.yflow.YFlowRequest)3 MessageException (org.openkilda.messaging.error.MessageException)3 PathSegment (org.openkilda.model.PathSegment)3 YFlow (org.openkilda.model.YFlow)3 AbstractYFlowTest (org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)3 ArrayList (java.util.ArrayList)2 FlowSegmentRequest (org.openkilda.floodlight.api.request.FlowSegmentRequest)2