Search in sources :

Example 1 with FlowPatchRequest

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

the class FlowServiceImpl method patchFlow.

@Override
public CompletableFuture<FlowResponseV2> patchFlow(String flowId, FlowPatchV2 flowPatchDto) {
    logger.info("Patch flow request for flow {}", flowId);
    String correlationId = RequestCorrelationId.getId();
    FlowPatch flowPatch;
    try {
        flowPatch = flowMapper.toFlowPatch(flowPatchDto);
    } catch (IllegalArgumentException e) {
        logger.error("Can not parse arguments: {}", e.getMessage(), e);
        throw new MessageException(correlationId, System.currentTimeMillis(), ErrorType.DATA_INVALID, e.getMessage(), "Can not parse arguments of the flow patch request");
    }
    flowPatch.setFlowId(flowId);
    CommandMessage request = new CommandMessage(new FlowPatchRequest(flowPatch), System.currentTimeMillis(), correlationId);
    return messagingChannel.sendAndGet(nbworkerTopic, request).thenApply(FlowResponse.class::cast).thenApply(FlowResponse::getPayload).thenApply(flowMapper::toFlowResponseV2);
}
Also used : FlowPatch(org.openkilda.messaging.model.FlowPatch) FlowPatchRequest(org.openkilda.messaging.nbtopology.request.FlowPatchRequest) MessageException(org.openkilda.messaging.error.MessageException) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) SwapFlowResponse(org.openkilda.messaging.info.flow.SwapFlowResponse) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Example 2 with FlowPatchRequest

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

the class FlowServiceImpl method patchFlow.

@Override
public CompletableFuture<FlowResponsePayload> patchFlow(String flowId, FlowPatchDto flowPatchDto) {
    logger.info("Patch flow request for flow {}", flowId);
    String correlationId = RequestCorrelationId.getId();
    FlowPatch flowPatch;
    try {
        flowPatch = flowMapper.toFlowPatch(flowPatchDto);
    } catch (IllegalArgumentException e) {
        logger.error("Can not parse arguments: {}", e.getMessage(), e);
        throw new MessageException(correlationId, System.currentTimeMillis(), ErrorType.DATA_INVALID, e.getMessage(), "Can not parse arguments of the flow patch request");
    }
    flowPatch.setFlowId(flowId);
    CommandMessage request = new CommandMessage(new FlowPatchRequest(flowPatch), System.currentTimeMillis(), correlationId);
    return messagingChannel.sendAndGet(nbworkerTopic, request).thenApply(FlowResponse.class::cast).thenApply(FlowResponse::getPayload).thenApply(flowMapper::toFlowResponseOutput);
}
Also used : FlowPatch(org.openkilda.messaging.model.FlowPatch) FlowPatchRequest(org.openkilda.messaging.nbtopology.request.FlowPatchRequest) MessageException(org.openkilda.messaging.error.MessageException) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) SwapFlowResponse(org.openkilda.messaging.info.flow.SwapFlowResponse) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)2 MessageException (org.openkilda.messaging.error.MessageException)2 FlowResponse (org.openkilda.messaging.info.flow.FlowResponse)2 SwapFlowResponse (org.openkilda.messaging.info.flow.SwapFlowResponse)2 FlowPatch (org.openkilda.messaging.model.FlowPatch)2 FlowPatchRequest (org.openkilda.messaging.nbtopology.request.FlowPatchRequest)2