Search in sources :

Example 6 with UpdateFlowResult

use of org.openkilda.wfm.topology.nbworker.services.FlowOperationsService.UpdateFlowResult in project open-kilda by telstra.

the class FlowOperationsServiceTest method shouldPrepareFlowUpdateResultWithChangedMaxLatencySecondCase.

@Test
public void shouldPrepareFlowUpdateResultWithChangedMaxLatencySecondCase() {
    // given: FlowPatch with max latency and MAX_LATENCY strategy
    // and Flow with MAX_LATENCY strategy and no max latency
    String flowId = "test_flow_id";
    FlowPatch flowDto = FlowPatch.builder().flowId(flowId).maxLatency(100L).pathComputationStrategy(PathComputationStrategy.MAX_LATENCY).build();
    Flow flow = Flow.builder().flowId(flowId).srcSwitch(Switch.builder().switchId(new SwitchId(1)).build()).destSwitch(Switch.builder().switchId(new SwitchId(2)).build()).pathComputationStrategy(PathComputationStrategy.MAX_LATENCY).build();
    // when: compare this flows
    UpdateFlowResult result = flowOperationsService.prepareFlowUpdateResult(flowDto, flow).build();
    // then: needRerouteFlow flag set to true
    assertTrue(result.isNeedUpdateFlow());
}
Also used : FlowPatch(org.openkilda.messaging.model.FlowPatch) UpdateFlowResult(org.openkilda.wfm.topology.nbworker.services.FlowOperationsService.UpdateFlowResult) SwitchId(org.openkilda.model.SwitchId) Flow(org.openkilda.model.Flow) InMemoryGraphBasedTest(org.openkilda.persistence.inmemory.InMemoryGraphBasedTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)6 FlowPatch (org.openkilda.messaging.model.FlowPatch)6 Flow (org.openkilda.model.Flow)6 SwitchId (org.openkilda.model.SwitchId)6 InMemoryGraphBasedTest (org.openkilda.persistence.inmemory.InMemoryGraphBasedTest)6 UpdateFlowResult (org.openkilda.wfm.topology.nbworker.services.FlowOperationsService.UpdateFlowResult)6