Search in sources :

Example 1 with TestFlowBuilder

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);
}
Also used : FlowPatch(org.openkilda.messaging.model.FlowPatch) TestFlowBuilder(org.openkilda.wfm.share.flow.TestFlowBuilder) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 2 with TestFlowBuilder

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;
}
Also used : Switch(org.openkilda.model.Switch) TestFlowBuilder(org.openkilda.wfm.share.flow.TestFlowBuilder) Flow(org.openkilda.model.Flow)

Example 3 with TestFlowBuilder

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;
}
Also used : Switch(org.openkilda.model.Switch) TestFlowBuilder(org.openkilda.wfm.share.flow.TestFlowBuilder) Flow(org.openkilda.model.Flow)

Example 4 with TestFlowBuilder

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());
}
Also used : FlowPatch(org.openkilda.messaging.model.FlowPatch) TestFlowBuilder(org.openkilda.wfm.share.flow.TestFlowBuilder) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Example 5 with TestFlowBuilder

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());
}
Also used : FlowPatch(org.openkilda.messaging.model.FlowPatch) TestFlowBuilder(org.openkilda.wfm.share.flow.TestFlowBuilder) PathComputationStrategy(org.openkilda.model.PathComputationStrategy) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

TestFlowBuilder (org.openkilda.wfm.share.flow.TestFlowBuilder)10 Flow (org.openkilda.model.Flow)9 Test (org.junit.Test)6 Switch (org.openkilda.model.Switch)6 FlowPatch (org.openkilda.messaging.model.FlowPatch)4 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)4 YFlow (org.openkilda.model.YFlow)2 FlowStatsData (org.openkilda.messaging.info.stats.FlowStatsData)1 FlowStatsEntry (org.openkilda.messaging.info.stats.FlowStatsEntry)1 MeterStatsData (org.openkilda.messaging.info.stats.MeterStatsData)1 MeterStatsEntry (org.openkilda.messaging.info.stats.MeterStatsEntry)1 FlowEndpoint (org.openkilda.model.FlowEndpoint)1 MeterId (org.openkilda.model.MeterId)1 PathComputationStrategy (org.openkilda.model.PathComputationStrategy)1 FlowSegmentCookie (org.openkilda.model.cookie.FlowSegmentCookie)1 TestYFlowBuilder (org.openkilda.wfm.share.yflow.TestYFlowBuilder)1 TestYSubFlowBuilder (org.openkilda.wfm.share.yflow.TestYSubFlowBuilder)1 FlowStatsAndDescriptor (org.openkilda.wfm.topology.stats.model.FlowStatsAndDescriptor)1 MeterStatsAndDescriptor (org.openkilda.wfm.topology.stats.model.MeterStatsAndDescriptor)1 YFlowDescriptor (org.openkilda.wfm.topology.stats.model.YFlowDescriptor)1