use of org.openkilda.messaging.payload.flow.OverlappingSegmentsStats in project open-kilda by telstra.
the class IntersectionComputerTest method partialIntersection.
@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(NEW_PATH_ID, SWITCH_ID_A, SWITCH_ID_B, 1, 1))).build();
flow2.addPaths(newPath);
paths.add(newPath);
IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, paths);
OverlappingSegmentsStats stats = computer.getOverlappingStats(NEW_PATH_ID, NEW_PATH_ID_REVERSE);
assertEquals(new OverlappingSegmentsStats(1, 2, 50, 66), stats);
}
use of org.openkilda.messaging.payload.flow.OverlappingSegmentsStats in project open-kilda by telstra.
the class IntersectionComputerTest method shouldNotFailIfNoIntersectionSegments.
@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, stats);
}
use of org.openkilda.messaging.payload.flow.OverlappingSegmentsStats in project open-kilda by telstra.
the class IntersectionComputerTest method shouldNoIntersections.
@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(NEW_PATH_ID, SWITCH_ID_D, SWITCH_ID_E, 10, 10))).build();
flow.addPaths(path);
FlowPath revPath = FlowPath.builder().pathId(NEW_PATH_ID_REVERSE).srcSwitch(makeSwitch(SWITCH_ID_E)).destSwitch(makeSwitch(SWITCH_ID_D)).segments(Lists.newArrayList(buildPathSegment(NEW_PATH_ID_REVERSE, SWITCH_ID_E, SWITCH_ID_D, 10, 10))).build();
flow2.addPaths(revPath);
paths.addAll(Lists.newArrayList(path, revPath));
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, stats);
}
use of org.openkilda.messaging.payload.flow.OverlappingSegmentsStats in project open-kilda by telstra.
the class IntersectionComputerTest method switchIntersectionByPathId.
@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(NEW_PATH_ID, SWITCH_ID_A, SWITCH_ID_D, 10, 10))).build();
flow2.addPaths(newPath);
paths.add(newPath);
IntersectionComputer computer = new IntersectionComputer(FLOW_ID, PATH_ID, PATH_ID_REVERSE, paths);
OverlappingSegmentsStats stats = computer.getOverlappingStats(NEW_PATH_ID, NEW_PATH_ID_REVERSE);
assertEquals(new OverlappingSegmentsStats(0, 1, 0, 33), stats);
}
Aggregations