22 #include "ns3/tcp-congestion-ops.h" 23 #include "ns3/tcp-socket-base.h" 24 #include "ns3/tcp-bic.h" 51 uint32_t segmentsAcked,
53 const std::string &name);
56 virtual void DoRun (
void);
68 void ExecuteTest (
void);
81 uint32_t segmentsAcked,
83 const std::string &name)
86 m_segmentSize (segmentSize),
87 m_ssThresh (ssThresh),
88 m_segmentsAcked (segmentsAcked),
89 m_lastMaxCwnd (lastMaxCwnd)
96 m_state = CreateObject<TcpSocketState> ();
104 Simulator::Destroy ();
117 "Bic has not increment cWnd");
124 "Bic has modified cWnd");
137 cong->
GetAttribute (
"BinarySearchCoefficient", bsCoeff);
145 if (segCwnd < lowWindow.
Get ())
153 if (midPt > wMax.
Get ())
156 ackCnt = segCwnd / wMax.
Get ();
160 ackCnt = (segCwnd * smoothPart.
Get ()) / bsCoeff.
Get ();
165 ackCnt = segCwnd / midPt;
173 ackCnt = (segCwnd * smoothPart.
Get ()) / bsCoeff.
Get ();
183 ackCnt = segCwnd / wMax.
Get ();
209 uint32_t segmentSize,
211 uint32_t lastMaxCwnd,
212 const std::string &name);
215 virtual void DoRun (
void);
230 uint32_t segmentSize,
232 uint32_t lastMaxCwnd,
233 const std::string &name)
236 m_segmentSize (segmentSize),
237 m_fastConvergence (fastConvergence),
238 m_lastMaxCwnd (lastMaxCwnd)
245 m_state = CreateObject<TcpSocketState> ();
252 Simulator::Destroy ();
271 uint32_t lastMaxCwnd, ssThresh;
275 lastMaxCwnd = beta.
Get () * segCwnd;
277 "Bic has not updated lastMaxCwnd during fast convergence");
281 lastMaxCwnd = segCwnd;
283 "Bic has not reset lastMaxCwnd to current cwnd (in segments)");
287 if (segCwnd < lowWindow.
Get ())
291 "Bic has not updated ssThresh when cWnd less than lowWindow");
297 "Bic has not updated ssThresh when cWnd greater than lowWindow");
314 "Bic increment test: under lowCwnd & enough ACKs received"),
317 "Bic increment test: under lowCwnd but not enough ACKs received"),
320 "Bic increment test: linear increase when distance exceeds S_max"),
323 "Bic increment test: binary search increase with smooth part"),
326 "Bic increment test: binary search increase"),
329 "Bic increment test: slow start AMD linear increase"),
332 "Bic increment test: slow start but not enough ACKs received"),
335 "Bic increment test: linear incrase but not enough ACKs received"),
339 "Bic decrement test: fast convergence & cwnd less than lowWindow"),
342 "Bic decrement test: not in fast convergence & cwnd less than lowWindow"),
345 "Bic decrement test: not in fast convergence & cwnd greater than lowWindow"),
void ExecuteTest(void)
Execute the test.
AttributeValue implementation for Boolean.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t m_lastMaxCwnd
Last maximum cWnd.
uint32_t Update(Ptr< TcpSocketState > tcb)
Update the TCP socket state.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
uint32_t m_segmentSize
Segment size.
TcpBicDecrementTest(uint32_t cWnd, uint32_t segmentSize, BooleanValue fastConvergence, uint32_t lastMaxCwnd, const std::string &name)
Constructor.
uint32_t m_cWnd
Congestion window.
virtual void DoRun(void)
Implementation to actually run this TestCase.
uint32_t m_cWnd
Congestion window.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
static TcpBicTestSuite g_tcpBicTest
Static variable for test initialization.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
uint32_t m_ssThresh
Slow Start Threshold.
Testing the congestion avoidance increment on TcpBic.
Hold an unsigned integer type.
#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.
TcpBicIncrementTest(uint32_t cWnd, uint32_t segmentSize, uint32_t ssThresh, uint32_t segmentsAcked, uint32_t lastMaxCwnd, const std::string &name)
Constructor.
uint32_t m_segmentSize
Segment size.
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
uint32_t m_segmentSize
Segment size.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_lastMaxCwnd
Last max Cwnd.
Testing the congestion avoidance decrement on TcpBic.
TracedValue< uint32_t > m_cWnd
Congestion window.
void ExecuteTest(void)
Execute the test.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance algorithm implementation.
T Get(void) const
Get the underlying value.
Time Seconds(double value)
Construct a Time in the indicated unit.
uint32_t m_segmentsAcked
Number of segments acked.
Ptr< TcpSocketState > m_state
TCP socket state.
uint32_t m_lastMaxCwnd
Last max Cwnd.
This test suite implements a Unit Test.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
BooleanValue m_fastConvergence
Fast convergence.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
Ptr< TcpSocketState > m_state
TCP socket state.