22 #include "ns3/simple-channel.h"
23 #include "ns3/config.h"
108 uint32_t packets, uint16_t pacingSsRatio, uint16_t pacingCaRatio,
109 uint32_t ssThresh,
bool paceInitialWindow, uint32_t delAckMaxCount,
110 const TypeId& congControl,
const std::string &desc);
113 virtual void CWndTrace (uint32_t oldValue, uint32_t newValue);
114 virtual void RttTrace (
Time oldTime,
Time newTime);
115 virtual void BytesInFlightTrace (uint32_t oldValue, uint32_t newValue);
120 virtual void NormalClose (
SocketWho who);
125 virtual void UpdateExpectedInterval (
void);
127 virtual void ConfigureEnvironment ();
128 virtual void ConfigureProperties ();
158 uint16_t pacingSsRatio,
159 uint16_t pacingCaRatio,
161 bool paceInitialWindow,
162 uint32_t delAckMaxCount,
164 const std::string &desc)
172 m_isFullCwndSent (true),
175 m_pacingSsRatio (pacingSsRatio),
176 m_pacingCaRatio (pacingCaRatio),
177 m_ssThresh (ssThresh),
178 m_paceInitialWindow (paceInitialWindow),
179 m_delAckMaxCount (delAckMaxCount),
180 m_isConnAboutToEnd (false),
181 m_transmissionStartTime (
Seconds (0)),
182 m_expectedInterval (
Seconds (0)),
184 m_nextPacketInterval (
Seconds (0)),
193 TcpGeneralTest::ConfigureEnvironment ();
204 TcpGeneralTest::ConfigureProperties ();
275 uint8_t hasFin = flags & TcpHeader::FIN;
276 uint8_t hasAck = flags & TcpHeader::ACK;
277 if (hasFin && hasAck)
314 " errorMargin (s): " << errorMargin.
GetSeconds ());
322 if (!canPacketBeSent || (
m_curCwnd == 0))
338 NS_FATAL_ERROR (
"Drop on the queue; cannot validate congestion avoidance");
344 NS_FATAL_ERROR (
"Drop on the phy: cannot validate congestion avoidance");
367 uint16_t pacingSsRatio = 200;
368 uint16_t pacingCaRatio = 120;
371 uint32_t numPackets = 40;
372 uint32_t delAckMaxCount = 1;
373 TypeId tid = TcpNewReno::GetTypeId ();
374 uint32_t ssThresh = 1e9;
375 bool paceInitialWindow =
false;
376 std::string description;
378 description = std::string (
"Pacing case 1: Slow start only, no initial pacing");
379 AddTestCase (
new TcpPacingTest (
segmentSize,
packetSize, numPackets, pacingSsRatio, pacingCaRatio, ssThresh, paceInitialWindow, delAckMaxCount, tid, description), TestCase::QUICK);
381 paceInitialWindow =
true;
382 description = std::string (
"Pacing case 2: Slow start only, initial pacing");
383 AddTestCase (
new TcpPacingTest (
segmentSize,
packetSize, numPackets, pacingSsRatio, pacingCaRatio, ssThresh, paceInitialWindow, delAckMaxCount, tid, description), TestCase::QUICK);
387 description = std::string (
"Pacing case 3: Slow start, followed by transition to Congestion avoidance, no initial pacing");
388 paceInitialWindow =
false;
391 AddTestCase (
new TcpPacingTest (
segmentSize,
packetSize, numPackets, pacingSsRatio, pacingCaRatio, ssThresh, paceInitialWindow, delAckMaxCount, tid, description), TestCase::QUICK);
395 paceInitialWindow =
false;
398 description = std::string (
"Pacing case 4: Slow start only, no initial pacing, delayed ACKs");
399 AddTestCase (
new TcpPacingTest (
segmentSize,
packetSize, numPackets, pacingSsRatio, pacingCaRatio, ssThresh, paceInitialWindow, delAckMaxCount, tid, description), TestCase::QUICK);
401 paceInitialWindow =
true;
402 description = std::string (
"Pacing case 5: Slow start only, initial pacing, delayed ACKs");
403 AddTestCase (
new TcpPacingTest (
segmentSize,
packetSize, numPackets, pacingSsRatio, pacingCaRatio, ssThresh, paceInitialWindow, delAckMaxCount, tid, description), TestCase::QUICK);
405 description = std::string (
"Pacing case 6: Slow start, followed by transition to Congestion avoidance, no initial pacing, delayed ACKs");
406 paceInitialWindow =
false;
409 AddTestCase (
new TcpPacingTest (
segmentSize,
packetSize, numPackets, pacingSsRatio, pacingCaRatio, ssThresh, paceInitialWindow, delAckMaxCount, tid, description), TestCase::QUICK);
Test the behavior of TCP pacing.
uint32_t m_initialCwnd
Initial value of cWnd.
virtual void CWndTrace(uint32_t oldValue, uint32_t newValue)
uint16_t m_pacingSsRatio
Pacing factor during Slow Start.
virtual void RttTrace(Time oldTime, Time newTime)
virtual void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue)
uint32_t m_delAckMaxCount
Delayed ack count for receiver.
Time m_tracedRtt
Traced value of RTT, which may be different from the environment RTT in case of delayed ACKs.
uint32_t m_ssThresh
Slow start threshold.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
Time m_expectedInterval
Theoretical estimate of the time at which next packet is scheduled for transmission.
virtual void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet transmitted down to IP layer.
Time m_nextPacketInterval
Time maintained by Tx () trace about interval at which next packet will be sent.
uint32_t m_segmentSize
Segment size.
Time m_prevTxTime
Time when Tx was previously called.
Time m_transmissionStartTime
Time at which sender starts data transmission.
bool m_isConnAboutToEnd
True when sender receives a FIN/ACK from receiver.
uint16_t m_pacingCaRatio
Pacing factor during Congestion Avoidance.
uint32_t m_bytesInFlight
Current bytes in flight.
virtual void UpdateExpectedInterval(void)
Update the expected interval at which next packet will be sent.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
bool m_paceInitialWindow
True if initial window should be paced.
uint32_t m_packets
Number of packets.
EventId m_event
Check event.
uint32_t m_curCwnd
Current sender cWnd.
virtual void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who)
Packet received from IP layer.
virtual void QueueDrop(SocketWho who)
uint32_t m_packetsSent
Number of packets sent by sender so far.
TcpPacingTest(uint32_t segmentSize, uint32_t packetSize, uint32_t packets, uint16_t pacingSsRatio, uint16_t pacingCaRatio, uint32_t ssThresh, bool paceInitialWindow, uint32_t delAckMaxCount, const TypeId &congControl, const std::string &desc)
Constructor.
virtual void PhyDrop(SocketWho who)
bool m_isFullCwndSent
True if all bytes for that cWnd is sent and sender is waiting for an ACK.
bool m_initial
True on first run.
uint32_t m_packetSize
Size of the packets.
virtual void NormalClose(SocketWho who)
TestSuite for the behavior of TCP pacing.
An identifier for simulation events.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
General infrastructure for TCP testing.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
void SetDelAckMaxCount(SocketWho who, uint32_t count)
Forcefully set the delayed acknowledgement count.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
void SetAppPktSize(uint32_t pktSize)
Set app packet size.
void SetInitialCwnd(SocketWho who, uint32_t initialCwnd)
Forcefully set the initial cwnd.
void SetPaceInitialWindow(SocketWho who, bool paceWindow)
Enable or disable pacing of the initial window.
void SetMTU(uint32_t mtu)
MTU of the bottleneck link.
Time GetPropagationDelay() const
Get the channel Propagation Delay.
void SetAppPktInterval(Time pktInterval)
Interval between app-generated packet.
TypeId m_congControlTypeId
Congestion control.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssthresh.
void SetPacingStatus(SocketWho who, bool pacing)
Enable or disable pacing in the TCP socket.
void SetTransmitStart(Time startTime)
Set the initial time at which the application sends the first data packet.
void SetSegmentSize(SocketWho who, uint32_t segmentSize)
Forcefully set the segment size.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
Simulation virtual time values and global simulation resolution.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
a unique identifier for an interface.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report and abort if not.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TcpPacingTestSuite g_tcpPacingTest
Static variable for test initialization.
static const uint32_t packetSize