use of org.openkilda.wfm.share.flow.TestFlowBuilder in project open-kilda by telstra.
the class FlowOperationsServiceTest method testStrictBandwidthAndIgnoreBandwidthPatchConflict.
@Test(expected = IllegalArgumentException.class)
public void testStrictBandwidthAndIgnoreBandwidthPatchConflict() throws FlowNotFoundException {
String testFlowId = "flow_id";
Flow flow = new TestFlowBuilder().flowId(testFlowId).srcSwitch(createSwitch(SWITCH_ID_1)).destSwitch(createSwitch(SWITCH_ID_2)).build();
flowRepository.add(flow);
FlowPatch receivedFlow = FlowPatch.builder().flowId(testFlowId).strictBandwidth(true).ignoreBandwidth(true).build();
flowOperationsService.updateFlow(new FlowCarrierImpl(), receivedFlow);
}
use of org.openkilda.wfm.share.flow.TestFlowBuilder in project open-kilda by telstra.
the class StatsTopologyTest method createFlowWithProtectedPath.
private Flow createFlowWithProtectedPath() {
Switch srcSw = Switch.builder().switchId(SWITCH_ID_1).build();
switchRepository.add(srcSw);
Switch transitSw = Switch.builder().switchId(SWITCH_ID_2).build();
switchRepository.add(transitSw);
Switch dstSw = Switch.builder().switchId(SWITCH_ID_3).build();
switchRepository.add(dstSw);
Flow flow = new TestFlowBuilder(flowId).srcSwitch(srcSw).srcPort(PORT_1).srcVlan(5).addTransitionEndpoint(srcSw, PORT_2).addTransitionEndpoint(transitSw, PORT_1).addTransitionEndpoint(transitSw, PORT_2).addTransitionEndpoint(dstSw, PORT_1).unmaskedCookie(MAIN_COOKIE).forwardMeterId(456).forwardTransitEncapsulationId(ENCAPSULATION_ID).reverseMeterId(457).reverseTransitEncapsulationId(ENCAPSULATION_ID + 1).addProtectedTransitionEndpoint(srcSw, PORT_3).addProtectedTransitionEndpoint(dstSw, PORT_2).protectedUnmaskedCookie(PROTECTED_COOKIE).protectedForwardMeterId(458).protectedForwardTransitEncapsulationId(ENCAPSULATION_ID + 2).protectedReverseMeterId(459).protectedReverseTransitEncapsulationId(ENCAPSULATION_ID + 3).destSwitch(dstSw).destPort(PORT_3).destVlan(5).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).build();
flowRepository.add(flow);
return flow;
}
use of org.openkilda.wfm.share.flow.TestFlowBuilder in project open-kilda by telstra.
the class StatsTopologyTest method createOneSwitchFlow.
private Flow createOneSwitchFlow(SwitchId switchId) {
Switch sw = Switch.builder().switchId(switchId).build();
switchRepository.add(sw);
Flow flow = new TestFlowBuilder(flowId).srcSwitch(sw).srcPort(1).srcVlan(5).destSwitch(sw).destPort(2).destVlan(5).unmaskedCookie(MAIN_COOKIE).forwardMeterId(456).reverseMeterId(457).forwardTransitEncapsulationId(ENCAPSULATION_ID).reverseTransitEncapsulationId(ENCAPSULATION_ID + 1).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).build();
flowRepository.add(flow);
return flow;
}
use of org.openkilda.wfm.share.flow.TestFlowBuilder in project open-kilda by telstra.
the class FlowOperationsServiceTest method testStrictBandwidthUpdate.
@Test
public void testStrictBandwidthUpdate() throws FlowNotFoundException {
String testFlowId = "flow_id";
Flow flow = new TestFlowBuilder().flowId(testFlowId).srcSwitch(createSwitch(SWITCH_ID_1)).destSwitch(createSwitch(SWITCH_ID_2)).build();
flowRepository.add(flow);
FlowPatch receivedFlow = FlowPatch.builder().flowId(testFlowId).strictBandwidth(true).build();
Flow updatedFlow = flowOperationsService.updateFlow(new FlowCarrierImpl(), receivedFlow);
assertTrue(updatedFlow.isStrictBandwidth());
}
use of org.openkilda.wfm.share.flow.TestFlowBuilder in project open-kilda by telstra.
the class FlowOperationsServiceTest method shouldUpdateMaxLatencyPriorityAndPinnedFlowFields.
@Test
public void shouldUpdateMaxLatencyPriorityAndPinnedFlowFields() throws FlowNotFoundException {
String testFlowId = "flow_id";
Long maxLatency = 555L;
Integer priority = 777;
PathComputationStrategy pathComputationStrategy = PathComputationStrategy.LATENCY;
String description = "new_description";
Flow flow = new TestFlowBuilder().flowId(testFlowId).srcSwitch(createSwitch(SWITCH_ID_1)).srcPort(1).srcVlan(10).destSwitch(createSwitch(SWITCH_ID_2)).destPort(2).destVlan(11).encapsulationType(FlowEncapsulationType.TRANSIT_VLAN).pathComputationStrategy(PathComputationStrategy.COST).description("description").status(FlowStatus.UP).build();
flowRepository.add(flow);
FlowPatch receivedFlow = FlowPatch.builder().flowId(testFlowId).maxLatency(maxLatency).priority(priority).pinned(true).targetPathComputationStrategy(pathComputationStrategy).description("new_description").build();
Flow updatedFlow = flowOperationsService.updateFlow(new FlowCarrierImpl(), receivedFlow);
assertEquals(maxLatency, updatedFlow.getMaxLatency());
assertEquals(priority, updatedFlow.getPriority());
assertEquals(pathComputationStrategy, updatedFlow.getTargetPathComputationStrategy());
assertEquals(description, updatedFlow.getDescription());
assertTrue(updatedFlow.isPinned());
receivedFlow = FlowPatch.builder().flowId(testFlowId).build();
updatedFlow = flowOperationsService.updateFlow(new FlowCarrierImpl(), receivedFlow);
assertEquals(maxLatency, updatedFlow.getMaxLatency());
assertEquals(priority, updatedFlow.getPriority());
assertEquals(pathComputationStrategy, updatedFlow.getTargetPathComputationStrategy());
assertEquals(description, updatedFlow.getDescription());
assertTrue(updatedFlow.isPinned());
}
Aggregations