11#include "ns3/config.h"
13#include "ns3/simple-channel.h"
97 uint16_t pacingSsRatio,
98 uint16_t pacingCaRatio,
100 bool paceInitialWindow,
102 const TypeId& congControl,
103 const std::string& desc);
154 uint16_t pacingSsRatio,
155 uint16_t pacingCaRatio,
157 bool paceInitialWindow,
160 const std::string& desc)
168 m_isFullCwndSent(true),
171 m_pacingSsRatio(pacingSsRatio),
172 m_pacingCaRatio(pacingCaRatio),
173 m_ssThresh(ssThresh),
174 m_paceInitialWindow(paceInitialWindow),
175 m_delAckMaxCount(delAckMaxCount),
176 m_isConnAboutToEnd(false),
177 m_transmissionStartTime(
Seconds(0)),
178 m_expectedInterval(
Seconds(0)),
180 m_nextPacketInterval(
Seconds(0)),
276 if (hasFin && hasAck)
305 <<
" beyondInitialDataSegment "
306 << beyondInitialDataSegment);
315 "Packet delivery in slow start didn't match pacing rate");
317 << actualInterval.
GetSeconds() <<
" expected interval (s): "
320 <<
" errorMargin (s): " << errorMargin.
GetSeconds());
337 NS_FATAL_ERROR(
"Drop on the queue; cannot validate congestion avoidance");
343 NS_FATAL_ERROR(
"Drop on the phy: cannot validate congestion avoidance");
366 uint16_t pacingSsRatio = 200;
367 uint16_t pacingCaRatio = 120;
374 bool paceInitialWindow =
false;
375 std::string description;
377 description = std::string(
"Pacing case 1: Slow start only, no initial pacing");
388 TestCase::Duration::QUICK);
390 paceInitialWindow =
true;
391 description = std::string(
"Pacing case 2: Slow start only, initial pacing");
402 TestCase::Duration::QUICK);
406 description = std::string(
"Pacing case 3: Slow start, followed by transition to Congestion "
407 "avoidance, no initial pacing");
408 paceInitialWindow =
false;
421 TestCase::Duration::QUICK);
425 paceInitialWindow =
false;
429 std::string(
"Pacing case 4: Slow start only, no initial pacing, delayed ACKs");
440 TestCase::Duration::QUICK);
442 paceInitialWindow =
true;
443 description = std::string(
"Pacing case 5: Slow start only, initial pacing, delayed ACKs");
454 TestCase::Duration::QUICK);
456 description = std::string(
"Pacing case 6: Slow start, followed by transition to Congestion "
457 "avoidance, no initial pacing, delayed ACKs");
458 paceInitialWindow =
false;
471 TestCase::Duration::QUICK);
Test the behavior of TCP pacing.
uint32_t m_initialCwnd
Initial value of cWnd.
void CWndTrace(uint32_t oldValue, uint32_t newValue) override
Tracks the congestion window changes.
uint16_t m_pacingSsRatio
Pacing factor during Slow Start.
void ConfigureProperties() override
Change the configuration of the socket properties.
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.
Time m_expectedInterval
Theoretical estimate of the time at which next packet is scheduled for transmission.
void RttTrace(Time oldTime, Time newTime) override
Rtt changes.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
Time m_nextPacketInterval
Time maintained by Tx () trace about interval at which next packet will be sent.
void NormalClose(SocketWho who) override
Socket closed normally.
uint32_t m_segmentSize
Segment size.
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet received from IP layer.
void PhyDrop(SocketWho who) override
Link drop.
Time m_prevTxTime
Time when Tx was previously called.
void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue) override
Bytes in flight changes.
Time m_transmissionStartTime
Time at which sender starts data transmission.
void QueueDrop(SocketWho who) override
Drop on the queue.
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.
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.
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.
bool m_isFullCwndSent
True if all bytes for that cWnd is sent and sender is waiting for an ACK.
void ConfigureEnvironment() override
Change the configuration of the environment.
virtual void UpdateExpectedInterval()
Update the expected interval at which next packet will be sent.
bool m_initial
True on first run.
uint32_t m_packetSize
Size of the packets.
TestSuite for the behavior of TCP pacing.
An identifier for simulation events.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Smart pointer class similar to boost::intrusive_ptr.
static Time Now()
Return the current simulation virtual time.
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.
virtual void ConfigureProperties()
Change the configuration of the socket properties.
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.
virtual void ConfigureEnvironment()
Change the configuration of the environment.
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.
static TypeId GetTypeId()
Get the type ID.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
Simulation virtual time values and global simulation resolution.
double GetSeconds() 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 ",...
#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
Packet size generated at the AP.