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;
}
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());
}
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());
}
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());
}
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);
}
Aggregations