use of org.openkilda.messaging.info.flow.FlowPingResponse in project open-kilda by telstra.
the class OnDemandResultManager method produceFlowErrors.
private List<FlowPingResponse> produceFlowErrors(Group group, String errorMessage) {
HashSet<String> seen = new HashSet<>();
ArrayList<FlowPingResponse> results = new ArrayList<>();
for (PingContext pingContext : group.getRecords()) {
if (!seen.add(pingContext.getFlowId())) {
continue;
}
log.info("Produce error response (group={}, flow={}): {}", group.getId(), pingContext.getFlowId(), errorMessage);
results.add(new FlowPingResponse(pingContext.getFlowId(), errorMessage));
}
return results;
}
use of org.openkilda.messaging.info.flow.FlowPingResponse in project open-kilda by telstra.
the class FlowMapperTest method testPingOutput.
@Test
public void testPingOutput() {
FlowPingResponse response = new FlowPingResponse(FLOW_ID, new UniFlowPingResponse(false, Errors.TIMEOUT, null, null), new UniFlowPingResponse(true, null, new PingMeters(1, 2, 3), null), ERROR_MESSAGE);
PingOutput output = flowMapper.toPingOutput(response);
assertEquals(response.getFlowId(), output.getFlowId());
assertEquals(response.getError(), output.getError());
assertEquals(response.getForward().isPingSuccess(), output.getForward().isPingSuccess());
assertEquals(0, output.getForward().getLatency());
assertEquals(TIMEOUT_ERROR_MESSAGE, output.getForward().getError());
assertEquals(response.getReverse().isPingSuccess(), output.getReverse().isPingSuccess());
assertEquals(1, output.getReverse().getLatency());
assertNull(output.getReverse().getError());
}
use of org.openkilda.messaging.info.flow.FlowPingResponse in project open-kilda by telstra.
the class FlowFetcher method emitOnDemandResponse.
private void emitOnDemandResponse(Tuple input, FlowPingRequest request, String errorMessage) throws PipelineException {
FlowPingResponse response = new FlowPingResponse(request.getFlowId(), errorMessage);
Values output = new Values(response, pullContext(input));
getOutput().emit(STREAM_ON_DEMAND_RESPONSE_ID, input, output);
}
use of org.openkilda.messaging.info.flow.FlowPingResponse in project open-kilda by telstra.
the class OnDemandResultManager method handleFlowResponse.
private void handleFlowResponse(Tuple input, Group group) throws PipelineException {
try {
FlowPingResponse response = collectResults(group);
emit(input, response);
} catch (IllegalArgumentException e) {
for (FlowPingResponse errorResponse : produceFlowErrors(group, e.getMessage())) {
emit(input, errorResponse);
}
}
}
Aggregations