20 #include "ns3/config.h"
23 #include "ns3/simple-channel.h"
24 #include "ns3/tcp-header.h"
25 #include "ns3/tcp-linux-reno.h"
65 uint32_t expectedCwnd,
67 const std::string& desc);
70 void CWndTrace(uint32_t oldValue, uint32_t newValue)
override;
74 void ConfigureEnvironment()
override;
75 void ConfigureProperties()
override;
76 void DoTeardown()
override;
97 uint32_t expectedCwnd,
99 const std::string& desc)
105 m_initialCwnd(initialCwnd),
106 m_delayedAck(delayedAck),
108 m_expectedCwnd(expectedCwnd)
116 TcpGeneralTest::ConfigureEnvironment();
125 TcpGeneralTest::ConfigureProperties();
148 uint32_t segSize =
GetSegSize(TcpGeneralTest::SENDER);
149 uint32_t increase = newValue - oldValue;
157 "The first update is for ACK of SYN and should initialize cwnd");
171 <<
"achieving a value of " << newValue);
191 "Congestion window did not evolve as expected");
192 TcpGeneralTest::DoTeardown();
227 uint32_t initialCwnd,
228 uint32_t initialSSThresh,
230 uint32_t expectedCwnd,
232 const std::string& desc);
235 void CWndTrace(uint32_t oldValue, uint32_t newValue)
override;
263 uint32_t initialCwnd,
264 uint32_t initialSSThresh,
266 uint32_t expectedCwnd,
268 const std::string& desc)
273 m_initialCwnd(initialCwnd),
274 m_initialSSThresh(initialSSThresh),
275 m_delayedAck(delayedAck),
277 m_expectedCwnd(expectedCwnd),
280 m_inCongAvoidance(false),
281 m_inSlowStartPhase(true)
289 TcpGeneralTest::ConfigureEnvironment();
298 TcpGeneralTest::ConfigureProperties();
316 "The first update is for ACK of SYN and should initialize cwnd");
341 NS_FATAL_ERROR(
"Drop on the queue; cannot validate congestion avoidance");
347 NS_FATAL_ERROR(
"Drop on the phy: cannot validate congestion avoidance");
367 "Congestion window did not evolve as expected");
368 TcpGeneralTest::DoTeardown();
382 TypeId cong_control_type = TcpLinuxReno::GetTypeId();
414 "Slow Start MSS = 524, socket send size = 524, delack = 1 " +
428 "Slow Start MSS = 524, socket send size = 524, delack = 2 " +
444 "Slow Start MSS = 1500, socket send size = 524, delack = 1 " +
457 "Slow Start MSS = 1500, socket send size = 524, delack = 2 " +
498 "Congestion Avoidance MSS = 524, socket send size = 524, delack = 1 " +
528 "Congestion Avoidance MSS = 524, socket send size = 524, delack = 2 " +
546 "Congestion Avoidance MSS = 1500, socket send size = 1500, delack = 1 " +
559 "Congestion Avoidance MSS = 1500, socket send size = 1500, delack = 2 " +
This unit test checks that the slow start and congestion avoidance behavior matches Linux behavior as...
bool m_inCongAvoidance
True if in congestion avoidance.
uint32_t m_initialSSThresh
Initial slow start threshold (bytes)
uint32_t m_segmentSize
Segment size.
bool m_inSlowStartPhase
True if in slow start.
uint32_t m_delayedAck
Delayed Acknowledgement.
uint32_t m_packetSize
Size of the packets used in socket writes.
bool m_initial
True on first run.
void DoTeardown() override
Teardown the TCP test.
void CWndTrace(uint32_t oldValue, uint32_t newValue) override
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet received from IP layer.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
uint32_t m_packets
Number of packets to send to the socket.
uint32_t m_expectedCwnd
Expected final cWnd value.
void PhyDrop(SocketWho who) override
uint32_t m_lastCwnd
Last cWnd value reported.
uint32_t m_increment
Congestion window increment.
void ConfigureProperties() override
Change the configuration of the socket properties.
TcpLinuxRenoCongAvoidTest(uint32_t segmentSize, uint32_t packetSize, uint32_t packets, uint32_t initialCwnd, uint32_t initialSSThresh, uint32_t delayedAck, uint32_t expectedCwnd, TypeId &congControl, const std::string &desc)
Constructor.
void ConfigureEnvironment() override
Change the configuration of the environment.
uint32_t m_initialCwnd
Initial congestion window (segments)
void QueueDrop(SocketWho who) override
This unit test checks that the slow start and congestion avoidance behavior matches Linux behavior as...
bool m_initial
First cycle flag.
void Tx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet transmitted down to IP layer.
uint32_t m_lastCwnd
Last cWnd value reported.
void DoTeardown() override
Teardown the TCP test.
uint32_t m_initialCwnd
Initial congestion window.
uint32_t m_delayedAck
Delayed Acknowledgement.
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Packet received from IP layer.
void ConfigureProperties() override
Change the configuration of the socket properties.
void ConfigureEnvironment() override
Change the configuration of the environment.
void CWndTrace(uint32_t oldValue, uint32_t newValue) override
TcpLinuxRenoSSTest(uint32_t segmentSize, uint32_t packetSize, uint32_t packets, uint32_t initialCwnd, uint32_t delayedAck, uint32_t expectedCwnd, TypeId &congControl, const std::string &desc)
Constructor.
uint32_t m_packetSize
Packet size.
void QueueDrop(SocketWho who) override
uint32_t m_expectedCwnd
Expected final cWnd value.
uint32_t m_packets
Packet counter.
uint32_t m_segmentSize
Segment size.
void PhyDrop(SocketWho who) override
TestSuite for the behavior of Linux Reno.
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.
uint32_t GetInitialSsThresh(SocketWho who)
Get the initial slow start threshold.
void SetMTU(uint32_t mtu)
MTU of the bottleneck link.
uint32_t GetSegSize(SocketWho who)
Get the segment size of the node specified.
TypeId m_congControlTypeId
Congestion control.
void SetInitialSsThresh(SocketWho who, uint32_t initialSsThresh)
Forcefully set the initial ssthresh.
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.
a unique identifier for an interface.
std::string GetName() const
Get the name.
#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_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#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 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 TcpLinuxRenoTestSuite g_tcpLinuxRenoTestSuite
Static variable for test initialization.
static const uint32_t packetSize
Packet size generated at the AP.