use of org.openkilda.messaging.command.yflow.YFlowRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method shouldFailOnErrorDuringDraftYFlowCreation.
@Test
public void shouldFailOnErrorDuringDraftYFlowCreation() throws RecoverableException, UnroutableFlowException, DuplicateKeyException {
// given
YFlowRequest request = buildYFlowRequest("test_failed_yflow", "test_flow_1", "test_flow_2").build();
YFlowRepository repository = setupYFlowRepositorySpy();
doThrow(new RuntimeException(injectedErrorMessage)).when(repository).add(ArgumentMatchers.argThat(argument -> argument.getYFlowId().equals(request.getYFlowId())));
preparePathComputation("test_flow_1", buildFirstSubFlowPathPair());
preparePathComputation("test_flow_2", buildSecondSubFlowPathPair());
prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT);
// when
processRequest(request);
// then
verifyNorthboundErrorResponse(yFlowCreateHubCarrier, ErrorType.INTERNAL_ERROR);
verifyNoSpeakerInteraction(yFlowCreateHubCarrier);
verifyYFlowIsAbsent(request.getYFlowId());
}
use of org.openkilda.messaging.command.yflow.YFlowRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method shouldFailIfNoPathAvailableForFirstSubFlow.
@Test
public void shouldFailIfNoPathAvailableForFirstSubFlow() throws RecoverableException, UnroutableFlowException, DuplicateKeyException {
// given
YFlowRequest request = buildYFlowRequest("test_failed_yflow", "test_flow_1", "test_flow_2").build();
when(pathComputer.getPath(buildFlowIdArgumentMatch("test_flow_1"))).thenThrow(new UnroutableFlowException(injectedErrorMessage));
preparePathComputation("test_flow_2", buildSecondSubFlowPathPair());
prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT);
// when
processRequest(request);
// then
verifyNorthboundErrorResponse(yFlowCreateHubCarrier, ErrorType.NOT_FOUND);
verifyNoSpeakerInteraction(yFlowCreateHubCarrier);
verifyYFlowIsAbsent(request.getYFlowId());
}
use of org.openkilda.messaging.command.yflow.YFlowRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method shouldFailOnUnsuccessfulMeterInstallation.
@Test
public void shouldFailOnUnsuccessfulMeterInstallation() 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
handleSpeakerCommandsAndFailInstall(service, request.getYFlowId(), request.getYFlowId());
// then
verifyYFlowIsAbsent(request.getYFlowId());
}
use of org.openkilda.messaging.command.yflow.YFlowRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method shouldFailOnTimeoutDuringMeterValidation.
@Ignore("TODO: implement meter validation")
@Test
public void shouldFailOnTimeoutDuringMeterValidation() 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
handleSpeakerCommandsAndTimeoutVerify(service, request.getYFlowId(), request.getYFlowId());
// then
verifyNoSpeakerInteraction(yFlowCreateHubCarrier);
verifyYFlowIsAbsent(request.getYFlowId());
}
use of org.openkilda.messaging.command.yflow.YFlowRequest in project open-kilda by telstra.
the class YFlowUpdateServiceTest method createYFlow.
private YFlowRequest createYFlow() throws UnroutableFlowException, RecoverableException, DuplicateKeyException {
YFlowRequest request = buildYFlowRequest("test_successful_yflow", "test_flow_1", "test_flow_2").build();
preparePathComputationForCreate("test_flow_1", buildFirstSubFlowPathPair());
preparePathComputationForCreate("test_flow_2", buildSecondSubFlowPathPair());
prepareYPointComputation(SWITCH_SHARED, SWITCH_FIRST_EP, SWITCH_SECOND_EP, SWITCH_TRANSIT);
processCreateRequestAndSpeakerCommands(request);
verifyNorthboundSuccessResponse(yFlowCreateHubCarrier, YFlowResponse.class);
verifyYFlowStatus(request.getYFlowId(), FlowStatus.UP);
verifyAffinity(request.getYFlowId());
return request;
}
Aggregations