@Test public void shouldPrepareFlowUpdateResultWithChangedMaxLatencyFirstCase() { String flowId = "test_flow_id"; FlowPatch flowDto = FlowPatch.builder() .flowId(flowId) .maxLatency(100L) .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(); UpdateFlowResult result = flowOperationsService.prepareFlowUpdateResult(flowDto, flow).build(); assertTrue(result.isNeedUpdateFlow()); }
@VisibleForTesting UpdateFlowResult.UpdateFlowResultBuilder prepareFlowUpdateResult(FlowPatch flowPatch, Flow flow) { boolean updateRequired = updateRequiredByPathComputationStrategy(flowPatch, flow); updateRequired |= updateRequiredBySource(flowPatch, flow); updateRequired |= updateRequiredByDestination(flowPatch, flow); updateRequired |= flowPatch.getBandwidth() != null && flow.getBandwidth() != flowPatch.getBandwidth(); updateRequired |= flowPatch.getAllocateProtectedPath() != null && !flowPatch.getAllocateProtectedPath().equals(flow.isAllocateProtectedPath()); updateRequired |= updateRequiredByDiverseFlowIdField(flowPatch, flow); updateRequired |= flowPatch.getIgnoreBandwidth() != null && flow.isIgnoreBandwidth() != flowPatch.getIgnoreBandwidth(); updateRequired |= flowPatch.getEncapsulationType() != null && !flow.getEncapsulationType().equals(flowPatch.getEncapsulationType()); return UpdateFlowResult.builder() .needUpdateFlow(updateRequired); }
FlowOperationsService { @VisibleForTesting UpdateFlowResult.UpdateFlowResultBuilder prepareFlowUpdateResult(FlowPatch flowPatch, Flow flow) { boolean updateRequired = updateRequiredByPathComputationStrategy(flowPatch, flow); updateRequired |= updateRequiredBySource(flowPatch, flow); updateRequired |= updateRequiredByDestination(flowPatch, flow); updateRequired |= flowPatch.getBandwidth() != null && flow.getBandwidth() != flowPatch.getBandwidth(); updateRequired |= flowPatch.getAllocateProtectedPath() != null && !flowPatch.getAllocateProtectedPath().equals(flow.isAllocateProtectedPath()); updateRequired |= updateRequiredByDiverseFlowIdField(flowPatch, flow); updateRequired |= flowPatch.getIgnoreBandwidth() != null && flow.isIgnoreBandwidth() != flowPatch.getIgnoreBandwidth(); updateRequired |= flowPatch.getEncapsulationType() != null && !flow.getEncapsulationType().equals(flowPatch.getEncapsulationType()); return UpdateFlowResult.builder() .needUpdateFlow(updateRequired); } }
FlowOperationsService { @VisibleForTesting UpdateFlowResult.UpdateFlowResultBuilder prepareFlowUpdateResult(FlowPatch flowPatch, Flow flow) { boolean updateRequired = updateRequiredByPathComputationStrategy(flowPatch, flow); updateRequired |= updateRequiredBySource(flowPatch, flow); updateRequired |= updateRequiredByDestination(flowPatch, flow); updateRequired |= flowPatch.getBandwidth() != null && flow.getBandwidth() != flowPatch.getBandwidth(); updateRequired |= flowPatch.getAllocateProtectedPath() != null && !flowPatch.getAllocateProtectedPath().equals(flow.isAllocateProtectedPath()); updateRequired |= updateRequiredByDiverseFlowIdField(flowPatch, flow); updateRequired |= flowPatch.getIgnoreBandwidth() != null && flow.isIgnoreBandwidth() != flowPatch.getIgnoreBandwidth(); updateRequired |= flowPatch.getEncapsulationType() != null && !flow.getEncapsulationType().equals(flowPatch.getEncapsulationType()); return UpdateFlowResult.builder() .needUpdateFlow(updateRequired); } FlowOperationsService(RepositoryFactory repositoryFactory, TransactionManager transactionManager); }
FlowOperationsService { @VisibleForTesting UpdateFlowResult.UpdateFlowResultBuilder prepareFlowUpdateResult(FlowPatch flowPatch, Flow flow) { boolean updateRequired = updateRequiredByPathComputationStrategy(flowPatch, flow); updateRequired |= updateRequiredBySource(flowPatch, flow); updateRequired |= updateRequiredByDestination(flowPatch, flow); updateRequired |= flowPatch.getBandwidth() != null && flow.getBandwidth() != flowPatch.getBandwidth(); updateRequired |= flowPatch.getAllocateProtectedPath() != null && !flowPatch.getAllocateProtectedPath().equals(flow.isAllocateProtectedPath()); updateRequired |= updateRequiredByDiverseFlowIdField(flowPatch, flow); updateRequired |= flowPatch.getIgnoreBandwidth() != null && flow.isIgnoreBandwidth() != flowPatch.getIgnoreBandwidth(); updateRequired |= flowPatch.getEncapsulationType() != null && !flow.getEncapsulationType().equals(flowPatch.getEncapsulationType()); return UpdateFlowResult.builder() .needUpdateFlow(updateRequired); } FlowOperationsService(RepositoryFactory repositoryFactory, TransactionManager transactionManager); Flow getFlow(String flowId); Set<String> getDiverseFlowsId(String flowId, String groupId); Collection<Flow> getAllFlows(FlowsDumpRequest request); Collection<FlowPath> getFlowPathsForLink(SwitchId srcSwitchId, Integer srcPort,
                                                    SwitchId dstSwitchId, Integer dstPort); Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port); Collection<FlowPath> getFlowPathsForSwitch(SwitchId switchId); List<FlowPathDto> getFlowPath(String flowId); Flow updateFlow(FlowOperationsCarrier carrier, FlowPatch flowPatch); Collection<SwitchConnectedDevice> getFlowConnectedDevice(String flowId); List<FlowRerouteRequest> makeRerouteRequests(
            Collection<FlowPath> targetPaths, Set<IslEndpoint> affectedIslEndpoints, String reason); }
