@Test public void getFlowsForEndpointNotReturnFlowsForOrphanedPaths() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); Switch switchB = createSwitch(SWITCH_ID_2); Switch switchC = createSwitch(SWITCH_ID_3); Switch switchD = createSwitch(SWITCH_ID_4); Flow flow = createFlow(FLOW_ID_1, switchA, 1, switchC, 2, FORWARD_PATH_1, REVERSE_PATH_1, switchB); createOrphanFlowPaths(flow, switchA, 1, switchC, 2, FORWARD_PATH_3, REVERSE_PATH_3, switchD); assertEquals(0, flowOperationsService.getFlowsForEndpoint(switchD.getSwitchId(), null).size()); }
public Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port) throws SwitchNotFoundException { flowDashboardLogger.onFlowPathsDumpByEndpoint(switchId, port); if (!switchRepository.findById(switchId).isPresent()) { throw new SwitchNotFoundException(switchId); } if (port != null) { return getFlowsForEndpoint(flowPathRepository.findBySegmentEndpoint(switchId, port), flowRepository.findByEndpoint(switchId, port)); } else { return getFlowsForEndpoint(flowPathRepository.findBySegmentSwitch(switchId), flowRepository.findByEndpointSwitch(switchId)); } }
FlowOperationsService { public Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port) throws SwitchNotFoundException { flowDashboardLogger.onFlowPathsDumpByEndpoint(switchId, port); if (!switchRepository.findById(switchId).isPresent()) { throw new SwitchNotFoundException(switchId); } if (port != null) { return getFlowsForEndpoint(flowPathRepository.findBySegmentEndpoint(switchId, port), flowRepository.findByEndpoint(switchId, port)); } else { return getFlowsForEndpoint(flowPathRepository.findBySegmentSwitch(switchId), flowRepository.findByEndpointSwitch(switchId)); } } }
FlowOperationsService { public Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port) throws SwitchNotFoundException { flowDashboardLogger.onFlowPathsDumpByEndpoint(switchId, port); if (!switchRepository.findById(switchId).isPresent()) { throw new SwitchNotFoundException(switchId); } if (port != null) { return getFlowsForEndpoint(flowPathRepository.findBySegmentEndpoint(switchId, port), flowRepository.findByEndpoint(switchId, port)); } else { return getFlowsForEndpoint(flowPathRepository.findBySegmentSwitch(switchId), flowRepository.findByEndpointSwitch(switchId)); } } FlowOperationsService(RepositoryFactory repositoryFactory, TransactionManager transactionManager); }
FlowOperationsService { public Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port) throws SwitchNotFoundException { flowDashboardLogger.onFlowPathsDumpByEndpoint(switchId, port); if (!switchRepository.findById(switchId).isPresent()) { throw new SwitchNotFoundException(switchId); } if (port != null) { return getFlowsForEndpoint(flowPathRepository.findBySegmentEndpoint(switchId, port), flowRepository.findByEndpoint(switchId, port)); } else { return getFlowsForEndpoint(flowPathRepository.findBySegmentSwitch(switchId), flowRepository.findByEndpointSwitch(switchId)); } } 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 { public Collection<Flow> getFlowsForEndpoint(SwitchId switchId, Integer port) throws SwitchNotFoundException { flowDashboardLogger.onFlowPathsDumpByEndpoint(switchId, port); if (!switchRepository.findById(switchId).isPresent()) { throw new SwitchNotFoundException(switchId); } if (port != null) { return getFlowsForEndpoint(flowPathRepository.findBySegmentEndpoint(switchId, port), flowRepository.findByEndpoint(switchId, port)); } else { return getFlowsForEndpoint(flowPathRepository.findBySegmentSwitch(switchId), flowRepository.findByEndpointSwitch(switchId)); } } 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);  }