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 addWatch() { NetworkWatcherService w = makeService(); w.addWatch(Endpoint.of(new SwitchId(1), 1), 1); w.addWatch(Endpoint.of(new SwitchId(1), 2), 1); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 2), 3); assertTh... | public void addWatch(Endpoint endpoint) { addWatch(endpoint, now()); } | NetworkWatcherService { public void addWatch(Endpoint endpoint) { addWatch(endpoint, now()); } } | NetworkWatcherService { public void addWatch(Endpoint endpoint) { addWatch(endpoint, now()); } NetworkWatcherService(
IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting NetworkWatcherService(
Clock clock, IWatcherCarrier carrier, D... | NetworkWatcherService { public void addWatch(Endpoint endpoint) { addWatch(endpoint, now()); } NetworkWatcherService(
IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting NetworkWatcherService(
Clock clock, IWatcherCarrier carrier, D... | NetworkWatcherService { public void addWatch(Endpoint endpoint) { addWatch(endpoint, now()); } NetworkWatcherService(
IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting NetworkWatcherService(
Clock clock, IWatcherCarrier carrier, D... |
@Test public void removeWatch() { NetworkWatcherService w = makeService(); w.addWatch(Endpoint.of(new SwitchId(1), 1), 1); w.addWatch(Endpoint.of(new SwitchId(1), 2), 2); w.addWatch(Endpoint.of(new SwitchId(2), 1), 3); w.addWatch(Endpoint.of(new SwitchId(2), 2), 4); w.addWatch(Endpoint.of(new SwitchId(3), 1), 5); verif... | public void removeWatch(Endpoint endpoint) { log.debug("Watcher service receive REMOVE-watch request for {}", endpoint); carrier.clearDiscovery(endpoint); discoveryPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); roundTripPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); confirmedPackets.remove... | NetworkWatcherService { public void removeWatch(Endpoint endpoint) { log.debug("Watcher service receive REMOVE-watch request for {}", endpoint); carrier.clearDiscovery(endpoint); discoveryPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); roundTripPackets.removeIf(packet -> packet.endpoint.equals(endpoint));... | NetworkWatcherService { public void removeWatch(Endpoint endpoint) { log.debug("Watcher service receive REMOVE-watch request for {}", endpoint); carrier.clearDiscovery(endpoint); discoveryPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); roundTripPackets.removeIf(packet -> packet.endpoint.equals(endpoint));... | NetworkWatcherService { public void removeWatch(Endpoint endpoint) { log.debug("Watcher service receive REMOVE-watch request for {}", endpoint); carrier.clearDiscovery(endpoint); discoveryPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); roundTripPackets.removeIf(packet -> packet.endpoint.equals(endpoint));... | NetworkWatcherService { public void removeWatch(Endpoint endpoint) { log.debug("Watcher service receive REMOVE-watch request for {}", endpoint); carrier.clearDiscovery(endpoint); discoveryPackets.removeIf(packet -> packet.endpoint.equals(endpoint)); roundTripPackets.removeIf(packet -> packet.endpoint.equals(endpoint));... |
@Test public void tick() { NetworkWatcherService w = makeService(); w.addWatch(Endpoint.of(new SwitchId(1), 1), 1); w.addWatch(Endpoint.of(new SwitchId(1), 2), 1); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 2), 3); assertThat(w... | public void tick() { tick(now()); } | NetworkWatcherService { public void tick() { tick(now()); } } | NetworkWatcherService { public void tick() { tick(now()); } NetworkWatcherService(
IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting NetworkWatcherService(
Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod... | NetworkWatcherService { public void tick() { tick(now()); } NetworkWatcherService(
IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting NetworkWatcherService(
Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod... | NetworkWatcherService { public void tick() { tick(now()); } NetworkWatcherService(
IWatcherCarrier carrier, Duration roundTripNotificationPeriod, long awaitTime, Integer taskId); @VisibleForTesting NetworkWatcherService(
Clock clock, IWatcherCarrier carrier, Duration roundTripNotificationPeriod... |
@Test public void discovery() { NetworkWatcherService w = makeService(); w.addWatch(Endpoint.of(new SwitchId(1), 1), 1); w.addWatch(Endpoint.of(new SwitchId(1), 2), 1); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 1), 2); w.addWatch(Endpoint.of(new SwitchId(2), 2), 3); assertT... | public void discovery(IslInfoData discoveryEvent) { Endpoint source = new Endpoint(discoveryEvent.getSource()); Long packetId = discoveryEvent.getPacketId(); if (packetId == null) { log.error("Got corrupted discovery packet into {} - packetId field is empty", source); } else { discovery(discoveryEvent, Packet.of(source... | NetworkWatcherService { public void discovery(IslInfoData discoveryEvent) { Endpoint source = new Endpoint(discoveryEvent.getSource()); Long packetId = discoveryEvent.getPacketId(); if (packetId == null) { log.error("Got corrupted discovery packet into {} - packetId field is empty", source); } else { discovery(discover... | NetworkWatcherService { public void discovery(IslInfoData discoveryEvent) { Endpoint source = new Endpoint(discoveryEvent.getSource()); Long packetId = discoveryEvent.getPacketId(); if (packetId == null) { log.error("Got corrupted discovery packet into {} - packetId field is empty", source); } else { discovery(discover... | NetworkWatcherService { public void discovery(IslInfoData discoveryEvent) { Endpoint source = new Endpoint(discoveryEvent.getSource()); Long packetId = discoveryEvent.getPacketId(); if (packetId == null) { log.error("Got corrupted discovery packet into {} - packetId field is empty", source); } else { discovery(discover... | NetworkWatcherService { public void discovery(IslInfoData discoveryEvent) { Endpoint source = new Endpoint(discoveryEvent.getSource()); Long packetId = discoveryEvent.getPacketId(); if (packetId == null) { log.error("Got corrupted discovery packet into {} - packetId field is empty", source); } else { discovery(discover... |
@Test public void discovered() { NetworkDecisionMakerService w = new NetworkDecisionMakerService(carrier, 10, 5); w.discovered(endpointBeta, 1L, islAlphaBeta, 1L); w.discovered(endpointAlpha, 2L, islBetaAlpha, 2L); verify(carrier).linkDiscovered(eq(islAlphaBeta)); verify(carrier).linkDiscovered(eq(islBetaAlpha)); } | public void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent) { discovered(endpoint, packetId, discoveryEvent, now()); } | NetworkDecisionMakerService { public void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent) { discovered(endpoint, packetId, discoveryEvent, now()); } } | NetworkDecisionMakerService { public void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent) { discovered(endpoint, packetId, discoveryEvent, now()); } NetworkDecisionMakerService(IDecisionMakerCarrier carrier, long failTimeout, long awaitTime); } | NetworkDecisionMakerService { public void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent) { discovered(endpoint, packetId, discoveryEvent, now()); } NetworkDecisionMakerService(IDecisionMakerCarrier carrier, long failTimeout, long awaitTime); void discovered(Endpoint endpoint, long packetId, Is... | NetworkDecisionMakerService { public void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent) { discovered(endpoint, packetId, discoveryEvent, now()); } NetworkDecisionMakerService(IDecisionMakerCarrier carrier, long failTimeout, long awaitTime); void discovered(Endpoint endpoint, long packetId, Is... |
@Test public void shouldValidateFlowWithTransitVlanEncapsulationESwitch() throws FlowNotFoundException, SwitchNotFoundException { buildTransitVlanFlow("E"); List<SwitchFlowEntries> flowEntries = getSwitchFlowEntriesWithTransitVlan(); List<SwitchMeterEntries> meterEntries = getSwitchMeterEntriesWithESwitch(); List<FlowV... | public List<FlowValidationResponse> validateFlow(String flowId, List<SwitchFlowEntries> switchFlowEntries, List<SwitchMeterEntries> switchMeterEntries) throws FlowNotFoundException, SwitchNotFoundException { Map<SwitchId, List<SimpleSwitchRule>> switchRules = new HashMap<>(); int rulesCount = 0; int metersCount = 0; fo... | FlowValidationService { public List<FlowValidationResponse> validateFlow(String flowId, List<SwitchFlowEntries> switchFlowEntries, List<SwitchMeterEntries> switchMeterEntries) throws FlowNotFoundException, SwitchNotFoundException { Map<SwitchId, List<SimpleSwitchRule>> switchRules = new HashMap<>(); int rulesCount = 0;... | FlowValidationService { public List<FlowValidationResponse> validateFlow(String flowId, List<SwitchFlowEntries> switchFlowEntries, List<SwitchMeterEntries> switchMeterEntries) throws FlowNotFoundException, SwitchNotFoundException { Map<SwitchId, List<SimpleSwitchRule>> switchRules = new HashMap<>(); int rulesCount = 0;... | FlowValidationService { public List<FlowValidationResponse> validateFlow(String flowId, List<SwitchFlowEntries> switchFlowEntries, List<SwitchMeterEntries> switchMeterEntries) throws FlowNotFoundException, SwitchNotFoundException { Map<SwitchId, List<SimpleSwitchRule>> switchRules = new HashMap<>(); int rulesCount = 0;... | FlowValidationService { public List<FlowValidationResponse> validateFlow(String flowId, List<SwitchFlowEntries> switchFlowEntries, List<SwitchMeterEntries> switchMeterEntries) throws FlowNotFoundException, SwitchNotFoundException { Map<SwitchId, List<SimpleSwitchRule>> switchRules = new HashMap<>(); int rulesCount = 0;... |
@Test public void failed() { NetworkDecisionMakerService w = new NetworkDecisionMakerService(carrier, 10, 5); w.failed(endpointAlpha, 0L, 0); w.failed(endpointAlpha, 1L, 1); w.failed(endpointAlpha, 2L, 4); verify(carrier, never()).linkDestroyed(any(Endpoint.class)); w.failed(endpointAlpha, 3L, 5); verify(carrier).linkD... | public void failed(Endpoint endpoint, long packetId) { failed(endpoint, packetId, now()); } | NetworkDecisionMakerService { public void failed(Endpoint endpoint, long packetId) { failed(endpoint, packetId, now()); } } | NetworkDecisionMakerService { public void failed(Endpoint endpoint, long packetId) { failed(endpoint, packetId, now()); } NetworkDecisionMakerService(IDecisionMakerCarrier carrier, long failTimeout, long awaitTime); } | NetworkDecisionMakerService { public void failed(Endpoint endpoint, long packetId) { failed(endpoint, packetId, now()); } NetworkDecisionMakerService(IDecisionMakerCarrier carrier, long failTimeout, long awaitTime); void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent); void failed(Endpoint endp... | NetworkDecisionMakerService { public void failed(Endpoint endpoint, long packetId) { failed(endpoint, packetId, now()); } NetworkDecisionMakerService(IDecisionMakerCarrier carrier, long failTimeout, long awaitTime); void discovered(Endpoint endpoint, long packetId, IslInfoData discoveryEvent); void failed(Endpoint endp... |
@Test public void colonSeparatedBytesIllegalArgumentExceptionNegativeOffset() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", -1)); new SwitchId("00").colonSeparatedBytes(new char[]{'t', 'e',... | @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", offset)); } int length = hex.length - offset;... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... |
@Test public void colonSeparatedBytesIllegalArgumentExceptionOddOffset() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", 3)); new SwitchId("00").colonSeparatedBytes(new char[]{'t', 'e', 's', ... | @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", offset)); } int length = hex.length - offset;... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... |
@Test public void colonSeparatedBytesIllegalArgumentExceptionMoreThenHexLength() { thrown.expect(IllegalArgumentException.class); thrown.expectMessage(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", 6)); new SwitchId("00").colonSeparatedBytes(new char[]{'t', 'e... | @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < hex.length)", offset)); } int length = hex.length - offset;... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... | SwitchId implements Comparable<SwitchId>, Serializable { @VisibleForTesting String colonSeparatedBytes(char[] hex, int offset) { if (offset < 0 || offset % 2 != 0 || offset >= hex.length) { throw new IllegalArgumentException(String.format( "Illegal offset value %d (expect offset > 0 and offset %% 2 == 0 and offset < he... |
@Test public void shouldComputeIsUnstable() { Isl isl = Isl.builder() .srcSwitch(Switch.builder().switchId(new SwitchId(1)).build()) .destSwitch(Switch.builder().switchId(new SwitchId(2)).build()) .build(); isl.setIslConfig(islConfig); isl.setTimeUnstable(Instant.now().minus(islConfig.getUnstableIslTimeout())); assertF... | public boolean isUnstable() { if (islConfig == null) { throw new IllegalStateException("IslConfig has not initialized."); } return getTimeUnstable() != null && getTimeUnstable().plus(islConfig.getUnstableIslTimeout()).isAfter(Instant.now()); } | Isl implements CompositeDataEntity<Isl.IslData> { public boolean isUnstable() { if (islConfig == null) { throw new IllegalStateException("IslConfig has not initialized."); } return getTimeUnstable() != null && getTimeUnstable().plus(islConfig.getUnstableIslTimeout()).isAfter(Instant.now()); } } | Isl implements CompositeDataEntity<Isl.IslData> { public boolean isUnstable() { if (islConfig == null) { throw new IllegalStateException("IslConfig has not initialized."); } return getTimeUnstable() != null && getTimeUnstable().plus(islConfig.getUnstableIslTimeout()).isAfter(Instant.now()); } private Isl(); Isl(@NonN... | Isl implements CompositeDataEntity<Isl.IslData> { public boolean isUnstable() { if (islConfig == null) { throw new IllegalStateException("IslConfig has not initialized."); } return getTimeUnstable() != null && getTimeUnstable().plus(islConfig.getUnstableIslTimeout()).isAfter(Instant.now()); } private Isl(); Isl(@NonN... | Isl implements CompositeDataEntity<Isl.IslData> { public boolean isUnstable() { if (islConfig == null) { throw new IllegalStateException("IslConfig has not initialized."); } return getTimeUnstable() != null && getTimeUnstable().plus(islConfig.getUnstableIslTimeout()).isAfter(Instant.now()); } private Isl(); Isl(@NonN... |
@Test public void calculateBurstSize() { assertEquals(1024, Meter.calculateBurstSize(512L, 1024L, 1.0, "centec")); assertEquals(32000, Meter.calculateBurstSize(32333L, 1024L, 1.0, "centec")); assertEquals(10030, Meter.calculateBurstSize(10000L, 1024L, 1.003, "centec")); assertEquals(1105500, Meter.calculateBurstSize(11... | public static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient, String switchDescription) { return calculateBurstSize(bandwidth, flowMeterMinBurstSizeInKbits, flowMeterBurstCoefficient, switchDescription, switchDescription); } | Meter implements Serializable { public static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient, String switchDescription) { return calculateBurstSize(bandwidth, flowMeterMinBurstSizeInKbits, flowMeterBurstCoefficient, switchDescription, switchDescription); } } | Meter implements Serializable { public static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient, String switchDescription) { return calculateBurstSize(bandwidth, flowMeterMinBurstSizeInKbits, flowMeterBurstCoefficient, switchDescription, switchDescription); } } | Meter implements Serializable { public static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient, String switchDescription) { return calculateBurstSize(bandwidth, flowMeterMinBurstSizeInKbits, flowMeterBurstCoefficient, switchDescription, switchDescription); } s... | Meter implements Serializable { public static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient, String switchDescription) { return calculateBurstSize(bandwidth, flowMeterMinBurstSizeInKbits, flowMeterBurstCoefficient, switchDescription, switchDescription); } s... |
@Test public void convertRateToKiloBitsTest() { assertEquals(800, Meter.convertRateToKiloBits(100, 1024)); assertEquals(64, Meter.convertRateToKiloBits(1, 1)); assertEquals(64, Meter.convertRateToKiloBits(8, 16)); } | public static long convertRateToKiloBits(long rateInPackets, long packetSizeInBytes) { return Math.max(MIN_RATE_IN_KBPS, (rateInPackets * packetSizeInBytes * 8) / 1024L); } | Meter implements Serializable { public static long convertRateToKiloBits(long rateInPackets, long packetSizeInBytes) { return Math.max(MIN_RATE_IN_KBPS, (rateInPackets * packetSizeInBytes * 8) / 1024L); } } | Meter implements Serializable { public static long convertRateToKiloBits(long rateInPackets, long packetSizeInBytes) { return Math.max(MIN_RATE_IN_KBPS, (rateInPackets * packetSizeInBytes * 8) / 1024L); } } | Meter implements Serializable { public static long convertRateToKiloBits(long rateInPackets, long packetSizeInBytes) { return Math.max(MIN_RATE_IN_KBPS, (rateInPackets * packetSizeInBytes * 8) / 1024L); } static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits,
... | Meter implements Serializable { public static long convertRateToKiloBits(long rateInPackets, long packetSizeInBytes) { return Math.max(MIN_RATE_IN_KBPS, (rateInPackets * packetSizeInBytes * 8) / 1024L); } static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits,
... |
@Test public void convertBurstSizeToKiloBitsTest() { assertEquals(800, Meter.convertBurstSizeToKiloBits(100, 1024)); assertEquals(1, Meter.convertBurstSizeToKiloBits(8, 16)); } | public static long convertBurstSizeToKiloBits(long burstSizeInPackets, long packetSizeInBytes) { return (burstSizeInPackets * packetSizeInBytes * 8) / 1024L; } | Meter implements Serializable { public static long convertBurstSizeToKiloBits(long burstSizeInPackets, long packetSizeInBytes) { return (burstSizeInPackets * packetSizeInBytes * 8) / 1024L; } } | Meter implements Serializable { public static long convertBurstSizeToKiloBits(long burstSizeInPackets, long packetSizeInBytes) { return (burstSizeInPackets * packetSizeInBytes * 8) / 1024L; } } | Meter implements Serializable { public static long convertBurstSizeToKiloBits(long burstSizeInPackets, long packetSizeInBytes) { return (burstSizeInPackets * packetSizeInBytes * 8) / 1024L; } static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits,
dou... | Meter implements Serializable { public static long convertBurstSizeToKiloBits(long burstSizeInPackets, long packetSizeInBytes) { return (burstSizeInPackets * packetSizeInBytes * 8) / 1024L; } static long calculateBurstSize(long bandwidth, long flowMeterMinBurstSizeInKbits,
dou... |
@Test public void convertCalculateBurstSizeConsideringHardwareLimitations() { Set<SwitchFeature> limitationFeature = newHashSet(MAX_BURST_COEFFICIENT_LIMITATION); assertEquals(4096, Meter.calculateBurstSizeConsideringHardwareLimitations(1, 4096, newHashSet())); assertEquals(1, Meter.calculateBurstSizeConsideringHardwar... | public static long calculateBurstSizeConsideringHardwareLimitations( long bandwidth, long requestedBurstSize, Set<SwitchFeature> features) { if (features.contains(SwitchFeature.MAX_BURST_COEFFICIENT_LIMITATION)) { return Math.min(requestedBurstSize, Math.round(bandwidth * MAX_NOVIFLOW_BURST_COEFFICIENT)); } return requ... | Meter implements Serializable { public static long calculateBurstSizeConsideringHardwareLimitations( long bandwidth, long requestedBurstSize, Set<SwitchFeature> features) { if (features.contains(SwitchFeature.MAX_BURST_COEFFICIENT_LIMITATION)) { return Math.min(requestedBurstSize, Math.round(bandwidth * MAX_NOVIFLOW_BU... | Meter implements Serializable { public static long calculateBurstSizeConsideringHardwareLimitations( long bandwidth, long requestedBurstSize, Set<SwitchFeature> features) { if (features.contains(SwitchFeature.MAX_BURST_COEFFICIENT_LIMITATION)) { return Math.min(requestedBurstSize, Math.round(bandwidth * MAX_NOVIFLOW_BU... | Meter implements Serializable { public static long calculateBurstSizeConsideringHardwareLimitations( long bandwidth, long requestedBurstSize, Set<SwitchFeature> features) { if (features.contains(SwitchFeature.MAX_BURST_COEFFICIENT_LIMITATION)) { return Math.min(requestedBurstSize, Math.round(bandwidth * MAX_NOVIFLOW_BU... | Meter implements Serializable { public static long calculateBurstSizeConsideringHardwareLimitations( long bandwidth, long requestedBurstSize, Set<SwitchFeature> features) { if (features.contains(SwitchFeature.MAX_BURST_COEFFICIENT_LIMITATION)) { return Math.min(requestedBurstSize, Math.round(bandwidth * MAX_NOVIFLOW_BU... |
@Test public void changingOfFlowSegmentCookieTypeTest() { FlowSegmentCookie flowCookie = new FlowSegmentCookie(FlowPathDirection.FORWARD, 10); Assert.assertEquals(CookieType.SERVICE_OR_FLOW_SEGMENT, flowCookie.getType()); FlowSegmentCookie server42Cookie = flowCookie.toBuilder() .type(CookieType.SERVER_42_INGRESS) .bui... | @Override public FlowSegmentCookieBuilder toBuilder() { return new FlowSegmentCookieBuilder() .type(getType()) .direction(getDirection()) .flowEffectiveId(getFlowEffectiveId()); } | FlowSegmentCookie extends Cookie { @Override public FlowSegmentCookieBuilder toBuilder() { return new FlowSegmentCookieBuilder() .type(getType()) .direction(getDirection()) .flowEffectiveId(getFlowEffectiveId()); } } | FlowSegmentCookie extends Cookie { @Override public FlowSegmentCookieBuilder toBuilder() { return new FlowSegmentCookieBuilder() .type(getType()) .direction(getDirection()) .flowEffectiveId(getFlowEffectiveId()); } @JsonCreator FlowSegmentCookie(long value); FlowSegmentCookie(FlowPathDirection direction, long flowEff... | FlowSegmentCookie extends Cookie { @Override public FlowSegmentCookieBuilder toBuilder() { return new FlowSegmentCookieBuilder() .type(getType()) .direction(getDirection()) .flowEffectiveId(getFlowEffectiveId()); } @JsonCreator FlowSegmentCookie(long value); FlowSegmentCookie(FlowPathDirection direction, long flowEff... | FlowSegmentCookie extends Cookie { @Override public FlowSegmentCookieBuilder toBuilder() { return new FlowSegmentCookieBuilder() .type(getType()) .direction(getDirection()) .flowEffectiveId(getFlowEffectiveId()); } @JsonCreator FlowSegmentCookie(long value); FlowSegmentCookie(FlowPathDirection direction, long flowEff... |
@Test public void shouldUpdateLinkUnderMaintenanceFlag() throws IslNotFoundException { createIsl(IslStatus.ACTIVE); for (int i = 0; i < 2; i++) { List<Isl> link = linkOperationsService .updateLinkUnderMaintenanceFlag(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT, true); assertEquals(2, link... | public List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort, SwitchId dstSwitchId, Integer dstPort, boolean underMaintenance) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { Optional<Isl> foundIsl = islRepository.findByEndpoints(srcSwitchId, srcPort, dstSwitchId... | LinkOperationsService { public List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort, SwitchId dstSwitchId, Integer dstPort, boolean underMaintenance) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { Optional<Isl> foundIsl = islRepository.findByEndpoints(srcSwitch... | LinkOperationsService { public List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort, SwitchId dstSwitchId, Integer dstPort, boolean underMaintenance) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { Optional<Isl> foundIsl = islRepository.findByEndpoints(srcSwitch... | LinkOperationsService { public List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort, SwitchId dstSwitchId, Integer dstPort, boolean underMaintenance) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { Optional<Isl> foundIsl = islRepository.findByEndpoints(srcSwitch... | LinkOperationsService { public List<Isl> updateLinkUnderMaintenanceFlag(SwitchId srcSwitchId, Integer srcPort, SwitchId dstSwitchId, Integer dstPort, boolean underMaintenance) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { Optional<Isl> foundIsl = islRepository.findByEndpoints(srcSwitch... |
@Test(expected = IllegalArgumentException.class) public void testContainsNodeInvalidInput() { flow.getForwardPath().getSegments().get(0).containsNode(null, 1); } | public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestSwitchId()) && port == getDestPort()); } | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... |
@Test public void testContainsNodeSourceMatch() { assertTrue(flow.getForwardPath().getSegments().get(0).containsNode(SWITCH_ID_A, 1)); } | public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestSwitchId()) && port == getDestPort()); } | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... |
@Test public void testContainsNodeDestinationMatch() { assertTrue(flow.getForwardPath().getSegments().get(0).containsNode(SWITCH_ID_B, 1)); } | public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestSwitchId()) && port == getDestPort()); } | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... |
@Test public void testContainsNodeNoSwitchMatch() { assertFalse(flow.getForwardPath().getSegments().get(0).containsNode(SWITCH_ID_C, 1)); } | public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestSwitchId()) && port == getDestPort()); } | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... |
@Test public void testContainsNodeNoPortMatch() { assertFalse(flow.getForwardPath().getSegments().get(0).containsNode(SWITCH_ID_B, 2)); } | public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestSwitchId()) && port == getDestPort()); } | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... |
@Test public void testContainsNodeNoSwitchPortMatch() { assertFalse(flow.getForwardPath().getSegments().get(0).containsNode(SWITCH_ID_C, 2)); } | public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestSwitchId()) && port == getDestPort()); } | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... | PathSegment implements CompositeDataEntity<PathSegment.PathSegmentData> { public boolean containsNode(SwitchId switchId, int port) { if (switchId == null) { throw new IllegalArgumentException("Switch id must be not null"); } return (switchId.equals(getSrcSwitchId()) && port == getSrcPort()) || (switchId.equals(getDestS... |
@Test(expected = IllegalArgumentException.class) public void createMeterIdForInvalidDefaultRuleTest() { MeterId.createMeterIdForDefaultRule(0x0000000000000123L); } | public static MeterId createMeterIdForDefaultRule(long cookie) { if (!Cookie.isDefaultRule(cookie)) { throw new IllegalArgumentException(String.format("Cookie '%s' is not a cookie of default rule", cookie)); } return new MeterId((int) (cookie & METER_ID_DEFAULT_RULE_MASK)); } | MeterId implements Comparable<MeterId>, Serializable { public static MeterId createMeterIdForDefaultRule(long cookie) { if (!Cookie.isDefaultRule(cookie)) { throw new IllegalArgumentException(String.format("Cookie '%s' is not a cookie of default rule", cookie)); } return new MeterId((int) (cookie & METER_ID_DEFAULT_RUL... | MeterId implements Comparable<MeterId>, Serializable { public static MeterId createMeterIdForDefaultRule(long cookie) { if (!Cookie.isDefaultRule(cookie)) { throw new IllegalArgumentException(String.format("Cookie '%s' is not a cookie of default rule", cookie)); } return new MeterId((int) (cookie & METER_ID_DEFAULT_RUL... | MeterId implements Comparable<MeterId>, Serializable { public static MeterId createMeterIdForDefaultRule(long cookie) { if (!Cookie.isDefaultRule(cookie)) { throw new IllegalArgumentException(String.format("Cookie '%s' is not a cookie of default rule", cookie)); } return new MeterId((int) (cookie & METER_ID_DEFAULT_RUL... | MeterId implements Comparable<MeterId>, Serializable { public static MeterId createMeterIdForDefaultRule(long cookie) { if (!Cookie.isDefaultRule(cookie)) { throw new IllegalArgumentException(String.format("Cookie '%s' is not a cookie of default rule", cookie)); } return new MeterId((int) (cookie & METER_ID_DEFAULT_RUL... |
@Test(expected = IllegalArgumentException.class) public void validatePropRaiseTest() { Switch sw = Switch.builder() .switchId(new SwitchId(1)) .build(); SwitchProperties sp = SwitchProperties.builder() .switchObj(sw) .build(); sp.validateProp(SwitchFeature.BFD); } | @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; } | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... |
@Test public void validatePropPassesTest() { Set<SwitchFeature> features = new HashSet<>(); features.add(SwitchFeature.MULTI_TABLE); Switch sw = Switch.builder() .switchId(new SwitchId(1)) .features(features) .build(); SwitchProperties sp = SwitchProperties.builder() .switchObj(sw) .build(); assertTrue(sp.validateProp(... | @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s", getSwitchId(), feature); throw new IllegalArgumentException(message); } return true; } | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { @VisibleForTesting public boolean validateProp(SwitchFeature feature) { if (getSwitchObj() != null && !getSwitchObj().getFeatures().contains(feature)) { String message = String.format("Switch %s doesn't support requested feature %s... |
@Test(expected = IllegalArgumentException.class) public void setUnsupportedMultiTableFlagTest() { Switch sw = Switch.builder() .switchId(new SwitchId(1)) .build(); SwitchProperties sp = SwitchProperties.builder() .switchObj(sw) .build(); sp.setMultiTable(true); } | public void setMultiTable(boolean multiTable) { if (multiTable) { validateProp(SwitchFeature.MULTI_TABLE); } data.setMultiTable(multiTable); } | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setMultiTable(boolean multiTable) { if (multiTable) { validateProp(SwitchFeature.MULTI_TABLE); } data.setMultiTable(multiTable); } } | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setMultiTable(boolean multiTable) { if (multiTable) { validateProp(SwitchFeature.MULTI_TABLE); } data.setMultiTable(multiTable); } private SwitchProperties(); SwitchProperties(@NonNull SwitchProperties entityToClone);... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setMultiTable(boolean multiTable) { if (multiTable) { validateProp(SwitchFeature.MULTI_TABLE); } data.setMultiTable(multiTable); } private SwitchProperties(); SwitchProperties(@NonNull SwitchProperties entityToClone);... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setMultiTable(boolean multiTable) { if (multiTable) { validateProp(SwitchFeature.MULTI_TABLE); } data.setMultiTable(multiTable); } private SwitchProperties(); SwitchProperties(@NonNull SwitchProperties entityToClone);... |
@Test public void shouldDeleteInactiveIsl() throws IslNotFoundException, IllegalIslStateException { createIsl(IslStatus.INACTIVE); linkOperationsService .deleteIsl(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT, false); assertTrue(islRepository.findAll().isEmpty()); } | public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination switch '{}', destination ... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... |
@Test(expected = IllegalArgumentException.class) public void setUnsupportedTransitEncapsulationTest() { Switch sw = Switch.builder() .switchId(new SwitchId(1)) .build(); SwitchProperties sp = SwitchProperties.builder() .switchObj(sw) .build(); Set<FlowEncapsulationType> flowEncapsulationTypes = new HashSet<>(); flowEnc... | public void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation) { if (supportedTransitEncapsulation != null && supportedTransitEncapsulation.contains(FlowEncapsulationType.VXLAN)) { validateProp(SwitchFeature.NOVIFLOW_COPY_FIELD); } data.setSupportedTransitEncapsulation(supportedT... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation) { if (supportedTransitEncapsulation != null && supportedTransitEncapsulation.contains(FlowEncapsulationType.VXLAN)) { validatePr... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation) { if (supportedTransitEncapsulation != null && supportedTransitEncapsulation.contains(FlowEncapsulationType.VXLAN)) { validatePr... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation) { if (supportedTransitEncapsulation != null && supportedTransitEncapsulation.contains(FlowEncapsulationType.VXLAN)) { validatePr... | SwitchProperties implements CompositeDataEntity<SwitchProperties.SwitchPropertiesData> { public void setSupportedTransitEncapsulation(Set<FlowEncapsulationType> supportedTransitEncapsulation) { if (supportedTransitEncapsulation != null && supportedTransitEncapsulation.contains(FlowEncapsulationType.VXLAN)) { validatePr... |
@Test public void add() { PathWeight first = new PathWeight(2, 7); PathWeight second = new PathWeight(1, 2); PathWeight actual = first.add(second); assertEquals(0, actual.compareTo(new PathWeight(3, 9))); } | public PathWeight add(PathWeight toAdd) { List<Long> result = new ArrayList<>(); Iterator<Long> firstIterator = params.iterator(); Iterator<Long> secondIterator = toAdd.params.iterator(); while (firstIterator.hasNext() || secondIterator.hasNext()) { long first = firstIterator.hasNext() ? firstIterator.next() : 0L; long... | PathWeight implements Comparable<PathWeight> { public PathWeight add(PathWeight toAdd) { List<Long> result = new ArrayList<>(); Iterator<Long> firstIterator = params.iterator(); Iterator<Long> secondIterator = toAdd.params.iterator(); while (firstIterator.hasNext() || secondIterator.hasNext()) { long first = firstItera... | PathWeight implements Comparable<PathWeight> { public PathWeight add(PathWeight toAdd) { List<Long> result = new ArrayList<>(); Iterator<Long> firstIterator = params.iterator(); Iterator<Long> secondIterator = toAdd.params.iterator(); while (firstIterator.hasNext() || secondIterator.hasNext()) { long first = firstItera... | PathWeight implements Comparable<PathWeight> { public PathWeight add(PathWeight toAdd) { List<Long> result = new ArrayList<>(); Iterator<Long> firstIterator = params.iterator(); Iterator<Long> secondIterator = toAdd.params.iterator(); while (firstIterator.hasNext() || secondIterator.hasNext()) { long first = firstItera... | PathWeight implements Comparable<PathWeight> { public PathWeight add(PathWeight toAdd) { List<Long> result = new ArrayList<>(); Iterator<Long> firstIterator = params.iterator(); Iterator<Long> secondIterator = toAdd.params.iterator(); while (firstIterator.hasNext() || secondIterator.hasNext()) { long first = firstItera... |
@Test public void compareTo() { final PathWeight first = new PathWeight(2, 7); final PathWeight second = new PathWeight(5, 7); final PathWeight equalToSecond = new PathWeight(5, 7); final PathWeight third = new PathWeight(7); final PathWeight fourth = new PathWeight(7, 2); assertTrue(first.compareTo(second) < 0); asser... | @Override public int compareTo(PathWeight o) { int firstSize = params.size(); int secondSize = o.params.size(); int limit = Math.min(firstSize, secondSize); int i = 0; while (i < limit) { long first = params.get(i).longValue(); long second = o.params.get(i).longValue(); if (first != second) { return first > second ? 1 ... | PathWeight implements Comparable<PathWeight> { @Override public int compareTo(PathWeight o) { int firstSize = params.size(); int secondSize = o.params.size(); int limit = Math.min(firstSize, secondSize); int i = 0; while (i < limit) { long first = params.get(i).longValue(); long second = o.params.get(i).longValue(); if... | PathWeight implements Comparable<PathWeight> { @Override public int compareTo(PathWeight o) { int firstSize = params.size(); int secondSize = o.params.size(); int limit = Math.min(firstSize, secondSize); int i = 0; while (i < limit) { long first = params.get(i).longValue(); long second = o.params.get(i).longValue(); if... | PathWeight implements Comparable<PathWeight> { @Override public int compareTo(PathWeight o) { int firstSize = params.size(); int secondSize = o.params.size(); int limit = Math.min(firstSize, secondSize); int i = 0; while (i < limit) { long first = params.get(i).longValue(); long second = o.params.get(i).longValue(); if... | PathWeight implements Comparable<PathWeight> { @Override public int compareTo(PathWeight o) { int firstSize = params.size(); int secondSize = o.params.size(); int limit = Math.min(firstSize, secondSize); int i = 0; while (i < limit) { long first = params.get(i).longValue(); long second = o.params.get(i).longValue(); if... |
@Test public void shouldCreateAnInstance() { PathComputerFactory factory = new PathComputerFactory( mock(PathComputerConfig.class), mock(AvailableNetworkFactory.class)); PathComputer pathComputer = factory.getPathComputer(); assertTrue(pathComputer instanceof InMemoryPathComputer); } | public PathComputer getPathComputer() { return new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(config.getMaxAllowedDepth()), config); } | PathComputerFactory { public PathComputer getPathComputer() { return new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(config.getMaxAllowedDepth()), config); } } | PathComputerFactory { public PathComputer getPathComputer() { return new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(config.getMaxAllowedDepth()), config); } PathComputerFactory(PathComputerConfig config, AvailableNetworkFactory availableNetworkFactory); } | PathComputerFactory { public PathComputer getPathComputer() { return new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(config.getMaxAllowedDepth()), config); } PathComputerFactory(PathComputerConfig config, AvailableNetworkFactory availableNetworkFactory); PathComputer getPathCompute... | PathComputerFactory { public PathComputer getPathComputer() { return new InMemoryPathComputer(availableNetworkFactory, new BestWeightAndShortestPathFinder(config.getMaxAllowedDepth()), config); } PathComputerFactory(PathComputerConfig config, AvailableNetworkFactory availableNetworkFactory); PathComputer getPathCompute... |
@Test public void shouldBuildAvailableNetworkUsingCostStrategy() throws RecoverableException { Flow flow = getFlow(false); Isl isl = getIsl(flow); when(config.getNetworkStrategy()).thenReturn("COST"); when(islRepository.findActiveWithAvailableBandwidth(flow.getBandwidth(), flow.getEncapsulationType())) .thenReturn(Coll... | public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvailableIsls(buildStrategy, flo... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... |
@Test public void shouldIncreaseDiversityGroupUseCounter() throws RecoverableException { List<Isl> isls = new ArrayList<>(); isls.addAll(getBidirectionalIsls(switchA, 1, switchB, 2)); isls.addAll(getBidirectionalIsls(switchB, 3, switchC, 4)); final Flow diverseFlow = Flow.builder() .flowId(FLOW_ID_1) .groupId(GROUP_ID)... | public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvailableIsls(buildStrategy, flo... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... |
@Test public void shouldBuildAvailableNetworkUsingCostStrategyWithIgnoreBandwidth() throws RecoverableException { Flow flow = getFlow(true); Isl isl = getIsl(flow); when(config.getNetworkStrategy()).thenReturn("COST"); when(islRepository.findAllActiveByEncapsulationType(flow.getEncapsulationType())) .thenReturn(Collect... | public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvailableIsls(buildStrategy, flo... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... |
@Test public void shouldBuildAvailableNetworkUsingSymmetricCostStrategy() throws RecoverableException { Flow flow = getFlow(false); Isl isl = getIsl(flow); when(config.getNetworkStrategy()).thenReturn("SYMMETRIC_COST"); when(islRepository.findSymmetricActiveWithAvailableBandwidth(flow.getBandwidth(), flow.getEncapsulat... | public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvailableIsls(buildStrategy, flo... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... |
@Test public void shouldBuildAvailableNetworkUsingSymmetricCostStrategyWithIgnoreBandwidth() throws RecoverableException { Flow flow = getFlow(true); Isl isl = getIsl(flow); when(config.getNetworkStrategy()).thenReturn("SYMMETRIC_COST"); when(islRepository.findAllActiveByEncapsulationType(flow.getEncapsulationType())) ... | public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvailableIsls(buildStrategy, flo... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... | AvailableNetworkFactory { public AvailableNetwork getAvailableNetwork(Flow flow, Collection<PathId> reusePathsResources) throws RecoverableException { BuildStrategy buildStrategy = BuildStrategy.from(config.getNetworkStrategy()); AvailableNetwork network = new AvailableNetwork(); try { Collection<Isl> links = getAvaila... |
@Test public void testJsonSerialization() throws IOException { InfoMessage msg = new InfoMessage(new FlowStatusResponse( new FlowIdStatusPayload("FLOW", FlowState.UP)), 10L, "CORRELATION", Destination.NORTHBOUND, null); InfoMessage fromJson = MAPPER.readValue(json, InfoMessage.class); FlowStatusResponse fsrJson = (Flow... | public FlowIdStatusPayload getPayload() { return payload; } | FlowStatusResponse extends InfoData { public FlowIdStatusPayload getPayload() { return payload; } } | FlowStatusResponse extends InfoData { public FlowIdStatusPayload getPayload() { return payload; } @JsonCreator FlowStatusResponse(@JsonProperty(PAYLOAD) final FlowIdStatusPayload payload); } | FlowStatusResponse extends InfoData { public FlowIdStatusPayload getPayload() { return payload; } @JsonCreator FlowStatusResponse(@JsonProperty(PAYLOAD) final FlowIdStatusPayload payload); FlowIdStatusPayload getPayload(); void setPayload(final FlowIdStatusPayload payload); @Override String toString(); @Override int h... | FlowStatusResponse extends InfoData { public FlowIdStatusPayload getPayload() { return payload; } @JsonCreator FlowStatusResponse(@JsonProperty(PAYLOAD) final FlowIdStatusPayload payload); FlowIdStatusPayload getPayload(); void setPayload(final FlowIdStatusPayload payload); @Override String toString(); @Override int h... |
@Test(expected = IllegalIslStateException.class) public void shouldNotDeleteActiveIsl() throws IslNotFoundException, IllegalIslStateException { createIsl(IslStatus.ACTIVE); linkOperationsService .deleteIsl(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT, false); } | public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination switch '{}', destination ... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... |
@Test(expected = InvalidFlowException.class) public void shouldFailOnSwapWhenEqualsEndpointsOnFirstFlow() throws InvalidFlowException { RequestedFlow firstFlow = RequestedFlow.builder() .flowId("firstFlow") .srcSwitch(SWITCH_ID_1) .srcPort(10) .srcVlan(11) .destSwitch(SWITCH_ID_2) .destPort(10) .destVlan(11) .build(); ... | @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, message); Set<FlowE... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... |
@Test(expected = InvalidFlowException.class) public void shouldFailOnSwapWhenEqualsEndpointsOnSecondFlow() throws InvalidFlowException { RequestedFlow firstFlow = RequestedFlow.builder() .flowId("firstFlow") .srcSwitch(SWITCH_ID_2) .srcPort(10) .srcVlan(11) .destSwitch(SWITCH_ID_2) .destPort(12) .build(); RequestedFlow... | @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, message); Set<FlowE... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... |
@Test(expected = InvalidFlowException.class) public void shouldFailOnSwapWhenEqualsEndpointsOnFirstAndSecondFlow() throws InvalidFlowException { RequestedFlow firstFlow = RequestedFlow.builder() .flowId("firstFlow") .srcSwitch(SWITCH_ID_1) .srcPort(10) .srcVlan(11) .destSwitch(SWITCH_ID_2) .destPort(12) .destVlan(13) .... | @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, message); Set<FlowE... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... |
@Test public void shouldNotFailOnSwapWhenDifferentEndpointsOnFirstAndSecondFlow() throws InvalidFlowException { RequestedFlow firstFlow = RequestedFlow.builder() .flowId("firstFlow") .srcSwitch(SWITCH_ID_1) .srcPort(10) .srcVlan(11) .destSwitch(SWITCH_ID_2) .destPort(12) .destVlan(13) .build(); RequestedFlow secondFlow... | @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, message); Set<FlowE... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... | FlowValidator { @VisibleForTesting void checkForEqualsEndpoints(RequestedFlow firstFlow, RequestedFlow secondFlow) throws InvalidFlowException { String message = "New requested endpoint for '%s' conflicts with existing endpoint for '%s'"; Set<FlowEndpoint> firstFlowEndpoints = validateFlowEqualsEndpoints(firstFlow, mes... |
@Test(expected = ResourceAllocationException.class) public void updateAvailableBandwidthFailsOnOverProvisionTest() throws ResourceAllocationException { when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory); when(repositoryFactory.createFlowPathRepository()).thenReturn(flowPathRepository); when(r... | @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = flowPathRepository.getUsedBandwidthBetweenEndpoints(srcSwitch, srcPort, dstSw... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... |
@Test() public void updateAvailableBandwidthIgnorsOverProvisionTest() throws ResourceAllocationException { when(persistenceManager.getRepositoryFactory()).thenReturn(repositoryFactory); when(repositoryFactory.createFlowPathRepository()).thenReturn(flowPathRepository); when(repositoryFactory.createIslRepository()).thenR... | @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = flowPathRepository.getUsedBandwidthBetweenEndpoints(srcSwitch, srcPort, dstSw... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... | BaseResourceAllocationAction extends
NbTrackableAction<T, S, E, C> { @VisibleForTesting void updateAvailableBandwidth(SwitchId srcSwitch, int srcPort, SwitchId dstSwitch, int dstPort, long allowedOverprovisionedBandwidth, boolean forceToIgnoreBandwidth) throws ResourceAllocationException { long usedBandwidth = ... |
@Test public void shouldSkipRerouteIfNoNewPathFound() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); preparePathComputation(origin.getFlowId(), make2SwitchesPathPair()); FlowRerouteRequest request = new FlowRerouteRequest(origin.getFlowId(), false, false, false, Collections.emptySet(),... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldCompleteRerouteOnErrorDuringCompletingFlowPathRemoval() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); preparePathComputation(origin.getFlowId(), make3SwitchesPathPair()); FlowPathRepository repository = setupFlowPathRepositorySpy(); doThrow(new RuntimeException... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldSuccessfullyRerouteFlow() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); origin.setStatus(FlowStatus.DOWN); transactionManager.doInTransaction(() -> repositoryFactory.createFlowRepository().updateStatus(origin.getFlowId(), FlowStatus.DOWN)); preparePathComputati... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldSuccessfullyHandleOverlappingRequests() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); origin.setStatus(FlowStatus.DOWN); transactionManager.doInTransaction(() -> repositoryFactory.createFlowRepository().updateStatus(origin.getFlowId(), FlowStatus.DOWN)); when(p... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test(expected = IllegalIslStateException.class) public void shouldNotDeleteBusyIsl() throws IslNotFoundException, IllegalIslStateException { createIsl(IslStatus.INACTIVE); createFlow("test_flow_id", TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT); linkOperationsService .deleteIsl(TEST_SWITC... | public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination switch '{}', destination ... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... |
@Test(expected = IllegalSwitchPropertiesException.class) public void shouldValidateMultiTableFlagWhenUpdatingSwitchProperties() { Switch sw = Switch.builder().switchId(TEST_SWITCH_ID).status(SwitchStatus.ACTIVE).build(); switchRepository.add(sw); createSwitchProperties(sw, Collections.singleton(FlowEncapsulationType.TR... | public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsulations should not be null or empty"); } SwitchProperties update = S... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... | SwitchOperationsService implements ILinkOperationsServiceCarrier { public SwitchPropertiesDto updateSwitchProperties(SwitchId switchId, SwitchPropertiesDto switchPropertiesDto) { if (isEmpty(switchPropertiesDto.getSupportedTransitEncapsulation())) { throw new IllegalSwitchPropertiesException("Supported transit encapsul... |
@Test public void shouldIgnoreEffectivelyDownStateIfSamePaths() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); preparePathComputation(origin.getFlowId(), make2SwitchesPathPair()); FlowRerouteService service = makeService(); FlowRerouteRequest request = new FlowRerouteRequest(origin.get... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldProcessRerouteForValidRequest() throws RecoverableException, UnroutableFlowException { Flow origin = makeFlow(); origin.setTargetPathComputationStrategy(LATENCY); setupFlowRepositorySpy().findById(origin.getFlowId()) .ifPresent(foundPath -> foundPath.setTargetPathComputationStrategy(LATENCY)); p... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldSkipRerouteOnOutdatedRequest() { Flow origin = makeFlow(); FlowRerouteService service = makeService(); IslEndpoint affectedEndpoint = extractIslEndpoint(origin); IslEndpoint notAffectedEndpoint = new IslEndpoint( affectedEndpoint.getSwitchId(), affectedEndpoint.getPortNumber() + 1); FlowRerouteR... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldMoveFlowToDegradedIfPathWithRequiredLatencyNotFound() throws Exception { Flow origin = makeFlow(); origin.setTargetPathComputationStrategy(MAX_LATENCY); setupFlowRepositorySpy().findById(origin.getFlowId()) .ifPresent(foundPath -> foundPath.setTargetPathComputationStrategy(MAX_LATENCY)); when(pa... | public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { log.error(e.getMessag... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... | FlowRerouteService { public void handleRequest(String key, FlowRerouteRequest reroute, final CommandContext commandContext) { log.debug("Handling flow reroute request with key {} and flow ID: {}", key, reroute.getFlowId()); try { checkRequestsCollision(key, reroute.getFlowId(), commandContext); } catch (Exception e) { ... |
@Test public void shouldFailDeleteFlowIfNoFlowFound() { String flowId = "dummy-flow"; FlowRepository repository = persistenceManager.getRepositoryFactory().createFlowRepository(); Assert.assertFalse(repository.findById(flowId).isPresent()); makeService().handleRequest(dummyRequestKey, commandContext, flowId); verifyNoS... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void shouldFailDeleteFlowOnLockedFlow() { Flow flow = makeFlow(); setupFlowRepositorySpy().findById(flow.getFlowId()) .ifPresent(foundFlow -> foundFlow.setStatus(FlowStatus.IN_PROGRESS)); makeService().handleRequest(dummyRequestKey, commandContext, flow.getFlowId()); verifyNoSpeakerInteraction(carrier); ve... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void shouldCompleteDeleteOnLockedSwitches() { String flowId = makeFlow().getFlowId(); FlowDeleteService service = makeService(); service.handleRequest(dummyRequestKey, commandContext, flowId); Flow flow = verifyFlowStatus(flowId, FlowStatus.IN_PROGRESS); verifyNorthboundSuccessResponse(carrier); produceSpe... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void shouldCompleteDeleteOnErrorDuringCompletingFlowPathRemoval() { Flow target = makeFlow(); FlowPath forwardPath = target.getForwardPath(); Assert.assertNotNull(forwardPath); FlowPathRepository repository = setupFlowPathRepositorySpy(); doThrow(new RuntimeException(injectedErrorMessage)) .when(repository... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void shouldCompleteDeleteOnErrorDuringResourceDeallocation() { Flow target = makeFlow(); FlowPath forwardPath = target.getForwardPath(); Assert.assertNotNull(forwardPath); doThrow(new RuntimeException(injectedErrorMessage)) .when(flowResourcesManager) .deallocatePathResources(MockitoHamcrest.argThat( Match... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void shouldCompleteDeleteOnErrorDuringRemovingFlow() { Flow target = makeFlow(); FlowRepository repository = setupFlowRepositorySpy(); doThrow(new RuntimeException(injectedErrorMessage)) .when(repository) .remove(eq(target.getFlowId())); FlowDeleteService service = makeService(); service.handleRequest(dumm... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void shouldForceDeleteActiveIsl() throws IslNotFoundException, IllegalIslStateException { createIsl(IslStatus.ACTIVE); linkOperationsService .deleteIsl(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT, true); assertTrue(islRepository.findAll().isEmpty()); } | public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination switch '{}', destination ... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... |
@Test public void shouldSuccessfullyDeleteFlow() { Flow target = makeFlow(); FlowDeleteService service = makeService(); service.handleRequest(dummyRequestKey, commandContext, target.getFlowId()); verifyFlowStatus(target.getFlowId(), FlowStatus.IN_PROGRESS); verifyNorthboundSuccessResponse(carrier); produceSpeakerRespon... | public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.", key); return; } Str... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... | FlowDeleteService { public void handleRequest(String key, CommandContext commandContext, String flowId) { log.debug("Handling flow delete request with key {} and flow ID: {}", key, flowId); if (fsms.containsKey(key)) { log.error("Attempt to create a FSM with key {}, while there's another active FSM with the same key.",... |
@Test public void mapFlowRequestToRequestedFlowTest() { RequestedFlow requestedFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(flowRequest); assertEquals(FLOW_ID, requestedFlow.getFlowId()); assertEquals(SRC_SWITCH_ID, requestedFlow.getSrcSwitch()); assertEquals(SRC_PORT, requestedFlow.getSrcPort()); assertEquals(S... | public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } RequestedFlo... | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } RequestedFlo... |
@Test public void mapFlowRequestToRequestedFlow() { RequestedFlow result = RequestedFlowMapper.INSTANCE.toRequestedFlow(flowRequest); assertEquals(FLOW_ID, result.getFlowId()); assertEquals(SRC_SWITCH_ID, result.getSrcSwitch()); assertEquals(SRC_PORT, result.getSrcPort()); assertEquals(SRC_VLAN, result.getSrcVlan()); a... | public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } RequestedFlo... | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } RequestedFlo... |
@Test public void mapFlowToFlowRequestTest() { FlowRequest flowRequest = RequestedFlowMapper.INSTANCE.toFlowRequest(flow); assertEquals(FLOW_ID, flowRequest.getFlowId()); assertEquals(SRC_SWITCH_ID, flowRequest.getSource().getSwitchId()); assertEquals(SRC_PORT, (int) flowRequest.getSource().getPortNumber()); assertEqua... | @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), flow.getDestVlan()))")... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... | RequestedFlowMapper { @Mapping(target = "flowId", source = "flowId") @Mapping(target = "source", expression = "java(new FlowEndpoint(flow.getSrcSwitchId(), " + "flow.getSrcPort(), flow.getSrcVlan()))") @Mapping(target = "destination", expression = "java(new FlowEndpoint(flow.getDestSwitchId(), " + "flow.getDestPort(), ... |
@Test public void mapSwapDtoToRequesterFlowTest() { SwapFlowDto swapFlowDto = SwapFlowDto.builder() .flowId(FLOW_ID) .sourceSwitch(SRC_SWITCH_ID) .sourcePort(SRC_PORT) .sourceVlan(SRC_VLAN) .destinationSwitch(DST_SWITCH_ID) .destinationPort(DST_PORT) .destinationVlan(DST_VLAN) .build(); RequestedFlow requestedFlow = Re... | public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } } | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } RequestedFlo... | RequestedFlowMapper { public RequestedFlow toRequestedFlow(FlowRequest request) { RequestedFlow flow = generatedMap(request); RequestedFlowIncrementalMapper.INSTANCE.mapSource(flow, request.getSource()); RequestedFlowIncrementalMapper.INSTANCE.mapDestination(flow, request.getDestination()); return flow; } RequestedFlo... |
@Test public void yesNoTest() { Assert.assertTrue(mapper.toBoolean(YesNo.YES)); Assert.assertFalse(mapper.toBoolean(YesNo.NO)); assertNull(mapper.toBoolean(null)); assertNull(mapper.toBoolean(YesNo.UNRECOGNIZED)); assertNull(mapper.toBoolean(YesNo.YESNO_RESERVED)); } | public Boolean toBoolean(YesNo yesNo) { if (yesNo == null) { return null; } switch (yesNo) { case YES: return true; case NO: return false; default: return null; } } | NoviflowResponseMapper { public Boolean toBoolean(YesNo yesNo) { if (yesNo == null) { return null; } switch (yesNo) { case YES: return true; case NO: return false; default: return null; } } } | NoviflowResponseMapper { public Boolean toBoolean(YesNo yesNo) { if (yesNo == null) { return null; } switch (yesNo) { case YES: return true; case NO: return false; default: return null; } } } | NoviflowResponseMapper { public Boolean toBoolean(YesNo yesNo) { if (yesNo == null) { return null; } switch (yesNo) { case YES: return true; case NO: return false; default: return null; } } @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping... | NoviflowResponseMapper { public Boolean toBoolean(YesNo yesNo) { if (yesNo == null) { return null; } switch (yesNo) { case YES: return true; case NO: return false; default: return null; } } @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping... |
@Test public void packetInOutTest() { PacketInOutStats stats = PacketInOutStats.newBuilder() .setPacketInTotalPackets(PACKET_IN_TOTAL_PACKETS) .setPacketInTotalPacketsDataplane(PACKET_IN_TOTAL_PACKETS_DATAPLANE) .setPacketInNoMatchPackets(PACKET_IN_NO_MATCH_PACKETS) .setPacketInApplyActionPackets(PACKET_IN_APPLY_ACTION... | @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping(source = "logicalporttype", target = "type") public abstract LogicalPort map(io.grpc.noviflow.LogicalPort port); | NoviflowResponseMapper { @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping(source = "logicalporttype", target = "type") public abstract LogicalPort map(io.grpc.noviflow.LogicalPort port); } | NoviflowResponseMapper { @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping(source = "logicalporttype", target = "type") public abstract LogicalPort map(io.grpc.noviflow.LogicalPort port); } | NoviflowResponseMapper { @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping(source = "logicalporttype", target = "type") public abstract LogicalPort map(io.grpc.noviflow.LogicalPort port); @Mapping(source = "logicalportno", target = "logica... | NoviflowResponseMapper { @Mapping(source = "logicalportno", target = "logicalPortNumber") @Mapping(source = "portnoList", target = "portNumbers") @Mapping(source = "logicalporttype", target = "type") public abstract LogicalPort map(io.grpc.noviflow.LogicalPort port); @Mapping(source = "logicalportno", target = "logica... |
@Test public void shouldDetectSameSwitchPaths() { SwitchId switchId = new SwitchId(1); Switch switchEntity = Switch.builder().switchId(switchId).build(); Path path = Path.builder() .srcSwitchId(switchId) .destSwitchId(switchId) .segments(Collections.emptyList()) .build(); FlowPath flowPath = FlowPath.builder() .srcSwit... | public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegments().iterator(); ... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... |
@Test public void shouldDetectNotSameSwitchPaths() { SwitchId switchId1 = new SwitchId(1); SwitchId switchId2 = new SwitchId(2); Switch switch2 = Switch.builder().switchId(switchId2).build(); Path path = Path.builder() .srcSwitchId(switchId1) .destSwitchId(switchId1) .segments(Collections.emptyList()) .build(); FlowPat... | public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegments().iterator(); ... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... |
@Test public void shouldDetectSame2SwitchPaths() { SwitchId switchId1 = new SwitchId(1); Switch switch1 = Switch.builder().switchId(switchId1).build(); SwitchId switchId2 = new SwitchId(2); Switch switch2 = Switch.builder().switchId(switchId2).build(); Path path = Path.builder() .srcSwitchId(switchId1) .destSwitchId(sw... | public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegments().iterator(); ... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... |
@Test public void shouldForceDeleteBusyIsl() throws IslNotFoundException, IllegalIslStateException { createIsl(IslStatus.INACTIVE); createFlow("test_flow_id", TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT); linkOperationsService .deleteIsl(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B... | public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination switch '{}', destination ... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... | LinkOperationsService { public Collection<Isl> deleteIsl(SwitchId sourceSwitch, int sourcePort, SwitchId destinationSwitch, int destinationPort, boolean force) throws IllegalIslStateException, IslNotFoundException { log.info("Delete ISL with following parameters: " + "source switch '{}', source port '{}', destination s... |
@Test public void shouldDetectDifferenceInPortsFor2SwitchPaths() { SwitchId switchId1 = new SwitchId(1); Switch switch1 = Switch.builder().switchId(switchId1).build(); SwitchId switchId2 = new SwitchId(2); Switch switch2 = Switch.builder().switchId(switchId2).build(); Path path = Path.builder() .srcSwitchId(switchId1) ... | public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegments().iterator(); ... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... |
@Test public void shouldDetectSame3SwitchPaths() { SwitchId switchId1 = new SwitchId(1); Switch switch1 = Switch.builder().switchId(switchId1).build(); SwitchId switchId2 = new SwitchId(2); Switch switch2 = Switch.builder().switchId(switchId2).build(); SwitchId switchId3 = new SwitchId(3); Switch switch3 = Switch.build... | public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegments().iterator(); ... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... | FlowPathBuilder { public boolean isSamePath(Path path, FlowPath flowPath) { if (!path.getSrcSwitchId().equals(flowPath.getSrcSwitchId()) || !path.getDestSwitchId().equals(flowPath.getDestSwitchId()) || path.getSegments().size() != flowPath.getSegments().size()) { return false; } Iterator<Segment> pathIt = path.getSegme... |
@Test public void shouldBuildFlowPathFor1SwitchPath() { SwitchId switchId = new SwitchId(1); Path path = Path.builder() .srcSwitchId(switchId) .destSwitchId(switchId) .segments(Collections.emptyList()) .build(); Flow flow = Flow.builder() .flowId("test_flow") .srcSwitch(Switch.builder().switchId(switchId).build()) .des... | public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.getSrcSwitch()); swi... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... |
@Test public void shouldBuildFlowPathFor2SwitchPath() { SwitchId switchId1 = new SwitchId(1); SwitchId switchId2 = new SwitchId(2); Path path = Path.builder() .srcSwitchId(switchId1) .destSwitchId(switchId2) .segments(Collections.singletonList(Segment.builder() .srcSwitchId(switchId1) .srcPort(1) .destSwitchId(switchId... | public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.getSrcSwitch()); swi... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... |
@Test public void shouldBuildFlowPathFor3SwitchPath() { SwitchId switchId1 = new SwitchId(1); SwitchId switchId2 = new SwitchId(2); SwitchId switchId3 = new SwitchId(3); Path path = Path.builder() .srcSwitchId(switchId1) .destSwitchId(switchId2) .segments(asList(Segment.builder() .srcSwitchId(switchId1) .srcPort(1) .de... | public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.getSrcSwitch()); swi... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... | FlowPathBuilder { public FlowPath buildFlowPath(Flow flow, PathResources pathResources, Path path, FlowSegmentCookie cookie, boolean forceToIgnoreBandwidth) { Map<SwitchId, Switch> switches = new HashMap<>(); Map<SwitchId, SwitchProperties> switchProperties = new HashMap<>(); switches.put(flow.getSrcSwitchId(), flow.ge... |
@Test public void shouldCreateNonIngressRequestsWithoutVlans() { Switch srcSwitch = Switch.builder().switchId(SWITCH_1).build(); Switch destSwitch = Switch.builder().switchId(SWITCH_2).build(); Flow flow = buildFlow(srcSwitch, 1, 0, destSwitch, 2, 0, 0); setSegmentsWithoutTransitSwitches( Objects.requireNonNull(flow.ge... | @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } } | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResource... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResource... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResource... |
@Test public void shouldCreateNonIngressCommandsWithTransitSwitch() { Switch srcSwitch = Switch.builder().switchId(SWITCH_1).build(); Switch destSwitch = Switch.builder().switchId(SWITCH_3).build(); Flow flow = buildFlow(srcSwitch, 1, 101, destSwitch, 2, 102, 0); setSegmentsWithTransitSwitches( Objects.requireNonNull(f... | @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } } | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResource... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResource... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAllExceptIngress(CommandContext context, @NonNull Flow flow) { return buildAllExceptIngress(context, flow, flow.getForwardPath(), flow.getReversePath()); } SpeakerFlowSegmentRequestBuilder(FlowResource... |
@Test public void shouldCreateOneSwitchFlow() { Switch sw = Switch.builder().switchId(SWITCH_1).build(); Flow flow = buildFlow(sw, 1, 10, sw, 2, 12, 1000); List<FlowSegmentRequestFactory> commands = target.buildAll( COMMAND_CONTEXT, flow, flow.getForwardPath(), flow.getReversePath(), SpeakerRequestBuildContext.EMPTY); ... | @Override public List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path, SpeakerRequestBuildContext speakerRequestBuildContext) { return makeRequests(context, flow, path, null, true, true, true, speakerRequestBuildContext); } | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path, SpeakerRequestBuildContext speakerRequestBuildContext) { return makeRequests(context, flow, path, null, true, true, true, speakerRequestBuildContex... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path, SpeakerRequestBuildContext speakerRequestBuildContext) { return makeRequests(context, flow, path, null, true, true, true, speakerRequestBuildContex... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path, SpeakerRequestBuildContext speakerRequestBuildContext) { return makeRequests(context, flow, path, null, true, true, true, speakerRequestBuildContex... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildAll(CommandContext context, Flow flow, FlowPath path, SpeakerRequestBuildContext speakerRequestBuildContext) { return makeRequests(context, flow, path, null, true, true, true, speakerRequestBuildContex... |
@Test public void useActualFlowEndpoint() { Switch srcSwitch = Switch.builder().switchId(SWITCH_1).build(); Switch destSwitch = Switch.builder().switchId(SWITCH_2).build(); Flow origin = buildFlow(srcSwitch, 1, 5, destSwitch, 2, 0, 0); setSegmentsWithoutTransitSwitches( Objects.requireNonNull(origin.getForwardPath()), ... | @Override public List<FlowSegmentRequestFactory> buildIngressOnly( CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext) { return buildIngressOnly(context, flow, flow.getForwardPath(), flow.getReversePath(), speakerRequestBuildContext); } | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildIngressOnly( CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext) { return buildIngressOnly(context, flow, flow.getForwardPath(), flow.getReversePath(), sp... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildIngressOnly( CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext) { return buildIngressOnly(context, flow, flow.getForwardPath(), flow.getReversePath(), sp... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildIngressOnly( CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext) { return buildIngressOnly(context, flow, flow.getForwardPath(), flow.getReversePath(), sp... | SpeakerFlowSegmentRequestBuilder implements FlowCommandBuilder { @Override public List<FlowSegmentRequestFactory> buildIngressOnly( CommandContext context, @NonNull Flow flow, SpeakerRequestBuildContext speakerRequestBuildContext) { return buildIngressOnly(context, flow, flow.getForwardPath(), flow.getReversePath(), sp... |
@Test public void noGroupIntersections() { List<FlowPath> paths = getFlowPaths(); IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, paths); OverlappingSegmentsStats stats = computer.getOverlappingStats(); assertEquals(ZERO_STATS, stats); } | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void shouldPropagateBfdEnableFlagUpdateOnFullUpdate() throws IslNotFoundException { createIsl(IslStatus.ACTIVE); Collection<Isl> result = linkOperationsService.updateEnableBfdFlag( Endpoint.of(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT), Endpoint.of(TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT), true); Assert.assertEqua... | public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destination, flagValue, proces... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... |
@Test public void noGroupIntersectionsInOneFlow() { List<FlowPath> paths = getFlowPaths(); paths.addAll(getFlowPaths(NEW_PATH_ID, NEW_PATH_ID_REVERSE, flow)); IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, paths); OverlappingSegmentsStats stats = computer.getOverlappingStats... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void shouldNoIntersections() { List<FlowPath> paths = getFlowPaths(); FlowPath path = FlowPath.builder() .pathId(NEW_PATH_ID) .srcSwitch(makeSwitch(SWITCH_ID_D)) .destSwitch(makeSwitch(SWITCH_ID_E)) .segments(Lists.newArrayList( buildPathSegment(SWITCH_ID_D, SWITCH_ID_E, 10, 10))) .build(); flow.addPaths(p... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void shouldNotIntersectPathInSameFlow() { List<FlowPath> paths = getFlowPaths(); FlowPath newPath = FlowPath.builder() .pathId(NEW_PATH_ID) .srcSwitch(makeSwitch(SWITCH_ID_A)) .destSwitch(makeSwitch(SWITCH_ID_D)) .segments(Lists.newArrayList( buildPathSegment(SWITCH_ID_A, SWITCH_ID_D, 10, 10))) .build(); f... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void shouldNotFailIfNoSegments() { IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, Collections.emptyList()); OverlappingSegmentsStats stats = computer.getOverlappingStats(NEW_PATH_ID, NEW_PATH_ID_REVERSE); assertEquals(ZERO_STATS, stats); } | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void shouldNotFailIfNoIntersectionSegments() { List<FlowPath> paths = getFlowPaths(); IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, paths); OverlappingSegmentsStats stats = computer.getOverlappingStats(NEW_PATH_ID, NEW_PATH_ID_REVERSE); assertEquals(ZERO_STATS,... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void switchIntersectionByPathId() { List<FlowPath> paths = getFlowPaths(); FlowPath newPath = FlowPath.builder() .pathId(NEW_PATH_ID) .srcSwitch(makeSwitch(SWITCH_ID_A)) .destSwitch(makeSwitch(SWITCH_ID_D)) .segments(Lists.newArrayList( buildPathSegment(SWITCH_ID_A, SWITCH_ID_D, 10, 10))) .build(); flow2.a... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void partialIntersection() { List<FlowPath> paths = getFlowPaths(); FlowPath newPath = FlowPath.builder() .pathId(NEW_PATH_ID) .srcSwitch(makeSwitch(SWITCH_ID_A)) .destSwitch(makeSwitch(SWITCH_ID_B)) .segments(Lists.newArrayList( buildPathSegment(SWITCH_ID_A, SWITCH_ID_B, 1, 1))) .build(); flow2.addPaths(n... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void fullIntersection() { List<FlowPath> paths = getFlowPaths(); paths.addAll(getFlowPaths(NEW_PATH_ID, NEW_PATH_ID_REVERSE, flow2)); IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, paths); OverlappingSegmentsStats stats = computer.getOverlappingStats(NEW_PATH_ID... | public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } } | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... | IntersectionComputer { public OverlappingSegmentsStats getOverlappingStats() { return computeIntersectionCounters( otherEdges.values().stream().flatMap(Collection::stream).collect(Collectors.toSet())); } IntersectionComputer(String targetFlowId, PathId targetForwardPathId, PathId targetReversePathId,
... |
@Test public void isProtectedPathOverlapsPositive() { List<FlowPath> paths = getFlowPaths(PATH_ID, PATH_ID_REVERSE, flow); List<PathSegment> primarySegments = getFlowPathSegments(paths); List<PathSegment> protectedSegmets = Collections.singletonList( buildPathSegment(SWITCH_ID_A, SWITCH_ID_B, 1, 1)); assertTrue(Interse... | public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().map(Edge::fromPathSegme... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... |
@Test public void isProtectedPathOverlapsNegative() { List<FlowPath> paths = getFlowPaths(PATH_ID, PATH_ID_REVERSE, flow); List<PathSegment> primarySegments = getFlowPathSegments(paths); List<PathSegment> protectedSegmets = Collections.singletonList( buildPathSegment(SWITCH_ID_A, SWITCH_ID_C, 3, 3)); assertFalse(Inters... | public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().map(Edge::fromPathSegme... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... | IntersectionComputer { public static boolean isProtectedPathOverlaps( List<PathSegment> primaryFlowSegments, List<PathSegment> protectedFlowSegments) { Set<Edge> primaryEdges = primaryFlowSegments.stream().map(Edge::fromPathSegment).collect(Collectors.toSet()); Set<Edge> protectedEdges = protectedFlowSegments.stream().... |
@Test public void shouldPropagateBfdEnableFlagUpdateOnPartialUpdate() throws IslNotFoundException { createIsl(IslStatus.ACTIVE); islRepository.findByEndpoints(TEST_SWITCH_A_ID, TEST_SWITCH_A_PORT, TEST_SWITCH_B_ID, TEST_SWITCH_B_PORT) .ifPresent(isl -> { isl.setEnableBfd(true); }); Collection<Isl> result = linkOperatio... | public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destination, flagValue, proces... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... | LinkOperationsService { public Collection<Isl> updateEnableBfdFlag(Endpoint source, Endpoint destination, boolean flagValue) throws IslNotFoundException { return transactionManager.doInTransaction(() -> { List<Isl> processed = new ArrayList<>(2); boolean madeChange; madeChange = updateUniIslEnableBfdFlag(source, destin... |
@Test public void islMapperTest() { IslInfoData islInfoData = IslInfoData.builder() .latency(1L) .source(new PathNode(TEST_SWITCH_A_ID, 1, 0)) .destination(new PathNode(TEST_SWITCH_B_ID, 1, 1)) .speed(2L) .state(IslChangeType.DISCOVERED) .cost(700) .availableBandwidth(4L) .underMaintenance(false) .build(); Isl isl = Is... | public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortNo(isl.getDes... | IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortN... | IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortN... | IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortN... | IslMapper { public IslInfoData map(Isl isl) { if (isl == null) { return null; } PathNode src = new PathNode(); src.setSwitchId(isl.getSrcSwitchId()); src.setPortNo(isl.getSrcPort()); src.setSegLatency(isl.getLatency()); src.setSeqId(0); PathNode dst = new PathNode(); dst.setSwitchId(isl.getDestSwitchId()); dst.setPortN... |
@Test public void testFlowPairToDto() { PathInfoData pathInfoData = new PathInfoData(); pathInfoData.setLatency(1L); pathInfoData.setPath(asList( new PathNode(SRC_SWITCH_ID, 1, 1, 1L, 1L), new PathNode(DST_SWITCH_ID, 2, 2, 2L, 2L) )); FlowDto forwardFlow = new FlowDto(); forwardFlow.setSourceSwitch(SRC_SWITCH_ID); forw... | @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destInnerVlan", tar... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... |
@Test public void testStatusDetailsMapping() { Flow flow = Flow.builder() .flowId("test_flow") .srcSwitch(Switch.builder().switchId(SRC_SWITCH_ID).build()) .destSwitch(Switch.builder().switchId(DST_SWITCH_ID).build()) .allocateProtectedPath(true) .build(); FlowPath forwardFlowPath = FlowPath.builder() .pathId(new PathI... | @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destInnerVlan", tar... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... | FlowMapper { @Mapping(source = "srcPort", target = "sourcePort") @Mapping(source = "srcVlan", target = "sourceVlan") @Mapping(source = "srcInnerVlan", target = "sourceInnerVlan") @Mapping(source = "destPort", target = "destinationPort") @Mapping(source = "destVlan", target = "destinationVlan") @Mapping(source = "destIn... |
@Test public void portMapperTest() { PortMapper portMapper = Mappers.getMapper(PortMapper.class); PortInfoData portInfoData = new PortInfoData(TEST_SWITCH_ID, 1, PortChangeType.UP); Port port = portMapper.map(portInfoData); Assert.assertEquals(PortStatus.UP, port.getStatus()); PortInfoData portInfoDataMapping = portMap... | @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData); | PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData); } | PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData); } | PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData); @Mapping(source = "state", target = "status") abstract Port map(PortInfoData portInfoData); @Mapping(target = "timestamp", ignore = true) @Mapping(target = "maxCapacity", ignore = true) @Mapping(target = "st... | PortMapper { @Mapping(source = "state", target = "status") public abstract Port map(PortInfoData portInfoData); @Mapping(source = "state", target = "status") abstract Port map(PortInfoData portInfoData); @Mapping(target = "timestamp", ignore = true) @Mapping(target = "maxCapacity", ignore = true) @Mapping(target = "st... |
@Test public void shouldConvertFlowPathWithTransitVlanEncapToSimpleSwitchRules() { Flow flow = buildFlow(FlowEncapsulationType.TRANSIT_VLAN); List<SimpleSwitchRule> expectedSwitchRules = getSimpleSwitchRuleForTransitVlan(); List<SimpleSwitchRule> switchRules = simpleSwitchRuleConverter.convertFlowPathToSimpleSwitchRule... | public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(buildIngressSimpleSwitchRule(f... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... | SimpleSwitchRuleConverter { public List<SimpleSwitchRule> convertFlowPathToSimpleSwitchRules(Flow flow, FlowPath flowPath, EncapsulationId encapsulationId, long flowMeterMinBurstSizeInKbits, double flowMeterBurstCoefficient) { List<SimpleSwitchRule> rules = new ArrayList<>(); if (!flowPath.isProtected()) { rules.add(bu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.