This documentation is not the Latest Release.
A Discrete-Event Network Simulator
API
wifi-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
4  * 2010 NICTA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Quincy Tse <quincy.tse@nicta.com.au> (Case for Bug 991)
21  * Sébastien Deronne <sebastien.deronne@gmail.com> (Case for bug 730)
22  */
23 
24 #include "ns3/nqos-wifi-mac-helper.h"
25 #include "ns3/yans-wifi-helper.h"
26 #include "ns3/mobility-helper.h"
27 #include "ns3/wifi-net-device.h"
28 #include "ns3/adhoc-wifi-mac.h"
29 #include "ns3/propagation-delay-model.h"
30 #include "ns3/propagation-loss-model.h"
31 #include "ns3/yans-error-rate-model.h"
32 #include "ns3/constant-position-mobility-model.h"
33 #include "ns3/test.h"
34 #include "ns3/pointer.h"
35 #include "ns3/rng-seed-manager.h"
36 #include "ns3/config.h"
37 #include "ns3/boolean.h"
38 #include "ns3/string.h"
39 #include "ns3/packet-socket-address.h"
40 #include "ns3/packet-socket-server.h"
41 #include "ns3/packet-socket-client.h"
42 #include "ns3/packet-socket-helper.h"
43 
44 using namespace ns3;
45 
46 //Helper function to assign streams to random variables, to control
47 //randomness in the tests
48 static void
50 {
51  int64_t currentStream = stream;
52  Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac);
53  if (rmac)
54  {
55  PointerValue ptr;
56  rmac->GetAttribute ("DcaTxop", ptr);
57  Ptr<DcaTxop> dcaTxop = ptr.Get<DcaTxop> ();
58  currentStream += dcaTxop->AssignStreams (currentStream);
59 
60  rmac->GetAttribute ("VO_EdcaTxopN", ptr);
61  Ptr<EdcaTxopN> vo_edcaTxopN = ptr.Get<EdcaTxopN> ();
62  currentStream += vo_edcaTxopN->AssignStreams (currentStream);
63 
64  rmac->GetAttribute ("VI_EdcaTxopN", ptr);
65  Ptr<EdcaTxopN> vi_edcaTxopN = ptr.Get<EdcaTxopN> ();
66  currentStream += vi_edcaTxopN->AssignStreams (currentStream);
67 
68  rmac->GetAttribute ("BE_EdcaTxopN", ptr);
69  Ptr<EdcaTxopN> be_edcaTxopN = ptr.Get<EdcaTxopN> ();
70  currentStream += be_edcaTxopN->AssignStreams (currentStream);
71 
72  rmac->GetAttribute ("BK_EdcaTxopN", ptr);
73  Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> ();
74  currentStream += bk_edcaTxopN->AssignStreams (currentStream);
75  }
76 }
77 
78 
79 class WifiTest : public TestCase
80 {
81 public:
82  WifiTest ();
83 
84  virtual void DoRun (void);
85 
86 
87 private:
88  void RunOne (void);
89  void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
91 
95 };
96 
98  : TestCase ("Wifi")
99 {
100 }
101 
102 void
104 {
105  Ptr<Packet> p = Create<Packet> ();
106  dev->Send (p, dev->GetBroadcast (), 1);
107 }
108 
109 void
111 {
112  Ptr<Node> node = CreateObject<Node> ();
113  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
114 
117  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
118  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
119  Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
120  phy->SetErrorRateModel (error);
121  phy->SetChannel (channel);
122  phy->SetDevice (dev);
123  phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
125 
126  mobility->SetPosition (pos);
127  node->AggregateObject (mobility);
128  mac->SetAddress (Mac48Address::Allocate ());
129  dev->SetMac (mac);
130  dev->SetPhy (phy);
131  dev->SetRemoteStationManager (manager);
132  node->AddDevice (dev);
133 
134  Simulator::Schedule (Seconds (1.0), &WifiTest::SendOnePacket, this, dev);
135 }
136 
137 void
139 {
140  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
142  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();
143  channel->SetPropagationDelayModel (propDelay);
144  channel->SetPropagationLossModel (propLoss);
145 
146  CreateOne (Vector (0.0, 0.0, 0.0), channel);
147  CreateOne (Vector (5.0, 0.0, 0.0), channel);
148  CreateOne (Vector (5.0, 0.0, 0.0), channel);
149 
150  Simulator::Stop (Seconds (10.0));
151 
152  Simulator::Run ();
153  Simulator::Destroy ();
154 }
155 
156 void
158 {
159  m_mac.SetTypeId ("ns3::AdhocWifiMac");
160  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
161 
162  m_manager.SetTypeId ("ns3::ArfWifiManager");
163  RunOne ();
164  m_manager.SetTypeId ("ns3::AarfWifiManager");
165  RunOne ();
166  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
167  RunOne ();
168  m_manager.SetTypeId ("ns3::OnoeWifiManager");
169  RunOne ();
170  m_manager.SetTypeId ("ns3::AmrrWifiManager");
171  RunOne ();
172  m_manager.SetTypeId ("ns3::IdealWifiManager");
173  RunOne ();
174 
175  m_mac.SetTypeId ("ns3::AdhocWifiMac");
176  RunOne ();
177  m_mac.SetTypeId ("ns3::ApWifiMac");
178  RunOne ();
179  m_mac.SetTypeId ("ns3::StaWifiMac");
180  RunOne ();
181 
182 
183  m_propDelay.SetTypeId ("ns3::RandomPropagationDelayModel");
184  m_mac.SetTypeId ("ns3::AdhocWifiMac");
185  RunOne ();
186 }
187 
188 //-----------------------------------------------------------------------------
190 {
191 public:
192  QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket")
193  {
194  }
195  virtual void DoRun (void)
196  {
197  //startingSeq=0, seqNum=2047
198  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2047), false, "2047 is new in comparison to 0");
199  //startingSeq=0, seqNum=2048
200  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2048), true, "2048 is old in comparison to 0");
201  //startingSeq=2048, seqNum=0
202  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 0), true, "0 is old in comparison to 2048");
203  //startingSeq=4095, seqNum=0
204  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 0), false, "0 is new in comparison to 4095");
205  //startingSeq=0, seqNum=4095
206  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 4095), true, "4095 is old in comparison to 0");
207  //startingSeq=4095 seqNum=2047
208  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 2047), true, "2047 is old in comparison to 4095");
209  //startingSeq=2048 seqNum=4095
210  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 4095), false, "4095 is new in comparison to 2048");
211  //startingSeq=2049 seqNum=0
212  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2049, 0), false, "0 is new in comparison to 2049");
213  }
214 };
215 
216 
217 //-----------------------------------------------------------------------------
222 {
223 public:
225 
226  virtual void DoRun (void);
227 
228 
229 private:
232  void SwitchCh (Ptr<WifiNetDevice> dev);
233 
237 };
238 
240  : TestCase ("InterferenceHelperSequence")
241 {
242 }
243 
244 void
246 {
247  Ptr<Packet> p = Create<Packet> (9999);
248  dev->Send (p, dev->GetBroadcast (), 1);
249 }
250 
251 void
253 {
254  Ptr<WifiPhy> p = dev->GetPhy ();
255  p->SetChannelNumber (1);
256 }
257 
258 Ptr<Node>
260 {
261  Ptr<Node> node = CreateObject<Node> ();
262  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
263 
266  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
267  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
268  Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
269  phy->SetErrorRateModel (error);
270  phy->SetChannel (channel);
271  phy->SetDevice (dev);
272  phy->SetMobility (mobility);
273  phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
275 
276  mobility->SetPosition (pos);
277  node->AggregateObject (mobility);
278  mac->SetAddress (Mac48Address::Allocate ());
279  dev->SetMac (mac);
280  dev->SetPhy (phy);
281  dev->SetRemoteStationManager (manager);
282  node->AddDevice (dev);
283 
284  return node;
285 }
286 
287 void
289 {
290  m_mac.SetTypeId ("ns3::AdhocWifiMac");
291  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
292  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
293 
294  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
296  Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel> ();
297  channel->SetPropagationDelayModel (propDelay);
298  channel->SetPropagationLossModel (propLoss);
299 
300  Ptr<Node> rxOnly = CreateOne (Vector (0.0, 0.0, 0.0), channel);
301  Ptr<Node> senderA = CreateOne (Vector (5.0, 0.0, 0.0), channel);
302  Ptr<Node> senderB = CreateOne (Vector (-5.0, 0.0, 0.0), channel);
303 
304  propLoss->SetLoss (senderB->GetObject<MobilityModel> (), rxOnly->GetObject<MobilityModel> (), 0, true);
305  propLoss->SetDefaultLoss (999);
306 
307  Simulator::Schedule (Seconds (1.0),
309  DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
310 
311  Simulator::Schedule (Seconds (1.0000001),
313  DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0)));
314 
315  Simulator::Schedule (Seconds (5.0),
317  DynamicCast<WifiNetDevice> (senderA->GetDevice (0)));
318 
319  Simulator::Schedule (Seconds (7.0),
321  DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
322 
323  Simulator::Stop (Seconds (100.0));
324  Simulator::Run ();
325 
326  Simulator::Destroy ();
327 }
328 
329 
330 //-----------------------------------------------------------------------------
362 class Bug555TestCase : public TestCase
363 {
364 public:
365  Bug555TestCase ();
366 
367  virtual void DoRun (void);
368 
369 
370 private:
372 
376 
379  unsigned int m_numSentPackets;
380 
382 };
383 
385  : TestCase ("Test case for Bug 555")
386 {
387 }
388 
389 void
391 {
392  if (m_numSentPackets == 0)
393  {
394  NS_ASSERT_MSG (Simulator::Now () == Time (Seconds (1)), "Packet 0 not transmitted at 1 second");
397  }
398  else if (m_numSentPackets == 1)
399  {
401  }
402 }
403 
404 void
406 {
407  Ptr<Packet> p = Create<Packet> (1000);
408  dev->Send (p, dev->GetBroadcast (), 1);
409 }
410 
411 void
413 {
414  m_mac.SetTypeId ("ns3::AdhocWifiMac");
415  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
416  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
417 
418  //Assign a seed and run number, and later fix the assignment of streams to
419  //WiFi random variables, so that the first backoff used is zero slots
420  RngSeedManager::SetSeed (1);
421  RngSeedManager::SetRun (17);
422 
423  //Disable the initial jitter of AP beacons (test case was written before
424  //beacon jitter was added)
425  Config::SetDefault ("ns3::ApWifiMac::EnableBeaconJitter", BooleanValue (false));
426 
427  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
429  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();
430  channel->SetPropagationDelayModel (propDelay);
431  channel->SetPropagationLossModel (propLoss);
432 
433  Ptr<Node> txNode = CreateObject<Node> ();
434  Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
435  Ptr<WifiMac> txMac = m_mac.Create<WifiMac> ();
437  //Fix the stream assignment to the Dcf Txop objects (backoffs)
438  //The below stream assignment will result in the DcaTxop object
439  //using a backoff value of zero for this test when the
440  //DcaTxop::EndTxNoAck() calls to StartBackoffNow()
441  AssignWifiRandomStreams (txMac, 23);
442 
443  Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel> ();
444  Ptr<YansWifiPhy> txPhy = CreateObject<YansWifiPhy> ();
445  Ptr<ErrorRateModel> txError = CreateObject<YansErrorRateModel> ();
446  txPhy->SetErrorRateModel (txError);
447  txPhy->SetChannel (channel);
448  txPhy->SetDevice (txDev);
449  txPhy->SetMobility (txMobility);
450  txPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
451 
452  txPhy->TraceConnectWithoutContext ("PhyTxBegin", MakeCallback (&Bug555TestCase::NotifyPhyTxBegin, this));
453 
454  txMobility->SetPosition (Vector (0.0, 0.0, 0.0));
455  txNode->AggregateObject (txMobility);
456  txMac->SetAddress (Mac48Address::Allocate ());
457  txDev->SetMac (txMac);
458  txDev->SetPhy (txPhy);
459  txDev->SetRemoteStationManager (m_manager.Create<WifiRemoteStationManager> ());
460  txNode->AddDevice (txDev);
461 
464  m_numSentPackets = 0;
465 
466  Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev);
467  Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev);
468 
469  Simulator::Stop (Seconds (2.0));
470  Simulator::Run ();
471  Simulator::Destroy ();
472 
473  //First packet has 1408 us of transmit time. Slot time is 9 us.
474  //Backoff is 0 slots. SIFS is 16 us. AIFS is 2 slots = 18 us.
475  //Should send next packet at 1408 us + (0 * 9 us) + 16 us + 18 us
476  //1442 us after the first one.
477  uint32_t expectedWait1 = 1408 + (0 * 9) + 16 + 18;
478  Time expectedSecondTransmissionTime = MicroSeconds (expectedWait1) + Seconds (1.0);
479 
480  NS_TEST_ASSERT_MSG_EQ (m_secondTransmissionTime, expectedSecondTransmissionTime, "The second transmission time not correct!");
481 }
482 
483 
484 //-----------------------------------------------------------------------------
497 class Bug730TestCase : public TestCase
498 {
499 public:
500  Bug730TestCase ();
501  virtual ~Bug730TestCase ();
502 
503  virtual void DoRun (void);
504 
505 
506 private:
507  uint32_t m_received;
508 
509  void Receive (std::string context, Ptr<const Packet> p, const Address &adr);
510 
511 };
512 
514  : TestCase ("Test case for Bug 730"),
515  m_received (0)
516 {
517 }
518 
520 {
521 }
522 
523 void
524 Bug730TestCase::Receive (std::string context, Ptr<const Packet> p, const Address &adr)
525 {
526  if ((p->GetSize () == 1460) && (Simulator::Now () > Seconds (20)))
527  {
528  m_received++;
529  }
530 }
531 
532 
533 void
535 {
536  m_received = 0;
537 
538  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2304"));
539  Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (2));
540  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1460));
541 
542  NodeContainer wifiStaNode;
543  wifiStaNode.Create (1);
544 
546  wifiApNode.Create (1);
547 
548  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
549  YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
550  phy.SetChannel (channel.Create ());
551 
552  WifiHelper wifi = WifiHelper::Default ();
554  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
555  "DataMode", StringValue ("DsssRate1Mbps"),
556  "ControlMode", StringValue ("DsssRate1Mbps"));
557 
558  NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
559  Ssid ssid = Ssid ("ns-3-ssid");
560  mac.SetType ("ns3::StaWifiMac",
561  "Ssid", SsidValue (ssid),
562  "ActiveProbing", BooleanValue (false));
563 
565  staDevices = wifi.Install (phy, mac, wifiStaNode);
566 
567  mac.SetType ("ns3::ApWifiMac",
568  "Ssid", SsidValue (ssid),
569  "BeaconGeneration", BooleanValue (true));
570 
572  apDevices = wifi.Install (phy, mac, wifiApNode);
573 
575  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
576 
577  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
578  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
579  mobility.SetPositionAllocator (positionAlloc);
580 
581  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
582  mobility.Install (wifiApNode);
583  mobility.Install (wifiStaNode);
584 
585  Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice> (apDevices.Get (0));
586  Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice> (staDevices.Get (0));
587 
588  PacketSocketAddress socket;
589  socket.SetSingleDevice (sta_device->GetIfIndex ());
590  socket.SetPhysicalAddress (ap_device->GetAddress ());
591  socket.SetProtocol (1);
592 
593  // give packet socket powers to nodes.
594  PacketSocketHelper packetSocket;
595  packetSocket.Install (wifiStaNode);
596  packetSocket.Install (wifiApNode);
597 
598  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
599  client->SetAttribute ("PacketSize", UintegerValue (1460));
600  client->SetRemote (socket);
601  wifiStaNode.Get(0)->AddApplication (client);
602  client->SetStartTime (Seconds (1));
603  client->SetStopTime (Seconds (51.0));
604 
605  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
606  server->SetLocal (socket);
607  wifiApNode.Get(0)->AddApplication (server);
608  server->SetStartTime (Seconds (0.0));
609  server->SetStopTime (Seconds (52.0));
610 
611  Config::Connect ("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx", MakeCallback (&Bug730TestCase::Receive, this));
612 
613  Simulator::Schedule (Seconds (10.0), Config::Set, "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold", StringValue ("800"));
614 
615  Simulator::Stop (Seconds (55));
616  Simulator::Run ();
617 
618  Simulator::Destroy ();
619 
620  bool result = (m_received > 0);
621  NS_TEST_ASSERT_MSG_EQ (result, true, "packet reception unexpectedly stopped after adapting fragmentation threshold!");
622 }
623 
624 //-----------------------------------------------------------------------------
625 class WifiTestSuite : public TestSuite
626 {
627 public:
628  WifiTestSuite ();
629 };
630 
632  : TestSuite ("devices-wifi", UNIT)
633 {
634  AddTestCase (new WifiTest, TestCase::QUICK);
635  AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK);
636  AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); //Bug 991
637  AddTestCase (new Bug555TestCase, TestCase::QUICK); //Bug 555
638  AddTestCase (new Bug730TestCase, TestCase::QUICK); //Bug 730
639 }
640 
void RunOne(void)
Definition: wifi-test.cc:138
tuple channel
Definition: third.py:85
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:157
void NotifyPhyTxBegin(Ptr< const Packet > p)
Definition: wifi-test.cc:390
void SetStopTime(Time stop)
Specify application stop time.
Definition: application.cc:75
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
virtual ~Bug730TestCase()
Definition: wifi-test.cc:519
Ptr< T > Get(void) const
Definition: pointer.h:194
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
AttributeValue implementation for Boolean.
Definition: boolean.h:34
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Definition: wifi-test.cc:524
Ptr< YansWifiChannel > Create(void) const
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wifi-helper.cc:74
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Definition: object.h:455
Hold variables of type string.
Definition: string.h:41
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
Make it easy to create and manage PHY objects for the yans model.
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:769
A suite of tests to run.
Definition: test.h:1333
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:246
virtual Address GetAddress(void) const
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
an address for a packet socket
ObjectFactory m_manager
Definition: wifi-test.cc:373
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
void ConfigureStandard(enum WifiPhyStandard standard)
Definition: wifi-mac.cc:289
ObjectFactory m_mac
Definition: wifi-test.cc:374
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#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:278
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:786
bool QosUtilsIsOldPacket(uint16_t startingSeq, uint16_t seqNumber)
This function checks if packet with sequence number seqNumber is an "old" packet. ...
Definition: qos-utils.cc:88
encapsulates test code
Definition: test.h:1147
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: dca-txop.cc:288
Make sure that when changing the fragmentation threshold during the simulation, the TCP transmission ...
Definition: wifi-test.cc:497
helps to create WifiNetDevice objects
Definition: wifi-helper.h:96
Give ns3::PacketSocket powers to ns3::Node.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wifi-helper.cc:103
a polymophic address class
Definition: address.h:90
Keep track of the current position and velocity of an object.
void SetChannel(Ptr< YansWifiChannel > channel)
Ptr< WifiPhy > GetPhy(void) const
Ptr< Node > CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Definition: wifi-test.cc:259
This queue contains packets for a particular access class.
Definition: edca-txop-n.h:82
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:405
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
tuple mobility
Definition: third.py:101
tuple phy
Definition: third.py:86
Time m_secondTransmissionTime
Definition: wifi-test.cc:378
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Definition: test.cc:297
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:44
Hold an unsigned integer type.
Definition: uinteger.h:44
Time m_firstTransmissionTime
Definition: wifi-test.cc:377
Vector3D Vector
Definition: vector.h:166
#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.
Definition: test.h:161
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
Definition: wifi-helper.cc:97
calculate a propagation delay.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
Definition: callback.h:1480
tuple staDevices
Definition: third.py:96
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:534
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
tuple mac
Definition: third.py:92
hold a list of per-remote-station state.
create non QoS-enabled MAC layers for a ns3::WifiNetDevice.
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:835
tuple wifiApNode
Definition: third.py:83
void SwitchCh(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:252
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:157
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
tuple apDevices
Definition: third.py:99
keep track of a set of node pointers.
Hold objects of type Ptr.
Definition: pointer.h:36
static WifiTestSuite g_wifiTestSuite
Definition: wifi-test.cc:641
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
ObjectFactory m_mac
Definition: wifi-test.cc:93
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void SetMobilityModel(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue())
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:195
tuple ssid
Definition: third.py:93
manage and create wifi channel objects for the yans model.
ObjectFactory m_propDelay
Definition: wifi-test.cc:94
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:229
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
virtual void SetChannelNumber(uint16_t id)=0
Set channel number.
void SetPosition(const Vector &position)
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:90
Helper class used to assign positions and mobility models to nodes.
virtual Address GetBroadcast(void) const
unsigned int m_numSentPackets
Definition: wifi-test.cc:379
ObjectFactory m_manager
Definition: wifi-test.cc:92
Instantiate subclasses of ns3::Object.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:128
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
static void AssignWifiRandomStreams(Ptr< WifiMac > mac, int64_t stream)
Definition: wifi-test.cc:49
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
ObjectFactory m_propDelay
Definition: wifi-test.cc:375
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:895
AttributeValue implementation for Ssid.
Definition: ssid.h:95
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:774
uint32_t m_received
Definition: wifi-test.cc:507
void Add(Vector v)
Add a position to the list of positions.
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:245
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:103
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:911
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
Definition: simulator.cc:330
tuple wifi
Definition: third.py:89
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
handle packet fragmentation and retransmissions.
Definition: dca-txop.h:67
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:412
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:191
void SetStartTime(Time start)
Specify application start time.
Definition: application.cc:69
void CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Definition: wifi-test.cc:110
Make sure that when multiple broadcast packets are queued on the same device in a short succession no...
Definition: wifi-test.cc:362
WifiTest()
Definition: wifi-test.cc:97
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:288