use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class YFlowRerouteHubBolt method sendYFlowRerouteResultStatus.
@Override
public void sendYFlowRerouteResultStatus(String flowId, RerouteError rerouteError, String correlationId) {
RerouteResultInfoData rerouteResult = RerouteResultInfoData.builder().flowId(flowId).success(rerouteError == null).rerouteError(rerouteError).build();
Message message = new InfoMessage(rerouteResult, System.currentTimeMillis(), correlationId);
emitWithContext(Stream.HUB_TO_REROUTE_RESPONSE_SENDER.name(), getCurrentTuple(), new Values(currentKey, message));
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class FlowRerouteServiceTest method shouldSuccessfullyRerouteFlow.
@Test
public void shouldSuccessfullyRerouteFlow() throws RecoverableException, UnroutableFlowException, UnknownKeyException {
Flow origin = makeFlow();
origin.setStatus(FlowStatus.DOWN);
transactionManager.doInTransaction(() -> repositoryFactory.createFlowRepository().updateStatus(origin.getFlowId(), FlowStatus.DOWN));
preparePathComputation(origin.getFlowId(), make3SwitchesPathPair());
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) {
produceAsyncResponse(service, speakerRequest);
}
Flow result = verifyFlowStatus(origin.getFlowId(), FlowStatus.UP);
verifyPathReplace(origin, result);
RerouteResultInfoData expected = RerouteResultInfoData.builder().flowId(origin.getFlowId()).success(true).build();
verify(carrier).sendRerouteResultStatus(eq(origin.getFlowId()), isNull(), any(String.class));
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldInjectRetryToThrottlingWhenReceivedFailedRerouteResult.
@Test
public void shouldInjectRetryToThrottlingWhenReceivedFailedRerouteResult() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(false).rerouteError(new RerouteInProgressError()).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
FlowThrottlingData expected = getFlowThrottlingData(flow, CORRELATION_ID + " : retry #1 ignore_bw false").build();
expected.setRetryCounter(1);
assertEquals(expected, rerouteQueue.getThrottling());
verify(carrier).sendExtendTimeWindowEvent();
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldNotInjectRetryWhenReceivedFailedRuleInstallResponseOnTerminatingSwitch.
@Test
public void shouldNotInjectRetryWhenReceivedFailedRuleInstallResponseOnTerminatingSwitch() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(false).rerouteError(new SpeakerRequestError("Failed to install rules", Collections.singleton(SWITCH_B.getSwitchId()))).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
assertNull(rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitch.
@Test
public void shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitch() {
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
FlowThrottlingData pending = FlowThrottlingData.builder().correlationId("pending").priority(7).timeCreate(flow.getTimeCreate()).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_A, 1))).force(false).effectivelyDown(true).reason("another reason").build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(false).rerouteError(new SpeakerRequestError("Failed to install rules", Collections.singleton(SWITCH_C.getSwitchId()))).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
String retryCorrelationId = CORRELATION_ID + " : retry #1 ignore_bw false";
FlowThrottlingData expected = getFlowThrottlingData(flow, retryCorrelationId).build();
expected.setPriority(pending.getPriority());
expected.setReason(pending.getReason());
assertEquals(expected, rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
FlowRerouteRequest expectedRequest = getFlowRerouteRequest(FLOW_ID, expected);
verify(carrier).sendRerouteRequest(eq(retryCorrelationId), eq(expectedRequest));
}
Aggregations