target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void shouldBuildRemoveFlowWithoutMeterFromFlowEntryWithStringOutPort() { Long cookie = new FlowSegmentCookie(FlowPathDirection.FORWARD, 1).getValue(); String inPort = "1"; String inVlan = "10"; String outPort = "in_port"; FlowEntry flowEntry = buildFlowEntry(cookie, inPort, inVlan, outPort, null, false); R... | @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions()); Optional<FlowApplyActions> applyActions = inst... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... |
@Test public void shouldBuildRemoveFlowWithoutMeterFromFlowEntryWithVxlanEncapsulationIngress() { Long cookie = new FlowSegmentCookie(FlowPathDirection.FORWARD, 1).getValue(); String inPort = "1"; String outPort = "2"; String tunnelId = "10"; FlowEntry flowEntry = buildFlowEntry(cookie, inPort, null, outPort, tunnelId,... | @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions()); Optional<FlowApplyActions> applyActions = inst... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... |
@Test public void shouldBuildRemoveFlowWithoutMeterFromFlowEntryWithVxlanEncapsulationTransitAndEgress() { Long cookie = new FlowSegmentCookie(FlowPathDirection.FORWARD, 1).getValue(); String inPort = "1"; String outPort = "2"; String tunnelId = "10"; FlowEntry flowEntry = buildFlowEntry(cookie, inPort, null, outPort, ... | @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions()); Optional<FlowApplyActions> applyActions = inst... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... | CommandBuilderImpl implements CommandBuilder { @VisibleForTesting RemoveFlow buildRemoveFlowWithoutMeterFromFlowEntry(SwitchId switchId, FlowEntry entry) { Optional<FlowMatchField> entryMatch = Optional.ofNullable(entry.getMatch()); Optional<FlowInstructions> instructions = Optional.ofNullable(entry.getInstructions());... |
@Test public void receiveOnlyRules() { handleRequestAndInitDataReceive(); service.handleFlowEntriesResponse(KEY, new SwitchFlowEntries(SWITCH_ID, singletonList(flowEntry))); verifyNoMoreInteractions(carrier); verifyNoMoreInteractions(validationService); } | @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } } | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } SwitchValidateServiceImpl(
SwitchM... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } SwitchValidateServiceImpl(
SwitchM... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } SwitchValidateServiceImpl(
SwitchM... |
@Test public void doNothingWhenFsmNotFound() { service.handleFlowEntriesResponse(KEY, new SwitchFlowEntries(SWITCH_ID, singletonList(flowEntry))); verifyZeroInteractions(carrier); verifyZeroInteractions(validationService); } | @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } } | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } SwitchValidateServiceImpl(
SwitchM... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } SwitchValidateServiceImpl(
SwitchM... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleFlowEntriesResponse(String key, SwitchFlowEntries data) { handle(key, SwitchValidateEvent.RULES_RECEIVED, SwitchValidateContext.builder().flowEntries(data.getFlowEntries()).build()); } SwitchValidateServiceImpl(
SwitchM... |
@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... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void errorResponseOnSwitchNotFound() { request = SwitchValidateRequest .builder().switchId(SWITCH_ID_MISSING).performSync(true).processMeters(true).build(); service.handleSwitchValidateRequest(KEY, request); verify(carrier).cancelTimeoutCallback(eq(KEY)); verify(carrier).errorResponse( eq(KEY), eq(ErrorTyp... | @Override public void handleSwitchValidateRequest(String key, SwitchValidateRequest request) { SwitchValidateFsm fsm = builder.newStateMachine( SwitchValidateState.START, carrier, key, request, validationService, repositoryFactory); fsms.put(key, fsm); fsm.start(); handle(fsm, SwitchValidateEvent.NEXT, SwitchValidateCo... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleSwitchValidateRequest(String key, SwitchValidateRequest request) { SwitchValidateFsm fsm = builder.newStateMachine( SwitchValidateState.START, carrier, key, request, validationService, repositoryFactory); fsms.put(key, fsm); fsm.st... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleSwitchValidateRequest(String key, SwitchValidateRequest request) { SwitchValidateFsm fsm = builder.newStateMachine( SwitchValidateState.START, carrier, key, request, validationService, repositoryFactory); fsms.put(key, fsm); fsm.st... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleSwitchValidateRequest(String key, SwitchValidateRequest request) { SwitchValidateFsm fsm = builder.newStateMachine( SwitchValidateState.START, carrier, key, request, validationService, repositoryFactory); fsms.put(key, fsm); fsm.st... | SwitchValidateServiceImpl implements SwitchValidateService { @Override public void handleSwitchValidateRequest(String key, SwitchValidateRequest request) { SwitchValidateFsm fsm = builder.newStateMachine( SwitchValidateState.START, carrier, key, request, validationService, repositoryFactory); fsms.put(key, fsm); fsm.st... |
@Test public void validateRulesEmpty() throws SwitchNotFoundException { ValidationService validationService = new ValidationServiceImpl(persistenceManager().build(), topologyConfig); ValidateRulesResult response = validationService.validateRules(SWITCH_ID_A, emptyList(), emptyList()); assertTrue(response.getMissingRule... | @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRulesResponse(expectedCookies, presentRules, expectedDe... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... |
@Test public void validateRulesSimpleSegmentCookies() throws SwitchNotFoundException { ValidationService validationService = new ValidationServiceImpl(persistenceManager().withSegmentsCookies(2L, 3L).build(), topologyConfig); List<FlowEntry> flowEntries = Lists.newArrayList(FlowEntry.builder().cookie(1L).build(), FlowE... | @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRulesResponse(expectedCookies, presentRules, expectedDe... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... |
@Test public void validateRulesSegmentAndIngressCookies() throws SwitchNotFoundException { ValidationService validationService = new ValidationServiceImpl(persistenceManager().withSegmentsCookies(2L).withIngressCookies(1L).build(), topologyConfig); List<FlowEntry> flowEntries = Lists.newArrayList(FlowEntry.builder().co... | @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRulesResponse(expectedCookies, presentRules, expectedDe... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... |
@Test public void validateRulesSegmentAndIngressCookiesWithServer42Rules() { SwitchProperties switchProperties = SwitchProperties.builder() .server42FlowRtt(true) .build(); ValidationService validationService = new ValidationServiceImpl(persistenceManager() .withIngressCookies(1L) .withSwitchProperties(switchProperties... | @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRulesResponse(expectedCookies, presentRules, expectedDe... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... | ValidationServiceImpl implements ValidationService { @Override public ValidateRulesResult validateRules(SwitchId switchId, List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules) { log.debug("Validating rules on switch {}", switchId); Set<Long> expectedCookies = getExpectedFlowRules(switchId); return makeRu... |
@Test public void validateDefaultRules() throws SwitchNotFoundException { ValidationService validationService = new ValidationServiceImpl(persistenceManager().build(), topologyConfig); List<FlowEntry> flowEntries = Lists.newArrayList(FlowEntry.builder().cookie(0x8000000000000001L).priority(1).byteCount(123).build(), Fl... | private void validateDefaultRules(List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules, Set<Long> missingRules, Set<Long> properRules, Set<Long> excessRules, Set<Long> misconfiguredRules) { List<FlowEntry> presentDefaultRules = presentRules.stream() .filter(rule -> Cookie.isDefaultRule(rule.getCookie())) ... | ValidationServiceImpl implements ValidationService { private void validateDefaultRules(List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules, Set<Long> missingRules, Set<Long> properRules, Set<Long> excessRules, Set<Long> misconfiguredRules) { List<FlowEntry> presentDefaultRules = presentRules.stream() .fi... | ValidationServiceImpl implements ValidationService { private void validateDefaultRules(List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules, Set<Long> missingRules, Set<Long> properRules, Set<Long> excessRules, Set<Long> misconfiguredRules) { List<FlowEntry> presentDefaultRules = presentRules.stream() .fi... | ValidationServiceImpl implements ValidationService { private void validateDefaultRules(List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules, Set<Long> missingRules, Set<Long> properRules, Set<Long> excessRules, Set<Long> misconfiguredRules) { List<FlowEntry> presentDefaultRules = presentRules.stream() .fi... | ValidationServiceImpl implements ValidationService { private void validateDefaultRules(List<FlowEntry> presentRules, List<FlowEntry> expectedDefaultRules, Set<Long> missingRules, Set<Long> properRules, Set<Long> excessRules, Set<Long> misconfiguredRules) { List<FlowEntry> presentDefaultRules = presentRules.stream() .fi... |
@Test public void handleNothingRulesToSync() { missingRules = emptyList(); service.handleSwitchSync(KEY, request, makeValidationResult()); verify(carrier).response(eq(KEY), any(InfoMessage.class)); verify(carrier).cancelTimeoutCallback(eq(KEY)); verifyNoMoreInteractions(commandBuilder); verifyNoMoreInteractions(carrier... | @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... |
@Test public void handleCommandBuilderMissingRulesException() { String errorMessage = "test error"; when(commandBuilder.buildCommandsToSyncMissingRules(eq(SWITCH_ID), any())) .thenThrow(new IllegalArgumentException(errorMessage)); service.handleSwitchSync(KEY, request, makeValidationResult()); verify(commandBuilder).bu... | @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... |
@Test public void doNothingWhenFsmNotFound() { service.handleInstallRulesResponse(KEY); verifyZeroInteractions(carrier); verifyZeroInteractions(commandBuilder); } | @Override public void handleInstallRulesResponse(String key) { SwitchSyncFsm fsm = fsms.get(key); if (fsm == null) { logFsmNotFound(key); return; } fsm.fire(SwitchSyncEvent.RULES_INSTALLED); process(fsm); } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleInstallRulesResponse(String key) { SwitchSyncFsm fsm = fsms.get(key); if (fsm == null) { logFsmNotFound(key); return; } fsm.fire(SwitchSyncEvent.RULES_INSTALLED); process(fsm); } } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleInstallRulesResponse(String key) { SwitchSyncFsm fsm = fsms.get(key); if (fsm == null) { logFsmNotFound(key); return; } fsm.fire(SwitchSyncEvent.RULES_INSTALLED); process(fsm); } SwitchSyncServiceImpl(SwitchManagerCarrier carrier, Persiste... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleInstallRulesResponse(String key) { SwitchSyncFsm fsm = fsms.get(key); if (fsm == null) { logFsmNotFound(key); return; } fsm.fire(SwitchSyncEvent.RULES_INSTALLED); process(fsm); } SwitchSyncServiceImpl(SwitchManagerCarrier carrier, Persiste... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleInstallRulesResponse(String key) { SwitchSyncFsm fsm = fsms.get(key); if (fsm == null) { logFsmNotFound(key); return; } fsm.fire(SwitchSyncEvent.RULES_INSTALLED); process(fsm); } SwitchSyncServiceImpl(SwitchManagerCarrier carrier, Persiste... |
@Test public void handleNothingToSyncWithExcess() { request = SwitchValidateRequest.builder().switchId(SWITCH_ID).performSync(true).removeExcess(true).build(); missingRules = emptyList(); service.handleSwitchSync(KEY, request, makeValidationResult()); verify(carrier).cancelTimeoutCallback(eq(KEY)); verify(carrier).resp... | @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } } | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... | SwitchSyncServiceImpl implements SwitchSyncService { @Override public void handleSwitchSync(String key, SwitchValidateRequest request, ValidationResult validationResult) { SwitchSyncFsm fsm = builder.newStateMachine(SwitchSyncState.INITIALIZED, carrier, key, commandBuilder, request, validationResult); process(fsm); } S... |
@Test public void getFlowsForEndpointOneSwitchFlowNoPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); createFlow(FLOW_ID_1, switchA, 1, switchA, 2, FORWARD_PATH_1, REVERSE_PATH_1, null); assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, null), FLOW_ID_1); createFlo... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldConvertToGraphProperty() { FlowPathStatusConverter converter = new FlowPathStatusConverter(); assertEquals("active", converter.toGraphProperty(FlowPathStatus.ACTIVE)); assertEquals("inactive", converter.toGraphProperty(FlowPathStatus.INACTIVE)); assertEquals("in_progress", converter.toGraphPrope... | @Override public String toGraphProperty(FlowPathStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public String toGraphProperty(FlowPathStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public String toGraphProperty(FlowPathStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public String toGraphProperty(FlowPathStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(FlowPathStatus value); @Override FlowPathStatus toEntityAttribute(Str... | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public String toGraphProperty(FlowPathStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(FlowPathStatus value); @Override FlowPathStatus toEntityAttribute(Str... |
@Test public void shouldConvertToEntity() { FlowPathStatusConverter converter = new FlowPathStatusConverter(); assertEquals(FlowPathStatus.ACTIVE, converter.toEntityAttribute("ACTIVE")); assertEquals(FlowPathStatus.ACTIVE, converter.toEntityAttribute("active")); assertEquals(FlowPathStatus.IN_PROGRESS, converter.toEnti... | @Override public FlowPathStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowPathStatus.valueOf(value.toUpperCase()); } | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public FlowPathStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowPathStatus.valueOf(value.toUpperCase()); } } | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public FlowPathStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowPathStatus.valueOf(value.toUpperCase()); } } | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public FlowPathStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowPathStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(FlowPathStatus value); @... | FlowPathStatusConverter implements AttributeConverter<FlowPathStatus, String> { @Override public FlowPathStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowPathStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(FlowPathStatus value); @... |
@Test public void shouldConvertIdToString() { PathId pathId = new PathId("test_path_id"); String graphObject = PathIdConverter.INSTANCE.toGraphProperty(pathId); assertEquals(pathId.getId(), graphObject); } | @Override public String toGraphProperty(PathId value) { if (value == null) { return null; } return value.getId(); } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public String toGraphProperty(PathId value) { if (value == null) { return null; } return value.getId(); } } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public String toGraphProperty(PathId value) { if (value == null) { return null; } return value.getId(); } } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public String toGraphProperty(PathId value) { if (value == null) { return null; } return value.getId(); } @Override String toGraphProperty(PathId value); @Override PathId toEntityAttribute(String value); } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public String toGraphProperty(PathId value) { if (value == null) { return null; } return value.getId(); } @Override String toGraphProperty(PathId value); @Override PathId toEntityAttribute(String value); static final PathIdConverter INSTANCE; } |
@Test public void shouldConvertStringToId() { PathId pathId = new PathId("test_path_id"); PathId actualEntity = PathIdConverter.INSTANCE.toEntityAttribute(pathId.getId()); assertEquals(pathId, actualEntity); } | @Override public PathId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new PathId(value); } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public PathId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new PathId(value); } } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public PathId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new PathId(value); } } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public PathId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new PathId(value); } @Override String toGraphProperty(PathId value); @Override PathId toEntityAttribute(String value); } | PathIdConverter implements AttributeConverter<PathId, String> { @Override public PathId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new PathId(value); } @Override String toGraphProperty(PathId value); @Override PathId toEntityAttribute(String value); static fi... |
@Test public void shouldConvertIdToString() { SwitchId switchId = new SwitchId((long) 0x123); String graphObject = SwitchIdConverter.INSTANCE.toGraphProperty(switchId); assertEquals(switchId.toString(), graphObject); } | @Override public String toGraphProperty(SwitchId value) { if (value == null) { return null; } return value.toString(); } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public String toGraphProperty(SwitchId value) { if (value == null) { return null; } return value.toString(); } } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public String toGraphProperty(SwitchId value) { if (value == null) { return null; } return value.toString(); } } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public String toGraphProperty(SwitchId value) { if (value == null) { return null; } return value.toString(); } @Override String toGraphProperty(SwitchId value); @Override SwitchId toEntityAttribute(String value); } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public String toGraphProperty(SwitchId value) { if (value == null) { return null; } return value.toString(); } @Override String toGraphProperty(SwitchId value); @Override SwitchId toEntityAttribute(String value); static final SwitchIdConvert... |
@Test public void shouldConvertStringToId() { SwitchId switchId = new SwitchId((long) 0x123); SwitchId actualEntity = SwitchIdConverter.INSTANCE.toEntityAttribute(switchId.toString()); assertEquals(switchId, actualEntity); } | @Override public SwitchId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new SwitchId(value); } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public SwitchId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new SwitchId(value); } } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public SwitchId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new SwitchId(value); } } | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public SwitchId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new SwitchId(value); } @Override String toGraphProperty(SwitchId value); @Override SwitchId toEntityAttribute(String value... | SwitchIdConverter implements AttributeConverter<SwitchId, String> { @Override public SwitchId toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return new SwitchId(value); } @Override String toGraphProperty(SwitchId value); @Override SwitchId toEntityAttribute(String value... |
@Test public void shouldConvertToGraphProperty() { FlowStatusConverter converter = FlowStatusConverter.INSTANCE; assertEquals("up", converter.toGraphProperty(FlowStatus.UP)); assertEquals("down", converter.toGraphProperty(FlowStatus.DOWN)); assertEquals("in_progress", converter.toGraphProperty(FlowStatus.IN_PROGRESS));... | @Override public String toGraphProperty(FlowStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public String toGraphProperty(FlowStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public String toGraphProperty(FlowStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public String toGraphProperty(FlowStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(FlowStatus value); @Override FlowStatus toEntityAttribute(String value); } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public String toGraphProperty(FlowStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(FlowStatus value); @Override FlowStatus toEntityAttribute(String value); static f... |
@Test public void shouldConvertToEntity() { FlowStatusConverter converter = FlowStatusConverter.INSTANCE; assertEquals(FlowStatus.UP, converter.toEntityAttribute("UP")); assertEquals(FlowStatus.UP, converter.toEntityAttribute("up")); assertEquals(FlowStatus.IN_PROGRESS, converter.toEntityAttribute("In_Progress")); } | @Override public FlowStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return FlowStatus.UP; } return FlowStatus.valueOf(value.toUpperCase()); } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public FlowStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return FlowStatus.UP; } return FlowStatus.valueOf(value.toUpperCase()); } } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public FlowStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return FlowStatus.UP; } return FlowStatus.valueOf(value.toUpperCase()); } } | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public FlowStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return FlowStatus.UP; } return FlowStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(FlowStatus value); @Override Fl... | FlowStatusConverter implements AttributeConverter<FlowStatus, String> { @Override public FlowStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return FlowStatus.UP; } return FlowStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(FlowStatus value); @Override Fl... |
@Test public void shouldConvertIdToLong() { ExclusionCookie cookie = new ExclusionCookie((long) 0x123); Long graphObject = new ExclusionCookieConverter().toGraphProperty(cookie); assertEquals(cookie.getValue(), (long) graphObject); } | @Override public Long toGraphProperty(ExclusionCookie value) { if (value == null) { return null; } return value.getValue(); } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public Long toGraphProperty(ExclusionCookie value) { if (value == null) { return null; } return value.getValue(); } } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public Long toGraphProperty(ExclusionCookie value) { if (value == null) { return null; } return value.getValue(); } } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public Long toGraphProperty(ExclusionCookie value) { if (value == null) { return null; } return value.getValue(); } @Override Long toGraphProperty(ExclusionCookie value); @Override ExclusionCookie toEntityAttribute(Long value); } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public Long toGraphProperty(ExclusionCookie value) { if (value == null) { return null; } return value.getValue(); } @Override Long toGraphProperty(ExclusionCookie value); @Override ExclusionCookie toEntityAttribute(Long value); s... |
@Test public void shouldConvertLongToId() { ExclusionCookie cookie = new ExclusionCookie((long) 0x123); Cookie actualEntity = new ExclusionCookieConverter().toEntityAttribute(cookie.getValue()); assertEquals(cookie, actualEntity); } | @Override public ExclusionCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new ExclusionCookie(value); } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public ExclusionCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new ExclusionCookie(value); } } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public ExclusionCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new ExclusionCookie(value); } } | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public ExclusionCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new ExclusionCookie(value); } @Override Long toGraphProperty(ExclusionCookie value); @Override ExclusionCookie toEntityAttribute(Lo... | ExclusionCookieConverter implements AttributeConverter<ExclusionCookie, Long> { @Override public ExclusionCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new ExclusionCookie(value); } @Override Long toGraphProperty(ExclusionCookie value); @Override ExclusionCookie toEntityAttribute(Lo... |
@Test public void getFlowsForEndpointMultiSwitchFlowNoPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); Switch switchB = createSwitch(SWITCH_ID_2); createFlow(FLOW_ID_1, switchA, 1, switchB, 2, FORWARD_PATH_1, REVERSE_PATH_1, null); assertFlows(flowOperationsService.getFlowsForEndp... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldDeletePortPropertiesWhenDeletingSwitch() throws SwitchNotFoundException { Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build(); switchRepository.add(sw); PortProperties portProperties = PortProperties.builder().switchObj(sw).port(7).discoveryEnabled(false).bu... | public boolean deleteSwitch(SwitchId switchId, boolean force) throws SwitchNotFoundException { transactionManager.doInTransaction(() -> { Switch sw = switchRepository.findById(switchId) .orElseThrow(() -> new SwitchNotFoundException(switchId)); switchPropertiesRepository.findBySwitchId(sw.getSwitchId()) .ifPresent(sp -... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public boolean deleteSwitch(SwitchId switchId, boolean force) throws SwitchNotFoundException { transactionManager.doInTransaction(() -> { Switch sw = switchRepository.findById(switchId) .orElseThrow(() -> new SwitchNotFoundException(switchId)); switchPr... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public boolean deleteSwitch(SwitchId switchId, boolean force) throws SwitchNotFoundException { transactionManager.doInTransaction(() -> { Switch sw = switchRepository.findById(switchId) .orElseThrow(() -> new SwitchNotFoundException(switchId)); switchPr... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public boolean deleteSwitch(SwitchId switchId, boolean force) throws SwitchNotFoundException { transactionManager.doInTransaction(() -> { Switch sw = switchRepository.findById(switchId) .orElseThrow(() -> new SwitchNotFoundException(switchId)); switchPr... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public boolean deleteSwitch(SwitchId switchId, boolean force) throws SwitchNotFoundException { transactionManager.doInTransaction(() -> { Switch sw = switchRepository.findById(switchId) .orElseThrow(() -> new SwitchNotFoundException(switchId)); switchPr... |
@Test public void shouldConvertIdToLong() { FlowSegmentCookie cookie = new FlowSegmentCookie((long) 0x123); Long graphObject = FlowSegmentCookieConverter.INSTANCE.toGraphProperty(cookie); assertEquals(cookie.getValue(), (long) graphObject); } | @Override public Long toGraphProperty(FlowSegmentCookie value) { if (value == null) { return null; } return value.getValue(); } | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public Long toGraphProperty(FlowSegmentCookie value) { if (value == null) { return null; } return value.getValue(); } } | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public Long toGraphProperty(FlowSegmentCookie value) { if (value == null) { return null; } return value.getValue(); } } | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public Long toGraphProperty(FlowSegmentCookie value) { if (value == null) { return null; } return value.getValue(); } @Override Long toGraphProperty(FlowSegmentCookie value); @Override FlowSegmentCookie toEntityAttribute(Long... | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public Long toGraphProperty(FlowSegmentCookie value) { if (value == null) { return null; } return value.getValue(); } @Override Long toGraphProperty(FlowSegmentCookie value); @Override FlowSegmentCookie toEntityAttribute(Long... |
@Test public void shouldConvertLongToId() { FlowSegmentCookie cookie = new FlowSegmentCookie((long) 0x123); FlowSegmentCookie actualEntity = FlowSegmentCookieConverter.INSTANCE.toEntityAttribute(cookie.getValue()); assertEquals(cookie, actualEntity); } | @Override public FlowSegmentCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new FlowSegmentCookie(value); } | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public FlowSegmentCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new FlowSegmentCookie(value); } } | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public FlowSegmentCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new FlowSegmentCookie(value); } } | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public FlowSegmentCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new FlowSegmentCookie(value); } @Override Long toGraphProperty(FlowSegmentCookie value); @Override FlowSegmentCookie toEntity... | FlowSegmentCookieConverter implements AttributeConverter<FlowSegmentCookie, Long> { @Override public FlowSegmentCookie toEntityAttribute(Long value) { if (value == null) { return null; } return new FlowSegmentCookie(value); } @Override Long toGraphProperty(FlowSegmentCookie value); @Override FlowSegmentCookie toEntity... |
@Test public void shouldConvertToGraphProperty() { SwitchStatusConverter converter = SwitchStatusConverter.INSTANCE; assertEquals("active", converter.toGraphProperty(SwitchStatus.ACTIVE)); assertEquals("inactive", converter.toGraphProperty(SwitchStatus.INACTIVE)); } | @Override public String toGraphProperty(SwitchStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public String toGraphProperty(SwitchStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public String toGraphProperty(SwitchStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public String toGraphProperty(SwitchStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(SwitchStatus value); @Override SwitchStatus toEntityAttribute(String value)... | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public String toGraphProperty(SwitchStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(SwitchStatus value); @Override SwitchStatus toEntityAttribute(String value)... |
@Test public void shouldConvertToEntity() { SwitchStatusConverter converter = SwitchStatusConverter.INSTANCE; assertEquals(SwitchStatus.ACTIVE, converter.toEntityAttribute("ACTIVE")); assertEquals(SwitchStatus.ACTIVE, converter.toEntityAttribute("active")); assertEquals(SwitchStatus.INACTIVE, converter.toEntityAttribut... | @Override public SwitchStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return SwitchStatus.valueOf(value.toUpperCase()); } | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public SwitchStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return SwitchStatus.valueOf(value.toUpperCase()); } } | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public SwitchStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return SwitchStatus.valueOf(value.toUpperCase()); } } | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public SwitchStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return SwitchStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(SwitchStatus value); @Override S... | SwitchStatusConverter implements AttributeConverter<SwitchStatus, String> { @Override public SwitchStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return SwitchStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(SwitchStatus value); @Override S... |
@Test public void shouldConvertToGraphProperty() { assertEquals("TRANSIT_VLAN", FlowEncapsulationTypeConverter.INSTANCE.toGraphProperty(FlowEncapsulationType.TRANSIT_VLAN)); } | @Override public String toGraphProperty(FlowEncapsulationType value) { if (value == null) { return null; } return value.name(); } | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public String toGraphProperty(FlowEncapsulationType value) { if (value == null) { return null; } return value.name(); } } | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public String toGraphProperty(FlowEncapsulationType value) { if (value == null) { return null; } return value.name(); } } | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public String toGraphProperty(FlowEncapsulationType value) { if (value == null) { return null; } return value.name(); } @Override String toGraphProperty(FlowEncapsulationType value); @Override FlowEncapsulationType ... | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public String toGraphProperty(FlowEncapsulationType value) { if (value == null) { return null; } return value.name(); } @Override String toGraphProperty(FlowEncapsulationType value); @Override FlowEncapsulationType ... |
@Test public void shouldConvertToEntity() { assertEquals(FlowEncapsulationType.TRANSIT_VLAN, FlowEncapsulationTypeConverter.INSTANCE.toEntityAttribute("TRANSIT_VLAN")); } | @Override public FlowEncapsulationType toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowEncapsulationType.valueOf(value); } | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public FlowEncapsulationType toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowEncapsulationType.valueOf(value); } } | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public FlowEncapsulationType toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowEncapsulationType.valueOf(value); } } | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public FlowEncapsulationType toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowEncapsulationType.valueOf(value); } @Override String toGraphProperty(FlowEncaps... | FlowEncapsulationTypeConverter implements AttributeConverter<FlowEncapsulationType, String> { @Override public FlowEncapsulationType toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return FlowEncapsulationType.valueOf(value); } @Override String toGraphProperty(FlowEncaps... |
@Test public void shouldConvertIdToString() { MeterId meterId = new MeterId(0x123); Long graphObject = MeterIdConverter.INSTANCE.toGraphProperty(meterId); assertEquals(meterId.getValue(), (long) graphObject); } | @Override public Long toGraphProperty(MeterId value) { if (value == null) { return null; } return value.getValue(); } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public Long toGraphProperty(MeterId value) { if (value == null) { return null; } return value.getValue(); } } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public Long toGraphProperty(MeterId value) { if (value == null) { return null; } return value.getValue(); } } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public Long toGraphProperty(MeterId value) { if (value == null) { return null; } return value.getValue(); } @Override Long toGraphProperty(MeterId value); @Override MeterId toEntityAttribute(Long value); } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public Long toGraphProperty(MeterId value) { if (value == null) { return null; } return value.getValue(); } @Override Long toGraphProperty(MeterId value); @Override MeterId toEntityAttribute(Long value); static final MeterIdConverter INSTANCE; } |
@Test public void shouldConvertStringToId() { MeterId meterId = new MeterId(0x123); MeterId actualEntity = MeterIdConverter.INSTANCE.toEntityAttribute(meterId.getValue()); assertEquals(meterId, actualEntity); } | @Override public MeterId toEntityAttribute(Long value) { if (value == null) { return null; } return new MeterId(value); } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public MeterId toEntityAttribute(Long value) { if (value == null) { return null; } return new MeterId(value); } } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public MeterId toEntityAttribute(Long value) { if (value == null) { return null; } return new MeterId(value); } } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public MeterId toEntityAttribute(Long value) { if (value == null) { return null; } return new MeterId(value); } @Override Long toGraphProperty(MeterId value); @Override MeterId toEntityAttribute(Long value); } | MeterIdConverter implements AttributeConverter<MeterId, Long> { @Override public MeterId toEntityAttribute(Long value) { if (value == null) { return null; } return new MeterId(value); } @Override Long toGraphProperty(MeterId value); @Override MeterId toEntityAttribute(Long value); static final MeterIdConverter INSTANC... |
@Test public void shouldConvertToGraphProperty() { IslStatusConverter converter = IslStatusConverter.INSTANCE; assertEquals("active", converter.toGraphProperty(IslStatus.ACTIVE)); assertEquals("inactive", converter.toGraphProperty(IslStatus.INACTIVE)); } | @Override public String toGraphProperty(IslStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public String toGraphProperty(IslStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public String toGraphProperty(IslStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public String toGraphProperty(IslStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(IslStatus value); @Override IslStatus toEntityAttribute(String value); } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public String toGraphProperty(IslStatus value) { if (value == null) { return null; } return value.name().toLowerCase(); } @Override String toGraphProperty(IslStatus value); @Override IslStatus toEntityAttribute(String value); static final ... |
@Test public void shouldConvertToEntity() { IslStatusConverter converter = IslStatusConverter.INSTANCE; assertEquals(IslStatus.ACTIVE, converter.toEntityAttribute("ACTIVE")); assertEquals(IslStatus.ACTIVE, converter.toEntityAttribute("active")); assertEquals(IslStatus.INACTIVE, converter.toEntityAttribute("InActive"));... | @Override public IslStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return IslStatus.valueOf(value.toUpperCase()); } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public IslStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return IslStatus.valueOf(value.toUpperCase()); } } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public IslStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return IslStatus.valueOf(value.toUpperCase()); } } | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public IslStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return IslStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(IslStatus value); @Override IslStatus toEnti... | IslStatusConverter implements AttributeConverter<IslStatus, String> { @Override public IslStatus toEntityAttribute(String value) { if (value == null || value.trim().isEmpty()) { return null; } return IslStatus.valueOf(value.toUpperCase()); } @Override String toGraphProperty(IslStatus value); @Override IslStatus toEnti... |
@Test public void getFlowsForEndpointTransitSwitchFlowNoPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); Switch switchB = createSwitch(SWITCH_ID_2); Switch switchC = createSwitch(SWITCH_ID_3); createFlow(FLOW_ID_1, switchA, 1, switchC, 2, FORWARD_PATH_1, REVERSE_PATH_1, switchB); ... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldCreatePortPropertiesWithRelation() { Switch origSwitch = createTestSwitch(TEST_SWITCH_ID.getId()); PortProperties portProperties = PortProperties.builder() .switchObj(origSwitch) .discoveryEnabled(false) .build(); portPropertiesRepository.add(portProperties); Collection<PortProperties> portPrope... | @Override public Collection<PortProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(PortPropertiesFrame.FRAME_LABEL)) .toListExplicit(PortPropertiesFrame.class).stream() .map(PortProperties::new) .collect(Collectors.toList()); } | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Collection<PortProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(PortPropertiesFrame.FRAME_LABEL)) .toListExplicit(PortPro... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Collection<PortProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(PortPropertiesFrame.FRAME_LABEL)) .toListExplicit(PortPro... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Collection<PortProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(PortPropertiesFrame.FRAME_LABEL)) .toListExplicit(PortPro... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Collection<PortProperties> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(PortPropertiesFrame.FRAME_LABEL)) .toListExplicit(PortPro... |
@Test public void shouldGetPortPropertiesBySwitchIdAndPort() { Switch origSwitch = createTestSwitch(TEST_SWITCH_ID.getId()); int port = 7; PortProperties portProperties = PortProperties.builder() .switchObj(origSwitch) .port(port) .discoveryEnabled(false) .build(); portPropertiesRepository.add(portProperties); Optional... | @Override public Optional<PortProperties> getBySwitchIdAndPort(SwitchId switchId, int port) { List<? extends PortPropertiesFrame> portPropertiesFrames = framedGraph().traverse(g -> g.V() .hasLabel(PortPropertiesFrame.FRAME_LABEL) .has(PortPropertiesFrame.SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(sw... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Optional<PortProperties> getBySwitchIdAndPort(SwitchId switchId, int port) { List<? extends PortPropertiesFrame> portPropertiesFrames = framedGraph... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Optional<PortProperties> getBySwitchIdAndPort(SwitchId switchId, int port) { List<? extends PortPropertiesFrame> portPropertiesFrames = framedGraph... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Optional<PortProperties> getBySwitchIdAndPort(SwitchId switchId, int port) { List<? extends PortPropertiesFrame> portPropertiesFrames = framedGraph... | FermaPortPropertiesRepository extends FermaGenericRepository<PortProperties, PortPropertiesData, PortPropertiesFrame> implements PortPropertiesRepository { @Override public Optional<PortProperties> getBySwitchIdAndPort(SwitchId switchId, int port) { List<? extends PortPropertiesFrame> portPropertiesFrames = framedGraph... |
@Test public void shouldCreateFlowCookie() { createFlowCookie(); Collection<FlowCookie> allCookies = flowCookieRepository.findAll(); FlowCookie foundCookie = allCookies.iterator().next(); assertEquals(TEST_COOKIE, foundCookie.getUnmaskedCookie()); assertEquals(TEST_FLOW_ID, foundCookie.getFlowId()); } | @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .map(FlowCookie::new) .collect(Collectors.toList()); } | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... |
@Test public void shouldDeleteFlowCookie() { FlowCookie cookie = createFlowCookie(); transactionManager.doInTransaction(() -> flowCookieRepository.remove(cookie)); assertEquals(0, flowCookieRepository.findAll().size()); } | @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .map(FlowCookie::new) .collect(Collectors.toList()); } | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... |
@Test public void shouldDeleteFoundFlowCookie() { createFlowCookie(); transactionManager.doInTransaction(() -> { Collection<FlowCookie> allCookies = flowCookieRepository.findAll(); FlowCookie foundCookie = allCookies.iterator().next(); flowCookieRepository.remove(foundCookie); }); assertEquals(0, flowCookieRepository.f... | @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .map(FlowCookie::new) .collect(Collectors.toList()); } | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Collection<FlowCookie> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL)) .toListExplicit(FlowCookieFrame.class).stream() .ma... |
@Test public void shouldSelectNextInOrderResourceWhenFindUnassignedCookie() { long first = findUnassignedCookieAndCreate("flow_1"); assertEquals(5, first); long second = findUnassignedCookieAndCreate("flow_2"); assertEquals(6, second); long third = findUnassignedCookieAndCreate("flow_3"); assertEquals(7, third); transa... | @Override public Optional<FlowCookie> findByCookie(long unmaskedCookie) { List<? extends FlowCookieFrame> flowCookieFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame.FRAME_LABEL) .has(FlowCookieFrame.UNMASKED_COOKIE_PROPERTY, unmaskedCookie)) .toListExplicit(FlowCookieFrame.class); return flowCookieF... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Optional<FlowCookie> findByCookie(long unmaskedCookie) { List<? extends FlowCookieFrame> flowCookieFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Optional<FlowCookie> findByCookie(long unmaskedCookie) { List<? extends FlowCookieFrame> flowCookieFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Optional<FlowCookie> findByCookie(long unmaskedCookie) { List<? extends FlowCookieFrame> flowCookieFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame... | FermaFlowCookieRepository extends FermaGenericRepository<FlowCookie, FlowCookieData, FlowCookieFrame> implements FlowCookieRepository { @Override public Optional<FlowCookie> findByCookie(long unmaskedCookie) { List<? extends FlowCookieFrame> flowCookieFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowCookieFrame... |
@Test public void shouldFlowPathUpdateKeepRelations() { createTestFlowPathPair(); Flow foundFlow = flowRepository.findById(TEST_FLOW_ID).get(); assertThat(foundFlow.getPaths(), hasSize(2)); FlowPath foundPath = flowPathRepository.findById(flow.getForwardPathId()).get(); foundPath.setStatus(FlowPathStatus.INACTIVE); fou... | @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.PATH_ID_PROPERTY, PathIdConverter.INSTANCE.toGraphProperty(pathId))) .toListExplicit(FlowPathFrame.class); return flowPat... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... |
@Test public void shouldFlowPathUpdateKeepFlowRelations() { createTestFlowPathPair(); Flow foundFlow = flowRepository.findById(TEST_FLOW_ID).get(); assertThat(foundFlow.getPaths(), hasSize(2)); FlowPath flowPath = foundFlow.getPaths().stream() .filter(path -> path.getPathId().equals(flow.getReversePathId())) .findAny()... | @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.PATH_ID_PROPERTY, PathIdConverter.INSTANCE.toGraphProperty(pathId))) .toListExplicit(FlowPathFrame.class); return flowPat... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... |
@Test public void shouldFindPathById() { FlowPath flowPath = createTestFlowPath(); Optional<FlowPath> foundPath = flowPathRepository.findById(flowPath.getPathId()); assertTrue(foundPath.isPresent()); } | @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.PATH_ID_PROPERTY, PathIdConverter.INSTANCE.toGraphProperty(pathId))) .toListExplicit(FlowPathFrame.class); return flowPat... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... |
@Test public void shouldFindPathByFlowIdAndCookie() { FlowPath flowPath = createTestFlowPath(); Optional<FlowPath> foundPath = flowPathRepository.findByFlowIdAndCookie(TEST_FLOW_ID, flowPath.getCookie()); assertTrue(foundPath.isPresent()); } | @Override public Optional<FlowPath> findByFlowIdAndCookie(String flowId, FlowSegmentCookie cookie) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.FLOW_ID_PROPERTY, flowId) .has(FlowPathFrame.COOKIE_PROPERTY, FlowSegmentCookieCon... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findByFlowIdAndCookie(String flowId, FlowSegmentCookie cookie) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(Fl... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findByFlowIdAndCookie(String flowId, FlowSegmentCookie cookie) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(Fl... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findByFlowIdAndCookie(String flowId, FlowSegmentCookie cookie) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(Fl... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findByFlowIdAndCookie(String flowId, FlowSegmentCookie cookie) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(Fl... |
@Test public void getFlowsForEndpointSeveralFlowNoPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); Switch switchB = createSwitch(SWITCH_ID_2); Switch switchC = createSwitch(SWITCH_ID_3); createFlow(FLOW_ID_1, switchB, 1, switchB, 2, FORWARD_PATH_1, REVERSE_PATH_1, null); assertFlo... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldFindByEndpointSwitch() { createTestFlowPathPair(); Collection<FlowPath> paths = flowPathRepository.findByEndpointSwitch(switchA.getSwitchId()); assertThat(paths, containsInAnyOrder(flow.getForwardPath(), flow.getReversePath())); } | @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... |
@Test public void shouldNotFindProtectedIngressByEndpointSwitch() { createTestFlowPathPair(); FlowPath protect = createFlowPath(flow, "_protectedpath", 10, 10, switchA, switchB); flow.setProtectedForwardPath(protect); Collection<FlowPath> paths = flowPathRepository.findByEndpointSwitch(switchA.getSwitchId()); assertTha... | @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... |
@Test public void shouldFindProtectedPathsByEndpointSwitchIncludeProtected() { createTestFlowPathPair(); flow.setProtectedForwardPath(createFlowPath(flow, "_forward_protected", 10, 10, switchA, switchB)); flow.setProtectedReversePath(createFlowPath(flow, "_reverse_protected", 11, 11, switchB, switchA)); Collection<Flow... | @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... |
@Test public void shouldFindProtectedPathsBySrcSwitchIncludeProtected() { createTestFlowPathPair(); flow.setProtectedForwardPath(createFlowPath(flow, "_forward_protected", 10, 10, switchA, switchB)); flow.setProtectedReversePath(createFlowPath(flow, "_reverse_protected", 11, 11, switchB, switchA)); assertThat(flowPathR... | @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))) .frameE... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... |
@Test public void shouldFindBySrcSwitch() { createTestFlowPathPair(); Collection<FlowPath> paths = flowPathRepository.findBySrcSwitch(switchA.getSwitchId()); assertThat(paths, containsInAnyOrder(flow.getForwardPath())); } | @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))) .frameE... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... |
@Test public void shouldFindFlowPathsForIsl() { FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100); flow.setForwardPath(flowPath); Collection<FlowPath> paths = flowPathRepository.findWithPathSegment(switchA.getSwitchId(), 1, switchC.getSwitchId(), 100); assertThat(paths, Matchers.hasSize(1)); assertTh... | @Override public Collection<FlowPath> findWithPathSegment(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(srcSwitchId)) .has(P... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findWithPathSegment(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFr... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findWithPathSegment(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFr... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findWithPathSegment(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFr... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findWithPathSegment(SwitchId srcSwitchId, int srcPort, SwitchId dstSwitchId, int dstPort) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFr... |
@Test public void shouldFindActiveAffectedPaths() { FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100); flow.setForwardPath(flowPath); Collection<FlowPath> paths = flowPathRepository.findBySegmentEndpoint( switchC.getSwitchId(), 100); assertThat(paths, containsInAnyOrder(flowPath)); } | @Override public Collection<FlowPath> findBySegmentEndpoint(SwitchId switchId, int port) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(Pa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentEndpoint(SwitchId switchId, int port) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegment... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentEndpoint(SwitchId switchId, int port) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegment... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentEndpoint(SwitchId switchId, int port) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegment... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentEndpoint(SwitchId switchId, int port) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegment... |
@Test public void shouldFindPathByFlowId() { createTestFlowPath(); Collection<FlowPath> foundPaths = flowPathRepository.findByFlowId(TEST_FLOW_ID); assertThat(foundPaths, hasSize(1)); } | @Override public Collection<FlowPath> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(FlowPathFrame.class).stream() .map(FlowPath::new) .collect(Collectors.toList()); } | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.FLOW_ID_PROPERTY, flowId)) .t... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.FLOW_ID_PROPERTY, flowId)) .t... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.FLOW_ID_PROPERTY, flowId)) .t... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.FLOW_ID_PROPERTY, flowId)) .t... |
@Test public void shouldFindPathBySrc() { createTestFlowPath(); Collection<FlowPath> foundPaths = flowPathRepository.findBySrcSwitch(switchA.getSwitchId()); assertThat(foundPaths, hasSize(1)); } | @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))) .frameE... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... |
@Test public void shouldNotFindPathByWrongSrc() { createTestFlowPath(); Collection<FlowPath> foundPaths = flowPathRepository.findBySrcSwitch(switchB.getSwitchId()); assertThat(foundPaths, Matchers.empty()); } | @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))) .frameE... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySrcSwitch(SwitchId switchId, boolean includeProtected) { List<FlowPath> result = new ArrayList<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPa... |
@Test public void getFlowsForEndpointOneSwitchFlowWithPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); createFlow(FLOW_ID_1, switchA, 1, switchA, 2, FORWARD_PATH_1, REVERSE_PATH_1, null); assertFlows(flowOperationsService.getFlowsForEndpoint(SWITCH_ID_1, 1), FLOW_ID_1); createFlow... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldFindPathByEndpointSwitch() { createTestFlowPath(); Collection<FlowPath> foundPaths = flowPathRepository.findByEndpointSwitch(switchB.getSwitchId()); assertThat(foundPaths, hasSize(1)); } | @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findByEndpointSwitch(SwitchId switchId, boolean includeProtected) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLa... |
@Test public void shouldFindPathBySegmentSwitch() { FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100); flow.setForwardPath(flowPath); Collection<FlowPath> foundPaths = flowPathRepository.findBySegmentSwitch(switchC.getSwitchId()); assertThat(foundPaths, hasSize(1)); } | @Override public Collection<FlowPath> findBySegmentSwitch(SwitchId switchId) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .in(FlowPathFrame.O... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentSwitch(SwitchId switchId) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentSwitch(SwitchId switchId) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentSwitch(SwitchId switchId) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentSwitch(SwitchId switchId) { Map<PathId, FlowPath> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_... |
@Test public void shouldFindInactivePathBySegmentSwitch() { Flow activeFlow = Flow.builder() .flowId("active flow") .srcSwitch(switchA) .srcPort(1) .destSwitch(switchB) .destPort(2) .status(FlowStatus.UP) .build(); flowRepository.add(activeFlow); FlowPath activeFlowPath = createFlowPath(activeFlow, "active", 100L, 200L... | @Override public Collection<FlowPath> findInactiveBySegmentSwitch(SwitchId switchId) { String downFlowStatus = FlowStatusConverter.INSTANCE.toGraphProperty(FlowStatus.DOWN); String degragedFlowStatus = FlowStatusConverter.INSTANCE.toGraphProperty(FlowStatus.DEGRADED); Map<PathId, FlowPath> result = new HashMap<>(); fra... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findInactiveBySegmentSwitch(SwitchId switchId) { String downFlowStatus = FlowStatusConverter.INSTANCE.toGraphProperty(FlowStatus.DOWN); String degragedFlowS... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findInactiveBySegmentSwitch(SwitchId switchId) { String downFlowStatus = FlowStatusConverter.INSTANCE.toGraphProperty(FlowStatus.DOWN); String degragedFlowS... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findInactiveBySegmentSwitch(SwitchId switchId) { String downFlowStatus = FlowStatusConverter.INSTANCE.toGraphProperty(FlowStatus.DOWN); String degragedFlowS... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findInactiveBySegmentSwitch(SwitchId switchId) { String downFlowStatus = FlowStatusConverter.INSTANCE.toGraphProperty(FlowStatus.DOWN); String degragedFlowS... |
@Test public void shouldFindPathBySegmentDestSwitch() { FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100); flow.setForwardPath(flowPath); Collection<FlowPath> foundPaths = flowPathRepository.findBySegmentDestSwitch(switchC.getSwitchId()); assertThat(foundPaths, hasSize(1)); } | @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .in(FlowPathFrame.OWNS_SEGMENTS_EDGE) .hasLabel(FlowPath... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... |
@Test public void shouldNotFindPathByWrongSegmentDestSwitch() { FlowPath flowPath = createTestFlowPathWithIntermediate(switchC, 100); flow.setForwardPath(flowPath); Collection<FlowPath> foundPaths = flowPathRepository.findBySegmentDestSwitch(switchA.getSwitchId()); assertThat(foundPaths, Matchers.empty()); } | @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .in(FlowPathFrame.OWNS_SEGMENTS_EDGE) .hasLabel(FlowPath... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findBySegmentDestSwitch(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(PathSegmentFrame.FRAME_LABEL) .has(PathSegmentFrame.DST_SWIT... |
@Test public void shouldKeepSegmentsOrdered() { FlowPath flowPath = createTestFlowPath(); List<PathSegment> segments = asList(PathSegment.builder() .srcSwitch(switchA) .destSwitch(switchC) .build(), PathSegment.builder() .srcSwitch(switchC) .destSwitch(switchB) .build()); flowPath.setSegments(segments); Optional<FlowPa... | @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathFrame.PATH_ID_PROPERTY, PathIdConverter.INSTANCE.toGraphProperty(pathId))) .toListExplicit(FlowPathFrame.class); return flowPat... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Optional<FlowPath> findById(PathId pathId) { List<? extends FlowPathFrame> flowPathFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowPathFrame.FRAME_LABEL) .has(FlowPathF... |
@Test public void shouldFindFlowPathIdsByFlowIds() { Flow flowA = buildTestProtectedFlow(TEST_FLOW_ID_1, switchA, PORT_1, VLAN_1, switchB, PORT_2, VLAN_2); flowRepository.add(flowA); Flow flowB = buildTestFlow(TEST_FLOW_ID_2, switchA, PORT_1, VLAN_2, switchB, PORT_2, 0); flowRepository.add(flowB); Flow flowC = buildTes... | @Override public Collection<FlowPath> findActualByFlowIds(Set<String> flowIds) { Set<String> pathIds = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, P.within(flowIds)) .values(FlowFrame.FORWARD_PATH_ID_PROPERTY, FlowFrame.REVERSE_PATH_ID_PROPERTY, F... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findActualByFlowIds(Set<String> flowIds) { Set<String> pathIds = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(Fl... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findActualByFlowIds(Set<String> flowIds) { Set<String> pathIds = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(Fl... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findActualByFlowIds(Set<String> flowIds) { Set<String> pathIds = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(Fl... | FermaFlowPathRepository extends FermaGenericRepository<FlowPath, FlowPathData, FlowPathFrame> implements FlowPathRepository { @Override public Collection<FlowPath> findActualByFlowIds(Set<String> flowIds) { Set<String> pathIds = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(Fl... |
@Test public void shouldLookupRuleByMatchAndFlow() { ApplicationRule ruleA = buildRuleA(); ApplicationRule foundRule = applicationRepository.lookupRuleByMatchAndFlow(ruleA.getSwitchId(), ruleA.getFlowId(), ruleA.getSrcIp(), ruleA.getSrcPort(), ruleA.getDstIp(), ruleA.getDstPort(), ruleA.getProto(), ruleA.getEthType(), ... | @Override public Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp, Integer srcPort, String dstIp, Integer dstPort, String proto, String ethType, Long metadata) { List<? extends ApplicationRuleFrame> applicationRuleFrames = framedGraph().traverse(g -> g.V() .hasLabel(Appl... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp, Integer srcPort, String dstIp, Integer dstP... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp, Integer srcPort, String dstIp, Integer dstP... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp, Integer srcPort, String dstIp, Integer dstP... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndFlow(SwitchId switchId, String flowId, String srcIp, Integer srcPort, String dstIp, Integer dstP... |
@Test public void shouldLookupRuleByMatchAndCookie() { ApplicationRule ruleA = buildRuleA(); ApplicationRule foundRule = applicationRepository.lookupRuleByMatchAndCookie(ruleA.getSwitchId(), ruleA.getCookie(), ruleA.getSrcIp(), ruleA.getSrcPort(), ruleA.getDstIp(), ruleA.getDstPort(), ruleA.getProto(), ruleA.getEthType... | @Override public Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp, Integer srcPort, String dstIp, Integer dstPort, String proto, String ethType, Long metadata) { List<? extends ApplicationRuleFrame> applicationRuleFrames = framedGraph().traverse(g -> g.V() .ha... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp, Integer srcPort, String dstIp, I... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp, Integer srcPort, String dstIp, I... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp, Integer srcPort, String dstIp, I... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Optional<ApplicationRule> lookupRuleByMatchAndCookie(SwitchId switchId, ExclusionCookie cookie, String srcIp, Integer srcPort, String dstIp, I... |
@Test public void shouldFindBySwitchId() { Collection<ApplicationRule> foundRules = applicationRepository.findBySwitchId(TEST_SWITCH_ID); assertEquals(2, foundRules.size()); assertTrue(foundRules.contains(buildRuleA())); assertTrue(foundRules.contains(buildRuleC())); } | @Override public Collection<ApplicationRule> findBySwitchId(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))) .toListExplicit(ApplicationRuleFrame.class).stream() ... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findBySwitchId(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findBySwitchId(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findBySwitchId(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findBySwitchId(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_... |
@Test public void getFlowsForEndpointMultiSwitchFlowWithPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); Switch switchB = createSwitch(SWITCH_ID_2); createFlow(FLOW_ID_1, switchA, 1, switchB, 2, FORWARD_PATH_1, REVERSE_PATH_1, null); assertFlows(flowOperationsService.getFlowsForEn... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldFindByFlowId() { Collection<ApplicationRule> foundRules = applicationRepository.findByFlowId(TEST_FLOW_ID); assertEquals(2, foundRules.size()); assertTrue(foundRules.contains(buildRuleA())); assertTrue(foundRules.contains(buildRuleB())); } | @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL) .has(ApplicationRuleFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(ApplicationRuleFrame.class).stream() .map(ApplicationRule::new) .collect(Collectors.toList(... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL)... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL)... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL)... | FermaApplicationRepository extends FermaGenericRepository<ApplicationRule, ApplicationRuleData,
ApplicationRuleFrame> implements ApplicationRepository { @Override public Collection<ApplicationRule> findByFlowId(String flowId) { return framedGraph().traverse(g -> g.V() .hasLabel(ApplicationRuleFrame.FRAME_LABEL)... |
@Test public void findByFlowIdAndTimeFrameOrderTest() { List<FlowEvent> expected = new ArrayList<>(); expected.add(buildFlowEvent(FLOW_1, ACTION_1, TIME_1)); expected.add(buildFlowEvent(FLOW_1, ACTION_2, TIME_2)); expected.add(buildFlowEvent(FLOW_1, ACTION_3, TIME_3)); for (FlowEvent flowHistory : expected) { repositor... | @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex> traversal = g.V() .hasLabel(FlowEventFrame.FRAME_LABEL) .has(FlowEventFrame.FLOW_ID_PROPERTY, flowId); if (timeFrom != null) { tr... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... |
@Test public void findByFlowIdAndTimeFrameTest() { repository.add(buildFlowEvent(FLOW_1, ACTION_1, TIME_1)); repository.add(buildFlowEvent(FLOW_1, ACTION_2, TIME_2)); repository.add(buildFlowEvent(FLOW_1, ACTION_3, TIME_3)); repository.add(buildFlowEvent(FLOW_1, ACTION_4, TIME_4)); repository.add(buildFlowEvent(FLOW_2,... | @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex> traversal = g.V() .hasLabel(FlowEventFrame.FRAME_LABEL) .has(FlowEventFrame.FLOW_ID_PROPERTY, flowId); if (timeFrom != null) { tr... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... |
@Test public void findByFlowIdTimeFrameAndMaxCountTest() { repository.add(buildFlowEvent(FLOW_1, ACTION_1, TIME_1)); repository.add(buildFlowEvent(FLOW_1, ACTION_2, TIME_2)); repository.add(buildFlowEvent(FLOW_1, ACTION_3, TIME_3)); repository.add(buildFlowEvent(FLOW_1, ACTION_4, TIME_4)); repository.add(buildFlowEvent... | @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex> traversal = g.V() .hasLabel(FlowEventFrame.FRAME_LABEL) .has(FlowEventFrame.FLOW_ID_PROPERTY, flowId); if (timeFrom != null) { tr... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... | FermaFlowEventRepository extends FermaGenericRepository<FlowEvent, FlowEventData, FlowEventFrame> implements FlowEventRepository { @Override public List<FlowEvent> findByFlowIdAndTimeFrame(String flowId, Instant timeFrom, Instant timeTo, int maxCount) { return framedGraph().traverse(g -> { GraphTraversal<Vertex, Vertex... |
@Test public void shouldCreateFlow() { createTestFlow(TEST_FLOW_ID, switchA, switchB); Collection<Flow> allFlows = flowRepository.findAll(); Flow foundFlow = allFlows.iterator().next(); assertEquals(switchA.getSwitchId(), foundFlow.getSrcSwitchId()); assertEquals(switchB.getSwitchId(), foundFlow.getDestSwitchId()); } | @Override public Collection<Flow> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL)) .toListExplicit(FlowFrame.class).stream() .map(Flow::new) .collect(Collectors.toList()); } | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL)) .toListExplicit(FlowFrame.class).stream() .map(Flow::new) .collect(Collectors.toList()); } } | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL)) .toListExplicit(FlowFrame.class).stream() .map(Flow::new) .collect(Collectors.toList()); } Fe... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL)) .toListExplicit(FlowFrame.class).stream() .map(Flow::new) .collect(Collectors.toList()); } Fe... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findAll() { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL)) .toListExplicit(FlowFrame.class).stream() .map(Flow::new) .collect(Collectors.toList()); } Fe... |
@Test public void shouldNotFindByIdWithEndpoints() { assertFalse(flowRepository.findById("Non_existent").isPresent()); } | @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(FlowFrame.class); return flowFrames.isEmpty() ? Optional.empty() : Optional.of(flowFrames.get(0)) ... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... |
@Test public void shouldCheckForExistence() { createTestFlow(TEST_FLOW_ID, switchA, switchB); assertTrue(flowRepository.exists(TEST_FLOW_ID)); } | @Override public boolean exists(String flowId) { try (GraphTraversal<?, ?> traversal = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .getRawTraversal()) { return traversal.hasNext(); } catch (Exception e) { throw new PersistenceException("Failed to traverse... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public boolean exists(String flowId) { try (GraphTraversal<?, ?> traversal = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .getRawTraversal()... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public boolean exists(String flowId) { try (GraphTraversal<?, ?> traversal = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .getRawTraversal()... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public boolean exists(String flowId) { try (GraphTraversal<?, ?> traversal = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .getRawTraversal()... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public boolean exists(String flowId) { try (GraphTraversal<?, ?> traversal = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .getRawTraversal()... |
@Test public void shouldFindFlowById() { createTestFlow(TEST_FLOW_ID, switchA, switchB); Optional<Flow> foundFlow = flowRepository.findById(TEST_FLOW_ID); assertTrue(foundFlow.isPresent()); } | @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(FlowFrame.class); return flowFrames.isEmpty() ? Optional.empty() : Optional.of(flowFrames.get(0)) ... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... |
@Test public void shouldFind2SegmentFlowById() { Switch switchC = createTestSwitch(TEST_SWITCH_C_ID.getId()); createTestFlowWithIntermediate(TEST_FLOW_ID, switchA, switchC, 100, switchB); Optional<Flow> foundFlow = flowRepository.findById(TEST_FLOW_ID); assertTrue(foundFlow.isPresent()); } | @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListExplicit(FlowFrame.class); return flowFrames.isEmpty() ? Optional.empty() : Optional.of(flowFrames.get(0)) ... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findById(String flowId) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.FLOW_ID_PROPERTY, flowId)) .toListE... |
@Test public void shouldFindFlowByGroupId() { Flow flow = createTestFlow(TEST_FLOW_ID, switchA, switchB); flow.setGroupId(TEST_GROUP_ID); List<Flow> foundFlow = Lists.newArrayList(flowRepository.findByGroupId(TEST_GROUP_ID)); assertThat(foundFlow, Matchers.hasSize(1)); assertEquals(Collections.singletonList(flow), foun... | @Override public Collection<Flow> findByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId)) .toListExplicit(FlowFrame.class).stream() .map(Flow::new) .collect(Collectors.toList()); } | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId)) .toListExplicit(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId)) .toListExplicit(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId)) .toListExplicit(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId)) .toListExplicit(FlowFr... |
@Test public void getFlowsForEndpointTransitSwitchFlowWithPortTest() throws SwitchNotFoundException { Switch switchA = createSwitch(SWITCH_ID_1); Switch switchB = createSwitch(SWITCH_ID_2); Switch switchC = createSwitch(SWITCH_ID_3); createFlow(FLOW_ID_1, switchA, 1, switchC, 2, FORWARD_PATH_1, REVERSE_PATH_1, switchB)... | 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 getFlowsForEndpoi... | 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) { ... | 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) { ... | 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) { ... | 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) { ... |
@Test public void shouldFindFlowsIdByGroupId() { Flow flow = createTestFlow(TEST_FLOW_ID, switchA, switchB); flow.setGroupId(TEST_GROUP_ID); List<String> foundFlowId = Lists.newArrayList(flowRepository.findFlowsIdByGroupId(TEST_GROUP_ID)); assertThat(foundFlowId, Matchers.hasSize(1)); assertEquals(Collections.singleton... | @Override public Collection<String> findFlowsIdByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId) .values(FlowFrame.FLOW_ID_PROPERTY)) .getRawTraversal().toStream() .map(i -> (String) i) .collect(Collectors.toList()); ... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId) .values(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId) .values(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId) .values(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdByGroupId(String flowGroupId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.GROUP_ID_PROPERTY, flowGroupId) .values(FlowFr... |
@Test public void shouldFindFlowByEndpointSwitchWithEnabledArp() { createFlowWithArp(TEST_FLOW_ID, switchA, false, switchB, false); createFlowWithArp(TEST_FLOW_ID_2, switchA, true, switchB, false); createFlowWithArp(TEST_FLOW_ID_3, switchB, false, switchA, true); createFlowWithArp(TEST_FLOW_ID_4, switchA, true, switchA... | @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_ARP_PRO... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... |
@Test public void shouldFindOneFlowByEndpointSwitchWithEnabledArp() { createFlowWithArp(TEST_FLOW_ID, switchA, true, switchA, true); Collection<Flow> foundFlows = flowRepository.findByEndpointSwitchWithEnabledArp(TEST_SWITCH_A_ID); assertEquals(1, foundFlows.size()); assertEquals(TEST_FLOW_ID, foundFlows.iterator().nex... | @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_ARP_PRO... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledArp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... |
@Test public void shouldFindFlowByEndpoint() { Flow flow = createTestFlow(TEST_FLOW_ID, switchA, switchB); Collection<Flow> foundFlows = flowRepository.findByEndpoint(TEST_SWITCH_A_ID, 1); Set<String> foundFlowIds = foundFlows.stream().map(foundFlow -> flow.getFlowId()).collect(Collectors.toSet()); assertThat(foundFlow... | @Override public Collection<Flow> findByEndpoint(SwitchId switchId, int port) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_PORT_PROPERTY, po... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpoint(SwitchId switchId, int port) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWIT... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpoint(SwitchId switchId, int port) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWIT... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpoint(SwitchId switchId, int port) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWIT... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpoint(SwitchId switchId, int port) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWIT... |
@Test public void shouldNotFindFlowByEndpointAndVlan() { assertFalse(flowRepository.findByEndpointAndVlan(new SwitchId(1234), 999, 999).isPresent()); } | @Override public Optional<Flow> findByEndpointAndVlan(SwitchId switchId, int port, int vlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_PORT_PR... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findByEndpointAndVlan(SwitchId switchId, int port, int vlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findByEndpointAndVlan(SwitchId switchId, int port, int vlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findByEndpointAndVlan(SwitchId switchId, int port, int vlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findByEndpointAndVlan(SwitchId switchId, int port, int vlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFram... |
@Test public void shouldNotFindOneSwitchFlowBySwitchIdInPortAndOutVlanIfFlowNotExist() { assertFalse(flowRepository.findOneSwitchFlowBySwitchIdInPortAndOutVlan( new SwitchId(1234), 999, 999).isPresent()); } | @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... |
@Test public void shouldNotFindNotOneSwitchFlowBySwitchIdInPortAndOutVlan() { createTestFlow(TEST_FLOW_ID, switchA, PORT_1, VLAN_1, switchB, PORT_2, VLAN_2); Optional<Flow> flow = flowRepository.findOneSwitchFlowBySwitchIdInPortAndOutVlan( switchA.getSwitchId(), PORT_1, VLAN_2); assertFalse(flow.isPresent()); } | @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... |
@Test public void shouldFindOnlyOneSwitchFlowBySwitchIdInPortAndOutVlan() { createTestFlow(TEST_FLOW_ID, switchA, PORT_1, VLAN_1, switchA, PORT_2, VLAN_2); createTestFlow(TEST_FLOW_ID_2, switchA, PORT_1, VLAN_3, switchB, PORT_2, VLAN_2); Optional<Flow> flow = flowRepository.findOneSwitchFlowBySwitchIdInPortAndOutVlan( ... | @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Optional<Flow> findOneSwitchFlowBySwitchIdInPortAndOutVlan(SwitchId switchId, int inPort, int outVlan) { List<? extends FlowFrame> flowFrames = framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame... |
@Test public void shouldFindIsByEndpointWithMultiTableSupport() { createTestFlow(TEST_FLOW_ID, switchA, PORT_1, VLAN_1, switchB, PORT_2, VLAN_2, true); createTestFlow(TEST_FLOW_ID_2, switchA, PORT_1, VLAN_2, switchB, PORT_2, 0, true); createTestFlow(TEST_FLOW_ID_3, switchA, PORT_1, VLAN_3, switchB, PORT_2, 0, false); c... | @Override public Collection<String> findFlowsIdsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFr... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowsIdsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL... |
@Test public void shouldFindFlowIdsForMultiSwitchFlowsByEndpointWithMultiTableSupport() { createTestFlow(TEST_FLOW_ID, switchA, PORT_1, VLAN_1, switchB, PORT_2, VLAN_2, true); createTestFlow(TEST_FLOW_ID_2, switchA, PORT_2, VLAN_2, switchB, PORT_2, 0, true); createTestFlow(TEST_FLOW_ID_3, switchA, PORT_1, VLAN_3, switc... | @Override public Collection<String> findFlowIdsForMultiSwitchFlowsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(swit... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowIdsForMultiSwitchFlowsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(Flo... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowIdsForMultiSwitchFlowsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(Flo... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowIdsForMultiSwitchFlowsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(Flo... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<String> findFlowIdsForMultiSwitchFlowsByEndpointWithMultiTableSupport(SwitchId switchId, int port) { Set<String> result = new HashSet<>(); framedGraph().traverse(g -> g.V() .hasLabel(Flo... |
@Test public void findNPathsByTransitVlanAndCost() throws SwitchNotFoundException, RecoverableException, UnroutableFlowException { List<PathsInfoData> paths = pathsService.getPaths(SWITCH_ID_1, SWITCH_ID_2, TRANSIT_VLAN, COST); assertEquals(MAX_PATH_COUNT, paths.size()); for (PathsInfoData path : paths) { assertEquals(... | public List<PathsInfoData> getPaths( SwitchId srcSwitchId, SwitchId dstSwitchId, FlowEncapsulationType requestEncapsulationType, PathComputationStrategy requestPathComputationStrategy) throws RecoverableException, SwitchNotFoundException, UnroutableFlowException { if (Objects.equals(srcSwitchId, dstSwitchId)) { throw n... | PathsService { public List<PathsInfoData> getPaths( SwitchId srcSwitchId, SwitchId dstSwitchId, FlowEncapsulationType requestEncapsulationType, PathComputationStrategy requestPathComputationStrategy) throws RecoverableException, SwitchNotFoundException, UnroutableFlowException { if (Objects.equals(srcSwitchId, dstSwitc... | PathsService { public List<PathsInfoData> getPaths( SwitchId srcSwitchId, SwitchId dstSwitchId, FlowEncapsulationType requestEncapsulationType, PathComputationStrategy requestPathComputationStrategy) throws RecoverableException, SwitchNotFoundException, UnroutableFlowException { if (Objects.equals(srcSwitchId, dstSwitc... | PathsService { public List<PathsInfoData> getPaths( SwitchId srcSwitchId, SwitchId dstSwitchId, FlowEncapsulationType requestEncapsulationType, PathComputationStrategy requestPathComputationStrategy) throws RecoverableException, SwitchNotFoundException, UnroutableFlowException { if (Objects.equals(srcSwitchId, dstSwitc... | PathsService { public List<PathsInfoData> getPaths( SwitchId srcSwitchId, SwitchId dstSwitchId, FlowEncapsulationType requestEncapsulationType, PathComputationStrategy requestPathComputationStrategy) throws RecoverableException, SwitchNotFoundException, UnroutableFlowException { if (Objects.equals(srcSwitchId, dstSwitc... |
@Test public void shouldFindFlowBySwitchEndpoint() { Flow flow = createTestFlow(TEST_FLOW_ID, switchA, switchB); Collection<Flow> foundFlows = flowRepository.findByEndpointSwitch(TEST_SWITCH_A_ID); Set<String> foundFlowIds = foundFlows.stream().map(foundFlow -> flow.getFlowId()).collect(Collectors.toSet()); assertThat(... | @Override public Collection<Flow> findByEndpointSwitch(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId))) .frameExplicit(FlowFrame.class) .forEac... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitch(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_I... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitch(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_I... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitch(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_I... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitch(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_I... |
@Test public void shouldFindFlowBySwitchEndpointWithMultiTable() { Flow firstFlow = createTestFlow(TEST_FLOW_ID, switchA, switchB); firstFlow.setSrcWithMultiTable(true); Flow secondFlow = createTestFlow(TEST_FLOW_ID_2, switchA, switchB); secondFlow.setSrcWithMultiTable(false); Collection<Flow> foundFlows = flowReposito... | @Override public Collection<Flow> findByEndpointSwitchWithMultiTableSupport(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithMultiTableSupport(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(F... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithMultiTableSupport(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(F... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithMultiTableSupport(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(F... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithMultiTableSupport(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(F... |
@Test public void shouldFindFlowByEndpointSwitchWithEnabledLldp() { createFlowWithLldp(TEST_FLOW_ID, switchA, false, switchB, false); createFlowWithLldp(TEST_FLOW_ID_2, switchA, true, switchB, false); createFlowWithLldp(TEST_FLOW_ID_3, switchB, false, switchA, true); createFlowWithLldp(TEST_FLOW_ID_4, switchA, true, sw... | @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_LLDP_P... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... |
@Test public void shouldFindOneFlowByEndpoint() { Flow flow1 = createTestFlow(TEST_FLOW_ID, switchA, switchA); flow1.setSrcPort(1); flow1.setDestPort(2); Flow flow2 = createTestFlow(TEST_FLOW_ID_2, switchB, switchB); flow2.setSrcPort(1); flow2.setDestPort(2); createTestFlow(TEST_FLOW_ID_3, switchA, switchB); Collection... | @Override public Collection<Flow> findOneSwitchFlows(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.DST_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProper... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findOneSwitchFlows(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findOneSwitchFlows(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findOneSwitchFlows(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findOneSwitchFlows(SwitchId switchId) { return framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.... |
@Test public void shouldFindOneFlowByEndpointSwitchWithEnabledLldp() { createFlowWithLldp(TEST_FLOW_ID, switchA, true, switchA, true); Collection<Flow> foundFlows = flowRepository.findByEndpointSwitchWithEnabledLldp(TEST_SWITCH_A_ID); assertEquals(1, foundFlows.size()); assertEquals(TEST_FLOW_ID, foundFlows.iterator().... | @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFrame.SRC_SWITCH_ID_PROPERTY, SwitchIdConverter.INSTANCE.toGraphProperty(switchId)) .has(FlowFrame.SRC_LLDP_P... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... | FermaFlowRepository extends FermaGenericRepository<Flow, FlowData, FlowFrame> implements FlowRepository { @Override public Collection<Flow> findByEndpointSwitchWithEnabledLldp(SwitchId switchId) { Map<String, Flow> result = new HashMap<>(); framedGraph().traverse(g -> g.V() .hasLabel(FlowFrame.FRAME_LABEL) .has(FlowFra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.