use of org.openkilda.messaging.command.flow.FlowRerouteRequest in project open-kilda by telstra.
the class FlowRerouteServiceTest method shouldSkipRerouteOnOutdatedRequest.
@Test
public void shouldSkipRerouteOnOutdatedRequest() {
Flow origin = makeFlow();
FlowRerouteService service = makeService();
IslEndpoint affectedEndpoint = extractIslEndpoint(origin);
FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, true, false, Collections.singleton(affectedEndpoint), null, false);
service.handleRequest(currentRequestKey, request, commandContext);
Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
verifyNoPathReplace(origin, result);
}
use of org.openkilda.messaging.command.flow.FlowRerouteRequest in project open-kilda by telstra.
the class FlowRerouteServiceTest method shouldIgnoreEffectivelyDownStateIfSamePaths.
@Test
public void shouldIgnoreEffectivelyDownStateIfSamePaths() throws RecoverableException, UnroutableFlowException, UnknownKeyException {
Flow origin = makeFlow();
preparePathComputation(origin.getFlowId(), make2SwitchesPathPair());
FlowRerouteService service = makeService();
FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, true, false, Collections.emptySet(), null, false);
service.handleRequest(currentRequestKey, request, commandContext);
FlowSegmentRequest speakerRequest;
while ((speakerRequest = requests.poll()) != null) {
produceAsyncResponse(service, speakerRequest);
}
Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
verifyNoPathReplace(origin, result);
}
use of org.openkilda.messaging.command.flow.FlowRerouteRequest in project open-kilda by telstra.
the class FlowRerouteServiceTest method shouldFailRerouteOnTimeoutDuringValidation.
@Test
public void shouldFailRerouteOnTimeoutDuringValidation() throws RecoverableException, UnroutableFlowException, UnknownKeyException {
Flow origin = makeFlow();
GetPathsResult newPathPair = make3SwitchesPathPair();
preparePathComputation(origin.getFlowId(), newPathPair);
FlowRerouteService service = makeService();
FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, false, false, Collections.emptySet(), null, false);
service.handleRequest(currentRequestKey, request, commandContext);
verifyFlowStatus(origin.getFlowId(), FlowStatus.IN_PROGRESS);
verifyNorthboundSuccessResponse(carrier);
FlowSegmentRequest speakerRequest;
while ((speakerRequest = requests.poll()) != null) {
if (speakerRequest.isVerifyRequest()) {
service.handleTimeout(currentRequestKey);
} else {
produceAsyncResponse(service, speakerRequest);
}
}
Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
verifyNoPathReplace(origin, result);
verify(carrier).sendRerouteResultStatus(eq(origin.getFlowId()), argThat(hasProperty("message", equalTo("Failed to validate rules"))), any(String.class));
}
use of org.openkilda.messaging.command.flow.FlowRerouteRequest in project open-kilda by telstra.
the class FlowRerouteServiceTest method shouldFailRerouteFlowIfNoPathAvailable.
@Test
public void shouldFailRerouteFlowIfNoPathAvailable() throws RecoverableException, UnroutableFlowException {
Flow origin = makeFlow();
preparePathComputation(origin.getFlowId(), new UnroutableFlowException(injectedErrorMessage));
FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, false, false, Collections.emptySet(), null, false);
testExpectedFailure(dummyRequestKey, request, commandContext, origin, FlowStatus.DOWN, ErrorType.NOT_FOUND);
verify(pathComputer, times(11)).getPath(makeFlowArgumentMatch(origin.getFlowId()), any());
}
use of org.openkilda.messaging.command.flow.FlowRerouteRequest in project open-kilda by telstra.
the class RerouteBolt method handleCommandMessage.
private void handleCommandMessage(CommandMessage commandMessage) {
CommandData commandData = commandMessage.getData();
String correlationId = getCommandContext().getCorrelationId();
if (commandData instanceof RerouteAffectedFlows) {
rerouteService.rerouteAffectedFlows(this, correlationId, (RerouteAffectedFlows) commandData);
} else if (commandData instanceof RerouteAffectedInactiveFlows) {
rerouteService.rerouteInactiveAffectedFlows(this, correlationId, ((RerouteAffectedInactiveFlows) commandData).getSwitchId());
} else if (commandData instanceof RerouteInactiveFlows) {
rerouteService.rerouteInactiveFlows(this, correlationId, (RerouteInactiveFlows) commandData);
} else if (commandData instanceof FlowRerouteRequest) {
rerouteService.processRerouteRequest(this, correlationId, (FlowRerouteRequest) commandData);
} else if (commandData instanceof YFlowRerouteRequest) {
rerouteService.processRerouteRequest(this, correlationId, (YFlowRerouteRequest) commandData);
} else {
unhandledInput(getCurrentTuple());
}
}
Aggregations