Search in sources :

Example 21 with IslEndpoint

use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.

the class YFlowRerouteServiceTest method shouldRerouteFlowWithTransitSwitchesWithAffectedIsl.

@Test
public void shouldRerouteFlowWithTransitSwitchesWithAffectedIsl() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    request.setAffectedIsl(Collections.singleton(new IslEndpoint(SWITCH_TRANSIT, 25)));
    preparePathComputationForReroute("test_flow_1", buildFirstSubFlowPathPairWithNewTransit());
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT);
    // when
    processRerouteRequestAndSpeakerCommands(request);
    verifyNorthboundSuccessResponse(yFlowRerouteHubCarrier, YFlowRerouteResponse.class);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
    verifyAffinity(request.getYFlowId());
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(null), anyString());
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 22 with IslEndpoint

use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.

the class YFlowRerouteServiceTest method shouldRerouteFlowWithTransitSwitchesWithMainFlowAffectedIsl.

@Test
public void shouldRerouteFlowWithTransitSwitchesWithMainFlowAffectedIsl() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    request.setAffectedIsl(Collections.singleton(new IslEndpoint(SWITCH_TRANSIT, 26)));
    preparePathComputationForReroute("test_flow_1", buildFirstSubFlowPathPairWithNewTransit());
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT);
    // when
    processRerouteRequestAndSpeakerCommands(request);
    verifyNorthboundSuccessResponse(yFlowRerouteHubCarrier, YFlowRerouteResponse.class);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
    verifyAffinity(request.getYFlowId());
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(null), anyString());
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 23 with IslEndpoint

use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.

the class YFlowRerouteServiceTest method shouldRerouteFlowWithTransitSwitchesWithSecondaryFlowAffectedIsl.

@Test
public void shouldRerouteFlowWithTransitSwitchesWithSecondaryFlowAffectedIsl() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    request.setAffectedIsl(Collections.singleton(new IslEndpoint(SWITCH_TRANSIT, 27)));
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_SHARED);
    // when
    processRerouteRequestAndSpeakerCommands(request, FlowStatus.IN_PROGRESS, FlowStatus.UP, FlowStatus.IN_PROGRESS);
    verifyNorthboundSuccessResponse(yFlowRerouteHubCarrier, YFlowRerouteResponse.class);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
    verifyAffinity(request.getYFlowId());
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(null), anyString());
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 24 with IslEndpoint

use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.

the class FlowRerouteServiceTest method shouldSkipRerouteOnOutdatedRequest.

@Test
public void shouldSkipRerouteOnOutdatedRequest() {
    Flow origin = makeFlow();
    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);
    Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
    verifyNoPathReplace(origin, result);
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

Example 25 with IslEndpoint

use of org.openkilda.model.IslEndpoint in project open-kilda by telstra.

the class FlowRerouteServiceTest method shouldFailRerouteYSubFlow.

@Test
public void shouldFailRerouteYSubFlow() throws UnroutableFlowException, RecoverableException {
    Flow origin = makeFlow();
    createTestYFlowForSubFlow(origin);
    preparePathComputation(origin.getFlowId(), make3SwitchesPathPair());
    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);
    verifyNoSpeakerInteraction(carrier);
    verifyNorthboundErrorResponse(carrier, ErrorType.REQUEST_INVALID);
}
Also used : IslEndpoint(org.openkilda.model.IslEndpoint) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) Flow(org.openkilda.model.Flow) Test(org.junit.Test)

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