use of org.openkilda.wfm.topology.ping.model.PingContext in project open-kilda by telstra.
the class Blacklist method handleInput.
@Override
protected void handleInput(Tuple input) throws Exception {
if (!PingRouter.BOLT_ID.equals(input.getSourceComponent())) {
unhandledInput(input);
return;
}
String stream = input.getSourceStreamId();
PingContext pingContext = pullPingContext(input);
if (PingRouter.STREAM_BLACKLIST_FILTER_ID.equals(stream)) {
filter(input, pingContext);
} else if (PingRouter.STREAM_BLACKLIST_UPDATE_ID.equals(stream)) {
update(pingContext);
} else {
unhandledInput(input);
}
}
use of org.openkilda.wfm.topology.ping.model.PingContext in project open-kilda by telstra.
the class OnDemandResultManager method handleYFlowResponse.
private void handleYFlowResponse(Tuple input, Group group) throws PipelineException {
try {
YFlowPingResponse response = buildYFlowPingResponse(group);
emit(input, response);
} catch (IllegalArgumentException e) {
String yFlowId = group.getRecords().stream().map(PingContext::getYFlowId).filter(Objects::nonNull).findFirst().orElse(null);
YFlowPingResponse errorResponse = new YFlowPingResponse(yFlowId, e.getMessage(), null);
emit(input, errorResponse);
}
}
use of org.openkilda.wfm.topology.ping.model.PingContext 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();
}
use of org.openkilda.wfm.topology.ping.model.PingContext in project open-kilda by telstra.
the class ResultDispatcher method handleInput.
@Override
protected void handleInput(Tuple input) throws Exception {
PingContext pingContext = pullPingContext(input);
final String stream = dispatch(pingContext);
Values output = new Values(pingContext, pullContext(input));
getOutput().emit(stream, input, output);
}
Aggregations