14#include "ns3/config.h"
16#include "ns3/tcp-rate-ops.h"
17#include "ns3/tcp-tx-buffer.h"
18#include "ns3/tcp-tx-item.h"
48 std::string testName);
51 void DoRun()
override;
96 for (uint8_t i = 0; i < 100; ++i)
105 for (uint8_t i = 0; i < 100; ++i)
116 for (uint8_t i = 0; i < 100; ++i)
132 "SKB should have delivered equal to current value of total delivered");
134 if (isStartOfTransmission)
138 "SKB should have updated the delivered time to current value");
144 "SKB should have updated the delivered time to current value");
158 "SKB should have delivered time as Time::Max ()");
164 "Socket should not be applimited");
170 "Socket should be applimited");
203 .AddConstructor<MimicCongControl>()
204 .SetGroupName(
"Internet");
230 std::vector<uint32_t>& toDrop);
304 std::vector<uint32_t>& toDrop)
306 m_sackEnabled(sackEnabled),
316 s->SetCongestionControlAlgorithm(
m_congCtl);
385 "FirstSentTime should be current time when bytes inflight is zero");
388 "Delivered time should be current time when bytes inflight is zero");
392 "Total delivered should not be lesser than previous values");
406 "RateSample should not update due to DupAcks");
414 "RateSample should not update as nothing is acked or sacked");
444 void DoRun()
override;
481 "TcpRateSampleUpdated",
499 "Delivered data is not equal to expected delivered");
508 "AckedSacked bytes is not equal to expected AckedSacked bytes");
524 for (uint8_t i = 0; i < 10; ++i)
529 m_rateOps->SkbSent(outItem, isStartOfTransmission);
534 for (uint8_t i = 1; i <= 2; ++i)
568 for (uint8_t i = 6; i <= 10; ++i)
599 "Testing SkbDelivered and SkbSent"),
600 TestCase::Duration::QUICK);
606 "Testing SkbDelivered and SkbSent with app limited data"),
607 TestCase::Duration::QUICK);
609 std::vector<uint32_t> toDrop;
610 toDrop.push_back(4001);
615 TestCase::Duration::QUICK);
621 TestCase::Duration::QUICK);
622 toDrop.push_back(4001);
627 TestCase::Duration::QUICK);
633 TestCase::Duration::QUICK);
637 "Checking rate sample values with arbitrary SACK Block"),
638 TestCase::Duration::QUICK);
642 "Checking rate sample values with arbitrary SACK Block"),
643 TestCase::Duration::QUICK);
Behaves as NewReno except HasCongControl returns true.
static TypeId GetTypeId()
Get the type ID.
bool HasCongControl() const override
Returns true when Congestion Control Algorithm implements CongControl.
The TcpRateLinux Basic Test.
void SkbDelivered(TcpTxItem *skb)
Deliver an application packet.
uint32_t m_delivered
Number of segments delivered.
void SendSkb(TcpTxItem *skb)
Send an application packet.
uint32_t m_segmentSize
Segment size.
TcpRateLinux m_rateOps
Rate information for TCP.
Time m_deliveredTime
Last time of a delivery.
uint32_t m_testCase
Test case type.
uint32_t m_inFlight
Number of packets in-flight.
uint32_t m_cWnd
Congestion window size.
TcpRateLinuxBasicTest(uint32_t cWnd, SequenceNumber32 tailSeq, SequenceNumber32 nextTx, uint32_t testCase, std::string testName)
Constructor.
SequenceNumber32 m_tailSeq
Tail sequence number.
void DoRun() override
Implementation to actually run this TestCase.
std::vector< TcpTxItem * > m_skbs
Application packets.
SequenceNumber32 m_nextTx
Tx next sequence number.
The TcpRateLinuxWithBufferTest tests rate sample functionality with arbitrary SACK scenario.
uint32_t m_expectedAckedSacked
Amount of expected acked sacked data.
void DoRun() override
Implementation to actually run this TestCase.
void TestWithStraightAcks()
Test with acks without drop.
TcpTxBuffer m_txBuf
Tcp Tx buffer.
virtual void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate)
Track the rate value of TcpRateLinux.
TcpRateLinuxWithBufferTest(uint32_t segmentSize, std::string desc)
Constructor.
virtual void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample)
Track the rate sample value of TcpRateLinux.
void TestWithSackBlocks()
Test with arbitrary SACK scenario.
Ptr< TcpRateOps > m_rateOps
Rate operations.
uint32_t m_expectedDelivered
Amount of expected delivered data.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
uint32_t m_segmentSize
Segment size.
The TcpRateLinux Test uses sender-receiver model to test its functionality.
void PktDropped(const Ipv4Header &ipH, const TcpHeader &tcpH, Ptr< const Packet > p)
Called when a packet is dropped.
TcpRateLinuxWithSocketsTest(const std::string &desc, bool sackEnabled, std::vector< uint32_t > &toDrop)
Constructor.
void Rx(const Ptr< const Packet > p, const TcpHeader &h, SocketWho who) override
Receive a packet.
Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node) override
Create and install the socket to install on the sender.
bool m_isDupAck
Whether ACK is DupAck.
void BytesInFlightTrace(uint32_t oldValue, uint32_t newValue) override
Track the bytes in flight.
void ConfigureEnvironment() override
Configure the test.
void FinalChecks() override
Do the final checks.
void RateSampleUpdatedTrace(const TcpRateLinux::TcpRateSample &sample) override
Track the rate sample value of TcpRateLinux.
SequenceNumber32 m_lastAckRecv
Last ACK received.
TcpRateLinux::TcpRateSample m_prevRateSample
Previous rate sample.
std::vector< uint32_t > m_toDrop
List of SequenceNumber to drop.
Ptr< ErrorModel > CreateReceiverErrorModel() override
Create a receiver error model.
uint32_t m_bytesInFlight
Bytes inflight.
bool m_sackEnabled
Sack Variable.
void RateUpdatedTrace(const TcpRateLinux::TcpRateConnection &rate) override
Track the rate value of TcpRateLinux.
TcpRateLinux::TcpRateConnection m_prevRate
Previous rate.
Ptr< MimicCongControl > m_congCtl
Dummy congestion control.
the TestSuite for the TcpRateLinux test case
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
General infrastructure for TCP testing.
virtual Ptr< TcpSocketMsgBase > CreateSenderSocket(Ptr< Node > node)
Create and install the socket to install on the sender.
void SetPropagationDelay(Time propDelay)
Propagation delay of the bottleneck link.
void SetAppPktCount(uint32_t pktCount)
Set app packet count.
SocketWho
Used as parameter of methods, specifies on what node the caller is interested (e.g.
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.
The NewReno implementation.
std::pair< SequenceNumber32, SequenceNumber32 > SackBlock
SACK block definition.
Linux management and generation of Rate information for TCP.
void SkbDelivered(TcpTxItem *skb) override
Update the Rate information after an item is received.
void SkbSent(TcpTxItem *skb, bool isStartOfTransmission) override
Put the rate information inside the sent skb.
void CalculateAppLimited(uint32_t cWnd, uint32_t in_flight, uint32_t segmentSize, const SequenceNumber32 &tailSeq, const SequenceNumber32 &nextTx, const uint32_t lostOut, const uint32_t retransOut) override
If a gap is detected between sends, it means we are app-limited.
virtual void SkbDelivered(TcpTxItem *skb)=0
Update the Rate information after an item is received.
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer.
void SetSegmentSize(uint32_t segmentSize)
Set the segment size.
void SetDupAckThresh(uint32_t dupAckThresh)
Set the DupAckThresh.
TcpTxItem * CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data from the range [seq, seq+numBytes) into a packet.
uint32_t Update(const TcpOptionSack::SackList &list, const Callback< void, TcpTxItem * > &sackedCb=m_nullCb)
Update the scoreboard.
uint32_t BytesInFlight() const
Return total bytes in flight.
void DiscardUpTo(const SequenceNumber32 &seq, const Callback< void, TcpTxItem * > &beforeDelCb=m_nullCb)
Discard data up to but not including this sequence number.
void SetHeadSequence(const SequenceNumber32 &seq)
Set the head sequence of the buffer.
Item that encloses the application packet and some flags for it.
uint32_t GetSeqSize() const
Get the size in the sequence number space.
RateInformation & GetRateInformation()
Get (to modify) the Rate Information of this item.
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.
static Time Max()
Maximum representable Time Not to be confused with Max(Time,Time).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
void SetDefault(std::string name, const AttributeValue &value)
#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.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number.
#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_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
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.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Information about the connection rate.
Time m_deliveredTime
Simulator time when m_delivered was last updated.
uint64_t m_delivered
The total amount of data in bytes delivered so far.
Time m_firstSentTime
The send time of the packet that was most recently marked as delivered.
uint32_t m_ackedSacked
The amount of data acked and sacked in the last received ack.
static TcpRateOpsTestSuite g_TcpRateOpsTestSuite
Static variable for test initialization.