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/internet-stack-helper.h"
27 #include "ns3/ipv4-address-helper.h"
28 #include "ns3/packet-sink-helper.h"
29 #include "ns3/on-off-helper.h"
30 #include "ns3/mobility-helper.h"
31 #include "ns3/wifi-net-device.h"
32 #include "ns3/adhoc-wifi-mac.h"
33 #include "ns3/propagation-delay-model.h"
34 #include "ns3/propagation-loss-model.h"
35 #include "ns3/yans-error-rate-model.h"
36 #include "ns3/constant-position-mobility-model.h"
37 #include "ns3/test.h"
38 #include "ns3/pointer.h"
39 #include "ns3/rng-seed-manager.h"
40 #include "ns3/config.h"
41 #include "ns3/boolean.h"
42 #include "ns3/string.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  void Receive (std::string context, Ptr<const Packet> p, const Address &adr);
508 
509  uint32_t m_received;
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 void
533 {
534  m_received = 0;
535 
536  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold", StringValue ("2304"));
537  Config::SetDefault ("ns3::TcpSocket::DelAckCount", UintegerValue (2));
538  Config::SetDefault ("ns3::TcpSocket::SegmentSize", UintegerValue (1460));
539 
540  NodeContainer wifiStaNode;
541  wifiStaNode.Create (1);
542 
544  wifiApNode.Create (1);
545 
546  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
547  YansWifiPhyHelper phy = YansWifiPhyHelper::Default ();
548  phy.SetChannel (channel.Create ());
549 
550  WifiHelper wifi = WifiHelper::Default ();
552  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
553  "DataMode", StringValue ("DsssRate1Mbps"),
554  "ControlMode", StringValue ("DsssRate1Mbps"));
555 
556  NqosWifiMacHelper mac = NqosWifiMacHelper::Default ();
557  Ssid ssid = Ssid ("ns-3-ssid");
558  mac.SetType ("ns3::StaWifiMac",
559  "Ssid", SsidValue (ssid),
560  "ActiveProbing", BooleanValue (false));
561 
563  staDevices = wifi.Install (phy, mac, wifiStaNode);
564 
565  mac.SetType ("ns3::ApWifiMac",
566  "Ssid", SsidValue (ssid),
567  "BeaconGeneration", BooleanValue (true));
568 
570  apDevices = wifi.Install (phy, mac, wifiApNode);
571 
573  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
574 
575  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
576  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
577  mobility.SetPositionAllocator (positionAlloc);
578 
579  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
580  mobility.Install (wifiApNode);
581  mobility.Install (wifiStaNode);
582 
584  stack.Install (wifiApNode);
585  stack.Install (wifiStaNode);
586 
588  address.SetBase ("10.1.1.0", "255.255.255.0");
589  Ipv4InterfaceContainer StaInterface;
590  StaInterface = address.Assign (staDevices);
591  Ipv4InterfaceContainer ApInterface;
592  ApInterface = address.Assign (apDevices);
593 
594  Address sinkLocalAddress (InetSocketAddress (Ipv4Address::GetAny (), 21));
595  PacketSinkHelper sinkHelper ("ns3::TcpSocketFactory", sinkLocalAddress);
596  ApplicationContainer sinkApp = sinkHelper.Install (wifiApNode.Get (0));
597  sinkApp.Start (Seconds (1.0));
598  sinkApp.Stop (Seconds (51.0));
599 
600  OnOffHelper sourceHelper ("ns3::TcpSocketFactory", Address ());
601  sourceHelper.SetAttribute ("OnTime", StringValue ("ns3::ConstantRandomVariable[Constant=1]"));
602  sourceHelper.SetAttribute ("OffTime", StringValue ("ns3::ConstantRandomVariable[Constant=0]"));
603  AddressValue remoteAddress (InetSocketAddress (ApInterface.GetAddress (0), 21));
604  sourceHelper.SetAttribute ("Remote", remoteAddress);
605  sourceHelper.SetAttribute ("PacketSize", UintegerValue (1460));
606  sourceHelper.SetAttribute ("DataRate", StringValue ("10Mb/s"));
607  ApplicationContainer sourceApp;
608  sourceApp.Add (sourceHelper.Install (wifiStaNode.Get (0)));
609  sourceApp.Start (Seconds (1.0));
610  sourceApp.Stop (Seconds (51.0));
611 
612  Config::Connect ("/NodeList/*/ApplicationList/0/$ns3::PacketSink/Rx", MakeCallback (&Bug730TestCase::Receive, this));
613 
614  Simulator::Schedule (Seconds (10.0), Config::Set, "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold", StringValue ("800"));
615 
616  Simulator::Stop (Seconds (55));
617  Simulator::Run ();
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 //-----------------------------------------------------------------------------
626 class WifiTestSuite : public TestSuite
627 {
628 public:
629  WifiTestSuite ();
630 };
631 
633  : TestSuite ("devices-wifi", UNIT)
634 {
635  AddTestCase (new WifiTest, TestCase::QUICK);
636  AddTestCase (new QosUtilsIsOldPacketTest, TestCase::QUICK);
637  AddTestCase (new InterferenceHelperSequenceTest, TestCase::QUICK); //Bug 991
638  AddTestCase (new Bug555TestCase, TestCase::QUICK); //Bug 555
639  AddTestCase (new Bug730TestCase, TestCase::QUICK); //Bug 730
640 }
641 
void RunOne(void)
Definition: wifi-test.cc:138
tuple channel
Definition: third.py:85
holds a vector of ns3::Application pointers.
void NotifyPhyTxBegin(Ptr< const Packet > p)
Definition: wifi-test.cc:390
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
an Inet address class
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
AttributeValue implementation for Boolean.
Definition: boolean.h:34
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Definition: wifi-test.cc:523
holds a vector of std::pair of Ptr and interface index.
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
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
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
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
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
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.
aggregate IP/TCP/UDP functionality to existing Nodes.
#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
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
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
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Definition: on-off-helper.h:42
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:135
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:532
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
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
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:642
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
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
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 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)
tuple stack
Definition: first.py:34
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.
AttributeValue implementation for Address.
Definition: address.h:278
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:121
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:509
void Add(Vector v)
Add a position to the list of positions.
void SendOnePacket(Ptr< WifiNetDevice > dev)
Definition: wifi-test.cc:245
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
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.
tuple address
Definition: first.py:37
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
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
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
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
WifiTest()
Definition: wifi-test.cc:97
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
virtual void DoRun(void)
Implementation to actually run this TestCase.
Definition: wifi-test.cc:288