Search in sources :

Example 1 with GetFlowsForIslRequest

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

the class LinkServiceImpl method getFlowsForLink.

@Override
public CompletableFuture<List<FlowResponsePayload>> getFlowsForLink(SwitchId srcSwitch, Integer srcPort, SwitchId dstSwitch, Integer dstPort) {
    final String correlationId = RequestCorrelationId.getId();
    logger.debug("Get all flows for a particular link request processing");
    GetFlowsForIslRequest data = null;
    try {
        data = new GetFlowsForIslRequest(new NetworkEndpoint(srcSwitch, srcPort), new NetworkEndpoint(dstSwitch, dstPort), correlationId);
    } catch (IllegalArgumentException e) {
        logger.error("Can not parse arguments: {}", e.getMessage());
        throw new MessageException(correlationId, System.currentTimeMillis(), ErrorType.DATA_INVALID, e.getMessage(), "Can not parse arguments when create \"get flows for link\" request");
    }
    CommandMessage message = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
    return messagingChannel.sendAndGetChunked(nbworkerTopic, message).thenApply(response -> response.stream().map(FlowResponse.class::cast).map(FlowResponse::getPayload).map(flowMapper::toFlowResponseOutput).collect(Collectors.toList()));
}
Also used : NetworkEndpoint(org.openkilda.messaging.model.NetworkEndpoint) MessageException(org.openkilda.messaging.error.MessageException) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) GetFlowsForIslRequest(org.openkilda.messaging.nbtopology.request.GetFlowsForIslRequest) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)1 MessageException (org.openkilda.messaging.error.MessageException)1 FlowResponse (org.openkilda.messaging.info.flow.FlowResponse)1 NetworkEndpoint (org.openkilda.messaging.model.NetworkEndpoint)1 GetFlowsForIslRequest (org.openkilda.messaging.nbtopology.request.GetFlowsForIslRequest)1