use of org.openkilda.messaging.info.flow.FlowPingResponse.FlowPingResponseBuilder in project open-kilda by telstra.
the class OnDemandResultManager method collectResults.
private FlowPingResponse collectResults(Group group) {
FlowPingResponseBuilder builder = FlowPingResponse.builder();
HashSet<String> idSet = new HashSet<>();
for (PingContext entry : group.getRecords()) {
idSet.add(entry.getFlowId());
switch(entry.getDirection()) {
case FORWARD:
builder.forward(makeResponse(entry));
break;
case REVERSE:
builder.reverse(makeResponse(entry));
break;
default:
throw new IllegalArgumentException(format("Unsupported %s.%s value", entry.getDirection().getClass().getName(), entry.getDirection()));
}
}
if (idSet.size() != 1) {
throw new IllegalArgumentException(format("Expect exact one flow id in pings group response, got - \"%s\"", String.join("\", \"", idSet)));
}
builder.flowId(idSet.iterator().next());
return builder.build();
}
Aggregations