FlowOperationsService { @VisibleForTesting UpdateFlowResult.UpdateFlowResultBuilder prepareFlowUpdateResult(FlowPatch flowPatch, Flow flow) { boolean updateRequired = updateRequiredByPathComputationStrategy(flowPatch, flow); updateRequired |= updateRequiredBySource(flowPatch, flow); updateRequired |= updateRequiredByDestination(flowPatch, flow); updateRequired |= flowPatch.getBandwidth() != null && flow.getBandwidth() != flowPatch.getBandwidth(); updateRequired |= flowPatch.getAllocateProtectedPath() != null && !flowPatch.getAllocateProtectedPath().equals(flow.isAllocateProtectedPath()); updateRequired |= updateRequiredByDiverseFlowIdField(flowPatch, flow); updateRequired |= flowPatch.getIgnoreBandwidth() != null && flow.isIgnoreBandwidth() != flowPatch.getIgnoreBandwidth(); updateRequired |= flowPatch.getEncapsulationType() != null && !flow.getEncapsulationType().equals(flowPatch.getEncapsulationType()); return UpdateFlowResult.builder() .needUpdateFlow(updateRequired); } FlowOperationsService(RepositoryFactory repositoryFactory, TransactionManager transactionManager); Flow getFlow(String flowId); Set<String> getDiverseFlowsId(String flowId, String groupId); Collection<Flow> getAllFlows(FlowsDumpRequest request); Collection<FlowPath> getFlowPathsForLink(SwitchId srcSwitchId, Integer srcPort,
                                                    SwitchId dstSwitchId, Integer dstPort); Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port); Collection<FlowPath> getFlowPathsForSwitch(SwitchId switchId); List<FlowPathDto> getFlowPath(String flowId); Flow updateFlow(FlowOperationsCarrier carrier, FlowPatch flowPatch); Collection<SwitchConnectedDevice> getFlowConnectedDevice(String flowId); List<FlowRerouteRequest> makeRerouteRequests(
            Collection<FlowPath> targetPaths, Set<IslEndpoint> affectedIslEndpoints, String reason);  }