Search in sources :

Example 11 with RequestedFlow

use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.

the class RequestedFlowMapper method toRequestedFlow.

/**
 * Convert {@link Flow} to {@link RequestedFlow}.
 */
public RequestedFlow toRequestedFlow(FlowRequest request) {
    RequestedFlow flow = generatedMap(request);
    RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource());
    RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination());
    return flow;
}
Also used : RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow)

Example 12 with RequestedFlow

use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.

the class FlowUpdateService method handleUpdateRequest.

/**
 * Handles request for flow update.
 *
 * @param key command identifier.
 * @param request request data.
 */
public void handleUpdateRequest(@NonNull String key, @NonNull CommandContext commandContext, @NonNull FlowRequest request) throws DuplicateKeyException {
    if (yFlowRepository.isSubFlow(request.getFlowId())) {
        sendForbiddenSubFlowOperationToNorthbound(request.getFlowId(), commandContext);
        return;
    }
    RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(request);
    startFlowUpdating(key, commandContext, requestedFlow, request.isDoNotRevert(), request.getBulkUpdateFlowIds(), requestedFlow.getFlowId());
}
Also used : RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow)

Example 13 with RequestedFlow

use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.

the class RequestedFlowMapperTest method mapSwapDtoToRequesterFlowTest.

@Test
public void mapSwapDtoToRequesterFlowTest() {
    SwapFlowDto swapFlowDto = SwapFlowDto.builder().flowId(FLOW_ID).sourceSwitch(SRC_SWITCH_ID).sourcePort(SRC_PORT).sourceVlan(SRC_VLAN).destinationSwitch(DST_SWITCH_ID).destinationPort(DST_PORT).destinationVlan(DST_VLAN).build();
    RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(swapFlowDto);
    assertEquals(FLOW_ID, requestedFlow.getFlowId());
    assertEquals(SRC_SWITCH_ID, requestedFlow.getSrcSwitch());
    assertEquals(SRC_PORT, requestedFlow.getSrcPort());
    assertEquals(SRC_VLAN, requestedFlow.getSrcVlan());
    assertEquals(DST_SWITCH_ID, requestedFlow.getDestSwitch());
    assertEquals(DST_PORT, requestedFlow.getDestPort());
    assertEquals(DST_VLAN, requestedFlow.getDestVlan());
}
Also used : SwapFlowDto(org.openkilda.messaging.model.SwapFlowDto) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Example 14 with RequestedFlow

use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.

the class RequestedFlowMapperTest method mapFlowRequestToRequestedFlowTest.

@Test
public void mapFlowRequestToRequestedFlowTest() {
    RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(flowRequest);
    assertEquals(FLOW_ID, requestedFlow.getFlowId());
    assertEquals(SRC_SWITCH_ID, requestedFlow.getSrcSwitch());
    assertEquals(SRC_PORT, requestedFlow.getSrcPort());
    assertEquals(SRC_VLAN, requestedFlow.getSrcVlan());
    assertEquals(SRC_INNER_VLAN, requestedFlow.getSrcInnerVlan());
    assertEquals(DST_SWITCH_ID, requestedFlow.getDestSwitch());
    assertEquals(DST_PORT, requestedFlow.getDestPort());
    assertEquals(DST_VLAN, requestedFlow.getDestVlan());
    assertEquals(DST_INNER_VLAN, requestedFlow.getDestInnerVlan());
    assertEquals(PRIORITY, requestedFlow.getPriority());
    assertEquals(DIVERSE_FLOW_ID, requestedFlow.getDiverseFlowId());
    assertEquals(DESCRIPTION, requestedFlow.getDescription());
    assertEquals(BANDWIDTH, requestedFlow.getBandwidth());
    assertEquals(MAX_LATENCY, requestedFlow.getMaxLatency());
    assertEquals(ENCAPSULATION_TYPE, requestedFlow.getFlowEncapsulationType());
    assertTrue(requestedFlow.isPinned());
    assertTrue(requestedFlow.isAllocateProtectedPath());
    assertTrue(requestedFlow.isIgnoreBandwidth());
    assertTrue(requestedFlow.isPeriodicPings());
    assertEquals(new DetectConnectedDevices(true, true, true, true, true, true, true, true), requestedFlow.getDetectConnectedDevices());
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Example 15 with RequestedFlow

use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.

the class RequestedFlowMapperTest method mapFlowToRequestedFlowTest.

@Test
public void mapFlowToRequestedFlowTest() {
    RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(flow);
    assertEquals(FLOW_ID, requestedFlow.getFlowId());
    assertEquals(SRC_SWITCH_ID, requestedFlow.getSrcSwitch());
    assertEquals(SRC_PORT, requestedFlow.getSrcPort());
    assertEquals(SRC_VLAN, requestedFlow.getSrcVlan());
    assertEquals(SRC_INNER_VLAN, requestedFlow.getSrcInnerVlan());
    assertEquals(DST_SWITCH_ID, requestedFlow.getDestSwitch());
    assertEquals(DST_PORT, requestedFlow.getDestPort());
    assertEquals(DST_VLAN, requestedFlow.getDestVlan());
    assertEquals(DST_INNER_VLAN, requestedFlow.getDestInnerVlan());
    assertEquals(PRIORITY, requestedFlow.getPriority());
    assertEquals(DESCRIPTION, requestedFlow.getDescription());
    assertEquals(BANDWIDTH, requestedFlow.getBandwidth());
    assertEquals(MAX_LATENCY, requestedFlow.getMaxLatency());
    assertEquals(ENCAPSULATION_TYPE, requestedFlow.getFlowEncapsulationType());
    assertTrue(requestedFlow.isPinned());
    assertTrue(requestedFlow.isAllocateProtectedPath());
    assertTrue(requestedFlow.isIgnoreBandwidth());
    assertTrue(requestedFlow.isPeriodicPings());
    assertEquals(new DetectConnectedDevices(true, true, true, true, true, true, true, true), requestedFlow.getDetectConnectedDevices());
    Flow mappedFlow = RequestedFlowMapper.INSTANCE.toFlow(requestedFlow);
    assertEquals(flow, mappedFlow);
}
Also used : DetectConnectedDevices(org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Flow(org.openkilda.model.Flow) RequestedFlow(org.openkilda.wfm.topology.flowhs.model.RequestedFlow) Test(org.junit.Test)

Aggregations

RequestedFlow (org.openkilda.wfm.topology.flowhs.model.RequestedFlow)34 Flow (org.openkilda.model.Flow)12 Test (org.junit.Test)10 DetectConnectedDevices (org.openkilda.wfm.topology.flowhs.model.DetectConnectedDevices)8 YFlow (org.openkilda.model.YFlow)4 YSubFlow (org.openkilda.model.YSubFlow)4 FlowProcessingException (org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException)4 FlowPath (org.openkilda.model.FlowPath)3 InvalidFlowException (org.openkilda.wfm.topology.flowhs.validation.InvalidFlowException)3 UnavailableFlowEndpointException (org.openkilda.wfm.topology.flowhs.validation.UnavailableFlowEndpointException)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 ArrayList (java.util.ArrayList)2 Collection (java.util.Collection)2 FlowSegmentRequestFactory (org.openkilda.floodlight.api.request.factory.FlowSegmentRequestFactory)2 Switch (org.openkilda.model.Switch)2 CommandContext (org.openkilda.wfm.CommandContext)2 FlowCommandBuilder (org.openkilda.wfm.topology.flowhs.service.FlowCommandBuilder)2 Sets (com.google.common.collect.Sets)1 String.format (java.lang.String.format)1 HashSet (java.util.HashSet)1