Search in sources :

Example 1 with GetFlowPathRequest

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

the class FlowServiceImpl method pathFlow.

/**
 * {@inheritDoc}
 */
@Override
public CompletableFuture<FlowPathPayload> pathFlow(final String id) {
    logger.debug("Flow path request for flow {}", id);
    final String correlationId = RequestCorrelationId.getId();
    GetFlowPathRequest data = new GetFlowPathRequest(id);
    CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId);
    return messagingChannel.sendAndGetChunked(nbworkerTopic, request).thenApply(result -> result.stream().map(GetFlowPathResponse.class::cast).map(GetFlowPathResponse::getPayload).collect(Collectors.toList())).thenApply(respList -> buildFlowPathPayload(respList, id));
}
Also used : GetFlowPathRequest(org.openkilda.messaging.nbtopology.request.GetFlowPathRequest) FlowReadRequest(org.openkilda.messaging.nbtopology.request.FlowReadRequest) GetFlowStatusTimestampsRequest(org.openkilda.messaging.nbtopology.request.GetFlowStatusTimestampsRequest) FlowHistoryEntry(org.openkilda.messaging.payload.history.FlowHistoryEntry) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) MessageException(org.openkilda.messaging.error.MessageException) CommandMessage(org.openkilda.messaging.command.CommandMessage) FlowResponseV2(org.openkilda.northbound.dto.v2.flows.FlowResponseV2) DiverseGroupPayload(org.openkilda.messaging.payload.flow.DiverseGroupPayload) FlowMirrorPointsDumpResponse(org.openkilda.messaging.nbtopology.response.FlowMirrorPointsDumpResponse) FlowPathPayload(org.openkilda.messaging.payload.flow.FlowPathPayload) FlowPatchRequest(org.openkilda.messaging.nbtopology.request.FlowPatchRequest) GroupFlowPathPayload(org.openkilda.messaging.payload.flow.GroupFlowPathPayload) PingInput(org.openkilda.northbound.dto.v1.flows.PingInput) FlowDeleteRequest(org.openkilda.messaging.command.flow.FlowDeleteRequest) FlowResponsePayload(org.openkilda.messaging.payload.flow.FlowResponsePayload) SwapFlowEndpointRequest(org.openkilda.messaging.command.flow.SwapFlowEndpointRequest) FlowValidationResponse(org.openkilda.messaging.info.flow.FlowValidationResponse) FlowProtectedPath(org.openkilda.messaging.payload.flow.FlowPathPayload.FlowProtectedPath) FlowPatchDto(org.openkilda.northbound.dto.v1.flows.FlowPatchDto) FlowPatchV2(org.openkilda.northbound.dto.v2.flows.FlowPatchV2) FlowMirrorPointsDumpRequest(org.openkilda.messaging.nbtopology.request.FlowMirrorPointsDumpRequest) Predicate(java.util.function.Predicate) GetFlowPathRequest(org.openkilda.messaging.nbtopology.request.GetFlowPathRequest) FlowDto(org.openkilda.messaging.model.FlowDto) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) FlowMirrorPointPayload(org.openkilda.northbound.dto.v2.flows.FlowMirrorPointPayload) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) FlowService(org.openkilda.northbound.service.FlowService) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) FLOW_ID(org.openkilda.messaging.Utils.FLOW_ID) List(java.util.List) FlowMirrorPointCreateRequest(org.openkilda.messaging.command.flow.FlowMirrorPointCreateRequest) BatchResults(org.openkilda.northbound.dto.BatchResults) FlowConnectedDevicesResponse(org.openkilda.northbound.dto.v1.flows.FlowConnectedDevicesResponse) FlowValidationRequest(org.openkilda.messaging.command.flow.FlowValidationRequest) FlowPatch(org.openkilda.messaging.model.FlowPatch) FlowsDumpRequest(org.openkilda.messaging.nbtopology.request.FlowsDumpRequest) Optional(java.util.Optional) FlowValidationDto(org.openkilda.northbound.dto.v1.flows.FlowValidationDto) GetFlowLoopsRequest(org.openkilda.messaging.nbtopology.request.GetFlowLoopsRequest) CreateFlowLoopRequest(org.openkilda.messaging.command.flow.CreateFlowLoopRequest) CompletableFuture(java.util.concurrent.CompletableFuture) SwapFlowEndpointPayload(org.openkilda.northbound.dto.v2.flows.SwapFlowEndpointPayload) Function(java.util.function.Function) FlowMirrorPointResponseV2(org.openkilda.northbound.dto.v2.flows.FlowMirrorPointResponseV2) PathMapper(org.openkilda.northbound.converter.PathMapper) FlowLoopResponse(org.openkilda.northbound.dto.v2.flows.FlowLoopResponse) ArrayList(java.util.ArrayList) PingOutput(org.openkilda.northbound.dto.v1.flows.PingOutput) Value(org.springframework.beans.factory.annotation.Value) FlowPingRequest(org.openkilda.messaging.command.flow.FlowPingRequest) Type(org.openkilda.messaging.command.flow.FlowRequest.Type) FlowIdStatusPayload(org.openkilda.messaging.payload.flow.FlowIdStatusPayload) MeterModifyRequest(org.openkilda.messaging.nbtopology.request.MeterModifyRequest) GetFlowPathResponse(org.openkilda.messaging.nbtopology.response.GetFlowPathResponse) FlowRequestV2(org.openkilda.northbound.dto.v2.flows.FlowRequestV2) Service(org.springframework.stereotype.Service) MessagingChannel(org.openkilda.northbound.messaging.MessagingChannel) FlowRerouteRequest.createManualFlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest.createManualFlowRerouteRequest) FlowPathSwapRequest(org.openkilda.messaging.command.flow.FlowPathSwapRequest) FlowPathDto(org.openkilda.messaging.model.FlowPathDto) FlowLoopsResponse(org.openkilda.messaging.nbtopology.response.FlowLoopsResponse) FlowProtectedPathDto(org.openkilda.messaging.model.FlowPathDto.FlowProtectedPathDto) FlowMapper(org.openkilda.northbound.converter.FlowMapper) FlowRerouteResponse(org.openkilda.messaging.info.flow.FlowRerouteResponse) FlowMirrorPointDeleteRequest(org.openkilda.messaging.command.flow.FlowMirrorPointDeleteRequest) CorrelationIdFactory(org.openkilda.northbound.utils.CorrelationIdFactory) AsyncUtils.collectResponses(org.openkilda.northbound.utils.async.AsyncUtils.collectResponses) FlowRequest(org.openkilda.messaging.command.flow.FlowRequest) Logger(org.slf4j.Logger) DeleteFlowLoopRequest(org.openkilda.messaging.command.flow.DeleteFlowLoopRequest) ErrorType(org.openkilda.messaging.error.ErrorType) FlowMeterEntries(org.openkilda.messaging.info.meter.FlowMeterEntries) FlowStatusTimestampsEntry(org.openkilda.messaging.payload.history.FlowStatusTimestampsEntry) RequestCorrelationId(org.openkilda.northbound.utils.RequestCorrelationId) FlowPingResponse(org.openkilda.messaging.info.flow.FlowPingResponse) FlowRerouteResponseV2(org.openkilda.northbound.dto.v2.flows.FlowRerouteResponseV2) FlowUpdatePayload(org.openkilda.messaging.payload.flow.FlowUpdatePayload) FlowConnectedDeviceRequest(org.openkilda.messaging.nbtopology.request.FlowConnectedDeviceRequest) SwitchId(org.openkilda.model.SwitchId) FlowReroutePayload(org.openkilda.messaging.payload.flow.FlowReroutePayload) ConnectedDeviceMapper(org.openkilda.northbound.converter.ConnectedDeviceMapper) Destination(org.openkilda.messaging.Destination) GetFlowHistoryRequest(org.openkilda.messaging.nbtopology.request.GetFlowHistoryRequest) FlowMirrorPointsResponseV2(org.openkilda.northbound.dto.v2.flows.FlowMirrorPointsResponseV2) Collections(java.util.Collections) FlowMirrorPointResponse(org.openkilda.messaging.info.flow.FlowMirrorPointResponse) FlowHistoryStatusesResponse(org.openkilda.northbound.dto.v2.flows.FlowHistoryStatusesResponse) SwapFlowResponse(org.openkilda.messaging.info.flow.SwapFlowResponse) FlowCreatePayload(org.openkilda.messaging.payload.flow.FlowCreatePayload) GetFlowPathResponse(org.openkilda.messaging.nbtopology.response.GetFlowPathResponse) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

String.format (java.lang.String.format)1 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 List (java.util.List)1 Optional (java.util.Optional)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 Function (java.util.function.Function)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 Destination (org.openkilda.messaging.Destination)1 FLOW_ID (org.openkilda.messaging.Utils.FLOW_ID)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 CreateFlowLoopRequest (org.openkilda.messaging.command.flow.CreateFlowLoopRequest)1 DeleteFlowLoopRequest (org.openkilda.messaging.command.flow.DeleteFlowLoopRequest)1 FlowDeleteRequest (org.openkilda.messaging.command.flow.FlowDeleteRequest)1 FlowMirrorPointCreateRequest (org.openkilda.messaging.command.flow.FlowMirrorPointCreateRequest)1 FlowMirrorPointDeleteRequest (org.openkilda.messaging.command.flow.FlowMirrorPointDeleteRequest)1 FlowPathSwapRequest (org.openkilda.messaging.command.flow.FlowPathSwapRequest)1 FlowPingRequest (org.openkilda.messaging.command.flow.FlowPingRequest)1