Search in sources :

Example 1 with FlowDirection

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);
    }
}
Also used : UpdateFlowCommand(org.openkilda.messaging.info.flow.UpdateFlowCommand) FlowDirection(org.openkilda.server42.messaging.FlowDirection) Duration(java.time.Duration)

Example 2 with FlowDirection

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);
    }
}
Also used : FlowLatencyRequest(org.openkilda.wfm.topology.flowmonitoring.model.FlowLatencyRequest) FlowDirection(org.openkilda.server42.messaging.FlowDirection) Duration(java.time.Duration)

Example 3 with FlowDirection

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);
}
Also used : Builder(org.openkilda.server42.control.messaging.Control.CommandPacket.Builder) FlowRttControl(org.openkilda.server42.control.messaging.flowrtt.FlowRttControl) CommandPacket(org.openkilda.server42.control.messaging.Control.CommandPacket) AddFlow(org.openkilda.server42.control.messaging.flowrtt.AddFlow) Flow(org.openkilda.server42.control.messaging.flowrtt.FlowRttControl.Flow) RemoveFlow(org.openkilda.server42.control.messaging.flowrtt.RemoveFlow)

Aggregations

Duration (java.time.Duration)2 FlowDirection (org.openkilda.server42.messaging.FlowDirection)2 UpdateFlowCommand (org.openkilda.messaging.info.flow.UpdateFlowCommand)1 CommandPacket (org.openkilda.server42.control.messaging.Control.CommandPacket)1 Builder (org.openkilda.server42.control.messaging.Control.CommandPacket.Builder)1 AddFlow (org.openkilda.server42.control.messaging.flowrtt.AddFlow)1 FlowRttControl (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl)1 Flow (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl.Flow)1 RemoveFlow (org.openkilda.server42.control.messaging.flowrtt.RemoveFlow)1 FlowLatencyRequest (org.openkilda.wfm.topology.flowmonitoring.model.FlowLatencyRequest)1