Search in sources :

Example 11 with YFlowRerouteRequest

use of org.openkilda.messaging.command.yflow.YFlowRerouteRequest in project open-kilda by telstra.

the class YFlowRerouteServiceTest method shouldFailIfNoPathAvailableForSecondSubFlow.

@Test
public void shouldFailIfNoPathAvailableForSecondSubFlow() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    preparePathComputationForReroute("test_flow_1", buildFirstSubFlowPathPairWithNewTransit());
    when(pathComputer.getPath(buildFlowIdArgumentMatch("test_flow_2"), any())).thenThrow(new UnroutableFlowException(injectedErrorMessage));
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT);
    // when
    processRerouteRequestAndSpeakerCommands(request, FlowStatus.IN_PROGRESS, FlowStatus.IN_PROGRESS, FlowStatus.UP);
    verifyNorthboundErrorResponse(yFlowRerouteHubCarrier, ErrorType.NOT_FOUND);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.DEGRADED, FlowStatus.UP, FlowStatus.DOWN);
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(new RerouteError("Failed to reroute sub-flows [test_flow_2] of y-flow test_successful_yflow")), anyString());
}
Also used : UnroutableFlowException(org.openkilda.pce.exception.UnroutableFlowException) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) RerouteError(org.openkilda.messaging.info.reroute.error.RerouteError) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 12 with YFlowRerouteRequest

use of org.openkilda.messaging.command.yflow.YFlowRerouteRequest 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 13 with YFlowRerouteRequest

use of org.openkilda.messaging.command.yflow.YFlowRerouteRequest in project open-kilda by telstra.

the class YFlowRerouteServiceTest method shouldFailOnTimeoutDuringMeterInstallation.

@Test
public void shouldFailOnTimeoutDuringMeterInstallation() throws UnroutableFlowException, RecoverableException, DuplicateKeyException, UnknownKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    preparePathComputationForReroute("test_flow_1", buildFirstSubFlowPathPairWithNewTransit());
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT);
    YFlowRerouteService service = makeYFlowRerouteService(0);
    // when
    service.handleRequest(request.getYFlowId(), new CommandContext(), request);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.IN_PROGRESS);
    // and
    handleSpeakerCommandsAndTimeoutInstall(service, request.getYFlowId());
    // then
    verifyNorthboundSuccessResponse(yFlowRerouteHubCarrier, YFlowRerouteResponse.class);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
    verifyAffinity(request.getYFlowId());
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(new RerouteError("Timeout event has been received")), anyString());
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) RerouteError(org.openkilda.messaging.info.reroute.error.RerouteError) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 14 with YFlowRerouteRequest

use of org.openkilda.messaging.command.yflow.YFlowRerouteRequest 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 15 with YFlowRerouteRequest

use of org.openkilda.messaging.command.yflow.YFlowRerouteRequest in project open-kilda by telstra.

the class YFlowRerouteServiceTest method shouldFailOnUnsuccessfulMeterInstallation.

@Test
public void shouldFailOnUnsuccessfulMeterInstallation() throws RecoverableException, UnroutableFlowException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    preparePathComputationForReroute("test_flow_1", buildFirstSubFlowPathPairWithNewTransit());
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT);
    YFlowRerouteService service = makeYFlowRerouteService(0);
    // when
    service.handleRequest(request.getYFlowId(), new CommandContext(), request);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.IN_PROGRESS, FlowStatus.IN_PROGRESS, FlowStatus.UP);
    // and
    handleSpeakerCommandsAndFailInstall(service, request.getYFlowId(), "test_successful_yflow");
    // then
    verifyNorthboundSuccessResponse(yFlowRerouteHubCarrier, YFlowRerouteResponse.class);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
    verifyAffinity(request.getYFlowId());
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(new RerouteError("Received error response(s) for 2 install commands")), anyString());
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) YFlowRerouteRequest(org.openkilda.messaging.command.yflow.YFlowRerouteRequest) RerouteError(org.openkilda.messaging.info.reroute.error.RerouteError) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Aggregations

YFlowRerouteRequest (org.openkilda.messaging.command.yflow.YFlowRerouteRequest)20 Test (org.junit.Test)13 YFlowRequest (org.openkilda.messaging.command.yflow.YFlowRequest)11 AbstractYFlowTest (org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)10 RerouteError (org.openkilda.messaging.info.reroute.error.RerouteError)5 IslEndpoint (org.openkilda.model.IslEndpoint)5 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)4 CommandContext (org.openkilda.wfm.CommandContext)3 FlowThrottlingData (org.openkilda.wfm.topology.reroute.model.FlowThrottlingData)3 MessageData (org.openkilda.messaging.MessageData)2 CommandMessage (org.openkilda.messaging.command.CommandMessage)2 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)2 RerouteResultInfoData (org.openkilda.messaging.info.reroute.RerouteResultInfoData)2 UnroutableFlowException (org.openkilda.pce.exception.UnroutableFlowException)2 RerouteQueue (org.openkilda.wfm.topology.reroute.model.RerouteQueue)2 HashSet (java.util.HashSet)1 Values (org.apache.storm.tuple.Values)1 CommandData (org.openkilda.messaging.command.CommandData)1 CreateFlowLoopRequest (org.openkilda.messaging.command.flow.CreateFlowLoopRequest)1 DeleteFlowLoopRequest (org.openkilda.messaging.command.flow.DeleteFlowLoopRequest)1