use of org.openkilda.server42.messaging.FlowDirection in project open-kilda by telstra.
the class ActionBolt method handleInput.
@Override
protected void handleInput(Tuple input) throws PipelineException {
if (!active) {
return;
}
if (FLOW_UPDATE_STREAM_ID.name().equals(input.getSourceStreamId())) {
UpdateFlowCommand updateFlowCommand = pullValue(input, COMMAND_DATA_FIELD, UpdateFlowCommand.class);
actionService.updateFlowInfo(updateFlowCommand);
return;
}
if (FLOW_REMOVE_STREAM_ID.name().equals(input.getSourceStreamId())) {
String flowId = pullValue(input, FLOW_ID_FIELD, String.class);
actionService.removeFlowInfo(flowId);
return;
}
if (ACTION_STREAM_ID.name().equals(input.getSourceStreamId())) {
String flowId = pullValue(input, FLOW_ID_FIELD, String.class);
FlowDirection direction = pullValue(input, FLOW_DIRECTION_FIELD, FlowDirection.class);
Duration latency = pullValue(input, LATENCY_FIELD, Duration.class);
actionService.processFlowLatencyMeasurement(flowId, direction, latency);
return;
}
if (ComponentId.TICK_BOLT.name().equals(input.getSourceComponent())) {
actionService.processTick();
} else {
unhandledInput(input);
}
}
use of org.openkilda.server42.messaging.FlowDirection in project open-kilda by telstra.
the class CalculateFlowLatencyService method handleGetLinkLatencyResponse.
/**
* Handle get link latency response. Send check flow latency request if ready.
*/
public void handleGetLinkLatencyResponse(String requestId, Link link, Duration latency) {
log.debug("Get link latency response for link {} with {} and requestId {}", link, latency, requestId);
FlowLatencyRequest flowLatencyRequest = requests.get(requestId);
if (flowLatencyRequest == null) {
log.warn("Link latency response for unknown request found {}", link);
return;
}
flowLatencyRequest.handleResponse(link, latency);
if (flowLatencyRequest.isFulfilled()) {
log.debug("Process calculated latency for requestId {}", requestId);
String flowId = flowLatencyRequest.getFlowId();
FlowDirection direction = flowLatencyRequest.getDirection();
Duration result = flowLatencyRequest.getResult();
carrier.emitCheckFlowLatencyRequest(flowId, direction, result);
carrier.emitLatencyStats(flowId, direction, result);
requests.remove(requestId);
}
}
use of org.openkilda.server42.messaging.FlowDirection in project open-kilda by telstra.
the class Gate method removeFlow.
private void removeFlow(String flowId, FlowDirection direction) throws InvalidProtocolBufferException {
Builder builder = CommandPacket.newBuilder();
Flow flow = Flow.newBuilder().setFlowId(flowId).setDirection(FlowDirection.toBoolean(direction)).build();
FlowRttControl.RemoveFlow removeFlow = FlowRttControl.RemoveFlow.newBuilder().setFlow(flow).build();
builder.setType(Type.REMOVE_FLOW);
builder.addCommand(Any.pack(removeFlow));
CommandPacket packet = builder.build();
zeroMqClient.send(packet);
}
Aggregations