use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class CacheWarmingService method getFlowCommands.
public List<CommandData> getFlowCommands(String switchId) {
List<CommandData> result = new ArrayList<>();
predefinedFlows.stream().filter(flow -> switchId.equals(flow.getLeft().getSourceSwitch())).forEach(pair -> {
CommandData command = getFlowCommandIfNeeded(pair.getLeft());
if (Objects.nonNull(command)) {
result.add(command);
}
});
return result;
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class CrudBolt method handlePathRequest.
private void handlePathRequest(String flowId, CommandMessage message, Tuple tuple) throws IOException {
ImmutablePair<Flow, Flow> flow = flowCache.getFlow(flowId);
logger.info("Path flow: {}", flow);
Values northbound = new Values(new InfoMessage(new FlowPathResponse(flow.left.getFlowPath()), message.getTimestamp(), message.getCorrelationId(), Destination.NORTHBOUND));
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, northbound);
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class CrudBolt method handlePushRequest.
private void handlePushRequest(String flowId, InfoMessage message, Tuple tuple) throws IOException {
logger.info("PUSH flow: {} :: {}", flowId, message);
FlowInfoData fid = (FlowInfoData) message.getData();
ImmutablePair<Flow, Flow> flow = fid.getPayload();
flowCache.pushFlow(flow);
Values northbound = new Values(new InfoMessage(new FlowStatusResponse(new FlowIdStatusPayload(flowId, FlowState.UP)), message.getTimestamp(), message.getCorrelationId(), Destination.NORTHBOUND));
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, northbound);
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class CrudBolt method handleReadRequest.
private void handleReadRequest(String flowId, CommandMessage message, Tuple tuple) {
ImmutablePair<Flow, Flow> flow = flowCache.getFlow(flowId);
logger.info("Got flow: {}", flow);
Values northbound = new Values(new InfoMessage(new FlowResponse(buildFlowResponse(flow)), message.getTimestamp(), message.getCorrelationId(), Destination.NORTHBOUND));
outputCollector.emit(StreamType.RESPONSE.toString(), tuple, northbound);
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class CrudBolt method buildFlowResponse.
/**
* Builds response flow.
*
* @param flow cache flow
* @return response flow model
*/
private Flow buildFlowResponse(ImmutablePair<Flow, Flow> flow) {
Flow response = new Flow(flow.left);
response.setCookie(response.getCookie() & ResourceCache.FLOW_COOKIE_VALUE_MASK);
return response;
}
Aggregations