Search in sources :

Example 31 with YFlowRequest

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

the class YFlowRerouteServiceTest method shouldRerouteFlowWithTransitSwitches.

@Test
public void shouldRerouteFlowWithTransitSwitches() throws UnroutableFlowException, RecoverableException, 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);
    // 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 : 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 32 with YFlowRequest

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

the class YFlowRerouteServiceTest method shouldUpdateFlowWithProtectedPath.

@Test
public void shouldUpdateFlowWithProtectedPath() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlowWithProtectedPath();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    preparePathComputationForReroute("test_flow_1", buildFirstSubFlowPathPair(), buildFirstSubFlowPathPairWithNewTransit());
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPair(), buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT, SWITCH_TRANSIT);
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT, 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 : 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 33 with YFlowRequest

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

the class YFlowRerouteServiceTest method shouldFailIfNoPathAvailableForFirstSubFlow.

@Test
public void shouldFailIfNoPathAvailableForFirstSubFlow() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    // given
    YFlowRequest createYFlowRequest = createYFlow();
    YFlowRerouteRequest request = new YFlowRerouteRequest(createYFlowRequest.getYFlowId(), "reason");
    when(pathComputer.getPath(buildFlowIdArgumentMatch("test_flow_1"), any())).thenThrow(new UnroutableFlowException(injectedErrorMessage));
    preparePathComputationForReroute("test_flow_2", buildSecondSubFlowPathPairWithNewTransit());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_NEW_TRANSIT);
    // when
    processRerouteRequestAndSpeakerCommands(request);
    verifyNorthboundErrorResponse(yFlowRerouteHubCarrier, ErrorType.NOT_FOUND);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.DEGRADED, FlowStatus.DOWN, FlowStatus.UP);
    verify(yFlowRerouteHubCarrier).sendYFlowRerouteResultStatus(eq(createYFlowRequest.getYFlowId()), eq(new RerouteError("Failed to reroute sub-flows [test_flow_1] 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 34 with YFlowRequest

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

the class YFlowCreateServiceTest method shouldFailIfNoPathAvailableForSecondSubFlow.

@Test
public void shouldFailIfNoPathAvailableForSecondSubFlow() throws RecoverableException, UnroutableFlowException, DuplicateKeyException {
    // given
    YFlowRequest request = buildYFlowRequest("test_failed_yflow", "test_flow_1", "test_flow_2").build();
    preparePathComputation("test_flow_1", buildFirstSubFlowPathPair());
    when(pathComputer.getPath(buildFlowIdArgumentMatch("test_flow_2"))).thenThrow(new UnroutableFlowException(injectedErrorMessage));
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT);
    // when
    processRequestAndSpeakerCommands(request);
    // then
    verifyNorthboundErrorResponse(yFlowCreateHubCarrier, ErrorType.NOT_FOUND);
    verifyNoSpeakerInteraction(yFlowCreateHubCarrier);
    verifyYFlowIsAbsent(request.getYFlowId());
}
Also used : UnroutableFlowException(org.openkilda.pce.exception.UnroutableFlowException) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 35 with YFlowRequest

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

the class YFlowCreateServiceTest method shouldCreateFlowWithProtectedPath.

@Test
public void shouldCreateFlowWithProtectedPath() throws Exception {
    // given
    YFlowRequest request = buildYFlowRequest("test_successful_yflow", "test_flow_1", "test_flow_2").allocateProtectedPath(true).build();
    preparePathComputation("test_flow_1", buildFirstSubFlowPathPair(), buildFirstSubFlowProtectedPathPair());
    preparePathComputation("test_flow_2", buildSecondSubFlowPathPair(), buildSecondSubFlowProtectedPathPair());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT, SWITCH_TRANSIT);
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_ALT_TRANSIT, SWITCH_ALT_TRANSIT);
    // when
    processRequestAndSpeakerCommands(request);
    // then
    verifyNorthboundSuccessResponse(yFlowCreateHubCarrier, YFlowResponse.class);
    verifyYFlowAndSubFlowStatus(request.getYFlowId(), FlowStatus.UP);
    verifyAffinity(request.getYFlowId());
}
Also used : YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Aggregations

YFlowRequest (org.openkilda.messaging.command.yflow.YFlowRequest)50 Test (org.junit.Test)35 AbstractYFlowTest (org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)27 YFlow (org.openkilda.model.YFlow)12 YFlowRerouteRequest (org.openkilda.messaging.command.yflow.YFlowRerouteRequest)11 CommandContext (org.openkilda.wfm.CommandContext)10 SwitchId (org.openkilda.model.SwitchId)9 SubFlowSharedEndpointEncapsulation (org.openkilda.messaging.command.yflow.SubFlowSharedEndpointEncapsulation)8 UnroutableFlowException (org.openkilda.pce.exception.UnroutableFlowException)7 RerouteError (org.openkilda.messaging.info.reroute.error.RerouteError)5 FlowProcessingException (org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException)5 ResourceAllocationException (org.openkilda.wfm.share.flow.resources.ResourceAllocationException)4 Ignore (org.junit.Ignore)3 CommandMessage (org.openkilda.messaging.command.CommandMessage)3 YFlowResponse (org.openkilda.messaging.command.yflow.YFlowResponse)3 FlowEndpoint (org.openkilda.model.FlowEndpoint)3 FlowStatus (org.openkilda.model.FlowStatus)3 IslEndpoint (org.openkilda.model.IslEndpoint)3 DuplicateKeyException (org.openkilda.wfm.topology.flowhs.exception.DuplicateKeyException)3 YFlowPartialUpdateRequest (org.openkilda.messaging.command.yflow.YFlowPartialUpdateRequest)2