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/yans-wifi-helper.h"
25 #include "ns3/mobility-helper.h"
26 #include "ns3/wifi-net-device.h"
27 #include "ns3/adhoc-wifi-mac.h"
28 #include "ns3/propagation-delay-model.h"
29 #include "ns3/propagation-loss-model.h"
30 #include "ns3/yans-error-rate-model.h"
31 #include "ns3/constant-position-mobility-model.h"
32 #include "ns3/test.h"
33 #include "ns3/pointer.h"
34 #include "ns3/rng-seed-manager.h"
35 #include "ns3/config.h"
36 #include "ns3/boolean.h"
37 #include "ns3/string.h"
38 #include "ns3/packet-socket-address.h"
39 #include "ns3/packet-socket-server.h"
40 #include "ns3/packet-socket-client.h"
41 #include "ns3/packet-socket-helper.h"
42 
43 using namespace ns3;
44 
45 //Helper function to assign streams to random variables, to control
46 //randomness in the tests
47 static void
49 {
50  int64_t currentStream = stream;
51  Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (mac);
52  if (rmac)
53  {
54  PointerValue ptr;
55  rmac->GetAttribute ("DcaTxop", ptr);
56  Ptr<DcaTxop> dcaTxop = ptr.Get<DcaTxop> ();
57  currentStream += dcaTxop->AssignStreams (currentStream);
58 
59  rmac->GetAttribute ("VO_EdcaTxopN", ptr);
60  Ptr<EdcaTxopN> vo_edcaTxopN = ptr.Get<EdcaTxopN> ();
61  currentStream += vo_edcaTxopN->AssignStreams (currentStream);
62 
63  rmac->GetAttribute ("VI_EdcaTxopN", ptr);
64  Ptr<EdcaTxopN> vi_edcaTxopN = ptr.Get<EdcaTxopN> ();
65  currentStream += vi_edcaTxopN->AssignStreams (currentStream);
66 
67  rmac->GetAttribute ("BE_EdcaTxopN", ptr);
68  Ptr<EdcaTxopN> be_edcaTxopN = ptr.Get<EdcaTxopN> ();
69  currentStream += be_edcaTxopN->AssignStreams (currentStream);
70 
71  rmac->GetAttribute ("BK_EdcaTxopN", ptr);
72  Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> ();
73  currentStream += bk_edcaTxopN->AssignStreams (currentStream);
74  }
75 }
76 
77 
78 class WifiTest : public TestCase
79 {
80 public:
81  WifiTest ();
82 
83  virtual void DoRun (void);
84 
85 
86 private:
87  void RunOne (void);
88  void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
90 
94 };
95 
97  : TestCase ("Wifi")
98 {
99 }
100 
101 void
103 {
104  Ptr<Packet> p = Create<Packet> ();
105  dev->Send (p, dev->GetBroadcast (), 1);
106 }
107 
108 void
110 {
111  Ptr<Node> node = CreateObject<Node> ();
112  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
113 
116  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
117  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
118  Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
119  phy->SetErrorRateModel (error);
120  phy->SetChannel (channel);
121  phy->SetDevice (dev);
122  phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
124 
125  mobility->SetPosition (pos);
126  node->AggregateObject (mobility);
127  mac->SetAddress (Mac48Address::Allocate ());
128  dev->SetMac (mac);
129  dev->SetPhy (phy);
130  dev->SetRemoteStationManager (manager);
131  node->AddDevice (dev);
132 
133  Simulator::Schedule (Seconds (1.0), &WifiTest::SendOnePacket, this, dev);
134 }
135 
136 void
138 {
139  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
141  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();
142  channel->SetPropagationDelayModel (propDelay);
143  channel->SetPropagationLossModel (propLoss);
144 
145  CreateOne (Vector (0.0, 0.0, 0.0), channel);
146  CreateOne (Vector (5.0, 0.0, 0.0), channel);
147  CreateOne (Vector (5.0, 0.0, 0.0), channel);
148 
149  Simulator::Stop (Seconds (10.0));
150 
151  Simulator::Run ();
152  Simulator::Destroy ();
153 }
154 
155 void
157 {
158  m_mac.SetTypeId ("ns3::AdhocWifiMac");
159  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
160 
161  m_manager.SetTypeId ("ns3::ArfWifiManager");
162  RunOne ();
163  m_manager.SetTypeId ("ns3::AarfWifiManager");
164  RunOne ();
165  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
166  RunOne ();
167  m_manager.SetTypeId ("ns3::OnoeWifiManager");
168  RunOne ();
169  m_manager.SetTypeId ("ns3::AmrrWifiManager");
170  RunOne ();
171  m_manager.SetTypeId ("ns3::IdealWifiManager");
172  RunOne ();
173 
174  m_mac.SetTypeId ("ns3::AdhocWifiMac");
175  RunOne ();
176  m_mac.SetTypeId ("ns3::ApWifiMac");
177  RunOne ();
178  m_mac.SetTypeId ("ns3::StaWifiMac");
179  RunOne ();
180 
181 
182  m_propDelay.SetTypeId ("ns3::RandomPropagationDelayModel");
183  m_mac.SetTypeId ("ns3::AdhocWifiMac");
184  RunOne ();
185 }
186 
187 //-----------------------------------------------------------------------------
189 {
190 public:
191  QosUtilsIsOldPacketTest () : TestCase ("QosUtilsIsOldPacket")
192  {
193  }
194  virtual void DoRun (void)
195  {
196  //startingSeq=0, seqNum=2047
197  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2047), false, "2047 is new in comparison to 0");
198  //startingSeq=0, seqNum=2048
199  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 2048), true, "2048 is old in comparison to 0");
200  //startingSeq=2048, seqNum=0
201  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 0), true, "0 is old in comparison to 2048");
202  //startingSeq=4095, seqNum=0
203  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 0), false, "0 is new in comparison to 4095");
204  //startingSeq=0, seqNum=4095
205  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (0, 4095), true, "4095 is old in comparison to 0");
206  //startingSeq=4095 seqNum=2047
207  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (4095, 2047), true, "2047 is old in comparison to 4095");
208  //startingSeq=2048 seqNum=4095
209  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2048, 4095), false, "4095 is new in comparison to 2048");
210  //startingSeq=2049 seqNum=0
211  NS_TEST_EXPECT_MSG_EQ (QosUtilsIsOldPacket (2049, 0), false, "0 is new in comparison to 2049");
212  }
213 };
214 
215 
216 //-----------------------------------------------------------------------------
221 {
222 public:
224 
225  virtual void DoRun (void);
226 
227 
228 private:
231  void SwitchCh (Ptr<WifiNetDevice> dev);
232 
236 };
237 
239  : TestCase ("InterferenceHelperSequence")
240 {
241 }
242 
243 void
245 {
246  Ptr<Packet> p = Create<Packet> (9999);
247  dev->Send (p, dev->GetBroadcast (), 1);
248 }
249 
250 void
252 {
253  Ptr<WifiPhy> p = dev->GetPhy ();
254  p->SetChannelNumber (1);
255 }
256 
257 Ptr<Node>
259 {
260  Ptr<Node> node = CreateObject<Node> ();
261  Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice> ();
262 
265  Ptr<ConstantPositionMobilityModel> mobility = CreateObject<ConstantPositionMobilityModel> ();
266  Ptr<YansWifiPhy> phy = CreateObject<YansWifiPhy> ();
267  Ptr<ErrorRateModel> error = CreateObject<YansErrorRateModel> ();
268  phy->SetErrorRateModel (error);
269  phy->SetChannel (channel);
270  phy->SetDevice (dev);
271  phy->SetMobility (mobility);
272  phy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
274 
275  mobility->SetPosition (pos);
276  node->AggregateObject (mobility);
277  mac->SetAddress (Mac48Address::Allocate ());
278  dev->SetMac (mac);
279  dev->SetPhy (phy);
280  dev->SetRemoteStationManager (manager);
281  node->AddDevice (dev);
282 
283  return node;
284 }
285 
286 void
288 {
289  m_mac.SetTypeId ("ns3::AdhocWifiMac");
290  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
291  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
292 
293  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
295  Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel> ();
296  channel->SetPropagationDelayModel (propDelay);
297  channel->SetPropagationLossModel (propLoss);
298 
299  Ptr<Node> rxOnly = CreateOne (Vector (0.0, 0.0, 0.0), channel);
300  Ptr<Node> senderA = CreateOne (Vector (5.0, 0.0, 0.0), channel);
301  Ptr<Node> senderB = CreateOne (Vector (-5.0, 0.0, 0.0), channel);
302 
303  propLoss->SetLoss (senderB->GetObject<MobilityModel> (), rxOnly->GetObject<MobilityModel> (), 0, true);
304  propLoss->SetDefaultLoss (999);
305 
306  Simulator::Schedule (Seconds (1.0),
308  DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
309 
310  Simulator::Schedule (Seconds (1.0000001),
312  DynamicCast<WifiNetDevice> (rxOnly->GetDevice (0)));
313 
314  Simulator::Schedule (Seconds (5.0),
316  DynamicCast<WifiNetDevice> (senderA->GetDevice (0)));
317 
318  Simulator::Schedule (Seconds (7.0),
320  DynamicCast<WifiNetDevice> (senderB->GetDevice (0)));
321 
322  Simulator::Stop (Seconds (100.0));
323  Simulator::Run ();
324 
325  Simulator::Destroy ();
326 }
327 
328 
329 //-----------------------------------------------------------------------------
361 class Bug555TestCase : public TestCase
362 {
363 public:
364  Bug555TestCase ();
365 
366  virtual void DoRun (void);
367 
368 
369 private:
371 
375 
378  unsigned int m_numSentPackets;
379 
381 };
382 
384  : TestCase ("Test case for Bug 555")
385 {
386 }
387 
388 void
390 {
391  if (m_numSentPackets == 0)
392  {
393  NS_ASSERT_MSG (Simulator::Now () == Time (Seconds (1)), "Packet 0 not transmitted at 1 second");
396  }
397  else if (m_numSentPackets == 1)
398  {
400  }
401 }
402 
403 void
405 {
406  Ptr<Packet> p = Create<Packet> (1000);
407  dev->Send (p, dev->GetBroadcast (), 1);
408 }
409 
410 void
412 {
413  m_mac.SetTypeId ("ns3::AdhocWifiMac");
414  m_propDelay.SetTypeId ("ns3::ConstantSpeedPropagationDelayModel");
415  m_manager.SetTypeId ("ns3::ConstantRateWifiManager");
416 
417  //Assign a seed and run number, and later fix the assignment of streams to
418  //WiFi random variables, so that the first backoff used is zero slots
419  RngSeedManager::SetSeed (1);
420  RngSeedManager::SetRun (17);
421 
422  //Disable the initial jitter of AP beacons (test case was written before
423  //beacon jitter was added)
424  Config::SetDefault ("ns3::ApWifiMac::EnableBeaconJitter", BooleanValue (false));
425 
426  Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel> ();
428  Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel> ();
429  channel->SetPropagationDelayModel (propDelay);
430  channel->SetPropagationLossModel (propLoss);
431 
432  Ptr<Node> txNode = CreateObject<Node> ();
433  Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice> ();
434  Ptr<WifiMac> txMac = m_mac.Create<WifiMac> ();
436  //Fix the stream assignment to the Dcf Txop objects (backoffs)
437  //The below stream assignment will result in the DcaTxop object
438  //using a backoff value of zero for this test when the
439  //DcaTxop::EndTxNoAck() calls to StartBackoffNow()
440  AssignWifiRandomStreams (txMac, 23);
441 
442  Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel> ();
443  Ptr<YansWifiPhy> txPhy = CreateObject<YansWifiPhy> ();
444  Ptr<ErrorRateModel> txError = CreateObject<YansErrorRateModel> ();
445  txPhy->SetErrorRateModel (txError);
446  txPhy->SetChannel (channel);
447  txPhy->SetDevice (txDev);
448  txPhy->SetMobility (txMobility);
449  txPhy->ConfigureStandard (WIFI_PHY_STANDARD_80211a);
450 
451  txPhy->TraceConnectWithoutContext ("PhyTxBegin", MakeCallback (&Bug555TestCase::NotifyPhyTxBegin, this));
452 
453  txMobility->SetPosition (Vector (0.0, 0.0, 0.0));
454  txNode->AggregateObject (txMobility);
455  txMac->SetAddress (Mac48Address::Allocate ());
456  txDev->SetMac (txMac);
457  txDev->SetPhy (txPhy);
458  txDev->SetRemoteStationManager (m_manager.Create<WifiRemoteStationManager> ());
459  txNode->AddDevice (txDev);
460 
463  m_numSentPackets = 0;
464 
465  Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev);
466  Simulator::Schedule (Seconds (1.0), &Bug555TestCase::SendOnePacket, this, txDev);
467 
468  Simulator::Stop (Seconds (2.0));
469  Simulator::Run ();
470  Simulator::Destroy ();
471 
472  //First packet has 1408 us of transmit time. Slot time is 9 us.
473  //Backoff is 0 slots. SIFS is 16 us. AIFS is 2 slots = 18 us.
474  //Should send next packet at 1408 us + (0 * 9 us) + 16 us + 18 us
475  //1442 us after the first one.
476  uint32_t expectedWait1 = 1408 + (0 * 9) + 16 + 18;
477  Time expectedSecondTransmissionTime = MicroSeconds (expectedWait1) + Seconds (1.0);
478 
479  NS_TEST_ASSERT_MSG_EQ (m_secondTransmissionTime, expectedSecondTransmissionTime, "The second transmission time not correct!");
480 }
481 
482 
483 //-----------------------------------------------------------------------------
496 class Bug730TestCase : public TestCase
497 {
498 public:
499  Bug730TestCase ();
500  virtual ~Bug730TestCase ();
501 
502  virtual void DoRun (void);
503 
504 
505 private:
506  uint32_t m_received;
507 
508  void Receive (std::string context, Ptr<const Packet> p, const Address &adr);
509 
510 };
511 
513  : TestCase ("Test case for Bug 730"),
514  m_received (0)
515 {
516 }
517 
519 {
520 }
521 
522 void
523 Bug730TestCase::Receive (std::string context, Ptr<const Packet> p, const Address &adr)
524 {
525  if ((p->GetSize () == 1460) && (Simulator::Now () > Seconds (20)))
526  {
527  m_received++;
528  }
529 }
530 
531 
532 void
534 {
535  m_received = 0;
536 
537  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2304"));
538 
539  NodeContainer wifiStaNode;
540  wifiStaNode.Create (1);
541 
543  wifiApNode.Create (1);
544 
545  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
546  YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
547  phy.SetChannel (channel.Create ());
548 
551  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
552  "DataMode", StringValue ("DsssRate1Mbps"),
553  "ControlMode", StringValue ("DsssRate1Mbps"));
554 
556  Ssid ssid = Ssid ("ns-3-ssid");
557  mac.SetType ("ns3::StaWifiMac",
558  "Ssid", SsidValue (ssid),
559  "ActiveProbing", BooleanValue (false));
560 
562  staDevices = wifi.Install (phy, mac, wifiStaNode);
563 
564  mac.SetType ("ns3::ApWifiMac",
565  "Ssid", SsidValue (ssid),
566  "BeaconGeneration", BooleanValue (true));
567 
569  apDevices = wifi.Install (phy, mac, wifiApNode);
570 
572  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
573 
574  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
575  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
576  mobility.SetPositionAllocator (positionAlloc);
577 
578  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
579  mobility.Install (wifiApNode);
580  mobility.Install (wifiStaNode);
581 
582  Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice> (apDevices.Get (0));
583  Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice> (staDevices.Get (0));
584 
585  PacketSocketAddress socket;
586  socket.SetSingleDevice (sta_device->GetIfIndex ());
587  socket.SetPhysicalAddress (ap_device->GetAddress ());
588  socket.SetProtocol (1);
589 
590  // give packet socket powers to nodes.
591  PacketSocketHelper packetSocket;
592  packetSocket.Install (wifiStaNode);
593  packetSocket.Install (wifiApNode);
594 
595  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
596  client->SetAttribute ("PacketSize", UintegerValue (1460));
597  client->SetRemote (socket);
598  wifiStaNode.Get(0)->AddApplication (client);
599  client->SetStartTime (Seconds (1));
600  client->SetStopTime (Seconds (51.0));
601 
602  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
603  server->SetLocal (socket);
604  wifiApNode.Get(0)->AddApplication (server);
605  server->SetStartTime (Seconds (0.0));
606  server->SetStopTime (Seconds (52.0));
607 
608  Config::Connect ("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx", MakeCallback (&Bug730TestCase::Receive, this));
609 
610  Simulator::Schedule (Seconds (10.0), Config::Set, "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold", StringValue ("800"));
611 
612  Simulator::Stop (Seconds (55));
613  Simulator::Run ();
614 
615  Simulator::Destroy ();
616 
617  bool result = (m_received > 0);
618  NS_TEST_ASSERT_MSG_EQ (result, true, "packet reception unexpectedly stopped after adapting fragmentation threshold!");
619 }
620 
621 //-----------------------------------------------------------------------------
622 class WifiTestSuite : public TestSuite
623 {
624 public:
625  WifiTestSuite ();
626 };
627 
629  : TestSuite ("devices-wifi", UNIT)
630 {
631  AddTestCase (new WifiTest, TestCase::QUICK);
632  AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK);
633  AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); //Bug 991
634  AddTestCase (new Bug555TestCase, TestCase::QUICK); //Bug 555
635  AddTestCase (new Bug730TestCase, TestCase::QUICK); //Bug 730
636 }
637 
void RunOne(void)
Definition: wifi-test.cc:137
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:389
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:518
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:523
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:71
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
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:372
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
void ConfigureStandard(enum WifiPhyStandard standard)
Definition: wifi-mac.cc:290
ObjectFactory m_mac
Definition: wifi-test.cc:373
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:289
Make sure that when changing the fragmentation threshold during the simulation, the TCP transmission ...
Definition: wifi-test.cc:496
helps to create WifiNetDevice objects
Definition: wifi-helper.h:76
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:100
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:258
This queue contains packets for a particular access class.
Definition: edca-txop-n.h:85
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:404
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:377
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:376
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:94
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:533
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.
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:251
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:156
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:638
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
ObjectFactory m_mac
Definition: wifi-test.cc:92
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:194
tuple ssid
Definition: third.py:93
manage and create wifi channel objects for the yans model.
ObjectFactory m_propDelay
Definition: wifi-test.cc:93
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
create MAC layers for a ns3::WifiNetDevice.
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
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(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
#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:378
ObjectFactory m_manager
Definition: wifi-test.cc:91
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:48
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:374
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:506
void Add(Vector v)
Add a position to the list of positions.
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:244
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:102
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:411
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:109
Make sure that when multiple broadcast packets are queued on the same device in a short succession no...
Definition: wifi-test.cc:361
WifiTest()
Definition: wifi-test.cc:96
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:287