use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class FlowRerouteQueueBolt method handleOperationQueueBoltMessage.
private void handleOperationQueueBoltMessage(Tuple tuple) throws PipelineException {
RerouteResultInfoData rerouteResultInfoData = pullValue(tuple, FIELD_ID_PAYLOAD, RerouteResultInfoData.class);
rerouteQueueService.processRerouteResult(rerouteResultInfoData, getCommandContext().getCorrelationId());
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class OperationQueueBolt method handleInput.
@Override
protected void handleInput(Tuple tuple) throws PipelineException {
CommandContext context = pullContext(tuple);
MessageData data = pullValue(tuple, FIELD_ID_PAYLOAD, MessageData.class);
if (data instanceof FlowPathSwapRequest) {
FlowPathSwapRequest flowPathSwapRequest = (FlowPathSwapRequest) data;
service.addFirst(flowPathSwapRequest.getFlowId(), context.getCorrelationId(), flowPathSwapRequest);
} else if (data instanceof FlowRerouteRequest) {
FlowRerouteRequest flowRerouteRequest = (FlowRerouteRequest) data;
service.addLast(flowRerouteRequest.getFlowId(), context.getCorrelationId(), flowRerouteRequest);
} else if (data instanceof YFlowRerouteRequest) {
YFlowRerouteRequest yFlowRerouteRequest = (YFlowRerouteRequest) data;
service.addLast(yFlowRerouteRequest.getYFlowId(), context.getCorrelationId(), yFlowRerouteRequest);
} else if (data instanceof RerouteResultInfoData) {
RerouteResultInfoData rerouteResultInfoData = (RerouteResultInfoData) data;
service.operationCompleted(rerouteResultInfoData.getFlowId(), rerouteResultInfoData);
emitRerouteResponse(rerouteResultInfoData);
} else if (data instanceof PathSwapResult) {
PathSwapResult pathSwapResult = (PathSwapResult) data;
service.operationCompleted(pathSwapResult.getFlowId(), pathSwapResult);
} else {
unhandledInput(tuple);
}
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitchYFlow.
@Test
public void shouldMergeAndSendRetryWithPendingRequestWhenReceivedFailedRuleInstallResponseOnTransitSwitchYFlow() {
FlowThrottlingData inProgress = getFlowThrottlingData(yFlow, CORRELATION_ID).build();
FlowThrottlingData pending = FlowThrottlingData.builder().correlationId("pending").priority(7).timeCreate(yFlow.getTimeCreate()).affectedIsl(Collections.singleton(new IslEndpoint(SWITCH_ID_A, 1))).force(false).effectivelyDown(true).reason("another reason").yFlow(true).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).build();
rerouteQueueService.getReroutes().put(YFLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(YFLOW_ID).success(false).rerouteError(new SpeakerRequestError("Failed to install rules", Collections.singleton(SWITCH_C.getSwitchId()))).yFlow(true).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
String retryCorrelationId = CORRELATION_ID + " : retry #1 ignore_bw false";
FlowThrottlingData expected = getFlowThrottlingData(yFlow, retryCorrelationId).build();
expected.setPriority(pending.getPriority());
expected.setReason(pending.getReason());
assertEquals(expected, rerouteQueue.getInProgress());
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
YFlowRerouteRequest expectedRequest = getYFlowRerouteRequest(YFLOW_ID, expected);
verify(carrier).sendRerouteRequest(eq(retryCorrelationId), eq(expectedRequest));
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class RerouteBolt method handleInfoMessage.
private void handleInfoMessage(Message message) {
if (message instanceof InfoMessage) {
InfoData infoData = ((InfoMessage) message).getData();
if (infoData instanceof RerouteResultInfoData) {
RerouteResultInfoData rerouteResultInfoData = (RerouteResultInfoData) infoData;
emitWithContext(STREAM_OPERATION_QUEUE_ID, getCurrentTuple(), new Values(rerouteResultInfoData.getFlowId(), rerouteResultInfoData));
} else if (infoData instanceof PathSwapResult) {
PathSwapResult pathSwapResult = (PathSwapResult) infoData;
emitWithContext(STREAM_OPERATION_QUEUE_ID, getCurrentTuple(), new Values(pathSwapResult.getFlowId(), pathSwapResult));
} else if (infoData instanceof SwitchStateChanged) {
if (active) {
rerouteService.processSingleSwitchFlowStatusUpdate((SwitchStateChanged) infoData);
}
} else {
unhandledInput(getCurrentTuple());
}
} else {
unhandledInput(getCurrentTuple());
}
}
use of org.openkilda.messaging.info.reroute.RerouteResultInfoData in project open-kilda by telstra.
the class RerouteQueueServiceTest method shouldMovePendingToInProcessWhenReceivedSuccessfulResult.
@Test
public void shouldMovePendingToInProcessWhenReceivedSuccessfulResult() {
String pendingCorrelationId = "pending";
FlowThrottlingData inProgress = getFlowThrottlingData(flow, CORRELATION_ID).build();
FlowThrottlingData pending = getFlowThrottlingData(flow, pendingCorrelationId).build();
RerouteQueue rerouteQueue = RerouteQueue.builder().inProgress(inProgress).pending(pending).build();
rerouteQueueService.getReroutes().put(FLOW_ID, rerouteQueue);
RerouteResultInfoData rerouteResultInfoData = RerouteResultInfoData.builder().flowId(FLOW_ID).success(true).build();
rerouteQueueService.processRerouteResult(rerouteResultInfoData, CORRELATION_ID);
assertNull(rerouteQueue.getPending());
assertNull(rerouteQueue.getThrottling());
FlowRerouteRequest expected = getFlowRerouteRequest(FLOW_ID, pending);
verify(carrier).sendRerouteRequest(eq(pendingCorrelationId), eq(expected));
}
Aggregations