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());
}
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;
}
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);
}
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);
}
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);
}
Aggregations