Search in sources :

Example 1 with GetFlowsForSwitchRequest

use of org.openkilda.messaging.nbtopology.request.GetFlowsForSwitchRequest in project open-kilda by telstra.

the class SwitchServiceImpl method getFlowsForSwitch.

@Override
public CompletableFuture<List<FlowPayload>> getFlowsForSwitch(SwitchId switchId, Integer port) {
    final String correlationId = RequestCorrelationId.getId();
    logger.debug("Get all flows for the switch: {}", switchId);
    GetFlowsForSwitchRequest data = new GetFlowsForSwitchRequest(switchId, port);
    CommandMessage message = new CommandMessage(data, System.currentTimeMillis(), correlationId);
    return messagingChannel.sendAndGetChunked(nbworkerTopic, message).thenApply(response -> response.stream().map(FlowResponse.class::cast).map(FlowResponse::getPayload).map(flowMapper::toFlowOutput).collect(Collectors.toList()));
}
Also used : GetFlowsForSwitchRequest(org.openkilda.messaging.nbtopology.request.GetFlowsForSwitchRequest) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)1 FlowResponse (org.openkilda.messaging.info.flow.FlowResponse)1 GetFlowsForSwitchRequest (org.openkilda.messaging.nbtopology.request.GetFlowsForSwitchRequest)1