@Test public void testDispatchTwoSent() { reset(packet); when(packet.getSizeBit()).thenReturn(packetSizeDataBytes * 8L); EcnTailDropOutputPort port = new EcnTailDropOutputPort(sourceNetworkDevice, targetNetworkDevice, link, 100 * packetSizeDataBytes, 40 * packetSizeDataBytes); port.enqueue(packet); port.enqueue(packet); assertEquals(1, port.getQueueSize()); Simulator.runNs(2 * packetSizeDataBytes * 8L / 10 + 20); assertEquals(0, port.getQueueSize()); assertEquals(0, Simulator.getEventSize()); verify(targetNetworkDevice, times(2)).receive(packet); }
@Override public void enqueue(Packet packet) { IpHeader ipHeader = (IpHeader) packet; if (getBufferOccupiedBits() >= ecnThresholdKBits) { ipHeader.markCongestionEncountered(); } if (getBufferOccupiedBits() + ipHeader.getSizeBit() <= maxQueueSizeBits) { guaranteedEnqueue(packet); } else { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED"); if (ipHeader.getSourceId() == this.getOwnId()) { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED_AT_SOURCE"); } } }
EcnTailDropOutputPort extends OutputPort { @Override public void enqueue(Packet packet) { IpHeader ipHeader = (IpHeader) packet; if (getBufferOccupiedBits() >= ecnThresholdKBits) { ipHeader.markCongestionEncountered(); } if (getBufferOccupiedBits() + ipHeader.getSizeBit() <= maxQueueSizeBits) { guaranteedEnqueue(packet); } else { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED"); if (ipHeader.getSourceId() == this.getOwnId()) { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED_AT_SOURCE"); } } } }
EcnTailDropOutputPort extends OutputPort { @Override public void enqueue(Packet packet) { IpHeader ipHeader = (IpHeader) packet; if (getBufferOccupiedBits() >= ecnThresholdKBits) { ipHeader.markCongestionEncountered(); } if (getBufferOccupiedBits() + ipHeader.getSizeBit() <= maxQueueSizeBits) { guaranteedEnqueue(packet); } else { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED"); if (ipHeader.getSourceId() == this.getOwnId()) { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED_AT_SOURCE"); } } } EcnTailDropOutputPort(NetworkDevice ownNetworkDevice, NetworkDevice targetNetworkDevice, Link link, long maxQueueSizeBytes, long ecnThresholdKBytes); }
EcnTailDropOutputPort extends OutputPort { @Override public void enqueue(Packet packet) { IpHeader ipHeader = (IpHeader) packet; if (getBufferOccupiedBits() >= ecnThresholdKBits) { ipHeader.markCongestionEncountered(); } if (getBufferOccupiedBits() + ipHeader.getSizeBit() <= maxQueueSizeBits) { guaranteedEnqueue(packet); } else { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED"); if (ipHeader.getSourceId() == this.getOwnId()) { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED_AT_SOURCE"); } } } EcnTailDropOutputPort(NetworkDevice ownNetworkDevice, NetworkDevice targetNetworkDevice, Link link, long maxQueueSizeBytes, long ecnThresholdKBytes); @Override void enqueue(Packet packet); }
EcnTailDropOutputPort extends OutputPort { @Override public void enqueue(Packet packet) { IpHeader ipHeader = (IpHeader) packet; if (getBufferOccupiedBits() >= ecnThresholdKBits) { ipHeader.markCongestionEncountered(); } if (getBufferOccupiedBits() + ipHeader.getSizeBit() <= maxQueueSizeBits) { guaranteedEnqueue(packet); } else { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED"); if (ipHeader.getSourceId() == this.getOwnId()) { SimulationLogger.increaseStatisticCounter("PACKETS_DROPPED_AT_SOURCE"); } } } EcnTailDropOutputPort(NetworkDevice ownNetworkDevice, NetworkDevice targetNetworkDevice, Link link, long maxQueueSizeBytes, long ecnThresholdKBytes); @Override void enqueue(Packet packet);  }