A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 * 2010 NICTA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 * Quincy Tse <quincy.tse@nicta.com.au>
20 * S├ębastien Deronne <sebastien.deronne@gmail.com>
21 */
22
23#include "ns3/adhoc-wifi-mac.h"
24#include "ns3/ap-wifi-mac.h"
25#include "ns3/config.h"
26#include "ns3/constant-position-mobility-model.h"
27#include "ns3/error-model.h"
28#include "ns3/fcfs-wifi-queue-scheduler.h"
29#include "ns3/frame-exchange-manager.h"
30#include "ns3/header-serialization-test.h"
31#include "ns3/ht-configuration.h"
32#include "ns3/interference-helper.h"
33#include "ns3/mgt-headers.h"
34#include "ns3/mobility-helper.h"
35#include "ns3/multi-model-spectrum-channel.h"
36#include "ns3/packet-socket-client.h"
37#include "ns3/packet-socket-helper.h"
38#include "ns3/packet-socket-server.h"
39#include "ns3/pointer.h"
40#include "ns3/propagation-loss-model.h"
41#include "ns3/rng-seed-manager.h"
42#include "ns3/socket.h"
43#include "ns3/spectrum-wifi-helper.h"
44#include "ns3/string.h"
45#include "ns3/test.h"
46#include "ns3/vht-phy.h"
47#include "ns3/waypoint-mobility-model.h"
48#include "ns3/wifi-default-ack-manager.h"
49#include "ns3/wifi-default-assoc-manager.h"
50#include "ns3/wifi-default-protection-manager.h"
51#include "ns3/wifi-mgt-header.h"
52#include "ns3/wifi-net-device.h"
53#include "ns3/wifi-ppdu.h"
54#include "ns3/wifi-psdu.h"
55#include "ns3/wifi-spectrum-signal-parameters.h"
56#include "ns3/yans-error-rate-model.h"
57#include "ns3/yans-wifi-helper.h"
58#include "ns3/yans-wifi-phy.h"
59
60using namespace ns3;
61
62// Helper function to assign streams to random variables, to control
63// randomness in the tests
64static void
66{
67 int64_t currentStream = stream;
68 PointerValue ptr;
69 if (!mac->GetQosSupported())
70 {
71 mac->GetAttribute("Txop", ptr);
72 Ptr<Txop> txop = ptr.Get<Txop>();
73 currentStream += txop->AssignStreams(currentStream);
74 }
75 else
76 {
77 mac->GetAttribute("VO_Txop", ptr);
78 Ptr<QosTxop> vo_txop = ptr.Get<QosTxop>();
79 currentStream += vo_txop->AssignStreams(currentStream);
80
81 mac->GetAttribute("VI_Txop", ptr);
82 Ptr<QosTxop> vi_txop = ptr.Get<QosTxop>();
83 currentStream += vi_txop->AssignStreams(currentStream);
84
85 mac->GetAttribute("BE_Txop", ptr);
86 Ptr<QosTxop> be_txop = ptr.Get<QosTxop>();
87 currentStream += be_txop->AssignStreams(currentStream);
88
89 mac->GetAttribute("BK_Txop", ptr);
90 Ptr<QosTxop> bk_txop = ptr.Get<QosTxop>();
91 bk_txop->AssignStreams(currentStream);
92 }
93}
94
101class WifiTest : public TestCase
102{
103 public:
104 WifiTest();
105
106 void DoRun() override;
107
108 private:
110 void RunOne();
116 void CreateOne(Vector pos, Ptr<YansWifiChannel> channel);
122
126};
127
129 : TestCase("Wifi")
130{
131}
132
133void
135{
136 Ptr<Packet> p = Create<Packet>();
137 dev->Send(p, dev->GetBroadcast(), 1);
138}
139
140void
142{
143 Ptr<Node> node = CreateObject<Node>();
144 Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
145 node->AddDevice(dev);
146
147 auto mobility = CreateObject<ConstantPositionMobilityModel>();
148 auto phy = CreateObject<YansWifiPhy>();
149 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
150 phy->SetInterferenceHelper(interferenceHelper);
151 auto error = CreateObject<YansErrorRateModel>();
152 phy->SetErrorRateModel(error);
153 phy->SetChannel(channel);
154 phy->SetDevice(dev);
155 phy->ConfigureStandard(WIFI_STANDARD_80211a);
156 dev->SetPhy(phy);
157 auto manager = m_manager.Create<WifiRemoteStationManager>();
158 dev->SetRemoteStationManager(manager);
159
161 mac->SetDevice(dev);
162 mac->SetAddress(Mac48Address::Allocate());
163 dev->SetMac(mac);
164 mac->ConfigureStandard(WIFI_STANDARD_80211a);
165 if (mac->GetTypeOfStation() == STA)
166 {
167 StaticCast<StaWifiMac>(mac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
168 }
169 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
170 Ptr<FrameExchangeManager> fem = mac->GetFrameExchangeManager();
171 Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager>();
172 protectionManager->SetWifiMac(mac);
173 fem->SetProtectionManager(protectionManager);
174 Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager>();
175 ackManager->SetWifiMac(mac);
176 fem->SetAckManager(ackManager);
177
178 mobility->SetPosition(pos);
179 node->AggregateObject(mobility);
180
182}
183
184void
186{
187 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
189 Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel>();
190 channel->SetPropagationDelayModel(propDelay);
191 channel->SetPropagationLossModel(propLoss);
192
193 CreateOne(Vector(0.0, 0.0, 0.0), channel);
194 CreateOne(Vector(5.0, 0.0, 0.0), channel);
195 CreateOne(Vector(5.0, 0.0, 0.0), channel);
196
198
201}
202
203void
205{
206 m_mac.SetTypeId("ns3::AdhocWifiMac");
207 m_propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
208
209 m_manager.SetTypeId("ns3::ArfWifiManager");
210 RunOne();
211 m_manager.SetTypeId("ns3::AarfWifiManager");
212 RunOne();
213 m_manager.SetTypeId("ns3::ConstantRateWifiManager");
214 RunOne();
215 m_manager.SetTypeId("ns3::OnoeWifiManager");
216 RunOne();
217 m_manager.SetTypeId("ns3::AmrrWifiManager");
218 RunOne();
219 m_manager.SetTypeId("ns3::IdealWifiManager");
220 RunOne();
221
222 m_mac.SetTypeId("ns3::AdhocWifiMac");
223 RunOne();
224 m_mac.SetTypeId("ns3::ApWifiMac");
225 RunOne();
226 m_mac.SetTypeId("ns3::StaWifiMac");
227 RunOne();
228
229 m_propDelay.SetTypeId("ns3::RandomPropagationDelayModel");
230 m_mac.SetTypeId("ns3::AdhocWifiMac");
231 RunOne();
232}
233
241{
242 public:
244 : TestCase("QosUtilsIsOldPacket")
245 {
246 }
247
248 void DoRun() override
249 {
250 // startingSeq=0, seqNum=2047
252 false,
253 "2047 is new in comparison to 0");
254 // startingSeq=0, seqNum=2048
255 NS_TEST_EXPECT_MSG_EQ(QosUtilsIsOldPacket(0, 2048), true, "2048 is old in comparison to 0");
256 // startingSeq=2048, seqNum=0
257 NS_TEST_EXPECT_MSG_EQ(QosUtilsIsOldPacket(2048, 0), true, "0 is old in comparison to 2048");
258 // startingSeq=4095, seqNum=0
260 false,
261 "0 is new in comparison to 4095");
262 // startingSeq=0, seqNum=4095
263 NS_TEST_EXPECT_MSG_EQ(QosUtilsIsOldPacket(0, 4095), true, "4095 is old in comparison to 0");
264 // startingSeq=4095 seqNum=2047
266 true,
267 "2047 is old in comparison to 4095");
268 // startingSeq=2048 seqNum=4095
270 false,
271 "4095 is new in comparison to 2048");
272 // startingSeq=2049 seqNum=0
274 false,
275 "0 is new in comparison to 2049");
276 }
277};
278
283{
284 public:
286
287 void DoRun() override;
288
289 private:
296 Ptr<Node> CreateOne(Vector pos, Ptr<YansWifiChannel> channel);
307
311};
312
314 : TestCase("InterferenceHelperSequence")
315{
316}
317
318void
320{
321 Ptr<Packet> p = Create<Packet>(1000);
322 dev->Send(p, dev->GetBroadcast(), 1);
323}
324
325void
327{
328 Ptr<WifiPhy> p = dev->GetPhy();
329 p->SetOperatingChannel(WifiPhy::ChannelTuple{40, 0, (int)(WIFI_PHY_BAND_5GHZ), 0});
330}
331
334{
335 Ptr<Node> node = CreateObject<Node>();
336 Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
337 node->AddDevice(dev);
338
339 auto mobility = CreateObject<ConstantPositionMobilityModel>();
340 auto phy = CreateObject<YansWifiPhy>();
341 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
342 phy->SetInterferenceHelper(interferenceHelper);
343 auto error = CreateObject<YansErrorRateModel>();
344 phy->SetErrorRateModel(error);
345 phy->SetChannel(channel);
346 phy->SetDevice(dev);
347 phy->SetMobility(mobility);
348 phy->ConfigureStandard(WIFI_STANDARD_80211a);
349 dev->SetPhy(phy);
350 auto manager = m_manager.Create<WifiRemoteStationManager>();
351 dev->SetRemoteStationManager(manager);
352
354 mac->SetDevice(dev);
355 mac->SetAddress(Mac48Address::Allocate());
356 dev->SetMac(mac);
357 mac->ConfigureStandard(WIFI_STANDARD_80211a);
358 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
359 Ptr<FrameExchangeManager> fem = mac->GetFrameExchangeManager();
360 Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager>();
361 protectionManager->SetWifiMac(mac);
362 fem->SetProtectionManager(protectionManager);
363 Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager>();
364 ackManager->SetWifiMac(mac);
365 fem->SetAckManager(ackManager);
366
367 mobility->SetPosition(pos);
368 node->AggregateObject(mobility);
369
370 return node;
371}
372
373void
375{
376 m_mac.SetTypeId("ns3::AdhocWifiMac");
377 m_propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
378 m_manager.SetTypeId("ns3::ConstantRateWifiManager");
379
380 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
382 Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel>();
383 channel->SetPropagationDelayModel(propDelay);
384 channel->SetPropagationLossModel(propLoss);
385
386 Ptr<Node> rxOnly = CreateOne(Vector(0.0, 0.0, 0.0), channel);
387 Ptr<Node> senderA = CreateOne(Vector(5.0, 0.0, 0.0), channel);
388 Ptr<Node> senderB = CreateOne(Vector(-5.0, 0.0, 0.0), channel);
389
390 propLoss->SetLoss(senderB->GetObject<MobilityModel>(),
391 rxOnly->GetObject<MobilityModel>(),
392 0,
393 true);
394 propLoss->SetDefaultLoss(999);
395
398 this,
399 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
400
401 Simulator::Schedule(Seconds(1.0000001),
403 this,
404 DynamicCast<WifiNetDevice>(rxOnly->GetDevice(0)));
405
408 this,
409 DynamicCast<WifiNetDevice>(senderA->GetDevice(0)));
410
413 this,
414 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
415
416 Simulator::Stop(Seconds(100.0));
418
420}
421
422//-----------------------------------------------------------------------------
474{
475 public:
477
478 void DoRun() override;
479
480 private:
486
490
493 unsigned int m_numSentPackets;
494
500 void NotifyPhyTxBegin(Ptr<const Packet> p, double txPowerW);
501};
502
504 : TestCase("Test case for DCF immediate access with broadcast frames")
505{
506}
507
508void
510{
511 if (m_numSentPackets == 0)
512 {
515 }
516 else if (m_numSentPackets == 1)
517 {
519 }
520}
521
522void
524{
525 Ptr<Packet> p = Create<Packet>(1000);
526 dev->Send(p, dev->GetBroadcast(), 1);
527}
528
529void
531{
532 m_mac.SetTypeId("ns3::AdhocWifiMac");
533 m_propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
534 m_manager.SetTypeId("ns3::ConstantRateWifiManager");
535
536 // Assign a seed and run number, and later fix the assignment of streams to
537 // WiFi random variables, so that the first backoff used is one slot
539 RngSeedManager::SetRun(40); // a value of 17 will result in zero slots
540
541 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
543 Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel>();
544 channel->SetPropagationDelayModel(propDelay);
545 channel->SetPropagationLossModel(propLoss);
546
547 Ptr<Node> txNode = CreateObject<Node>();
548 Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice>();
549
550 Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel>();
551 Ptr<YansWifiPhy> txPhy = CreateObject<YansWifiPhy>();
552 Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper>();
553 txPhy->SetInterferenceHelper(txInterferenceHelper);
554 Ptr<ErrorRateModel> txError = CreateObject<YansErrorRateModel>();
555 txPhy->SetErrorRateModel(txError);
556 txPhy->SetChannel(channel);
557 txPhy->SetDevice(txDev);
558 txPhy->SetMobility(txMobility);
559 txPhy->ConfigureStandard(WIFI_STANDARD_80211a);
560
561 txPhy->TraceConnectWithoutContext(
562 "PhyTxBegin",
564
565 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
566 txNode->AggregateObject(txMobility);
567 txDev->SetPhy(txPhy);
568 txDev->SetRemoteStationManager(m_manager.Create<WifiRemoteStationManager>());
569 txNode->AddDevice(txDev);
570
571 auto txMac = m_mac.Create<WifiMac>();
572 txMac->SetDevice(txDev);
573 txMac->SetAddress(Mac48Address::Allocate());
574 txDev->SetMac(txMac);
575 txMac->ConfigureStandard(WIFI_STANDARD_80211a);
576 txMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
577 auto fem = txMac->GetFrameExchangeManager();
578 auto protectionManager = CreateObject<WifiDefaultProtectionManager>();
579 protectionManager->SetWifiMac(txMac);
580 fem->SetProtectionManager(protectionManager);
581 auto ackManager = CreateObject<WifiDefaultAckManager>();
582 ackManager->SetWifiMac(txMac);
583 fem->SetAckManager(ackManager);
584
585 // Fix the stream assignment to the Dcf Txop objects (backoffs)
586 // The below stream assignment will result in the Txop object
587 // using a backoff value of zero for this test when the
588 // Txop::EndTxNoAck() calls to StartBackoffNow()
589 AssignWifiRandomStreams(txMac, 23);
590
594
597 this,
598 txDev);
601 this,
602 txDev);
603
607
608 // First packet is transmitted a DIFS after the packet is queued. A DIFS
609 // is 2 slots (2 * 9 = 18 us) plus a SIFS (16 us), i.e., 34 us
610 Time expectedFirstTransmissionTime = Seconds(1.0) + MicroSeconds(34);
611
612 // First packet has 1408 us of transmit time. Slot time is 9 us.
613 // Backoff is 1 slots. SIFS is 16 us. DIFS is 2 slots = 18 us.
614 // Should send next packet at 1408 us + (1 * 9 us) + 16 us + (2 * 9) us
615 // 1451 us after the first one.
616 uint32_t expectedWait1 = 1408 + (1 * 9) + 16 + (2 * 9);
617 Time expectedSecondTransmissionTime =
618 expectedFirstTransmissionTime + MicroSeconds(expectedWait1);
620 expectedFirstTransmissionTime,
621 "The first transmission time not correct!");
622
624 expectedSecondTransmissionTime,
625 "The second transmission time not correct!");
626}
627
628//-----------------------------------------------------------------------------
642{
643 public:
645 ~Bug730TestCase() override;
646
647 void DoRun() override;
648
649 private:
651
658 void Receive(std::string context, Ptr<const Packet> p, const Address& adr);
659};
660
662 : TestCase("Test case for Bug 730"),
663 m_received(0)
664{
665}
666
668{
669}
670
671void
672Bug730TestCase::Receive(std::string context, Ptr<const Packet> p, const Address& adr)
673{
674 if ((p->GetSize() == 1460) && (Simulator::Now() > Seconds(20)))
675 {
676 m_received++;
677 }
678}
679
680void
682{
683 m_received = 0;
684
685 NodeContainer wifiStaNode;
686 wifiStaNode.Create(1);
687
688 NodeContainer wifiApNode;
689 wifiApNode.Create(1);
690
693 phy.SetChannel(channel.Create());
694
695 WifiHelper wifi;
696 wifi.SetStandard(WIFI_STANDARD_80211b);
697 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
698 "DataMode",
699 StringValue("DsssRate1Mbps"),
700 "ControlMode",
701 StringValue("DsssRate1Mbps"));
702
703 WifiMacHelper mac;
704 Ssid ssid = Ssid("ns-3-ssid");
705 mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid), "ActiveProbing", BooleanValue(false));
706
707 NetDeviceContainer staDevices;
708 staDevices = wifi.Install(phy, mac, wifiStaNode);
709
710 mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid), "BeaconGeneration", BooleanValue(true));
711
712 NetDeviceContainer apDevices;
713 apDevices = wifi.Install(phy, mac, wifiApNode);
714
715 MobilityHelper mobility;
716 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
717
718 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
719 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
720 mobility.SetPositionAllocator(positionAlloc);
721
722 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
723 mobility.Install(wifiApNode);
724 mobility.Install(wifiStaNode);
725
726 Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice>(apDevices.Get(0));
727 Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice>(staDevices.Get(0));
728
729 PacketSocketAddress socket;
730 socket.SetSingleDevice(sta_device->GetIfIndex());
731 socket.SetPhysicalAddress(ap_device->GetAddress());
732 socket.SetProtocol(1);
733
734 // give packet socket powers to nodes.
735 PacketSocketHelper packetSocket;
736 packetSocket.Install(wifiStaNode);
737 packetSocket.Install(wifiApNode);
738
739 Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient>();
740 client->SetAttribute("PacketSize", UintegerValue(1460));
741 client->SetRemote(socket);
742 wifiStaNode.Get(0)->AddApplication(client);
743 client->SetStartTime(Seconds(1));
744 client->SetStopTime(Seconds(51.0));
745
746 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
747 server->SetLocal(socket);
748 wifiApNode.Get(0)->AddApplication(server);
749 server->SetStartTime(Seconds(0.0));
750 server->SetStopTime(Seconds(52.0));
751
752 Config::Connect("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
754
757 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
758 StringValue("800"));
759
762
764
765 bool result = (m_received > 0);
767 result,
768 true,
769 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
770}
771
772//-----------------------------------------------------------------------------
781{
782 public:
784 ~QosFragmentationTestCase() override;
785
786 void DoRun() override;
787
788 private:
791
798 void Receive(std::string context, Ptr<const Packet> p, const Address& adr);
799
806 void Transmit(std::string context, Ptr<const Packet> p, double power);
807};
808
810 : TestCase("Test case for fragmentation with QoS stations"),
811 m_received(0),
812 m_fragments(0)
813{
814}
815
817{
818}
819
820void
822{
823 if (p->GetSize() == 1400)
824 {
825 m_received++;
826 }
827}
828
829void
830QosFragmentationTestCase::Transmit(std::string context, Ptr<const Packet> p, double power)
831{
832 WifiMacHeader hdr;
833 p->PeekHeader(hdr);
834 if (hdr.IsQosData())
835 {
836 NS_TEST_EXPECT_MSG_LT_OR_EQ(p->GetSize(), 400, "Unexpected fragment size");
837 m_fragments++;
838 }
839}
840
841void
843{
844 NodeContainer wifiStaNode;
845 wifiStaNode.Create(1);
846
847 NodeContainer wifiApNode;
848 wifiApNode.Create(1);
849
852 phy.SetChannel(channel.Create());
853
854 WifiHelper wifi;
855 wifi.SetStandard(WIFI_STANDARD_80211n);
856 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode", StringValue("HtMcs7"));
857
858 WifiMacHelper mac;
859 Ssid ssid = Ssid("ns-3-ssid");
860 mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid), "ActiveProbing", BooleanValue(false));
861
862 NetDeviceContainer staDevices;
863 staDevices = wifi.Install(phy, mac, wifiStaNode);
864
865 mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid), "BeaconGeneration", BooleanValue(true));
866
867 NetDeviceContainer apDevices;
868 apDevices = wifi.Install(phy, mac, wifiApNode);
869
870 MobilityHelper mobility;
871 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
872
873 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
874 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
875 mobility.SetPositionAllocator(positionAlloc);
876
877 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
878 mobility.Install(wifiApNode);
879 mobility.Install(wifiStaNode);
880
881 Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice>(apDevices.Get(0));
882 Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice>(staDevices.Get(0));
883
884 // set the TXOP limit on BE AC
885 PointerValue ptr;
886 sta_device->GetMac()->GetAttribute("BE_Txop", ptr);
887 ptr.Get<QosTxop>()->SetTxopLimit(MicroSeconds(3008));
888
889 PacketSocketAddress socket;
890 socket.SetSingleDevice(sta_device->GetIfIndex());
891 socket.SetPhysicalAddress(ap_device->GetAddress());
892 socket.SetProtocol(1);
893
894 // give packet socket powers to nodes.
895 PacketSocketHelper packetSocket;
896 packetSocket.Install(wifiStaNode);
897 packetSocket.Install(wifiApNode);
898
899 Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient>();
900 client->SetAttribute("PacketSize", UintegerValue(1400));
901 client->SetAttribute("MaxPackets", UintegerValue(1));
902 client->SetRemote(socket);
903 wifiStaNode.Get(0)->AddApplication(client);
904 client->SetStartTime(Seconds(1));
905 client->SetStopTime(Seconds(3.0));
906
907 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
908 server->SetLocal(socket);
909 wifiApNode.Get(0)->AddApplication(server);
910 server->SetStartTime(Seconds(0.0));
911 server->SetStopTime(Seconds(4.0));
912
913 Config::Connect("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
915
916 Config::Set("/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
917 StringValue("400"));
918 Config::Connect("/NodeList/0/DeviceList/0/Phy/PhyTxBegin",
920
923
925
926 NS_TEST_ASSERT_MSG_EQ(m_received, 1, "Unexpected number of received packets");
927 NS_TEST_ASSERT_MSG_EQ(m_fragments, 4, "Unexpected number of transmitted fragments");
928}
929
937{
938 public:
940
941 void DoRun() override;
942
943 private:
950};
951
953 : TestCase("Test case for setting WifiPhy channel and frequency")
954{
955}
956
959{
960 Ptr<WifiNetDevice> wnd = nc.Get(0)->GetObject<WifiNetDevice>();
961 Ptr<WifiPhy> wp = wnd->GetPhy();
962 return wp->GetObject<YansWifiPhy>();
963}
964
965void
967{
968 NodeContainer wifiStaNode;
969 wifiStaNode.Create(1);
970 NodeContainer wifiApNode;
971 wifiApNode.Create(1);
972
975 phy.SetChannel(channel.Create());
976
977 // Configure and declare other generic components of this example
978 Ssid ssid;
979 ssid = Ssid("wifi-phy-configuration");
980 WifiMacHelper macSta;
981 macSta.SetType("ns3::StaWifiMac",
982 "Ssid",
983 SsidValue(ssid),
984 "ActiveProbing",
985 BooleanValue(false));
986 NetDeviceContainer staDevice;
987 Ptr<YansWifiPhy> phySta;
988
989 // Cases taken from src/wifi/examples/wifi-phy-configuration.cc example
990 {
991 // case 0:
992 // Default configuration, without WifiHelper::SetStandard or WifiHelper
993 phySta = CreateObject<YansWifiPhy>();
994 // The default results in an invalid configuration
995 NS_TEST_ASSERT_MSG_EQ(phySta->GetOperatingChannel().IsSet(),
996 false,
997 "default configuration");
998 }
999 {
1000 // case 1:
1001 WifiHelper wifi;
1002 wifi.SetStandard(WIFI_STANDARD_80211a);
1003 wifi.SetRemoteStationManager("ns3::ArfWifiManager");
1004 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1005 phySta = GetYansWifiPhyPtr(staDevice);
1006 // We expect channel 36, width 20, frequency 5180
1007 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "default configuration");
1008 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "default configuration");
1009 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "default configuration");
1010 }
1011 {
1012 // case 2:
1013 WifiHelper wifi;
1014 wifi.SetStandard(WIFI_STANDARD_80211b);
1015 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1016 phySta = GetYansWifiPhyPtr(staDevice);
1017 // We expect channel 1, width 22, frequency 2412
1018 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11b configuration");
1019 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 22, "802.11b configuration");
1020 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11b configuration");
1021 }
1022 {
1023 // case 3:
1024 WifiHelper wifi;
1025 wifi.SetStandard(WIFI_STANDARD_80211g);
1026 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1027 phySta = GetYansWifiPhyPtr(staDevice);
1028 // We expect channel 1, width 20, frequency 2412
1029 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11g configuration");
1030 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11g configuration");
1031 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11g configuration");
1032 }
1033 {
1034 // case 4:
1035 WifiHelper wifi;
1036 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1037 wifi.SetStandard(WIFI_STANDARD_80211n);
1038 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_5GHZ, 0}"));
1039 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1040 phySta = GetYansWifiPhyPtr(staDevice);
1041 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11n-5GHz configuration");
1042 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11n-5GHz configuration");
1043 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11n-5GHz configuration");
1044 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1045 }
1046 {
1047 // case 5:
1048 WifiHelper wifi;
1049 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1050 wifi.SetStandard(WIFI_STANDARD_80211n);
1051 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1052 phySta = GetYansWifiPhyPtr(staDevice);
1053 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11n-2.4GHz configuration");
1054 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11n-2.4GHz configuration");
1055 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11n-2.4GHz configuration");
1056 }
1057 {
1058 // case 6:
1059 WifiHelper wifi;
1060 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1061 wifi.SetStandard(WIFI_STANDARD_80211ac);
1062 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1063 phySta = GetYansWifiPhyPtr(staDevice);
1064 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 42, "802.11ac configuration");
1065 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 80, "802.11ac configuration");
1066 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5210, "802.11ac configuration");
1067 }
1068 {
1069 // case 7:
1070 // By default, WifiHelper will use WIFI_PHY_STANDARD_80211ax
1071 WifiHelper wifi;
1072 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1073 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_2_4GHZ, 0}"));
1074 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1075 phySta = GetYansWifiPhyPtr(staDevice);
1076 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11ax-2.4GHz configuration");
1077 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11ax-2.4GHz configuration");
1078 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11ax-2.4GHz configuration");
1079 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1080 }
1081 {
1082 // case 8:
1083 WifiHelper wifi;
1084 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1085 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1086 phySta = GetYansWifiPhyPtr(staDevice);
1087 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 42, "802.11ax-5GHz configuration");
1088 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 80, "802.11ax-5GHz configuration");
1089 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5210, "802.11ax-5GHz configuration");
1090 }
1091 {
1092 // case 9:
1093 WifiHelper wifi;
1094 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1095 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_6GHZ, 0}"));
1096 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1097 phySta = GetYansWifiPhyPtr(staDevice);
1098 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 7, "802.11ax-6GHz configuration");
1099 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 80, "802.11ax-6GHz configuration");
1100 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5985, "802.11ax-6GHz configuration");
1101 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1102 }
1103 {
1104 // case 10:
1105 WifiHelper wifi;
1106 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1107 wifi.SetStandard(WIFI_STANDARD_80211p);
1108 phy.Set("ChannelSettings", StringValue("{0, 10, BAND_5GHZ, 0}"));
1109 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1110 phySta = GetYansWifiPhyPtr(staDevice);
1111 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 172, "802.11p 10Mhz configuration");
1112 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 10, "802.11p 10Mhz configuration");
1113 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5860, "802.11p 10Mhz configuration");
1114 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1115 }
1116 {
1117 // case 11:
1118 WifiHelper wifi;
1119 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1120 wifi.SetStandard(WIFI_STANDARD_80211p);
1121 phy.Set("ChannelSettings", StringValue("{0, 5, BAND_5GHZ, 0}"));
1122 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1123 phySta = GetYansWifiPhyPtr(staDevice);
1124 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 171, "802.11p 5Mhz configuration");
1125 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 5, "802.11p 5Mhz configuration");
1126 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5860, "802.11p 5Mhz configuration");
1127 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1128 }
1129 {
1130 // case 12:
1131 WifiHelper wifi;
1132 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1133 wifi.SetStandard(WIFI_STANDARD_80211n);
1134 phy.Set("ChannelSettings", StringValue("{44, 20, BAND_5GHZ, 0}"));
1135 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1136 phySta = GetYansWifiPhyPtr(staDevice);
1137 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 44, "802.11 5GHz configuration");
1138 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1139 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5220, "802.11 5GHz configuration");
1140 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1141 }
1142 {
1143 // case 13:
1144 WifiHelper wifi;
1145 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1146 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1147 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1148 phySta = GetYansWifiPhyPtr(staDevice);
1149 // Post-install reconfiguration to channel number 40
1150 std::ostringstream path;
1151 path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex()
1152 << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1153 Config::Set(path.str(), StringValue("{40, 0, BAND_5GHZ, 0}"));
1154 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1155 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1156 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1157 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1158 }
1159 {
1160 // case 14:
1161 WifiHelper wifi;
1162 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1163 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1164 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1165 phySta = GetYansWifiPhyPtr(staDevice);
1166 // Post-install reconfiguration to a 40 MHz channel
1167 std::ostringstream path;
1168 path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex()
1169 << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1170 Config::Set(path.str(), StringValue("{46, 0, BAND_5GHZ, 0}"));
1171 // Although channel 44 is configured originally for 20 MHz, we
1172 // allow it to be used for 40 MHz here
1173 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 46, "802.11 5GHz configuration");
1174 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 40, "802.11 5GHz configuration");
1175 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5230, "802.11 5GHz configuration");
1176 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1177 }
1178 {
1179 // case 15:
1180 WifiHelper wifi;
1181 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1182 wifi.SetStandard(WIFI_STANDARD_80211n);
1183 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1184 phySta = GetYansWifiPhyPtr(staDevice);
1185 phySta->SetAttribute("ChannelSettings", StringValue("{3, 20, BAND_2_4GHZ, 0}"));
1186 return;
1187 // Post-install reconfiguration to a 40 MHz channel
1188 std::ostringstream path;
1189 path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex()
1190 << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1191 Config::Set(path.str(), StringValue("{4, 40, BAND_2_4GHZ, 0}"));
1192 // Although channel 44 is configured originally for 20 MHz, we
1193 // allow it to be used for 40 MHz here
1194 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 4, "802.11 5GHz configuration");
1195 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 40, "802.11 5GHz configuration");
1196 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2427, "802.11 5GHz configuration");
1197 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1198 }
1199 {
1200 // case 16:
1201 WifiHelper wifi;
1202 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1203 // Test that setting Frequency to a non-standard value will throw an exception
1204 wifi.SetStandard(WIFI_STANDARD_80211n);
1205 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1206 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1207 phySta = GetYansWifiPhyPtr(staDevice);
1208 bool exceptionThrown = false;
1209 try
1210 {
1211 phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
1212 }
1213 catch (const std::runtime_error&)
1214 {
1215 exceptionThrown = true;
1216 }
1217 // We expect that an exception is thrown
1218 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1219 }
1220 {
1221 // case 17:
1222 WifiHelper wifi;
1223 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1224 wifi.SetStandard(WIFI_STANDARD_80211n);
1225 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1226 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1227 phySta = GetYansWifiPhyPtr(staDevice);
1228 // Test that setting channel to a standard value will set the
1229 // frequency correctly
1230 phySta->SetAttribute("ChannelSettings", StringValue("{100, 0, BAND_5GHZ, 0}"));
1231 // We expect frequency to be 5500 due to channel number being 100
1232 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 100, "802.11 5GHz configuration");
1233 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1234 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5500, "802.11 5GHz configuration");
1235 }
1236 {
1237 // case 18:
1238 // Set a wrong channel after initialization
1239 WifiHelper wifi;
1240 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1241 wifi.SetStandard(WIFI_STANDARD_80211n);
1242 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1243 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1244 phySta = GetYansWifiPhyPtr(staDevice);
1245 bool exceptionThrown = false;
1246 try
1247 {
1248 phySta->SetOperatingChannel(WifiPhy::ChannelTuple{99, 40, WIFI_PHY_BAND_5GHZ, 0});
1249 }
1250 catch (const std::runtime_error&)
1251 {
1252 exceptionThrown = true;
1253 }
1254 // We expect that an exception is thrown
1255 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1256 }
1257 {
1258 // case 19:
1259 WifiHelper wifi;
1260 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1261 // Test how channel number behaves when frequency is non-standard
1262 wifi.SetStandard(WIFI_STANDARD_80211n);
1263 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1264 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1265 phySta = GetYansWifiPhyPtr(staDevice);
1266 bool exceptionThrown = false;
1267 try
1268 {
1269 phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
1270 }
1271 catch (const std::runtime_error&)
1272 {
1273 exceptionThrown = true;
1274 }
1275 // We expect that an exception is thrown due to unknown channel number 45
1276 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1277 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1278 // We expect channel number to be 36 due to known center frequency 5180
1279 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1280 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1281 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1282 exceptionThrown = false;
1283 try
1284 {
1285 phySta->SetAttribute("ChannelSettings", StringValue("{43, 0, BAND_5GHZ, 0}"));
1286 }
1287 catch (const std::runtime_error&)
1288 {
1289 exceptionThrown = true;
1290 }
1291 // We expect that an exception is thrown due to unknown channel number 43
1292 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1293 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1294 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1295 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1296 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1297 }
1298 {
1299 // case 20:
1300 WifiHelper wifi;
1301 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1302 phy.Set("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
1303 wifi.SetStandard(WIFI_STANDARD_80211n);
1304 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1305 phySta = GetYansWifiPhyPtr(staDevice);
1306 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1307 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1308 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1309 // Set both channel and frequency to consistent values after initialization
1310 wifi.SetStandard(WIFI_STANDARD_80211n);
1311 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1312 phySta = GetYansWifiPhyPtr(staDevice);
1313 phySta->SetAttribute("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
1314 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1315 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1316 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1317
1318 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1319 // We expect channel number to be 36
1320 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1321 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1322 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1323 phySta->SetAttribute("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
1324 // We expect channel number to be 40
1325 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1326 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1327 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1328 bool exceptionThrown = false;
1329 try
1330 {
1331 phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
1332 }
1333 catch (const std::runtime_error&)
1334 {
1335 exceptionThrown = true;
1336 }
1337 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1338 // We expect channel number to be 36 and an exception to be thrown
1339 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1340 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1341 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1342 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1343 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1344 exceptionThrown = false;
1345 try
1346 {
1347 phySta->SetAttribute("ChannelSettings", StringValue("{43, 0, BAND_5GHZ, 0}"));
1348 }
1349 catch (const std::runtime_error&)
1350 {
1351 exceptionThrown = true;
1352 }
1353 // We expect channel number to be 36 and an exception to be thrown
1354 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1355 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1356 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1357 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1358 }
1359
1361}
1362
1363//-----------------------------------------------------------------------------
1372{
1373 public:
1375 ~Bug2222TestCase() override;
1376
1377 void DoRun() override;
1378
1379 private:
1381
1387 void TxDataFailedTrace(std::string context, Mac48Address adr);
1388};
1389
1391 : TestCase("Test case for Bug 2222"),
1392 m_countInternalCollisions(0)
1393{
1394}
1395
1397{
1398}
1399
1400void
1402{
1403 // Indicate the long retry counter has been increased in the wifi remote station manager
1405}
1406
1407void
1409{
1411
1412 // Generate same backoff for AC_VI and AC_VO
1413 // The below combination will work
1416 int64_t streamNumber = 100;
1417
1418 NodeContainer wifiNodes;
1419 wifiNodes.Create(2);
1420
1423 phy.SetChannel(channel.Create());
1424
1425 WifiHelper wifi;
1426 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
1427 "DataMode",
1428 StringValue("OfdmRate54Mbps"),
1429 "ControlMode",
1430 StringValue("OfdmRate24Mbps"));
1431 WifiMacHelper mac;
1432 Ssid ssid = Ssid("ns-3-ssid");
1433 mac.SetType("ns3::AdhocWifiMac", "QosSupported", BooleanValue(true));
1434
1435 NetDeviceContainer wifiDevices;
1436 wifiDevices = wifi.Install(phy, mac, wifiNodes);
1437
1438 // Assign fixed streams to random variables in use
1439 wifi.AssignStreams(wifiDevices, streamNumber);
1440
1441 MobilityHelper mobility;
1442 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1443
1444 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1445 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1446 mobility.SetPositionAllocator(positionAlloc);
1447
1448 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1449 mobility.Install(wifiNodes);
1450
1451 Ptr<WifiNetDevice> device1 = DynamicCast<WifiNetDevice>(wifiDevices.Get(0));
1452 Ptr<WifiNetDevice> device2 = DynamicCast<WifiNetDevice>(wifiDevices.Get(1));
1453
1454 PacketSocketAddress socket;
1455 socket.SetSingleDevice(device1->GetIfIndex());
1456 socket.SetPhysicalAddress(device2->GetAddress());
1457 socket.SetProtocol(1);
1458
1459 PacketSocketHelper packetSocket;
1460 packetSocket.Install(wifiNodes);
1461
1462 Ptr<PacketSocketClient> clientLowPriority = CreateObject<PacketSocketClient>();
1463 clientLowPriority->SetAttribute("PacketSize", UintegerValue(1460));
1464 clientLowPriority->SetAttribute("MaxPackets", UintegerValue(1));
1465 clientLowPriority->SetAttribute("Priority", UintegerValue(4)); // AC_VI
1466 clientLowPriority->SetRemote(socket);
1467 wifiNodes.Get(0)->AddApplication(clientLowPriority);
1468 clientLowPriority->SetStartTime(Seconds(0.0));
1469 clientLowPriority->SetStopTime(Seconds(1.0));
1470
1471 Ptr<PacketSocketClient> clientHighPriority = CreateObject<PacketSocketClient>();
1472 clientHighPriority->SetAttribute("PacketSize", UintegerValue(1460));
1473 clientHighPriority->SetAttribute("MaxPackets", UintegerValue(1));
1474 clientHighPriority->SetAttribute("Priority", UintegerValue(6)); // AC_VO
1475 clientHighPriority->SetRemote(socket);
1476 wifiNodes.Get(0)->AddApplication(clientHighPriority);
1477 clientHighPriority->SetStartTime(Seconds(0.0));
1478 clientHighPriority->SetStopTime(Seconds(1.0));
1479
1480 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
1481 server->SetLocal(socket);
1482 wifiNodes.Get(1)->AddApplication(server);
1483 server->SetStartTime(Seconds(0.0));
1484 server->SetStopTime(Seconds(1.0));
1485
1486 Config::Connect("/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1488
1492
1494 1,
1495 "unexpected number of internal collisions!");
1496}
1497
1498//-----------------------------------------------------------------------------
1512{
1513 public:
1515 ~Bug2843TestCase() override;
1516 void DoRun() override;
1517
1518 private:
1523 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1525 std::vector<FreqWidthSubbandModulationTuple>
1528
1535 void StoreDistinctTuple(std::string context, Ptr<SpectrumSignalParameters> txParams);
1542 void SendPacketBurst(uint8_t numPackets,
1543 Ptr<NetDevice> sourceDevice,
1544 Address& destination) const;
1545
1547};
1548
1550 : TestCase("Test case for Bug 2843"),
1551 m_channelWidth(20)
1552{
1553}
1554
1556{
1557}
1558
1559void
1561{
1562 // Extract starting frequency and number of subbands
1563 Ptr<const SpectrumModel> c = txParams->psd->GetSpectrumModel();
1564 std::size_t numBands = c->GetNumBands();
1565 double startingFreq = c->Begin()->fl;
1566
1567 // Get channel bandwidth and modulation class
1569 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1570
1571 Ptr<WifiPpdu> ppdu = wifiTxParams->ppdu->Copy();
1572 WifiTxVector txVector = ppdu->GetTxVector();
1573 m_channelWidth = txVector.GetChannelWidth();
1574 WifiModulationClass modulationClass = txVector.GetMode().GetModulationClass();
1575
1576 // Build a tuple and check if seen before (if so store it)
1577 FreqWidthSubbandModulationTuple tupleForCurrentTx =
1578 std::make_tuple(startingFreq, m_channelWidth, numBands, modulationClass);
1579 bool found = false;
1580 for (std::vector<FreqWidthSubbandModulationTuple>::const_iterator it = m_distinctTuples.begin();
1581 it != m_distinctTuples.end();
1582 it++)
1583 {
1584 if (*it == tupleForCurrentTx)
1585 {
1586 found = true;
1587 }
1588 }
1589 if (!found)
1590 {
1591 m_distinctTuples.push_back(tupleForCurrentTx);
1592 }
1593}
1594
1595void
1597 Ptr<NetDevice> sourceDevice,
1598 Address& destination) const
1599{
1600 for (uint8_t i = 0; i < numPackets; i++)
1601 {
1602 Ptr<Packet> pkt = Create<Packet>(1000); // 1000 dummy bytes of data
1603 sourceDevice->Send(pkt, destination, 0);
1604 }
1605}
1606
1607void
1609{
1610 uint16_t channelWidth = 40; // at least 40 MHz expected here
1611
1612 NodeContainer wifiStaNode;
1613 wifiStaNode.Create(1);
1614
1615 NodeContainer wifiApNode;
1616 wifiApNode.Create(1);
1617
1618 SpectrumWifiPhyHelper spectrumPhy;
1619 Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
1620 Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel>();
1621 lossModel->SetFrequency(5.190e9);
1622 spectrumChannel->AddPropagationLossModel(lossModel);
1623
1625 CreateObject<ConstantSpeedPropagationDelayModel>();
1626 spectrumChannel->SetPropagationDelayModel(delayModel);
1627
1628 spectrumPhy.SetChannel(spectrumChannel);
1629 spectrumPhy.SetErrorRateModel("ns3::NistErrorRateModel");
1630 spectrumPhy.Set("ChannelSettings", StringValue("{38, 40, BAND_5GHZ, 0}"));
1631 spectrumPhy.Set("TxPowerStart", DoubleValue(10));
1632 spectrumPhy.Set("TxPowerEnd", DoubleValue(10));
1633
1634 WifiHelper wifi;
1635 wifi.SetStandard(WIFI_STANDARD_80211ac);
1636 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
1637 "DataMode",
1638 StringValue("VhtMcs8"),
1639 "ControlMode",
1640 StringValue("VhtMcs8"),
1641 "RtsCtsThreshold",
1642 StringValue("500")); // so as to force RTS/CTS for data frames
1643
1644 WifiMacHelper mac;
1645 mac.SetType("ns3::StaWifiMac");
1646 NetDeviceContainer staDevice;
1647 staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode);
1648
1649 mac.SetType("ns3::ApWifiMac");
1650 NetDeviceContainer apDevice;
1651 apDevice = wifi.Install(spectrumPhy, mac, wifiApNode);
1652
1653 MobilityHelper mobility;
1654 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1655 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1656 positionAlloc->Add(Vector(1.0, 0.0, 0.0)); // put close enough in order to use MCS
1657 mobility.SetPositionAllocator(positionAlloc);
1658
1659 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1660 mobility.Install(wifiApNode);
1661 mobility.Install(wifiStaNode);
1662
1663 // Send two 5 packet-bursts
1666 this,
1667 5,
1668 apDevice.Get(0),
1669 staDevice.Get(0)->GetAddress());
1672 this,
1673 5,
1674 apDevice.Get(0),
1675 staDevice.Get(0)->GetAddress());
1676
1677 Config::Connect("/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1679
1682
1684
1685 // {starting frequency, channelWidth, Number of subbands in SpectrumModel, modulation type}
1686 // tuples
1687 std::size_t numberTuples = m_distinctTuples.size();
1688 NS_TEST_ASSERT_MSG_EQ(numberTuples, 2, "Only two distinct tuples expected");
1689 NS_TEST_ASSERT_MSG_EQ(std::get<0>(m_distinctTuples[0]) - 20e6,
1690 std::get<0>(m_distinctTuples[1]),
1691 "The starting frequency of the first tuple should be shifted 20 MHz to "
1692 "the right wrt second tuple");
1693 // Note that the first tuple should the one initiated by the beacon, i.e. non-HT OFDM (20 MHz)
1695 20,
1696 "First tuple's channel width should be 20 MHz");
1698 193,
1699 "First tuple should have 193 subbands (64+DC, 20MHz+DC, inband and 64*2 "
1700 "out-of-band, 20MHz on each side)");
1702 WifiModulationClass::WIFI_MOD_CLASS_OFDM,
1703 "First tuple should be OFDM");
1704 // Second tuple
1706 channelWidth,
1707 "Second tuple's channel width should be 40 MHz");
1709 385,
1710 "Second tuple should have 385 subbands (128+DC, 40MHz+DC, inband and "
1711 "128*2 out-of-band, 40MHz on each side)");
1713 WifiModulationClass::WIFI_MOD_CLASS_VHT,
1714 "Second tuple should be VHT_OFDM");
1715}
1716
1717//-----------------------------------------------------------------------------
1730{
1731 public:
1733 ~Bug2831TestCase() override;
1734 void DoRun() override;
1735
1736 private:
1747 void RxCallback(std::string context, Ptr<const Packet> p, RxPowerWattPerChannelBand rxPowersW);
1748
1751
1758};
1759
1761 : TestCase("Test case for Bug 2831"),
1762 m_assocReqCount(0),
1763 m_assocRespCount(0),
1764 m_countOperationalChannelWidth20(0),
1765 m_countOperationalChannelWidth40(0)
1766{
1767}
1768
1770{
1771}
1772
1773void
1775{
1778}
1779
1780void
1783 RxPowerWattPerChannelBand rxPowersW)
1784{
1785 Ptr<Packet> packet = p->Copy();
1786 WifiMacHeader hdr;
1787 packet->RemoveHeader(hdr);
1788 if (hdr.IsAssocReq())
1789 {
1791 }
1792 else if (hdr.IsAssocResp())
1793 {
1795 }
1796 else if (hdr.IsBeacon())
1797 {
1798 MgtBeaconHeader beacon;
1799 packet->RemoveHeader(beacon);
1800 const auto& htOperation = beacon.Get<HtOperation>();
1801 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1802 {
1804 }
1805 else
1806 {
1808 }
1809 }
1810}
1811
1812void
1814{
1815 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
1816 ObjectFactory propDelay;
1817 propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
1818 Ptr<PropagationDelayModel> propagationDelay = propDelay.Create<PropagationDelayModel>();
1819 Ptr<PropagationLossModel> propagationLoss = CreateObject<FriisPropagationLossModel>();
1820 channel->SetPropagationDelayModel(propagationDelay);
1821 channel->SetPropagationLossModel(propagationLoss);
1822
1823 Ptr<Node> apNode = CreateObject<Node>();
1824 Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice>();
1825 apNode->AddDevice(apDev);
1826 apDev->SetStandard(WIFI_STANDARD_80211ax);
1827 Ptr<HtConfiguration> apHtConfiguration = CreateObject<HtConfiguration>();
1828 apDev->SetHtConfiguration(apHtConfiguration);
1829 ObjectFactory manager;
1830 manager.SetTypeId("ns3::ConstantRateWifiManager");
1831 apDev->SetRemoteStationManager(manager.Create<WifiRemoteStationManager>());
1832
1833 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1834 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1835 apNode->AggregateObject(apMobility);
1836
1837 auto error = CreateObject<YansErrorRateModel>();
1838 m_apPhy = CreateObject<YansWifiPhy>();
1839 apDev->SetPhy(m_apPhy);
1840 Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
1841 m_apPhy->SetInterferenceHelper(apInterferenceHelper);
1842 m_apPhy->SetErrorRateModel(error);
1843 m_apPhy->SetChannel(channel);
1844 m_apPhy->SetMobility(apMobility);
1845 m_apPhy->SetDevice(apDev);
1848
1849 ObjectFactory mac;
1850 mac.SetTypeId("ns3::ApWifiMac");
1851 mac.Set("EnableBeaconJitter", BooleanValue(false));
1852 mac.Set("QosSupported", BooleanValue(true));
1853 Ptr<WifiMac> apMac = mac.Create<WifiMac>();
1854 apMac->SetDevice(apDev);
1855 apMac->SetAddress(Mac48Address::Allocate());
1856 apDev->SetMac(apMac);
1857 apMac->ConfigureStandard(WIFI_STANDARD_80211ax);
1858 apMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1859 Ptr<FrameExchangeManager> fem = apMac->GetFrameExchangeManager();
1860 Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager>();
1861 protectionManager->SetWifiMac(apMac);
1862 fem->SetProtectionManager(protectionManager);
1863 Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager>();
1864 ackManager->SetWifiMac(apMac);
1865 fem->SetAckManager(ackManager);
1866
1867 Ptr<Node> staNode = CreateObject<Node>();
1868 Ptr<WifiNetDevice> staDev = CreateObject<WifiNetDevice>();
1869 staNode->AddDevice(staDev);
1870 staDev->SetStandard(WIFI_STANDARD_80211ax);
1871 Ptr<HtConfiguration> staHtConfiguration = CreateObject<HtConfiguration>();
1872 staDev->SetHtConfiguration(staHtConfiguration);
1873 staDev->SetRemoteStationManager(manager.Create<WifiRemoteStationManager>());
1874
1875 Ptr<ConstantPositionMobilityModel> staMobility = CreateObject<ConstantPositionMobilityModel>();
1876 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1877 staNode->AggregateObject(staMobility);
1878
1879 m_staPhy = CreateObject<YansWifiPhy>();
1880 staDev->SetPhy(m_staPhy);
1881 Ptr<InterferenceHelper> staInterferenceHelper = CreateObject<InterferenceHelper>();
1882 m_staPhy->SetInterferenceHelper(staInterferenceHelper);
1884 m_staPhy->SetChannel(channel);
1885 m_staPhy->SetMobility(staMobility);
1886 m_staPhy->SetDevice(apDev);
1889
1890 mac.SetTypeId("ns3::StaWifiMac");
1891 auto staMac = mac.Create<WifiMac>();
1892 staDev->SetMac(staMac);
1893 staMac->SetDevice(staDev);
1894 staMac->SetAddress(Mac48Address::Allocate());
1895 staMac->ConfigureStandard(WIFI_STANDARD_80211ax);
1896 StaticCast<StaWifiMac>(staMac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
1897 staMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1898 fem = staMac->GetFrameExchangeManager();
1899 protectionManager = CreateObject<WifiDefaultProtectionManager>();
1900 protectionManager->SetWifiMac(staMac);
1901 fem->SetProtectionManager(protectionManager);
1902 ackManager = CreateObject<WifiDefaultAckManager>();
1903 ackManager->SetWifiMac(staMac);
1904 fem->SetAckManager(ackManager);
1905
1906 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1908
1910
1914
1915 NS_TEST_ASSERT_MSG_EQ(m_assocReqCount, 2, "Second Association request not received");
1916 NS_TEST_ASSERT_MSG_EQ(m_assocRespCount, 2, "Second Association response not received");
1918 10,
1919 "Incorrect operational channel width before channel change");
1921 20,
1922 "Incorrect operational channel width after channel change");
1923}
1924
1925//-----------------------------------------------------------------------------
1942{
1943 public:
1945 ~StaWifiMacScanningTestCase() override;
1946 void DoRun() override;
1947
1948 private:
1954 void AssocCallback(std::string context, Mac48Address bssid);
1959 void TurnBeaconGenerationOn(Ptr<Node> apNode);
1964 void TurnApOff(Ptr<Node> apNode);
1971 NodeContainer Setup(bool nearestApBeaconGeneration, bool staActiveProbe);
1972
1974};
1975
1977 : TestCase("Test case for StaWifiMac scanning capability")
1978{
1979}
1980
1982{
1983}
1984
1985void
1987{
1988 m_associatedApBssid = bssid;
1989}
1990
1991void
1993{
1994 Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice>(apNode->GetDevice(0));
1995 Ptr<ApWifiMac> mac = DynamicCast<ApWifiMac>(netDevice->GetMac());
1996 mac->SetAttribute("BeaconGeneration", BooleanValue(true));
1997}
1998
1999void
2001{
2002 Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice>(apNode->GetDevice(0));
2003 Ptr<WifiPhy> phy = netDevice->GetPhy();
2004 phy->SetOffMode();
2005}
2006
2008StaWifiMacScanningTestCase::Setup(bool nearestApBeaconGeneration, bool staActiveProbe)
2009{
2012 int64_t streamNumber = 1;
2013
2014 NodeContainer apNodes;
2015 apNodes.Create(2);
2016
2017 Ptr<Node> apNodeNearest = CreateObject<Node>();
2018 Ptr<Node> staNode = CreateObject<Node>();
2019
2022 phy.SetChannel(channel.Create());
2023
2024 WifiHelper wifi;
2025 wifi.SetStandard(WIFI_STANDARD_80211n);
2026 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager");
2027
2028 WifiMacHelper mac;
2029 NetDeviceContainer apDevice;
2030 NetDeviceContainer apDeviceNearest;
2031 mac.SetType("ns3::ApWifiMac", "BeaconGeneration", BooleanValue(true));
2032 apDevice = wifi.Install(phy, mac, apNodes);
2033 mac.SetType("ns3::ApWifiMac", "BeaconGeneration", BooleanValue(nearestApBeaconGeneration));
2034 apDeviceNearest = wifi.Install(phy, mac, apNodeNearest);
2035
2036 NetDeviceContainer staDevice;
2037 mac.SetType("ns3::StaWifiMac", "ActiveProbing", BooleanValue(staActiveProbe));
2038 staDevice = wifi.Install(phy, mac, staNode);
2039
2040 // Assign fixed streams to random variables in use
2041 wifi.AssignStreams(apDevice, streamNumber);
2042 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2043 wifi.AssignStreams(staDevice, streamNumber + 2);
2044
2045 MobilityHelper mobility;
2046 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2047 positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // Furthest AP
2048 positionAlloc->Add(Vector(10.0, 0.0, 0.0)); // Second nearest AP
2049 positionAlloc->Add(Vector(5.0, 5.0, 0.0)); // Nearest AP
2050 positionAlloc->Add(Vector(6.0, 5.0, 0.0)); // STA
2051 mobility.SetPositionAllocator(positionAlloc);
2052
2053 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2054 mobility.Install(apNodes);
2055 mobility.Install(apNodeNearest);
2056 mobility.Install(staNode);
2057
2058 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2060
2061 NodeContainer allNodes = NodeContainer(apNodes, apNodeNearest, staNode);
2062 return allNodes;
2063}
2064
2065void
2067{
2068 {
2069 NodeContainer nodes = Setup(false, false);
2070 Ptr<Node> nearestAp = nodes.Get(2);
2071 Mac48Address nearestApAddr =
2072 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2073
2076 this,
2077 nearestAp);
2078
2082
2084 nearestApAddr,
2085 "STA is associated to the wrong AP");
2086 }
2088 {
2089 NodeContainer nodes = Setup(true, true);
2090 Ptr<Node> nearestAp = nodes.Get(2);
2091 Mac48Address nearestApAddr =
2092 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2093
2097
2099 nearestApAddr,
2100 "STA is associated to the wrong AP");
2101 }
2103 {
2104 NodeContainer nodes = Setup(true, false);
2105 Ptr<Node> nearestAp = nodes.Get(2);
2106 Mac48Address secondNearestApAddr =
2107 DynamicCast<WifiNetDevice>(nodes.Get(1)->GetDevice(0))->GetMac()->GetAddress();
2108
2110
2114
2116 secondNearestApAddr,
2117 "STA is associated to the wrong AP");
2118 }
2119}
2120
2121//-----------------------------------------------------------------------------
2145{
2146 public:
2148 ~Bug2470TestCase() override;
2149 void DoRun() override;
2150
2151 private:
2160 void AddbaStateChangedCallback(std::string context,
2161 Time t,
2162 Mac48Address recipient,
2163 uint8_t tid,
2173 void TxCallback(Ptr<ListErrorModel> rxErrorModel,
2174 std::string context,
2175 WifiConstPsduMap psduMap,
2176 WifiTxVector txVector,
2177 double txPowerW);
2178
2189 void RxCallback(std::string context,
2191 uint16_t channelFreqMhz,
2192 WifiTxVector txVector,
2193 MpduInfo aMpdu,
2194 SignalNoiseDbm signalNoise,
2195 uint16_t staId);
2202 void RxErrorCallback(std::string context, Ptr<const Packet> p, double snr);
2209 void SendPacketBurst(uint32_t numPackets,
2210 Ptr<NetDevice> sourceDevice,
2211 Address& destination) const;
2216 void RunSubtest(TypeOfStation rcvErrorType);
2217
2224 uint16_t
2226 uint16_t
2229};
2230
2232 : TestCase("Test case for Bug 2470"),
2233 m_receivedNormalMpduCount(0),
2234 m_receivedAmpduCount(0),
2235 m_failedActionCount(0),
2236 m_addbaEstablishedCount(0),
2237 m_addbaPendingCount(0),
2238 m_addbaRejectedCount(0),
2239 m_addbaNoReplyCount(0),
2240 m_addbaResetCount(0)
2241{
2242}
2243
2245{
2246}
2247
2248void
2250 Time t,
2251 Mac48Address recipient,
2252 uint8_t tid,
2254{
2255 switch (state)
2256 {
2259 break;
2262 break;
2265 break;
2268 break;
2271 break;
2272 }
2273}
2274
2275void
2277 std::string context,
2278 WifiConstPsduMap psduMap,
2279 WifiTxVector txVector,
2280 double txPowerW)
2281{
2282 auto psdu = psduMap.begin()->second;
2283
2284 // The sender is transmitting an ADDBA_REQUEST or ADDBA_RESPONSE frame. If this is
2285 // the first attempt at establishing a BA agreement (i.e., before the second set of packets
2286 // is generated), make the reception of the frame fail at the receiver.
2287 if (psdu->GetHeader(0).GetType() == WIFI_MAC_MGT_ACTION && Simulator::Now() < Seconds(0.8))
2288 {
2289 auto uid = psdu->GetPayload(0)->GetUid();
2290 rxErrorModel->SetList({uid});
2291 }
2292}
2293
2294void
2297 uint16_t channelFreqMhz,
2298 WifiTxVector txVector,
2299 MpduInfo aMpdu,
2300 SignalNoiseDbm signalNoise,
2301 uint16_t staId)
2302{
2303 Ptr<Packet> packet = p->Copy();
2304 if (aMpdu.type != MpduType::NORMAL_MPDU)
2305 {
2307 }
2308 else
2309 {
2310 WifiMacHeader hdr;
2311 packet->RemoveHeader(hdr);
2312 if (hdr.IsData())
2313 {
2315 }
2316 }
2317}
2318
2319void
2320Bug2470TestCase::RxErrorCallback(std::string context, Ptr<const Packet> p, double snr)
2321{
2322 Ptr<Packet> packet = p->Copy();
2323 WifiMacHeader hdr;
2324 packet->RemoveHeader(hdr);
2325 if (hdr.IsAction())
2326 {
2328 }
2329}
2330
2331void
2333 Ptr<NetDevice> sourceDevice,
2334 Address& destination) const
2335{
2336 for (uint32_t i = 0; i < numPackets; i++)
2337 {
2338 Ptr<Packet> pkt = Create<Packet>(1000); // 1000 dummy bytes of data
2339 sourceDevice->Send(pkt, destination, 0);
2340 }
2341}
2342
2343void
2345{
2348 int64_t streamNumber = 200;
2349
2350 NodeContainer wifiApNode;
2351 NodeContainer wifiStaNode;
2352 wifiApNode.Create(1);
2353 wifiStaNode.Create(1);
2354
2357 phy.SetChannel(channel.Create());
2358
2359 WifiHelper wifi;
2360 wifi.SetStandard(WIFI_STANDARD_80211n);
2361 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
2362 "DataMode",
2363 StringValue("HtMcs7"),
2364 "ControlMode",
2365 StringValue("HtMcs7"));
2366
2367 WifiMacHelper mac;
2368 NetDeviceContainer apDevice;
2369 phy.Set("ChannelSettings", StringValue("{36, 20, BAND_5GHZ, 0}"));
2370 mac.SetType("ns3::ApWifiMac", "EnableBeaconJitter", BooleanValue(false));
2371 apDevice = wifi.Install(phy, mac, wifiApNode);
2372
2373 NetDeviceContainer staDevice;
2374 mac.SetType("ns3::StaWifiMac");
2375 staDevice = wifi.Install(phy, mac, wifiStaNode);
2376
2377 // Assign fixed streams to random variables in use
2378 wifi.AssignStreams(apDevice, streamNumber);
2379 wifi.AssignStreams(staDevice, streamNumber);
2380
2381 MobilityHelper mobility;
2382 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2383 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2384 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2385 mobility.SetPositionAllocator(positionAlloc);
2386
2387 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2388 mobility.Install(wifiApNode);
2389 mobility.Install(wifiStaNode);
2390
2391 auto rxErrorModel = CreateObject<ListErrorModel>();
2392 Ptr<WifiMac> wifiMac;
2393 switch (rcvErrorType)
2394 {
2395 case AP:
2396 wifiMac = DynamicCast<WifiNetDevice>(apDevice.Get(0))->GetMac();
2397 break;
2398 case STA:
2399 wifiMac = DynamicCast<WifiNetDevice>(staDevice.Get(0))->GetMac();
2400 break;
2401 default:
2402 NS_ABORT_MSG("Station type " << +rcvErrorType << " cannot be used here");
2403 }
2404 wifiMac->GetWifiPhy(0)->SetPostReceptionErrorModel(rxErrorModel);
2405
2407 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2409 Config::Connect("/NodeList/*/DeviceList/*/Phy/State/RxError",
2411 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2412 "BlockAckManager/AgreementState",
2414 Config::Connect("/NodeList/" + std::to_string(rcvErrorType == STA ? 0 /* AP */ : 1 /* STA */) +
2415 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2416 MakeCallback(&Bug2470TestCase::TxCallback, this).Bind(rxErrorModel));
2417
2420 this,
2421 1,
2422 apDevice.Get(0),
2423 staDevice.Get(0)->GetAddress());
2426 this,
2427 4,
2428 apDevice.Get(0),
2429 staDevice.Get(0)->GetAddress());
2432 this,
2433 1,
2434 apDevice.Get(0),
2435 staDevice.Get(0)->GetAddress());
2438 this,
2439 4,
2440 apDevice.Get(0),
2441 staDevice.Get(0)->GetAddress());
2442
2446}
2447
2448void
2450{
2451 {
2452 RunSubtest(STA);
2453 NS_TEST_ASSERT_MSG_EQ(m_failedActionCount, 7, "ADDBA request packets are not failed");
2454 // There are two sets of 5 packets to be transmitted. The first 5 packets should be sent by
2455 // normal MPDU because of failed ADDBA handshake. For the second set, the first packet
2456 // should be sent by normal MPDU, and the rest with A-MPDU. In total we expect to receive 6
2457 // normal MPDU packets and 4 A-MPDU packet.
2459 6,
2460 "Receiving incorrect number of normal MPDU packet on subtest 1");
2462 4,
2463 "Receiving incorrect number of A-MPDU packets on subtest 1");
2464
2466 1,
2467 "Incorrect number of times the ADDBA state machine was in "
2468 "established state on subtest 1");
2471 2,
2472 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2475 0,
2476 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2479 1,
2480 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2483 1,
2484 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2485 }
2486
2495
2496 {
2497 RunSubtest(AP);
2498 NS_TEST_ASSERT_MSG_EQ(m_failedActionCount, 7, "ADDBA response packets are not failed");
2499 // Similar to subtest 1, we also expect to receive 6 normal MPDU packets and 4 A-MPDU
2500 // packets.
2502 6,
2503 "Receiving incorrect number of normal MPDU packet on subtest 2");
2505 4,
2506 "Receiving incorrect number of A-MPDU packet on subtest 2");
2507
2509 1,
2510 "Incorrect number of times the ADDBA state machine was in "
2511 "established state on subtest 2");
2514 2,
2515 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2518 0,
2519 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2522 1,
2523 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2526 1,
2527 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2528 }
2529
2530 // TODO: In the second test set, it does not go to reset state since ADDBA response is received
2531 // after timeout (NO_REPLY) but before it does not enter RESET state. More tests should be
2532 // written to verify all possible scenarios.
2533}
2534
2535//-----------------------------------------------------------------------------
2551{
2552 public:
2554 ~Issue40TestCase() override;
2555 void DoRun() override;
2556
2557 private:
2562 void RunOne(bool useAmpdu);
2563
2569 void RxSuccessCallback(std::string context, Ptr<const Packet> p);
2576 void SendPackets(uint8_t numPackets, Ptr<NetDevice> sourceDevice, Address& destination);
2582 void TxFinalDataFailedCallback(std::string context, Mac48Address address);
2583
2584 uint16_t m_rxCount;
2585 uint16_t m_txCount;
2586 uint16_t
2588};
2589
2591 : TestCase("Test case for issue #40"),
2592 m_rxCount(0),
2593 m_txCount(0),
2594 m_txMacFinalDataFailedCount(0)
2595{
2596}
2597
2599{
2600}
2601
2602void
2604{
2605 m_rxCount++;
2606}
2607
2608void
2609Issue40TestCase::SendPackets(uint8_t numPackets, Ptr<NetDevice> sourceDevice, Address& destination)
2610{
2611 for (uint8_t i = 0; i < numPackets; i++)
2612 {
2613 Ptr<Packet> pkt = Create<Packet>(1000); // 1000 dummy bytes of data
2614 sourceDevice->Send(pkt, destination, 0);
2615 m_txCount++;
2616 }
2617}
2618
2619void
2621{
2623}
2624
2625void
2627{
2628 m_rxCount = 0;
2629 m_txCount = 0;
2631
2634 int64_t streamNumber = 100;
2635
2636 NodeContainer wifiApNode;
2637 NodeContainer wifiStaNode;
2638 wifiApNode.Create(1);
2639 wifiStaNode.Create(1);
2640
2643 phy.SetChannel(channel.Create());
2644
2645 WifiHelper wifi;
2646 wifi.SetStandard(WIFI_STANDARD_80211ac);
2647 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
2648
2649 WifiMacHelper mac;
2650 NetDeviceContainer apDevice;
2651 mac.SetType("ns3::ApWifiMac");
2652 apDevice = wifi.Install(phy, mac, wifiApNode);
2653
2654 NetDeviceContainer staDevice;
2655 mac.SetType("ns3::StaWifiMac");
2656 staDevice = wifi.Install(phy, mac, wifiStaNode);
2657
2658 // Assign fixed streams to random variables in use
2659 wifi.AssignStreams(apDevice, streamNumber);
2660 wifi.AssignStreams(staDevice, streamNumber);
2661
2662 MobilityHelper mobility;
2663 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2664 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2665 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2666 mobility.SetPositionAllocator(positionAlloc);
2667
2668 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2669 mobility.Install(wifiApNode);
2670
2671 mobility.SetMobilityModel("ns3::WaypointMobilityModel");
2672 mobility.Install(wifiStaNode);
2673
2674 Config::Connect("/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2676 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
2678
2679 Ptr<WaypointMobilityModel> staWaypointMobility =
2680 DynamicCast<WaypointMobilityModel>(wifiStaNode.Get(0)->GetObject<MobilityModel>());
2681 staWaypointMobility->AddWaypoint(Waypoint(Seconds(1.0), Vector(10.0, 0.0, 0.0)));
2682 staWaypointMobility->AddWaypoint(Waypoint(Seconds(1.5), Vector(50.0, 0.0, 0.0)));
2683
2684 if (useAmpdu)
2685 {
2686 // Disable use of BAR that are sent with the lowest modulation so that we can also reproduce
2687 // the problem with A-MPDU, i.e. the lack of feedback about SNR change
2688 Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice>(apDevice.Get(0));
2689 PointerValue ptr;
2690 ap_device->GetMac()->GetAttribute("BE_Txop", ptr);
2691 ptr.Get<QosTxop>()->SetAttribute("UseExplicitBarAfterMissedBlockAck", BooleanValue(false));
2692 }
2693
2694 // Transmit a first data packet before the station moves: it should be sent with a high
2695 // modulation and successfully received
2698 this,
2699 useAmpdu ? 2 : 1,
2700 apDevice.Get(0),
2701 staDevice.Get(0)->GetAddress());
2702
2703 // Transmit a second data packet once the station is away from the access point: it should be
2704 // sent with the same high modulation and be unsuccessfuly received
2707 this,
2708 useAmpdu ? 2 : 1,
2709 apDevice.Get(0),
2710 staDevice.Get(0)->GetAddress());
2711
2712 // Keep on transmitting data packets while the station is away from the access point: it should
2713 // be sent with a lower modulation and be successfully received
2716 this,
2717 useAmpdu ? 2 : 1,
2718 apDevice.Get(0),
2719 staDevice.Get(0)->GetAddress());
2722 this,
2723 useAmpdu ? 2 : 1,
2724 apDevice.Get(0),
2725 staDevice.Get(0)->GetAddress());
2728 this,
2729 useAmpdu ? 2 : 1,
2730 apDevice.Get(0),
2731 staDevice.Get(0)->GetAddress());
2734 this,
2735 useAmpdu ? 2 : 1,
2736 apDevice.Get(0),
2737 staDevice.Get(0)->GetAddress());
2740 this,
2741 useAmpdu ? 2 : 1,
2742 apDevice.Get(0),
2743 staDevice.Get(0)->GetAddress());
2744
2747
2749 (useAmpdu ? 14 : 7),
2750 "Incorrect number of transmitted packets");
2752 (useAmpdu ? 12 : 6),
2753 "Incorrect number of successfully received packets");
2754 NS_TEST_ASSERT_MSG_EQ(m_txMacFinalDataFailedCount, 1, "Incorrect number of dropped TX packets");
2755
2757}
2758
2759void
2761{
2762 // Test without A-MPDU
2763 RunOne(false);
2764
2765 // Test with A-MPDU
2766 RunOne(true);
2767}
2768
2769//-----------------------------------------------------------------------------
2783{
2784 public:
2786 ~Issue169TestCase() override;
2787 void DoRun() override;
2788
2789 private:
2797 void SendPackets(uint8_t numPackets,
2798 Ptr<NetDevice> sourceDevice,
2799 Address& destination,
2800 uint8_t priority);
2801
2809 void TxCallback(std::string context,
2810 WifiConstPsduMap psdus,
2811 WifiTxVector txVector,
2812 double txPowerW);
2813};
2814
2816 : TestCase("Test case for issue #169")
2817{
2818}
2819
2821{
2822}
2823
2824void
2826 Ptr<NetDevice> sourceDevice,
2827 Address& destination,
2828 uint8_t priority)
2829{
2830 SocketPriorityTag priorityTag;
2831 priorityTag.SetPriority(priority);
2832 for (uint8_t i = 0; i < numPackets; i++)
2833 {
2834 Ptr<Packet> packet = Create<Packet>(1000); // 1000 dummy bytes of data
2835 packet->AddPacketTag(priorityTag);
2836 sourceDevice->Send(packet, destination, 0);
2837 }
2838}
2839
2840void
2842 WifiConstPsduMap psdus,
2843 WifiTxVector txVector,
2844 double txPowerW)
2845{
2846 if (psdus.begin()->second->GetSize() >= 1000)
2847 {
2849 WifiModulationClass::WIFI_MOD_CLASS_VHT,
2850 "Ideal rate manager selected incorrect modulation class");
2851 }
2852}
2853
2854void
2856{
2859 int64_t streamNumber = 100;
2860
2861 NodeContainer wifiApNode;
2862 NodeContainer wifiStaNode;
2863 wifiApNode.Create(1);
2864 wifiStaNode.Create(1);
2865
2868 phy.SetChannel(channel.Create());
2869
2870 WifiHelper wifi;
2871 wifi.SetStandard(WIFI_STANDARD_80211ac);
2872 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
2873
2874 WifiMacHelper mac;
2875 NetDeviceContainer apDevice;
2876 mac.SetType("ns3::ApWifiMac");
2877 apDevice = wifi.Install(phy, mac, wifiApNode);
2878
2879 NetDeviceContainer staDevice;
2880 mac.SetType("ns3::StaWifiMac");
2881 staDevice = wifi.Install(phy, mac, wifiStaNode);
2882
2883 // Assign fixed streams to random variables in use
2884 wifi.AssignStreams(apDevice, streamNumber);
2885 wifi.AssignStreams(staDevice, streamNumber);
2886
2887 MobilityHelper mobility;
2888 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2889 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2890 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2891 mobility.SetPositionAllocator(positionAlloc);
2892
2893 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2894 mobility.Install(wifiApNode);
2895 mobility.Install(wifiStaNode);
2896
2897 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2899
2900 // Send best-effort packet (i.e. priority 0)
2903 this,
2904 1,
2905 apDevice.Get(0),
2906 staDevice.Get(0)->GetAddress(),
2907 0);
2908
2909 // Send non best-effort (voice) packet (i.e. priority 6)
2912 this,
2913 1,
2914 apDevice.Get(0),
2915 staDevice.Get(0)->GetAddress(),
2916 6);
2917
2920
2922}
2923
2924//-----------------------------------------------------------------------------
2940{
2941 public:
2944 void DoRun() override;
2945
2946 private:
2951 void ChangeChannelWidth(uint16_t channelWidth);
2952
2958 void SendPacket(Ptr<NetDevice> sourceDevice, Address& destination);
2959
2967 void TxCallback(std::string context,
2968 WifiConstPsduMap psduMap,
2969 WifiTxVector txVector,
2970 double txPowerW);
2971
2976 void CheckLastSelectedMode(WifiMode expectedMode);
2977
2979};
2980
2982 : TestCase("Test case for use of channel bonding with Ideal rate manager")
2983{
2984}
2985
2987{
2988}
2989
2990void
2992{
2993 Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
2994 StringValue("{0, " + std::to_string(channelWidth) + ", BAND_5GHZ, 0}"));
2995}
2996
2997void
2999{
3000 Ptr<Packet> packet = Create<Packet>(1000);
3001 sourceDevice->Send(packet, destination, 0);
3002}
3003
3004void
3006 WifiConstPsduMap psduMap,
3007 WifiTxVector txVector,
3008 double txPowerW)
3009{
3010 if (psduMap.begin()->second->GetSize() >= 1000)
3011 {
3012 m_txMode = txVector.GetMode();
3013 }
3014}
3015
3016void
3018{
3020 expectedMode,
3021 "Last selected WifiMode "
3022 << m_txMode << " does not match expected WifiMode " << expectedMode);
3023}
3024
3025void
3027{
3030 int64_t streamNumber = 100;
3031
3032 NodeContainer wifiApNode;
3033 NodeContainer wifiStaNode;
3034 wifiApNode.Create(1);
3035 wifiStaNode.Create(1);
3036
3039 phy.SetChannel(channel.Create());
3040
3041 WifiHelper wifi;
3042 wifi.SetStandard(WIFI_STANDARD_80211ac);
3043 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
3044
3045 WifiMacHelper mac;
3046 NetDeviceContainer apDevice;
3047 mac.SetType("ns3::ApWifiMac");
3048 apDevice = wifi.Install(phy, mac, wifiApNode);
3049
3050 NetDeviceContainer staDevice;
3051 mac.SetType("ns3::StaWifiMac");
3052 staDevice = wifi.Install(phy, mac, wifiStaNode);
3053
3054 // Assign fixed streams to random variables in use
3055 wifi.AssignStreams(apDevice, streamNumber);
3056 wifi.AssignStreams(staDevice, streamNumber);
3057
3058 MobilityHelper mobility;
3059 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
3060 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3061 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3062 mobility.SetPositionAllocator(positionAlloc);
3063
3064 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
3065 mobility.Install(wifiApNode);
3066 mobility.Install(wifiStaNode);
3067
3068 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3070
3071 // Set channel width to 80 MHz & send packet
3074 this,
3075 80);
3078 this,
3079 apDevice.Get(0),
3080 staDevice.Get(0)->GetAddress());
3081 // Selected rate should be VHT-MCS 1
3084 this,
3086
3087 // Set channel width to 20 MHz & send packet
3090 this,
3091 20);
3094 this,
3095 apDevice.Get(0),
3096 staDevice.Get(0)->GetAddress());
3097 // Selected rate should be VHT-MCS 3 since SNR should be 6 dB higher than previously
3100 this,
3102
3103 // Set channel width to 40 MHz & send packet
3106 this,
3107 40);
3110 this,
3111 apDevice.Get(0),
3112 staDevice.Get(0)->GetAddress());
3113 // Selected rate should be VHT-MCS 2 since SNR should be 3 dB lower than previously
3116 this,
3118
3121
3123}
3124
3125//-----------------------------------------------------------------------------
3135{
3136 public:
3138 ~IdealRateManagerMimoTest() override;
3139 void DoRun() override;
3140
3141 private:
3147 void SetApMimoSettings(uint8_t antennas, uint8_t maxStreams);
3153 void SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams);
3159 void SendPacket(Ptr<NetDevice> sourceDevice, Address& destination);
3160
3168 void TxCallback(std::string context,
3169 WifiConstPsduMap psdus,
3170 WifiTxVector txVector,
3171 double txPowerW);
3172
3177 void CheckLastSelectedMode(WifiMode expectedMode);
3182 void CheckLastSelectedNss(uint8_t expectedNss);
3183
3185};
3186
3188 : TestCase("Test case for use of imbalanced MIMO settings with Ideal rate manager")
3189{
3190}
3191
3193{
3194}
3195
3196void
3197IdealRateManagerMimoTest::SetApMimoSettings(uint8_t antennas, uint8_t maxStreams)
3198{
3199 Config::Set("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3200 UintegerValue(antennas));
3201 Config::Set("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3202 UintegerValue(maxStreams));
3203 Config::Set("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3204 UintegerValue(maxStreams));
3205}
3206
3207void
3208IdealRateManagerMimoTest::SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams)
3209{
3210 Config::Set("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3211 UintegerValue(antennas));
3212 Config::Set("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3213 UintegerValue(maxStreams));
3214 Config::Set("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3215 UintegerValue(maxStreams));
3216}
3217
3218void
3220{
3221 Ptr<Packet> packet = Create<Packet>(1000);
3222 sourceDevice->Send(packet, destination, 0);
3223}
3224
3225void
3227 WifiConstPsduMap psdus,
3228 WifiTxVector txVector,
3229 double txPowerW)
3230{
3231 if (psdus.begin()->second->GetSize() >= 1000)
3232 {
3233 m_txVector = txVector;
3234 }
3235}
3236
3237void
3239{
3241 expectedNss,
3242 "Last selected Nss " << m_txVector.GetNss()
3243 << " does not match expected Nss " << expectedNss);
3244}
3245
3246void
3248{
3250 expectedMode,
3251 "Last selected WifiMode " << m_txVector.GetMode()
3252 << " does not match expected WifiMode "
3253 << expectedMode);
3254}
3255
3256void
3258{
3261 int64_t streamNumber = 100;
3262
3263 NodeContainer wifiApNode;
3264 NodeContainer wifiStaNode;
3265 wifiApNode.Create(1);
3266 wifiStaNode.Create(1);
3267
3270 phy.SetChannel(channel.Create());
3271
3272 WifiHelper wifi;
3273 wifi.SetStandard(WIFI_STANDARD_80211ac);
3274 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
3275
3276 WifiMacHelper mac;
3277 NetDeviceContainer apDevice;
3278 mac.SetType("ns3::ApWifiMac");
3279 apDevice = wifi.Install(phy, mac, wifiApNode);
3280
3281 NetDeviceContainer staDevice;
3282 mac.SetType("ns3::StaWifiMac");
3283 staDevice = wifi.Install(phy, mac, wifiStaNode);
3284
3285 // Assign fixed streams to random variables in use
3286 wifi.AssignStreams(apDevice, streamNumber);
3287 wifi.AssignStreams(staDevice, streamNumber);
3288
3289 MobilityHelper mobility;
3290 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
3291 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3292 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3293 mobility.SetPositionAllocator(positionAlloc);
3294
3295 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
3296 mobility.Install(wifiApNode);
3297 mobility.Install(wifiStaNode);
3298
3299 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3301
3302 // TX: 1 antenna
3304 // RX: 1 antenna
3306 // Send packets (2 times to get one feedback)
3309 this,
3310 apDevice.Get(0),
3311 staDevice.Get(0)->GetAddress());
3314 this,
3315 apDevice.Get(0),
3316 staDevice.Get(0)->GetAddress());
3317 // Selected NSS should be 1 since both TX and RX support a single antenna
3319 // Selected rate should be VHT-MCS 2 because of settings and distance between TX and RX
3322 this,
3324
3325 // TX: 1 antenna
3327 // RX: 2 antennas, but only supports 1 spatial stream
3329 // Send packets (2 times to get one feedback)
3332 this,
3333 apDevice.Get(0),
3334 staDevice.Get(0)->GetAddress());
3337 this,
3338 apDevice.Get(0),
3339 staDevice.Get(0)->GetAddress());
3340 // Selected NSS should be 1 since both TX and RX support a single antenna
3342 // Selected rate should be increased to VHT-MCS 3 because of RX diversity resulting in SNR
3343 // improvement of about 3dB
3346 this,
3348
3349 // TX: 1 antenna
3351 // RX: 2 antennas, and supports 2 spatial streams
3353 // Send packets (2 times to get one feedback)
3356 this,
3357 apDevice.Get(0),
3358 staDevice.Get(0)->GetAddress());
3361 this,
3362 apDevice.Get(0),
3363 staDevice.Get(0)->GetAddress());
3364 // Selected NSS should be 1 since TX supports a single antenna
3366 // Selected rate should be as previously
3369 this,
3371
3372 // TX: 2 antennas, but only supports 1 spatial stream
3374 // RX: 1 antenna
3376 // Send packets (2 times to get one feedback)
3379 this,
3380 apDevice.Get(0),
3381 staDevice.Get(0)->GetAddress());
3384 this,
3385 apDevice.Get(0),
3386 staDevice.Get(0)->GetAddress());
3387 // Selected NSS should be 1 since both TX and RX support a single antenna
3389 // Selected rate should be VHT-MCS 2 because we do no longer have diversity in this scenario
3390 // (more antennas at TX does not result in SNR improvement in AWGN channel)
3393 this,
3395
3396 // TX: 2 antennas, but only supports 1 spatial stream
3398 // RX: 2 antennas, but only supports 1 spatial stream
3400 // Send packets (2 times to get one feedback)
3403 this,
3404 apDevice.Get(0),
3405 staDevice.Get(0)->GetAddress());
3408 this,
3409 apDevice.Get(0),
3410 staDevice.Get(0)->GetAddress());
3411 // Selected NSS should be 1 since both TX and RX support a single antenna
3413 // Selected rate should be increased to VHT-MCS 3 because of RX diversity resulting in SNR
3414 // improvement of about 3dB (more antennas at TX does not result in SNR improvement in AWGN
3415 // channel)
3418 this,
3420
3421 // TX: 2 antennas, but only supports 1 spatial stream
3423 // RX: 2 antennas, and supports 2 spatial streams
3425 // Send packets (2 times to get one feedback)
3428 this,
3429 apDevice.Get(0),
3430 staDevice.Get(0)->GetAddress());
3433 this,
3434 apDevice.Get(0),
3435 staDevice.Get(0)->GetAddress());
3436 // Selected NSS should be 1 since TX supports a single antenna
3438 // Selected rate should be as previously
3441 this,
3443
3444 // TX: 2 antennas, and supports 2 spatial streams
3446 // RX: 1 antenna
3448 // Send packets (2 times to get one feedback)
3451 this,
3452 apDevice.Get(0),
3453 staDevice.Get(0)->GetAddress());
3456 this,
3457 apDevice.Get(0),
3458 staDevice.Get(0)->GetAddress());
3459 // Selected NSS should be 1 since RX supports a single antenna
3461 // Selected rate should be VHT-MCS 2 because we do no longer have diversity in this scenario
3462 // (more antennas at TX does not result in SNR improvement in AWGN channel)
3465 this,
3467
3468 // TX: 2 antennas, and supports 2 spatial streams
3470 // RX: 2 antennas, but only supports 1 spatial stream
3472 // Send packets (2 times to get one feedback)
3475 this,
3476 apDevice.Get(0),
3477 staDevice.Get(0)->GetAddress());
3480 this,
3481 apDevice.Get(0),
3482 staDevice.Get(0)->GetAddress());
3483 // Selected NSS should be 1 since RX supports a single antenna
3485 // Selected rate should be increased to VHT-MCS 3 because of RX diversity resulting in SNR
3486 // improvement of about 3dB (more antennas at TX does not result in SNR improvement in AWGN
3487 // channel)
3490 this,
3492
3493 // TX: 2 antennas, and supports 2 spatial streams
3495 // RX: 2 antennas, and supports 2 spatial streams
3497 // Send packets (2 times to get one feedback)
3500 this,
3501 apDevice.Get(0),
3502 staDevice.Get(0)->GetAddress());
3505 this,
3506 apDevice.Get(0),
3507 staDevice.Get(0)->GetAddress());
3508 // Selected NSS should be 2 since both TX and RX support 2 antennas
3510 // Selected rate should be the same as without diversity, as it uses 2 spatial streams so there
3511 // is no more benefits from diversity in AWGN channels
3514 this,
3516
3517 // Verify we can go back to initial situation
3522 this,
3523 apDevice.Get(0),
3524 staDevice.Get(0)->GetAddress());
3528 this,
3530
3531 Simulator::Stop(Seconds(10.2));
3534}
3535
3536//-----------------------------------------------------------------------------
3544{
3545 public:
3547
3548 private:
3559 bool CheckDataRate(HeRu::RuType ruType,
3560 std::string mcs,
3561 uint8_t nss,
3562 uint16_t guardInterval,
3563 uint16_t expectedDataRate);
3564 void DoRun() override;
3565};
3566
3568 : TestCase("Check data rates for different RU types.")
3569{
3570}
3571
3572bool
3574 std::string mcs,
3575 uint8_t nss,
3576 uint16_t guardInterval,
3577 uint16_t expectedDataRate)
3578{
3579 uint16_t approxWidth = HeRu::GetBandwidth(ruType);
3580 WifiMode mode(mcs);
3581 uint64_t dataRate = round(mode.GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3582 NS_ABORT_MSG_IF(dataRate > 65535, "Rate is way too high");
3583 if (static_cast<uint16_t>(dataRate) != expectedDataRate)
3584 {
3585 std::cerr << "RU=" << ruType << " mode=" << mode << " Nss=" << +nss
3586 << " guardInterval=" << guardInterval << " expected=" << expectedDataRate
3587 << " x100kbps"
3588 << " computed=" << static_cast<uint16_t>(dataRate) << " x100kbps" << std::endl;
3589 return false;
3590 }
3591 return true;
3592}
3593
3594void
3596{
3597 bool retval = true;
3598
3599 // 26-tone RU, browse over all MCSs, GIs and Nss's (up to 4, current max)
3600 retval = retval && CheckDataRate(HeRu::RU_26_TONE, "HeMcs0", 1, 800, 9) &&
3601 CheckDataRate(HeRu::RU_26_TONE, "HeMcs1", 1, 1600, 17) &&
3602 CheckDataRate(HeRu::RU_26_TONE, "HeMcs2", 1, 3200, 23) &&
3603 CheckDataRate(HeRu::RU_26_TONE, "HeMcs3", 1, 3200, 30) &&
3604 CheckDataRate(HeRu::RU_26_TONE, "HeMcs4", 2, 1600, 100) &&
3605 CheckDataRate(HeRu::RU_26_TONE, "HeMcs5", 3, 1600, 200) &&
3606 CheckDataRate(HeRu::RU_26_TONE, "HeMcs6", 4, 1600, 300) &&
3607 CheckDataRate(HeRu::RU_26_TONE, "HeMcs7", 4, 3200, 300) &&
3608 CheckDataRate(HeRu::RU_26_TONE, "HeMcs8", 4, 1600, 400) &&
3609 CheckDataRate(HeRu::RU_26_TONE, "HeMcs9", 4, 3200, 400) &&
3610 CheckDataRate(HeRu::RU_26_TONE, "HeMcs10", 4, 1600, 500) &&
3611 CheckDataRate(HeRu::RU_26_TONE, "HeMcs11", 4, 3200, 500);
3612
3614 retval,
3615 true,
3616 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3617
3618 // Check other RU sizes
3619 retval = retval && CheckDataRate(HeRu::RU_52_TONE, "HeMcs2", 1, 1600, 50) &&
3620 CheckDataRate(HeRu::RU_106_TONE, "HeMcs9", 1, 800, 500) &&
3621 CheckDataRate(HeRu::RU_242_TONE, "HeMcs5", 1, 1600, 650) &&
3622 CheckDataRate(HeRu::RU_484_TONE, "HeMcs3", 1, 1600, 650) &&
3623 CheckDataRate(HeRu::RU_996_TONE, "HeMcs5", 1, 3200, 2450) &&
3624 CheckDataRate(HeRu::RU_2x996_TONE, "HeMcs3", 1, 3200, 2450);
3625
3626 NS_TEST_EXPECT_MSG_EQ(retval,
3627 true,
3628 "Data rate verification for RUs above 52-tone RU (included) failed");
3629}
3630
3633 std::tuple<SupportedRates, std::optional<ExtendedSupportedRatesIE>, std::vector<Ssid>>;
3634
3641class MgtTestHeader : public WifiMgtHeader<MgtTestHeader, MgtTestElems>
3642{
3643 public:
3644 ~MgtTestHeader() override = default;
3645
3650 static TypeId GetTypeId();
3651
3655 TypeId GetInstanceTypeId() const override;
3656
3657 using WifiMgtHeader<MgtTestHeader, MgtTestElems>::GetSerializedSize;
3658 using WifiMgtHeader<MgtTestHeader, MgtTestElems>::Serialize;
3659 using WifiMgtHeader<MgtTestHeader, MgtTestElems>::Deserialize;
3660};
3661
3662TypeId
3664{
3665 static TypeId tid = TypeId("ns3::MgtTestHeader")
3666 .SetParent<Header>()
3667 .SetGroupName("Wifi")
3668 .AddConstructor<MgtTestHeader>();
3669 return tid;
3670}
3671
3672TypeId
3674{
3675 return GetTypeId();
3676}
3677
3685{
3686 public:
3688 ~WifiMgtHeaderTest() override = default;
3689
3690 private:
3691 void DoRun() override;
3692};
3693
3695 : HeaderSerializationTestCase("Check (de)serialization of a test management header")
3696{
3697}
3698
3699void
3701{
3702 MgtTestHeader frame;
3703
3704 // Add the mandatory Information Element (SupportedRates)
3705 AllSupportedRates allRates;
3706 allRates.AddSupportedRate(1000000);
3707 allRates.AddSupportedRate(2000000);
3708 allRates.AddSupportedRate(3000000);
3709 allRates.AddSupportedRate(4000000);
3710 allRates.AddSupportedRate(5000000);
3711
3712 frame.Get<SupportedRates>() = allRates.rates;
3713 frame.Get<ExtendedSupportedRatesIE>() = allRates.extendedRates;
3714
3715 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3716 true,
3717 "Expected a SupportedRates IE to be included");
3718 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3719 false,
3720 "Expected no ExtendedSupportedRatesIE to be included");
3721 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 0, "Expected no Ssid IE to be included");
3722
3724
3725 // Add more rates, so that the optional Information Element (ExtendedSupportedRatesIE) is added
3726 allRates.AddSupportedRate(6000000);
3727 allRates.AddSupportedRate(7000000);
3728 allRates.AddSupportedRate(8000000);
3729 allRates.AddSupportedRate(9000000);
3730 allRates.AddSupportedRate(10000000);
3731
3732 frame.Get<SupportedRates>() = allRates.rates;
3733 frame.Get<ExtendedSupportedRatesIE>() = allRates.extendedRates;
3734
3735 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3736 true,
3737 "Expected a SupportedRates IE to be included");
3738 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3739 true,
3740 "Expected an ExtendedSupportedRatesIE to be included");
3741 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 0, "Expected no Ssid IE to be included");
3742
3744
3745 // Add a first Ssid IE
3746 Ssid one("Ssid One");
3747 frame.Get<Ssid>().push_back(one);
3748
3749 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3750 true,
3751 "Expected a SupportedRates IE to be included");
3752 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3753 true,
3754 "Expected an ExtendedSupportedRatesIE to be included");
3755 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 1, "Expected one Ssid IE to be included");
3756 NS_TEST_EXPECT_MSG_EQ(std::string(frame.Get<Ssid>().front().PeekString()),
3757 "Ssid One",
3758 "Incorrect SSID");
3759
3761
3762 // Add a second Ssid IE
3763 frame.Get<Ssid>().emplace_back("Ssid Two");
3764
3765 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3766 true,
3767 "Expected a SupportedRates IE to be included");
3768 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3769 true,
3770 "Expected an ExtendedSupportedRatesIE to be included");
3771 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 2, "Expected two Ssid IEs to be included");
3772 NS_TEST_EXPECT_MSG_EQ(std::string(frame.Get<Ssid>().front().PeekString()),
3773 "Ssid One",
3774 "Incorrect first SSID");
3775 NS_TEST_EXPECT_MSG_EQ(std::string(frame.Get<Ssid>().back().PeekString()),
3776 "Ssid Two",
3777 "Incorrect second SSID");
3778
3780}
3781
3789{
3790 public:
3791 WifiTestSuite();
3792};
3793
3795 : TestSuite("wifi-devices", UNIT)
3796{
3809 AddTestCase(new Issue40TestCase, TestCase::QUICK); // Issue #40
3810 AddTestCase(new Issue169TestCase, TestCase::QUICK); // Issue #169
3815}
3816
Make sure that when virtual collision occurs the wifi remote station manager is triggered and the ret...
Definition: wifi-test.cc:1372
~Bug2222TestCase() override
Definition: wifi-test.cc:1396
uint32_t m_countInternalCollisions
count internal collisions
Definition: wifi-test.cc:1380
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:1408
void TxDataFailedTrace(std::string context, Mac48Address adr)
Transmit data failed function.
Definition: wifi-test.cc:1401
Make sure that the ADDBA handshake process is protected.
Definition: wifi-test.cc:2145
void RxErrorCallback(std::string context, Ptr< const Packet > p, double snr)
Callback when packet is dropped.
Definition: wifi-test.cc:2320
void RunSubtest(TypeOfStation rcvErrorType)
Run subtest for this test suite.
Definition: wifi-test.cc:2344
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2449
uint16_t m_addbaResetCount
Count number of times ADDBA state machine is in reset state.
Definition: wifi-test.cc:2228
uint16_t m_addbaRejectedCount
Count number of times ADDBA state machine is in rejected state.
Definition: wifi-test.cc:2225
void AddbaStateChangedCallback(std::string context, Time t, Mac48Address recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)
Callback when ADDBA state changed.
Definition: wifi-test.cc:2249
uint16_t m_failedActionCount
Count failed ADDBA request/response.
Definition: wifi-test.cc:2220
void TxCallback(Ptr< ListErrorModel > rxErrorModel, std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback when a frame is transmitted.
Definition: wifi-test.cc:2276
uint16_t m_addbaEstablishedCount
Count number of times ADDBA state machine is in established state.
Definition: wifi-test.cc:2221
void RxCallback(std::string context, Ptr< const Packet > p, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId)
Callback when packet is received.
Definition: wifi-test.cc:2295
~Bug2470TestCase() override
Definition: wifi-test.cc:2244
uint16_t m_receivedNormalMpduCount
Count received normal MPDU packets on STA.
Definition: wifi-test.cc:2218
uint16_t m_addbaNoReplyCount
Count number of times ADDBA state machine is in no_reply state.
Definition: wifi-test.cc:2227
uint16_t m_addbaPendingCount
Count number of times ADDBA state machine is in pending state.
Definition: wifi-test.cc:2223
void SendPacketBurst(uint32_t numPackets, Ptr< NetDevice > sourceDevice, Address &destination) const
Triggers the arrival of a burst of 1000 Byte-long packets in the source device.
Definition: wifi-test.cc:2332
uint16_t m_receivedAmpduCount
Count received A-MPDU packets on STA.
Definition: wifi-test.cc:2219
Make sure that the channel width and the channel number can be changed at runtime.
Definition: wifi-test.cc:1730
uint16_t m_countOperationalChannelWidth20
count number of beacon frames announcing a 20 MHz operating channel width
Definition: wifi-test.cc:1754
void ChangeSupportedChannelWidth()
Function called to change the supported channel width at runtime.
Definition: wifi-test.cc:1774
uint16_t m_countOperationalChannelWidth40
count number of beacon frames announcing a 40 MHz operating channel width
Definition: wifi-test.cc:1756
void RxCallback(std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by the PHYs.
Definition: wifi-test.cc:1781
uint16_t m_assocReqCount
count number of association requests
Definition: wifi-test.cc:1752
Ptr< YansWifiPhy > m_apPhy
AP PHY.
Definition: wifi-test.cc:1749
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:1813
Ptr< YansWifiPhy > m_staPhy
STA PHY.
Definition: wifi-test.cc:1750
uint16_t m_assocRespCount
count number of association responses
Definition: wifi-test.cc:1753
~Bug2831TestCase() override
Definition: wifi-test.cc:1769
Make sure that the correct channel width and center frequency have been set for OFDM basic rate trans...
Definition: wifi-test.cc:1512
void SendPacketBurst(uint8_t numPackets, Ptr< NetDevice > sourceDevice, Address &destination) const
Triggers the arrival of a burst of 1000 Byte-long packets in the source device.
Definition: wifi-test.cc:1596
void StoreDistinctTuple(std::string context, Ptr< SpectrumSignalParameters > txParams)
Stores the distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Definition: wifi-test.cc:1560
std::vector< FreqWidthSubbandModulationTuple > m_distinctTuples
vector of distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Definition: wifi-test.cc:1526
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:1608
uint16_t m_channelWidth
channel width (in MHz)
Definition: wifi-test.cc:1546
~Bug2843TestCase() override
Definition: wifi-test.cc:1555
std::tuple< double, uint16_t, uint32_t, WifiModulationClass > FreqWidthSubbandModulationTuple
A tuple of {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Definition: wifi-test.cc:1524
Make sure that when changing the fragmentation threshold during the simulation, the TCP transmission ...
Definition: wifi-test.cc:642
~Bug730TestCase() override
Definition: wifi-test.cc:667
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Receive function.
Definition: wifi-test.cc:672
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:681
uint32_t m_received
received
Definition: wifi-test.cc:650
Make sure that when multiple broadcast packets are queued on the same device in a short succession,...
Definition: wifi-test.cc:474
void NotifyPhyTxBegin(Ptr< const Packet > p, double txPowerW)
Notify Phy transmit begin.
Definition: wifi-test.cc:509
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:530
ObjectFactory m_propDelay
propagation delay
Definition: wifi-test.cc:489
unsigned int m_numSentPackets
number of sent packets
Definition: wifi-test.cc:493
Time m_secondTransmissionTime
second transmission time
Definition: wifi-test.cc:492
Time m_firstTransmissionTime
first transmission time
Definition: wifi-test.cc:491
ObjectFactory m_manager
manager
Definition: wifi-test.cc:487
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
Definition: wifi-test.cc:523
Data rate verification test for MCSs of different RU sizes.
Definition: wifi-test.cc:3544
bool CheckDataRate(HeRu::RuType ruType, std::string mcs, uint8_t nss, uint16_t guardInterval, uint16_t expectedDataRate)
Compare the data rate computed for the provided combination with standard defined one.
Definition: wifi-test.cc:3573
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3595
Make sure that Ideal rate manager properly selects MCS based on the configured channel width.
Definition: wifi-test.cc:2940
WifiMode m_txMode
Store the last selected mode to send data packet.
Definition: wifi-test.cc:2978
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3026
void SendPacket(Ptr< NetDevice > sourceDevice, Address &destination)
Triggers the transmission of a 1000 Byte-long data packet from the source device.
Definition: wifi-test.cc:2998
void CheckLastSelectedMode(WifiMode expectedMode)
Check if the selected WifiMode is correct.
Definition: wifi-test.cc:3017
void TxCallback(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
Definition: wifi-test.cc:3005
void ChangeChannelWidth(uint16_t channelWidth)
Change the configured channel width for all nodes.
Definition: wifi-test.cc:2991
~IdealRateManagerChannelWidthTest() override
Definition: wifi-test.cc:2986
Test to validate that Ideal rate manager properly selects TXVECTOR in scenarios where MIMO is used.
Definition: wifi-test.cc:3135
~IdealRateManagerMimoTest() override
Definition: wifi-test.cc:3192
void CheckLastSelectedNss(uint8_t expectedNss)
Check if the selected Nss is correct.
Definition: wifi-test.cc:3238
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3257
void TxCallback(std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
Definition: wifi-test.cc:3226
void SetApMimoSettings(uint8_t antennas, uint8_t maxStreams)
Change the configured MIMO settings for AP node.
Definition: wifi-test.cc:3197
WifiTxVector m_txVector
Store the last TXVECTOR used to transmit Data.
Definition: wifi-test.cc:3184
void SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams)
Change the configured MIMO settings for STA node.
Definition: wifi-test.cc:3208
void SendPacket(Ptr< NetDevice > sourceDevice, Address &destination)
Triggers the transmission of a 1000 Byte-long data packet from the source device.
Definition: wifi-test.cc:3219
void CheckLastSelectedMode(WifiMode expectedMode)
Check if the selected WifiMode is correct.
Definition: wifi-test.cc:3247
void SwitchCh(Ptr< WifiNetDevice > dev)
Switch channel function.
Definition: wifi-test.cc:326
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
Definition: wifi-test.cc:319
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:374
ObjectFactory m_manager
manager
Definition: wifi-test.cc:308
ObjectFactory m_propDelay
propagation delay
Definition: wifi-test.cc:310
Ptr< Node > CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Create one function.
Definition: wifi-test.cc:333
Make sure that Ideal rate manager is able to handle non best-effort traffic.
Definition: wifi-test.cc:2783
void SendPackets(uint8_t numPackets, Ptr< NetDevice > sourceDevice, Address &destination, uint8_t priority)
Triggers the transmission of a 1000 Byte-long data packet from the source device.
Definition: wifi-test.cc:2825
~Issue169TestCase() override
Definition: wifi-test.cc:2820
void TxCallback(std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
Definition: wifi-test.cc:2841
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2855
Make sure that Ideal rate manager recovers when the station is moving away from the access point.
Definition: wifi-test.cc:2551
uint16_t m_txCount
Count number of transmitted data packets.
Definition: wifi-test.cc:2585
uint16_t m_txMacFinalDataFailedCount
Count number of unsuccessfuly transmitted data packets.
Definition: wifi-test.cc:2587
void RunOne(bool useAmpdu)
Run one function.
Definition: wifi-test.cc:2626
uint16_t m_rxCount
Count number of successfully received data packets.
Definition: wifi-test.cc:2584
void RxSuccessCallback(std::string context, Ptr< const Packet > p)
Callback when packet is successfully received.
Definition: wifi-test.cc:2603
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2760
void TxFinalDataFailedCallback(std::string context, Mac48Address address)
Transmit final data failed function.
Definition: wifi-test.cc:2620
void SendPackets(uint8_t numPackets, Ptr< NetDevice > sourceDevice, Address &destination)
Triggers the arrival of 1000 Byte-long packets in the source device.
Definition: wifi-test.cc:2609
~Issue40TestCase() override
Definition: wifi-test.cc:2598
Test management header.
Definition: wifi-test.cc:3642
static TypeId GetTypeId()
Register this type.
Definition: wifi-test.cc:3663
~MgtTestHeader() override=default
TypeId GetInstanceTypeId() const override
Definition: wifi-test.cc:3673
Make sure that fragmentation works with QoS stations.
Definition: wifi-test.cc:781
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:842
uint32_t m_received
received packets
Definition: wifi-test.cc:789
~QosFragmentationTestCase() override
Definition: wifi-test.cc:816
uint32_t m_fragments
transmitted fragments
Definition: wifi-test.cc:790
void Transmit(std::string context, Ptr< const Packet > p, double power)
Callback invoked when PHY transmits a packet.
Definition: wifi-test.cc:830
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Receive function.
Definition: wifi-test.cc:821
Qos Utils Is Old Packet Test.
Definition: wifi-test.cc:241
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:248
Set Channel Frequency Test.
Definition: wifi-test.cc:937
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc) const
Get yans wifi phy function.
Definition: wifi-test.cc:958
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:966
Make sure that Wifi STA is correctly associating to the best AP (i.e., nearest from STA).
Definition: wifi-test.cc:1942
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2066
void TurnBeaconGenerationOn(Ptr< Node > apNode)
Turn beacon generation on the AP node.
Definition: wifi-test.cc:1992
Mac48Address m_associatedApBssid
Associated AP's bssid.
Definition: wifi-test.cc:1973
~StaWifiMacScanningTestCase() override
Definition: wifi-test.cc:1981
void TurnApOff(Ptr< Node > apNode)
Turn the AP node off.
Definition: wifi-test.cc:2000
NodeContainer Setup(bool nearestApBeaconGeneration, bool staActiveProbe)
Setup test.
Definition: wifi-test.cc:2008
void AssocCallback(std::string context, Mac48Address bssid)
Callback function on STA assoc event.
Definition: wifi-test.cc:1986
Mgt header (de)serialization Test Suite.
Definition: wifi-test.cc:3685
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3700
~WifiMgtHeaderTest() override=default
Wifi Test.
Definition: wifi-test.cc:102
void CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Create one function.
Definition: wifi-test.cc:141
void RunOne()
Run one function.
Definition: wifi-test.cc:185
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:204
ObjectFactory m_mac
MAC.
Definition: wifi-test.cc:124
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
Definition: wifi-test.cc:134
ObjectFactory m_manager
manager
Definition: wifi-test.cc:123
ObjectFactory m_propDelay
propagation delay
Definition: wifi-test.cc:125
Wifi Test Suite.
Definition: wifi-test.cc:3789
a polymophic address class
Definition: address.h:100
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
The Extended Supported Rates Information Element.
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:762
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
@ RU_26_TONE
Definition: he-ru.h:42
@ RU_484_TONE
Definition: he-ru.h:46
@ RU_996_TONE
Definition: he-ru.h:47
@ RU_106_TONE
Definition: he-ru.h:44
@ RU_52_TONE
Definition: he-ru.h:43
@ RU_242_TONE
Definition: he-ru.h:45
@ RU_2x996_TONE
Definition: he-ru.h:48
Protocol header serialization and deserialization.
Definition: header.h:44
Subclass of TestCase class adding the ability to test the serialization and deserialization of a Head...
void TestHeaderSerialization(const T &hdr, Args &&... args)
Serialize the given header in a buffer, then create a new header by deserializing from the buffer and...
The HT Operation Information Element.
Definition: ht-operation.h:51
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address Allocate()
Allocate a new Mac48Address.
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:516
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:169
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:152
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
State
Represents the state for this agreement.
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Ptr< T > Get() const
Definition: pointer.h:202
calculate a propagation delay.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:72
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:140
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static void Run()
Run the simulation.
Definition: simulator.cc:176
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:184
indicates whether the socket has a priority set.
Definition: socket.h:1316
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:852
Make it easy to create and manage PHY objects for the spectrum model.
void SetChannel(const Ptr< SpectrumChannel > channel)
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
char * PeekString() const
Peek the SSID.
Definition: ssid.cc:78
AttributeValue implementation for Ssid.
Hold variables of type string.
Definition: string.h:56
The Supported Rates Information Element.
encapsulates test code
Definition: test.h:1060
@ QUICK
Fast test.
Definition: test.h:1065
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1256
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:71
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
Hold an unsigned integer type.
Definition: uinteger.h:45
static WifiMode GetVhtMcs3()
Return MCS 3 from VHT MCS values.
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
static WifiMode GetVhtMcs2()
Return MCS 2 from VHT MCS values.
a (time, location) pair.
Definition: waypoint.h:36
helps to create WifiNetDevice objects
Definition: wifi-helper.h:324
Implements the IEEE 802.11 MAC header.
bool IsAssocReq() const
Return true if the header is an Association Request header.
bool IsBeacon() const
Return true if the header is a Beacon header.
bool IsAssocResp() const
Return true if the header is an Association Response header.
bool IsAction() const
Return true if the header is an Action header.
bool IsData() const
Return true if the Type is DATA.
bool IsQosData() const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:94
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:431
Implement the header for management frames.
represent a single transmission mode
Definition: wifi-mode.h:50
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:185
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
Hold together all Wifi-related objects.
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:163
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
Definition: wifi-helper.h:550
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
Definition: wifi-phy.cc:641
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:950
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
Definition: wifi-phy.cc:1082
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:609
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
Definition: wifi-phy.cc:621
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:872
hold a list of per-remote-station state.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode.
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
uint16_t GetChannelWidth() const
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
802.11 PHY layer model
Definition: yans-wifi-phy.h:48
void SetChannel(const Ptr< YansWifiChannel > channel)
Set the YansWifiChannel this YansWifiPhy is to be connected to.
void SetInterferenceHelper(const Ptr< InterferenceHelper > helper) override
Sets the interference helper.
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:975
void Set(std::string path, const AttributeValue &value)
Definition: config.cc:877
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#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:144
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report if not.
Definition: test.h:830
#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:251
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1360
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
TypeOfStation
Enumeration for type of WiFi station.
Definition: wifi-mac.h:62
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:182
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ STA
Definition: wifi-mac.h:63
@ AP
Definition: wifi-mac.h:64
@ WIFI_STANDARD_80211a
@ WIFI_STANDARD_80211p
@ WIFI_STANDARD_80211n
@ WIFI_STANDARD_80211g
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_80211ac
@ WIFI_STANDARD_80211b
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
NodeContainer nodes
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< void, Ptr< const WifiPsdu > > RxErrorCallback
Callback if PSDU unsuccessfuly received.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:702
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
@ WIFI_MAC_MGT_ACTION
Struct containing all supported rates.
SupportedRates rates
supported rates
std::optional< ExtendedSupportedRatesIE > extendedRates
supported extended rates
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
MpduInfo structure.
Definition: phy-entity.h:63
MpduType type
type of MPDU
Definition: phy-entity.h:64
SignalNoiseDbm structure.
Definition: phy-entity.h:56
static void AssignWifiRandomStreams(Ptr< WifiMac > mac, int64_t stream)
Definition: wifi-test.cc:65
static WifiTestSuite g_wifiTestSuite
the test suite
Definition: wifi-test.cc:3817
std::tuple< SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::vector< Ssid > > MgtTestElems
List of Information Elements included in the test management frame.
Definition: wifi-test.cc:3633