A Discrete-Event Network Simulator
API
tbf-queue-disc-test-suite.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017 Kungliga Tekniska Högskolan
4  * 2017 Universita' degli Studi di Napoli Federico II
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Surya Seetharaman <suryaseetharaman.9@gmail.com>
20  * Stefano Avallone <stavallo@unina.it>
21  */
22 
23 #include "ns3/test.h"
24 #include "ns3/tbf-queue-disc.h"
25 #include "ns3/packet.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/string.h"
28 #include "ns3/double.h"
29 #include "ns3/log.h"
30 #include "ns3/simulator.h"
31 #include "ns3/node-container.h"
32 #include "ns3/simple-net-device.h"
33 #include "ns3/simple-channel.h"
34 #include "ns3/traffic-control-layer.h"
35 #include "ns3/config.h"
36 
37 using namespace ns3;
38 
46 public:
53  TbfQueueDiscTestItem (Ptr<Packet> p, const Address & addr);
54  virtual ~TbfQueueDiscTestItem ();
55  virtual void AddHeader (void);
56  virtual bool Mark (void);
57 
58 private:
71 };
72 
74  : QueueDiscItem (p, addr, 0)
75 {
76 }
77 
79 {
80 }
81 
82 void
84 {
85 }
86 
87 bool
89 {
90  return false;
91 }
92 
100 {
101 public:
103  virtual void DoRun (void);
104 private:
111  void Enqueue (Ptr<TbfQueueDisc> queue, Address dest, uint32_t size);
118  void DequeueAndCheck (Ptr<TbfQueueDisc> queue, bool flag, std::string printStatement);
123  void RunTbfTest (QueueSizeUnit mode);
124 };
125 
127  : TestCase ("Sanity check on the TBF queue implementation")
128 {
129 }
130 
131 void
133 {
134  uint32_t pktSize = 1500;
135  // 1 for packets; pktSize for bytes
136  uint32_t modeSize = 1;
137  uint32_t qSize = 4;
138  uint32_t burst = 6000;
139  uint32_t mtu = 0;
140  DataRate rate = DataRate ("6KB/s");
141  DataRate peakRate = DataRate ("0KB/s");
142 
143  Ptr<TbfQueueDisc> queue = CreateObject<TbfQueueDisc> ();
144 
145  // test 1: Simple Enqueue/Dequeue with verification of attribute setting
146  /* 1. There is no second bucket since "peakRate" is set to 0.
147  2. A simple enqueue of five packets, each containing 1500B is followed by
148  the dequeue those five packets.
149  3. The subtraction of tokens from the first bucket to send out each of the
150  five packets is monitored and verified.
151  Note : The number of tokens in the first bucket is full at the beginning.
152  With the dequeuing of each packet, the number of tokens keeps decreasing.
153  So packets are dequeued as long as there are enough tokens in the bucket. */
154 
155  if (mode == QueueSizeUnit::BYTES)
156  {
157  modeSize = pktSize;
158  qSize = qSize * modeSize;
159  }
160 
161  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
162  true, "Verify that we can actually set the attribute MaxSize");
163  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
164  "Verify that we can actually set the attribute Burst");
165  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
166  "Verify that we can actually set the attribute Mtu");
167  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
168  "Verify that we can actually set the attribute Rate");
169  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
170  "Verify that we can actually set the attribute PeakRate");
171 
172  Address dest;
173 
174  Ptr<Packet> p1, p2, p3, p4, p5;
175  p1 = Create<Packet> (pktSize);
176  p2 = Create<Packet> (pktSize);
177  p3 = Create<Packet> (pktSize);
178  p4 = Create<Packet> (pktSize);
179  p5 = Create<Packet> (pktSize);
180 
181  queue->Initialize ();
182  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be no packets in there");
183  queue->Enqueue (Create<TbfQueueDiscTestItem> (p1, dest));
184  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
185  queue->Enqueue (Create<TbfQueueDiscTestItem> (p2, dest));
186  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
187  queue->Enqueue (Create<TbfQueueDiscTestItem> (p3, dest));
188  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in there");
189  queue->Enqueue (Create<TbfQueueDiscTestItem> (p4, dest));
190  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize, "There should be four packets in there");
191  queue->Enqueue (Create<TbfQueueDiscTestItem> (p5, dest));
192  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 4 * modeSize,
193  "There should still be four packets in there as this enqueue cannot happen since QueueLimit will be exceeded");
194 
195  Ptr<QueueDiscItem> item;
196  NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst, "The first token bucket should be full");
197  item = queue->Dequeue ();
198  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the first packet");
199  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 3 * modeSize, "There should be three packets in there");
200  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p1->GetUid (), "was this the first packet ?");
201  NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (1 * pktSize),
202  "The number of tokens in the first bucket should be one pktSize lesser");
203 
204  item = queue->Dequeue ();
205  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the second packet");
206  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 2 * modeSize, "There should be two packets in there");
207  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p2->GetUid (), "Was this the second packet ?");
208  NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (2 * pktSize),
209  "The number of tokens in the first bucket should be two pktSizes lesser");
210 
211  item = queue->Dequeue ();
212  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the third packet");
213  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 1 * modeSize, "There should be one packet in there");
214  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p3->GetUid (), "Was this the third packet ?");
215  NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (3 * pktSize),
216  "The number of tokens in the first bucket should be three pktSizes lesser");
217 
218  item = queue->Dequeue ();
219  NS_TEST_EXPECT_MSG_EQ ((item != 0), true, "I want to remove the fourth packet");
220  NS_TEST_EXPECT_MSG_EQ (queue->GetCurrentSize ().GetValue (), 0 * modeSize, "There should be zero packet in there");
221  NS_TEST_EXPECT_MSG_EQ (item->GetPacket ()->GetUid (), p4->GetUid (), "Was this the fourth packet ?");
222  NS_TEST_EXPECT_MSG_EQ (queue->GetFirstBucketTokens (), burst - (4 * pktSize),
223  "The number of tokens in the first bucket should be four pktSizes lesser");
224 
225  // test 2 : When DataRate == FirstBucketTokenRate; packets should pass smoothly.
226  queue = CreateObject<TbfQueueDisc> ();
227  qSize = 10;
228  pktSize = 1000;
229  burst = 10000;
230  mtu = 1000;
231  rate = DataRate ("10KB/s");
232  peakRate = DataRate ("100KB/s");
233  uint32_t nPkt = qSize;
234 
235  if (mode == QueueSizeUnit::BYTES)
236  {
237  modeSize = pktSize;
238  qSize = qSize * modeSize;
239  }
240 
241  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
242  true, "Verify that we can actually set the attribute MaxSize");
243  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
244  "Verify that we can actually set the attribute Burst");
245  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
246  "Verify that we can actually set the attribute Mtu");
247  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
248  "Verify that we can actually set the attribute Rate");
249  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
250  "Verify that we can actually set the attribute PeakRate");
251 
252  queue->Initialize ();
253  double delay = 0.09;
254  for (uint32_t i = 1; i <= nPkt; i++)
255  {
256  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &TbfQueueDiscTestCase::Enqueue, this, queue, dest, pktSize);
257  }
258  delay = 0.1;
259  for (uint32_t i = 1; i <= nPkt; i++)
260  {
261  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &TbfQueueDiscTestCase::DequeueAndCheck, this,
262  queue, true, "No packet should be blocked");
263  }
264  Simulator::Stop (Seconds (1));
265  Simulator::Run ();
266 
267  // test 3 : When DataRate >>> FirstBucketTokenRate; some packets should get blocked and waking of queue should get scheduled.
268  /* 10 packets are enqueued and then dequeued. Since the token rate is less than the data rate, the last packet i.e the 10th
269  packet gets blocked and waking of queue is scheduled after a time when enough tokens will be available. At that time the
270  10th packet passes through. */
271  queue = CreateObject<TbfQueueDisc> ();
272 
273  Config::SetDefault ("ns3::QueueDisc::Quota", UintegerValue (1));
274  NodeContainer nodesA;
275  nodesA.Create (2);
276  Ptr<SimpleNetDevice> txDevA = CreateObject<SimpleNetDevice> ();
277  nodesA.Get (0)->AddDevice (txDevA);
278  Ptr<SimpleNetDevice> rxDevA = CreateObject<SimpleNetDevice> ();
279  nodesA.Get (1)->AddDevice (rxDevA);
280  Ptr<SimpleChannel> channelA = CreateObject<SimpleChannel> ();
281  txDevA->SetChannel (channelA);
282  rxDevA->SetChannel (channelA);
283  txDevA->SetNode (nodesA.Get (0));
284  rxDevA->SetNode (nodesA.Get (1));
285 
286  dest = txDevA->GetAddress ();
287 
288  Ptr<TrafficControlLayer> tcA = CreateObject<TrafficControlLayer> ();
289  nodesA.Get (0)->AggregateObject (tcA);
290  tcA->SetRootQueueDiscOnDevice (txDevA, queue);
291  tcA->Initialize ();
292 
293  burst = 5000;
294  mtu = 1000;
295  rate = DataRate ("5KB/s");
296  peakRate = DataRate ("100KB/s");
297 
298  if (mode == QueueSizeUnit::BYTES)
299  {
300  modeSize = pktSize;
301  qSize = qSize * modeSize;
302  }
303 
304  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
305  true, "Verify that we can actually set the attribute MaxSize");
306  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
307  "Verify that we can actually set the attribute Burst");
308  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
309  "Verify that we can actually set the attribute Mtu");
310  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
311  "Verify that we can actually set the attribute Rate");
312  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
313  "Verify that we can actually set the attribute PeakRate");
314 
315  delay = 0.09;
316  for (uint32_t i = 1; i <= nPkt; i++)
317  {
318  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &TbfQueueDiscTestCase::Enqueue, this, queue, dest, pktSize);
319  }
320  delay = 0.1;
321  for (uint32_t i = 1; i <= nPkt; i++)
322  {
323  if (i == 10)
324  {
325  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &TbfQueueDiscTestCase::DequeueAndCheck, this,
326  queue, false, "10th packet should be blocked");
327  }
328  else
329  {
330  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &TbfQueueDiscTestCase::DequeueAndCheck, this,
331  queue, true, "This packet should not be blocked");
332  }
333  }
334  Simulator::Stop (Seconds (1.3));
335  Simulator::Run ();
336 
337  // test 4 : This test checks the peakRate control of packet dequeue, when DataRate < FirstBucketTokenRate.
338  /* 10 packets each of size 1000 bytes are enqueued followed by
339  their dequeue. The data rate (25 KB/s) is not sufficiently higher than the btokens rate (15 KB/s), so that in
340  the startup phase the first bucket is not empty. Hence when adequate tokens are present in the second (peak) bucket,
341  the packets get transmitted, otherwise they are blocked. So basically the transmission of packets falls under the
342  regulation of the second bucket since first bucket will always have excess tokens. TBF does not let all
343  the packets go smoothly without any control just because there are excess tokens in the first bucket. */
344  queue = CreateObject<TbfQueueDisc> ();
345 
346  Config::SetDefault ("ns3::QueueDisc::Quota", UintegerValue (1));
347  NodeContainer nodesB;
348  nodesB.Create (2);
349  Ptr<SimpleNetDevice> txDevB = CreateObject<SimpleNetDevice> ();
350  nodesB.Get (0)->AddDevice (txDevB);
351  Ptr<SimpleNetDevice> rxDevB = CreateObject<SimpleNetDevice> ();
352  nodesB.Get (1)->AddDevice (rxDevB);
353  Ptr<SimpleChannel> channelB = CreateObject<SimpleChannel> ();
354  txDevB->SetChannel (channelB);
355  rxDevB->SetChannel (channelB);
356  txDevB->SetNode (nodesB.Get (0));
357  rxDevB->SetNode (nodesB.Get (1));
358 
359  dest = txDevB->GetAddress ();
360 
361  Ptr<TrafficControlLayer> tcB = CreateObject<TrafficControlLayer> ();
362  nodesB.Get (0)->AggregateObject (tcB);
363  tcB->SetRootQueueDiscOnDevice (txDevB, queue);
364  tcB->Initialize ();
365 
366  burst = 15000;
367  mtu = 1000;
368  pktSize = 1000;
369  rate = DataRate ("15KB/s");
370  peakRate = DataRate ("20KB/s");
371 
372  if (mode == QueueSizeUnit::BYTES)
373  {
374  modeSize = pktSize;
375  qSize = qSize * modeSize;
376  }
377 
378  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("MaxSize", QueueSizeValue (QueueSize (mode, qSize))),
379  true, "Verify that we can actually set the attribute MaxSize");
380  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Burst", UintegerValue (burst)), true,
381  "Verify that we can actually set the attribute Burst");
382  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Mtu", UintegerValue (mtu)), true,
383  "Verify that we can actually set the attribute Mtu");
384  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("Rate", DataRateValue (rate)), true,
385  "Verify that we can actually set the attribute Rate");
386  NS_TEST_EXPECT_MSG_EQ (queue->SetAttributeFailSafe ("PeakRate", DataRateValue (peakRate)), true,
387  "Verify that we can actually set the attribute PeakRate");
388 
389  queue->Initialize ();
390  delay = 0.04;
391  for (uint32_t i = 1; i <= nPkt; i++)
392  {
393  Simulator::Schedule (Time (Seconds ((i + 1) * delay)), &TbfQueueDiscTestCase::Enqueue, this, queue, dest, pktSize);
394  }
395 
396  // The pattern being checked is a pattern of dequeue followed by blocked. The delay between enqueues is not sufficient
397  // to allow ptokens to refill befor the next dequeue. The first enqueue is at 1.08s in the future, and the attempted
398  // dequeue is at 1.10s in the future. The first dequeue will always succeed. The second enqueue is 1.12s and attempted
399  // dequeue is at 1.14s in the future, but the last dequeue was 0.04s prior; only 800 tokens can be refilled in 0.04s
400  // at a peak rate of 20Kbps. The actual dequeue occurs at 0.01s further into the future when ptokens refills to 1000.
401  // To repeat the pattern, odd-numbered dequeue events should be spaced at intervals of at least 100ms, and the
402  // even-numbered dequeue events (that block) should be 0.04s (delay) following the last odd-numbered dequeue event.
403  double nextDelay = (2 * delay) + 0.02; // 20ms after first enqueue to attempt the first dequeue;
404  for (uint32_t i = 1; i <= nPkt; i++)
405  {
406  if (i % 2 == 1)
407  {
408  Simulator::Schedule (Seconds (nextDelay), &TbfQueueDiscTestCase::DequeueAndCheck, this,
409  queue, true, "1st packet should not be blocked");
410  nextDelay += 0.04;
411  }
412  else
413  {
414  Simulator::Schedule (Seconds (nextDelay), &TbfQueueDiscTestCase::DequeueAndCheck, this,
415  queue, false, "This packet should be blocked");
416  nextDelay += 0.06; // Need 0.04 + 0.06 seconds to allow the next packet to be dequeued without block
417  }
418  }
419  Simulator::Stop (Seconds (0.55));
420  Simulator::Run ();
421 
422 }
423 
424 void
426 {
427  queue->Enqueue (Create<TbfQueueDiscTestItem> (Create<Packet> (size), dest));
428 }
429 
430 void
431 TbfQueueDiscTestCase::DequeueAndCheck (Ptr<TbfQueueDisc> queue, bool flag, std::string printStatement)
432 {
433  Ptr<QueueDiscItem> item = queue->Dequeue ();
434  NS_TEST_EXPECT_MSG_EQ ((item != 0), flag, printStatement);
435 }
436 
437 void
439 {
442  Simulator::Destroy ();
443 
444 }
445 
452 static class TbfQueueDiscTestSuite : public TestSuite
453 {
454 public:
456  : TestSuite ("tbf-queue-disc", UNIT)
457  {
458  AddTestCase (new TbfQueueDiscTestCase (), TestCase::QUICK);
459  }
ns3::QueueDiscItem
QueueDiscItem is the abstract base class for items that are stored in a queue disc.
Definition: queue-item.h:148
ns3::DataRateValue
AttributeValue implementation for DataRate.
Definition: data-rate.h:298
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
ns3::TrafficControlLayer::SetRootQueueDiscOnDevice
virtual void SetRootQueueDiscOnDevice(Ptr< NetDevice > device, Ptr< QueueDisc > qDisc)
This method can be used to set the root queue disc installed on a device.
Definition: traffic-control-layer.cc:202
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::ObjectBase::SetAttributeFailSafe
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
Definition: object-base.cc:205
TbfQueueDiscTestItem
Tbf Queue Disc Test Item.
Definition: tbf-queue-disc-test-suite.cc:45
TbfQueueDiscTestCase::DoRun
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: tbf-queue-disc-test-suite.cc:438
TbfQueueDiscTestItem::~TbfQueueDiscTestItem
virtual ~TbfQueueDiscTestItem()
Definition: tbf-queue-disc-test-suite.cc:78
ns3::QueueDisc::Enqueue
bool Enqueue(Ptr< QueueDiscItem > item)
Pass a packet to store to the queue discipline.
Definition: queue-disc.cc:861
ns3::SimpleNetDevice::SetChannel
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
Definition: simple-net-device.cc:274
g_tbfQueueTestSuite
TbfQueueDiscTestSuite g_tbfQueueTestSuite
the test suite
ns3::PACKETS
@ PACKETS
Use number of packets for queue size.
Definition: queue-size.h:44
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition: node-container.cc:98
ns3::TestCase
encapsulates test code
Definition: test.h:1154
ns3::QueueSizeValue
Definition: queue-size.h:221
TbfQueueDiscTestCase
Tbf Queue Disc Test Case.
Definition: tbf-queue-disc-test-suite.cc:100
ns3::Ptr< Packet >
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
TbfQueueDiscTestItem::Mark
virtual bool Mark(void)
Marks the packet as a substitute for dropping it, such as for Explicit Congestion Notification.
Definition: tbf-queue-disc-test-suite.cc:88
ns3::SimpleNetDevice::GetAddress
virtual Address GetAddress(void) const
Definition: simple-net-device.cc:329
TbfQueueDiscTestCase::TbfQueueDiscTestCase
TbfQueueDiscTestCase()
Definition: tbf-queue-disc-test-suite.cc:126
TbfQueueDiscTestCase::RunTbfTest
void RunTbfTest(QueueSizeUnit mode)
Run TBF test function.
Definition: tbf-queue-disc-test-suite.cc:132
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::Object::AggregateObject
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
ns3::NodeContainer::Get
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Definition: node-container.cc:93
NS_TEST_EXPECT_MSG_EQ
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:283
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::QueueDisc::GetCurrentSize
QueueSize GetCurrentSize(void)
Get the current size of the queue disc in bytes, if operating in bytes mode, or packets,...
Definition: queue-disc.cc:523
ns3::Node::AddDevice
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
TbfQueueDiscTestCase::Enqueue
void Enqueue(Ptr< TbfQueueDisc > queue, Address dest, uint32_t size)
Enqueue function.
Definition: tbf-queue-disc-test-suite.cc:425
TbfQueueDiscTestCase::DequeueAndCheck
void DequeueAndCheck(Ptr< TbfQueueDisc > queue, bool flag, std::string printStatement)
DequeueAndCheck function to check if a packet is blocked or not after dequeuing and verify against ex...
Definition: tbf-queue-disc-test-suite.cc:431
ns3::TbfQueueDisc::GetFirstBucketTokens
uint32_t GetFirstBucketTokens(void) const
Get the current number of tokens inside the first bucket in bytes.
Definition: tbf-queue-disc.cc:168
TbfQueueDiscTestItem::AddHeader
virtual void AddHeader(void)
Add the header to the packet.
Definition: tbf-queue-disc-test-suite.cc:83
ns3::QueueDisc::Dequeue
Ptr< QueueDiscItem > Dequeue(void)
Extract from the queue disc the packet that has been dequeued by calling Peek, if any,...
Definition: queue-disc.cc:896
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
ns3::SimpleNetDevice::SetNode
virtual void SetNode(Ptr< Node > node)
Definition: simple-net-device.cc:513
ns3::QueueItem::GetPacket
Ptr< Packet > GetPacket(void) const
Definition: queue-item.cc:42
TbfQueueDiscTestSuite
Tbf Queue Disc Test Suite.
Definition: tbf-queue-disc-test-suite.cc:453
ns3::TestSuite::UNIT
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1353
ns3::TracedValueCallback::DataRate
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:329
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
TbfQueueDiscTestItem::TbfQueueDiscTestItem
TbfQueueDiscTestItem(const TbfQueueDiscTestItem &)
Copy constructor Disable default implementation to avoid misuse.
pktSize
uint32_t pktSize
packet size used for the simulation (in bytes)
Definition: wifi-bianchi.cc:86
ns3::BYTES
@ BYTES
Use number of bytes for queue size.
Definition: queue-size.h:45
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::QueueSizeUnit
QueueSizeUnit
Enumeration of the operating modes of queues.
Definition: queue-size.h:43
TbfQueueDiscTestSuite::TbfQueueDiscTestSuite
TbfQueueDiscTestSuite()
Definition: tbf-queue-disc-test-suite.cc:455
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::Config::SetDefault
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
ns3::QueueSize::GetValue
uint32_t GetValue() const
Get the underlying value.
Definition: queue-size.cc:175
ns3::Object::Initialize
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:183
ns3::QueueSize
Class for representing queue sizes.
Definition: queue-size.h:95
ns3::Packet::GetUid
uint64_t GetUid(void) const
Returns the packet's Uid.
Definition: packet.cc:390
TbfQueueDiscTestItem::TbfQueueDiscTestItem
TbfQueueDiscTestItem()