Search in sources :

Example 11 with YFlowRequest

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

the class YFlowCreateServiceTest method shouldFailOnTimeoutDuringMeterInstallation.

@Test
public void shouldFailOnTimeoutDuringMeterInstallation() throws RecoverableException, UnroutableFlowException, DuplicateKeyException {
    // given
    YFlowRequest request = buildYFlowRequest("test_failed_yflow", "test_flow_1", "test_flow_2").build();
    preparePathComputation("test_flow_1", buildFirstSubFlowPathPair());
    preparePathComputation("test_flow_2", buildSecondSubFlowPathPair());
    prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT);
    YFlowCreateService service = makeYFlowCreateService(0);
    // when
    service.handleRequest(request.getYFlowId(), new CommandContext(), request);
    verifyYFlowAndSubFlowStatus(request.getYFlowId(), FlowStatus.IN_PROGRESS);
    // and
    handleSpeakerCommandsAndTimeoutInstall(service, request.getYFlowId());
    // then
    verifyYFlowIsAbsent(request.getYFlowId());
}
Also used : CommandContext(org.openkilda.wfm.CommandContext) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Example 12 with YFlowRequest

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

the class YFlowUpdateServiceTest method createYFlowWithProtectedPath.

private YFlowRequest createYFlowWithProtectedPath() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
    YFlowRequest request = buildYFlowRequest("test_successful_yflow", "test_flow_1", "test_flow_2").allocateProtectedPath(true).build();
    preparePathComputationForCreate("test_flow_1", buildFirstSubFlowPathPair(), buildFirstSubFlowProtectedPathPair());
    preparePathComputationForCreate("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);
    processCreateRequestAndSpeakerCommands(request);
    verifyNorthboundSuccessResponse(yFlowCreateHubCarrier, YFlowResponse.class);
    verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
    return request;
}
Also used : YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest)

Example 13 with YFlowRequest

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

the class YFlowValidatorTest method failIfOneSwitchFlowRequestedAsTheLast.

@Test(expected = InvalidFlowException.class)
public void failIfOneSwitchFlowRequestedAsTheLast() throws InvalidFlowException, UnavailableFlowEndpointException {
    YFlowRequest request = YFlowRequest.builder().yFlowId("test").sharedEndpoint(FlowEndpoint.builder().switchId(SWITCH_ID_1).portNumber(PORT_1).build()).subFlows(Arrays.asList(SubFlowDto.builder().flowId("test_1").sharedEndpoint(new SubFlowSharedEndpointEncapsulation(1, 0)).endpoint(FlowEndpoint.builder().switchId(SWITCH_ID_2).portNumber(PORT_2).build()).build(), SubFlowDto.builder().flowId("test_2").sharedEndpoint(new SubFlowSharedEndpointEncapsulation(2, 0)).endpoint(FlowEndpoint.builder().switchId(SWITCH_ID_1).portNumber(PORT_3).build()).build())).build();
    yFlowValidator.validate(request);
}
Also used : SubFlowSharedEndpointEncapsulation(org.openkilda.messaging.command.yflow.SubFlowSharedEndpointEncapsulation) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test)

Example 14 with YFlowRequest

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

the class YFlowValidatorTest method failIfSubFlowHasNoSharedEndpointProvided.

@Test(expected = InvalidFlowException.class)
public void failIfSubFlowHasNoSharedEndpointProvided() throws InvalidFlowException, UnavailableFlowEndpointException {
    YFlowRequest request = YFlowRequest.builder().yFlowId("test").sharedEndpoint(FlowEndpoint.builder().switchId(SWITCH_ID_1).portNumber(PORT_1).build()).subFlows(Arrays.asList(SubFlowDto.builder().flowId("test_1").endpoint(FlowEndpoint.builder().switchId(SWITCH_ID_2).portNumber(PORT_2).build()).build(), SubFlowDto.builder().flowId("test_2").sharedEndpoint(new SubFlowSharedEndpointEncapsulation(2, 0)).endpoint(FlowEndpoint.builder().switchId(SWITCH_ID_3).portNumber(PORT_3).build()).build())).build();
    yFlowValidator.validate(request);
}
Also used : SubFlowSharedEndpointEncapsulation(org.openkilda.messaging.command.yflow.SubFlowSharedEndpointEncapsulation) YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test)

Example 15 with YFlowRequest

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

the class YFlowValidatorTest method failIfNoSubFlowsProvided.

@Test(expected = InvalidFlowException.class)
public void failIfNoSubFlowsProvided() throws InvalidFlowException, UnavailableFlowEndpointException {
    YFlowRequest request = YFlowRequest.builder().yFlowId("test").sharedEndpoint(FlowEndpoint.builder().switchId(SWITCH_ID_1).portNumber(PORT_1).build()).subFlows(emptyList()).build();
    yFlowValidator.validate(request);
}
Also used : YFlowRequest(org.openkilda.messaging.command.yflow.YFlowRequest) Test(org.junit.Test)

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