@Test public void testThreePointsInTime() { long gap = Simulator.getConfiguration().getLongPropertyOrFail("FLOWLET_GAP_NS"); assertTrue(gap > 0); when(packet.getFlowId()).thenReturn(100L); UniformFlowletIntermediary intermediary = new UniformFlowletIntermediary(); intermediary.adaptOutgoing(packet); Simulator.runNs(gap - 1); intermediary.adaptOutgoing(packet); Simulator.runNs(2 * gap - 1); intermediary.adaptOutgoing(packet); ArgumentCaptor<Integer> captor = ArgumentCaptor.forClass(Integer.class); verify(packet, times(3)).setFlowletId(captor.capture()); assertEquals(0, (int) captor.getAllValues().get(0)); assertEquals(0, (int) captor.getAllValues().get(1)); assertEquals(1, (int) captor.getAllValues().get(2)); verify(packet, times(3)).setHashSrcDstFlowFlowletDependent(); verify(packet, times(0)).setHashSrcDstFlowletDependent(); }
@Override public Packet adaptOutgoing(Packet packet) { long flowId = packet.getFlowId(); int currentFlowlet = getCurrentFlowlet(flowId); if (flowletGapExceeded(flowId)) { currentFlowlet = Math.max(0, currentFlowlet + 1); setCurrentFlowlet(flowId, currentFlowlet); } packet.setFlowletId(currentFlowlet); TcpHeader tcpHeader = (TcpHeader) packet; tcpHeader.setHashSrcDstFlowFlowletDependent(); return packet; }
UniformFlowletIntermediary extends FixedGapFlowletIntermediary { @Override public Packet adaptOutgoing(Packet packet) { long flowId = packet.getFlowId(); int currentFlowlet = getCurrentFlowlet(flowId); if (flowletGapExceeded(flowId)) { currentFlowlet = Math.max(0, currentFlowlet + 1); setCurrentFlowlet(flowId, currentFlowlet); } packet.setFlowletId(currentFlowlet); TcpHeader tcpHeader = (TcpHeader) packet; tcpHeader.setHashSrcDstFlowFlowletDependent(); return packet; } }
UniformFlowletIntermediary extends FixedGapFlowletIntermediary { @Override public Packet adaptOutgoing(Packet packet) { long flowId = packet.getFlowId(); int currentFlowlet = getCurrentFlowlet(flowId); if (flowletGapExceeded(flowId)) { currentFlowlet = Math.max(0, currentFlowlet + 1); setCurrentFlowlet(flowId, currentFlowlet); } packet.setFlowletId(currentFlowlet); TcpHeader tcpHeader = (TcpHeader) packet; tcpHeader.setHashSrcDstFlowFlowletDependent(); return packet; } UniformFlowletIntermediary(); }
UniformFlowletIntermediary extends FixedGapFlowletIntermediary { @Override public Packet adaptOutgoing(Packet packet) { long flowId = packet.getFlowId(); int currentFlowlet = getCurrentFlowlet(flowId); if (flowletGapExceeded(flowId)) { currentFlowlet = Math.max(0, currentFlowlet + 1); setCurrentFlowlet(flowId, currentFlowlet); } packet.setFlowletId(currentFlowlet); TcpHeader tcpHeader = (TcpHeader) packet; tcpHeader.setHashSrcDstFlowFlowletDependent(); return packet; } UniformFlowletIntermediary(); @Override Packet adaptOutgoing(Packet packet); @Override Packet adaptIncoming(Packet packet); }
UniformFlowletIntermediary extends FixedGapFlowletIntermediary { @Override public Packet adaptOutgoing(Packet packet) { long flowId = packet.getFlowId(); int currentFlowlet = getCurrentFlowlet(flowId); if (flowletGapExceeded(flowId)) { currentFlowlet = Math.max(0, currentFlowlet + 1); setCurrentFlowlet(flowId, currentFlowlet); } packet.setFlowletId(currentFlowlet); TcpHeader tcpHeader = (TcpHeader) packet; tcpHeader.setHashSrcDstFlowFlowletDependent(); return packet; } UniformFlowletIntermediary(); @Override Packet adaptOutgoing(Packet packet); @Override Packet adaptIncoming(Packet packet);  }