use of org.openkilda.messaging.info.flow.RemoveFlowCommand in project open-kilda by telstra.
the class NotifyFlowMonitorAction method getFlowInfo.
private CommandData getFlowInfo(String flowId) {
Optional<Flow> flow = flowRepository.findById(flowId);
if (!flow.isPresent() || flow.get().isOneSwitchFlow()) {
return new RemoveFlowCommand(flowId);
}
FlowPathDto flowPathDto = toFlowPathDtoBuilder(flow.get()).build();
return new UpdateFlowCommand(flowId, flowPathDto, flow.get().getMaxLatency(), flow.get().getMaxLatencyTier2());
}
use of org.openkilda.messaging.info.flow.RemoveFlowCommand in project open-kilda by telstra.
the class FlowSplitterBolt method handleInput.
@Override
protected void handleInput(Tuple input) throws PipelineException {
Message message = pullValue(input, FIELD_ID_PAYLOAD, Message.class);
if (message instanceof InfoMessage) {
InfoData infoData = ((InfoMessage) message).getData();
if (infoData instanceof FlowRttStatsData) {
FlowRttStatsData flowRttStatsData = (FlowRttStatsData) infoData;
emit(input, new Values(flowRttStatsData.getFlowId(), flowRttStatsData, getCommandContext()));
} else {
unhandledInput(input);
}
return;
}
if (message instanceof CommandMessage) {
CommandData commandData = pullValue(input, FIELD_ID_PAYLOAD, CommandMessage.class).getData();
if (commandData instanceof UpdateFlowCommand) {
UpdateFlowCommand updateFlowCommand = (UpdateFlowCommand) commandData;
emit(FLOW_UPDATE_STREAM_ID.name(), input, new Values(updateFlowCommand.getFlowId(), updateFlowCommand, getCommandContext()));
} else if (commandData instanceof RemoveFlowCommand) {
RemoveFlowCommand removeFlowCommand = (RemoveFlowCommand) commandData;
emit(FLOW_REMOVE_STREAM_ID.name(), input, new Values(removeFlowCommand.getFlowId(), getCommandContext()));
} else {
unhandledInput(input);
}
} else {
unhandledInput(input);
}
}
Aggregations