Search in sources :

Example 11 with FlowPathPayload

use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.

the class FlowSteps method verifyFlowPath.

@And("^(.*) flow's path equals to '(.*)'$")
public void verifyFlowPath(String flowAlias, String pathAlias) {
    FlowPayload flow = topologyUnderTest.getAliasedObject(flowAlias);
    FlowPathPayload expectedPath = topologyUnderTest.getAliasedObject(pathAlias);
    FlowPathPayload actualPath = northboundService.getFlowPath(flow.getId());
    assertThat(actualPath, equalTo(expectedPath));
}
Also used : FlowPayload(org.openkilda.messaging.payload.flow.FlowPayload) FlowPathPayload(org.openkilda.messaging.payload.flow.FlowPathPayload) And(cucumber.api.java.en.And)

Example 12 with FlowPathPayload

use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.

the class FlowServiceImpl method buildFlowPathPayload.

private FlowPathPayload buildFlowPathPayload(List<FlowPathDto> paths, String flowId) {
    FlowPathDto askedPathDto = paths.stream().filter(e -> e.getId().equals(flowId)).findAny().orElseThrow(() -> new IllegalStateException(format("Path for flow %s is not found.", flowId)));
    // fill primary flow path
    FlowPathPayload payload = new FlowPathPayload();
    payload.setId(askedPathDto.getId());
    payload.setForwardPath(askedPathDto.getForwardPath());
    payload.setReversePath(askedPathDto.getReversePath());
    if (askedPathDto.getProtectedPath() != null) {
        FlowProtectedPathDto protectedPath = askedPathDto.getProtectedPath();
        payload.setProtectedPath(FlowProtectedPath.builder().forwardPath(protectedPath.getForwardPath()).reversePath(protectedPath.getReversePath()).build());
    }
    // fill group paths
    if (paths.size() > 1) {
        payload.setDiverseGroupPayload(DiverseGroupPayload.builder().overlappingSegments(askedPathDto.getSegmentsStats()).otherFlows(mapGroupPaths(paths, flowId, FlowPathDto::isPrimaryPathCorrespondStat)).build());
        if (askedPathDto.getProtectedPath() != null) {
            payload.setDiverseGroupProtectedPayload(DiverseGroupPayload.builder().overlappingSegments(askedPathDto.getProtectedPath().getSegmentsStats()).otherFlows(mapGroupPaths(paths, flowId, e -> !e.isPrimaryPathCorrespondStat())).build());
        }
    }
    return payload;
}
Also used : 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) FlowPathDto(org.openkilda.messaging.model.FlowPathDto) FlowProtectedPathDto(org.openkilda.messaging.model.FlowPathDto.FlowProtectedPathDto) FlowPathPayload(org.openkilda.messaging.payload.flow.FlowPathPayload) GroupFlowPathPayload(org.openkilda.messaging.payload.flow.GroupFlowPathPayload)

Example 13 with FlowPathPayload

use of org.openkilda.messaging.payload.flow.FlowPathPayload in project open-kilda by telstra.

the class FlowFFRTest method flowPathIsShortest.

@When("^flow (.+) path is shortest$")
public void flowPathIsShortest(String flowId) throws Throwable {
    String flowName = FlowUtils.getFlowName(flowId);
    FlowPathPayload payload = getFlowPath(flowName, FlowPathTest.expectedShortestPath.getLeft());
    assertNotNull(payload);
    assertEquals(flowName, payload.getId());
    assertEquals(FlowPathTest.expectedShortestPath.getLeft(), payload.getPath());
}
Also used : FlowPathPayload(org.openkilda.messaging.payload.flow.FlowPathPayload) When(cucumber.api.java.en.When)

Aggregations

FlowPathPayload (org.openkilda.messaging.payload.flow.FlowPathPayload)13 Then (cucumber.api.java.en.Then)2 When (cucumber.api.java.en.When)2 String.format (java.lang.String.format)2 Instant (java.time.Instant)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 List (java.util.List)2 Optional (java.util.Optional)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Function (java.util.function.Function)2 Predicate (java.util.function.Predicate)2 Collectors (java.util.stream.Collectors)2 Test (org.junit.Test)2 Destination (org.openkilda.messaging.Destination)2 FLOW_ID (org.openkilda.messaging.Utils.FLOW_ID)2 CommandMessage (org.openkilda.messaging.command.CommandMessage)2 CreateFlowLoopRequest (org.openkilda.messaging.command.flow.CreateFlowLoopRequest)2 DeleteFlowLoopRequest (org.openkilda.messaging.command.flow.DeleteFlowLoopRequest)2 FlowDeleteRequest (org.openkilda.messaging.command.flow.FlowDeleteRequest)2