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
60#include <optional>
61
62using namespace ns3;
63
64// Helper function to assign streams to random variables, to control
65// randomness in the tests
66static void
68{
69 int64_t currentStream = stream;
70 PointerValue ptr;
71 if (!mac->GetQosSupported())
72 {
73 mac->GetAttribute("Txop", ptr);
74 Ptr<Txop> txop = ptr.Get<Txop>();
75 currentStream += txop->AssignStreams(currentStream);
76 }
77 else
78 {
79 mac->GetAttribute("VO_Txop", ptr);
80 Ptr<QosTxop> vo_txop = ptr.Get<QosTxop>();
81 currentStream += vo_txop->AssignStreams(currentStream);
82
83 mac->GetAttribute("VI_Txop", ptr);
84 Ptr<QosTxop> vi_txop = ptr.Get<QosTxop>();
85 currentStream += vi_txop->AssignStreams(currentStream);
86
87 mac->GetAttribute("BE_Txop", ptr);
88 Ptr<QosTxop> be_txop = ptr.Get<QosTxop>();
89 currentStream += be_txop->AssignStreams(currentStream);
90
91 mac->GetAttribute("BK_Txop", ptr);
92 Ptr<QosTxop> bk_txop = ptr.Get<QosTxop>();
93 bk_txop->AssignStreams(currentStream);
94 }
95}
96
103class WifiTest : public TestCase
104{
105 public:
106 WifiTest();
107
108 void DoRun() override;
109
110 private:
112 void RunOne();
118 void CreateOne(Vector pos, Ptr<YansWifiChannel> channel);
124
128};
129
131 : TestCase("Wifi")
132{
133}
134
135void
137{
138 Ptr<Packet> p = Create<Packet>();
139 dev->Send(p, dev->GetBroadcast(), 1);
140}
141
142void
144{
145 Ptr<Node> node = CreateObject<Node>();
146 Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
147 node->AddDevice(dev);
148
149 auto mobility = CreateObject<ConstantPositionMobilityModel>();
150 auto phy = CreateObject<YansWifiPhy>();
151 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
152 phy->SetInterferenceHelper(interferenceHelper);
153 auto error = CreateObject<YansErrorRateModel>();
154 phy->SetErrorRateModel(error);
155 phy->SetChannel(channel);
156 phy->SetDevice(dev);
157 phy->ConfigureStandard(WIFI_STANDARD_80211a);
158 dev->SetPhy(phy);
159 auto manager = m_manager.Create<WifiRemoteStationManager>();
160 dev->SetRemoteStationManager(manager);
161
163 mac->SetDevice(dev);
164 mac->SetAddress(Mac48Address::Allocate());
165 dev->SetMac(mac);
166 mac->ConfigureStandard(WIFI_STANDARD_80211a);
167 if (mac->GetTypeOfStation() == STA)
168 {
169 StaticCast<StaWifiMac>(mac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
170 }
171 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
172 Ptr<FrameExchangeManager> fem = mac->GetFrameExchangeManager();
173 Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager>();
174 protectionManager->SetWifiMac(mac);
175 fem->SetProtectionManager(protectionManager);
176 Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager>();
177 ackManager->SetWifiMac(mac);
178 fem->SetAckManager(ackManager);
179
180 mobility->SetPosition(pos);
181 node->AggregateObject(mobility);
182
184}
185
186void
188{
189 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
191 Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel>();
192 channel->SetPropagationDelayModel(propDelay);
193 channel->SetPropagationLossModel(propLoss);
194
195 CreateOne(Vector(0.0, 0.0, 0.0), channel);
196 CreateOne(Vector(5.0, 0.0, 0.0), channel);
197 CreateOne(Vector(5.0, 0.0, 0.0), channel);
198
200
203}
204
205void
207{
208 m_mac.SetTypeId("ns3::AdhocWifiMac");
209 m_propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
210
211 m_manager.SetTypeId("ns3::ArfWifiManager");
212 RunOne();
213 m_manager.SetTypeId("ns3::AarfWifiManager");
214 RunOne();
215 m_manager.SetTypeId("ns3::ConstantRateWifiManager");
216 RunOne();
217 m_manager.SetTypeId("ns3::OnoeWifiManager");
218 RunOne();
219 m_manager.SetTypeId("ns3::AmrrWifiManager");
220 RunOne();
221 m_manager.SetTypeId("ns3::IdealWifiManager");
222 RunOne();
223
224 m_mac.SetTypeId("ns3::AdhocWifiMac");
225 RunOne();
226 m_mac.SetTypeId("ns3::ApWifiMac");
227 RunOne();
228 m_mac.SetTypeId("ns3::StaWifiMac");
229 RunOne();
230
231 m_propDelay.SetTypeId("ns3::RandomPropagationDelayModel");
232 m_mac.SetTypeId("ns3::AdhocWifiMac");
233 RunOne();
234}
235
243{
244 public:
246 : TestCase("QosUtilsIsOldPacket")
247 {
248 }
249
250 void DoRun() override
251 {
252 // startingSeq=0, seqNum=2047
254 false,
255 "2047 is new in comparison to 0");
256 // startingSeq=0, seqNum=2048
257 NS_TEST_EXPECT_MSG_EQ(QosUtilsIsOldPacket(0, 2048), true, "2048 is old in comparison to 0");
258 // startingSeq=2048, seqNum=0
259 NS_TEST_EXPECT_MSG_EQ(QosUtilsIsOldPacket(2048, 0), true, "0 is old in comparison to 2048");
260 // startingSeq=4095, seqNum=0
262 false,
263 "0 is new in comparison to 4095");
264 // startingSeq=0, seqNum=4095
265 NS_TEST_EXPECT_MSG_EQ(QosUtilsIsOldPacket(0, 4095), true, "4095 is old in comparison to 0");
266 // startingSeq=4095 seqNum=2047
268 true,
269 "2047 is old in comparison to 4095");
270 // startingSeq=2048 seqNum=4095
272 false,
273 "4095 is new in comparison to 2048");
274 // startingSeq=2049 seqNum=0
276 false,
277 "0 is new in comparison to 2049");
278 }
279};
280
285{
286 public:
288
289 void DoRun() override;
290
291 private:
298 Ptr<Node> CreateOne(Vector pos, Ptr<YansWifiChannel> channel);
309
313};
314
316 : TestCase("InterferenceHelperSequence")
317{
318}
319
320void
322{
323 Ptr<Packet> p = Create<Packet>(1000);
324 dev->Send(p, dev->GetBroadcast(), 1);
325}
326
327void
329{
330 Ptr<WifiPhy> p = dev->GetPhy();
331 p->SetOperatingChannel(WifiPhy::ChannelTuple{40, 0, (int)(WIFI_PHY_BAND_5GHZ), 0});
332}
333
336{
337 Ptr<Node> node = CreateObject<Node>();
338 Ptr<WifiNetDevice> dev = CreateObject<WifiNetDevice>();
339 node->AddDevice(dev);
340
341 auto mobility = CreateObject<ConstantPositionMobilityModel>();
342 auto phy = CreateObject<YansWifiPhy>();
343 Ptr<InterferenceHelper> interferenceHelper = CreateObject<InterferenceHelper>();
344 phy->SetInterferenceHelper(interferenceHelper);
345 auto error = CreateObject<YansErrorRateModel>();
346 phy->SetErrorRateModel(error);
347 phy->SetChannel(channel);
348 phy->SetDevice(dev);
349 phy->SetMobility(mobility);
350 phy->ConfigureStandard(WIFI_STANDARD_80211a);
351 dev->SetPhy(phy);
352 auto manager = m_manager.Create<WifiRemoteStationManager>();
353 dev->SetRemoteStationManager(manager);
354
356 mac->SetDevice(dev);
357 mac->SetAddress(Mac48Address::Allocate());
358 dev->SetMac(mac);
359 mac->ConfigureStandard(WIFI_STANDARD_80211a);
360 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
361 Ptr<FrameExchangeManager> fem = mac->GetFrameExchangeManager();
362 Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager>();
363 protectionManager->SetWifiMac(mac);
364 fem->SetProtectionManager(protectionManager);
365 Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager>();
366 ackManager->SetWifiMac(mac);
367 fem->SetAckManager(ackManager);
368
369 mobility->SetPosition(pos);
370 node->AggregateObject(mobility);
371
372 return node;
373}
374
375void
377{
378 m_mac.SetTypeId("ns3::AdhocWifiMac");
379 m_propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
380 m_manager.SetTypeId("ns3::ConstantRateWifiManager");
381
382 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
384 Ptr<MatrixPropagationLossModel> propLoss = CreateObject<MatrixPropagationLossModel>();
385 channel->SetPropagationDelayModel(propDelay);
386 channel->SetPropagationLossModel(propLoss);
387
388 Ptr<Node> rxOnly = CreateOne(Vector(0.0, 0.0, 0.0), channel);
389 Ptr<Node> senderA = CreateOne(Vector(5.0, 0.0, 0.0), channel);
390 Ptr<Node> senderB = CreateOne(Vector(-5.0, 0.0, 0.0), channel);
391
392 propLoss->SetLoss(senderB->GetObject<MobilityModel>(),
393 rxOnly->GetObject<MobilityModel>(),
394 0,
395 true);
396 propLoss->SetDefaultLoss(999);
397
400 this,
401 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
402
403 Simulator::Schedule(Seconds(1.0000001),
405 this,
406 DynamicCast<WifiNetDevice>(rxOnly->GetDevice(0)));
407
410 this,
411 DynamicCast<WifiNetDevice>(senderA->GetDevice(0)));
412
415 this,
416 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
417
418 Simulator::Stop(Seconds(100.0));
420
422}
423
424//-----------------------------------------------------------------------------
476{
477 public:
479
480 void DoRun() override;
481
482 private:
488
492
495 unsigned int m_numSentPackets;
496
502 void NotifyPhyTxBegin(Ptr<const Packet> p, double txPowerW);
503};
504
506 : TestCase("Test case for DCF immediate access with broadcast frames")
507{
508}
509
510void
512{
513 if (m_numSentPackets == 0)
514 {
517 }
518 else if (m_numSentPackets == 1)
519 {
521 }
522}
523
524void
526{
527 Ptr<Packet> p = Create<Packet>(1000);
528 dev->Send(p, dev->GetBroadcast(), 1);
529}
530
531void
533{
534 m_mac.SetTypeId("ns3::AdhocWifiMac");
535 m_propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
536 m_manager.SetTypeId("ns3::ConstantRateWifiManager");
537
538 // Assign a seed and run number, and later fix the assignment of streams to
539 // WiFi random variables, so that the first backoff used is one slot
541 RngSeedManager::SetRun(40); // a value of 17 will result in zero slots
542
543 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
545 Ptr<PropagationLossModel> propLoss = CreateObject<RandomPropagationLossModel>();
546 channel->SetPropagationDelayModel(propDelay);
547 channel->SetPropagationLossModel(propLoss);
548
549 Ptr<Node> txNode = CreateObject<Node>();
550 Ptr<WifiNetDevice> txDev = CreateObject<WifiNetDevice>();
551
552 Ptr<ConstantPositionMobilityModel> txMobility = CreateObject<ConstantPositionMobilityModel>();
553 Ptr<YansWifiPhy> txPhy = CreateObject<YansWifiPhy>();
554 Ptr<InterferenceHelper> txInterferenceHelper = CreateObject<InterferenceHelper>();
555 txPhy->SetInterferenceHelper(txInterferenceHelper);
556 Ptr<ErrorRateModel> txError = CreateObject<YansErrorRateModel>();
557 txPhy->SetErrorRateModel(txError);
558 txPhy->SetChannel(channel);
559 txPhy->SetDevice(txDev);
560 txPhy->SetMobility(txMobility);
561 txPhy->ConfigureStandard(WIFI_STANDARD_80211a);
562
563 txPhy->TraceConnectWithoutContext(
564 "PhyTxBegin",
566
567 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
568 txNode->AggregateObject(txMobility);
569 txDev->SetPhy(txPhy);
570 txDev->SetRemoteStationManager(m_manager.Create<WifiRemoteStationManager>());
571 txNode->AddDevice(txDev);
572
573 auto txMac = m_mac.Create<WifiMac>();
574 txMac->SetDevice(txDev);
575 txMac->SetAddress(Mac48Address::Allocate());
576 txDev->SetMac(txMac);
577 txMac->ConfigureStandard(WIFI_STANDARD_80211a);
578 txMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
579 auto fem = txMac->GetFrameExchangeManager();
580 auto protectionManager = CreateObject<WifiDefaultProtectionManager>();
581 protectionManager->SetWifiMac(txMac);
582 fem->SetProtectionManager(protectionManager);
583 auto ackManager = CreateObject<WifiDefaultAckManager>();
584 ackManager->SetWifiMac(txMac);
585 fem->SetAckManager(ackManager);
586
587 // Fix the stream assignment to the Dcf Txop objects (backoffs)
588 // The below stream assignment will result in the Txop object
589 // using a backoff value of zero for this test when the
590 // Txop::EndTxNoAck() calls to StartBackoffNow()
591 AssignWifiRandomStreams(txMac, 23);
592
596
599 this,
600 txDev);
603 this,
604 txDev);
605
609
610 // First packet is transmitted a DIFS after the packet is queued. A DIFS
611 // is 2 slots (2 * 9 = 18 us) plus a SIFS (16 us), i.e., 34 us
612 Time expectedFirstTransmissionTime = Seconds(1.0) + MicroSeconds(34);
613
614 // First packet has 1408 us of transmit time. Slot time is 9 us.
615 // Backoff is 1 slots. SIFS is 16 us. DIFS is 2 slots = 18 us.
616 // Should send next packet at 1408 us + (1 * 9 us) + 16 us + (2 * 9) us
617 // 1451 us after the first one.
618 uint32_t expectedWait1 = 1408 + (1 * 9) + 16 + (2 * 9);
619 Time expectedSecondTransmissionTime =
620 expectedFirstTransmissionTime + MicroSeconds(expectedWait1);
622 expectedFirstTransmissionTime,
623 "The first transmission time not correct!");
624
626 expectedSecondTransmissionTime,
627 "The second transmission time not correct!");
628}
629
630//-----------------------------------------------------------------------------
644{
645 public:
647 ~Bug730TestCase() override;
648
649 void DoRun() override;
650
651 private:
653
660 void Receive(std::string context, Ptr<const Packet> p, const Address& adr);
661};
662
664 : TestCase("Test case for Bug 730"),
665 m_received(0)
666{
667}
668
670{
671}
672
673void
674Bug730TestCase::Receive(std::string context, Ptr<const Packet> p, const Address& adr)
675{
676 if ((p->GetSize() == 1460) && (Simulator::Now() > Seconds(20)))
677 {
678 m_received++;
679 }
680}
681
682void
684{
685 m_received = 0;
686
687 NodeContainer wifiStaNode;
688 wifiStaNode.Create(1);
689
690 NodeContainer wifiApNode;
691 wifiApNode.Create(1);
692
695 phy.SetChannel(channel.Create());
696
697 WifiHelper wifi;
698 wifi.SetStandard(WIFI_STANDARD_80211b);
699 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
700 "DataMode",
701 StringValue("DsssRate1Mbps"),
702 "ControlMode",
703 StringValue("DsssRate1Mbps"));
704
705 WifiMacHelper mac;
706 Ssid ssid = Ssid("ns-3-ssid");
707 mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid), "ActiveProbing", BooleanValue(false));
708
709 NetDeviceContainer staDevices;
710 staDevices = wifi.Install(phy, mac, wifiStaNode);
711
712 mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid), "BeaconGeneration", BooleanValue(true));
713
714 NetDeviceContainer apDevices;
715 apDevices = wifi.Install(phy, mac, wifiApNode);
716
717 MobilityHelper mobility;
718 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
719
720 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
721 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
722 mobility.SetPositionAllocator(positionAlloc);
723
724 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
725 mobility.Install(wifiApNode);
726 mobility.Install(wifiStaNode);
727
728 Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice>(apDevices.Get(0));
729 Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice>(staDevices.Get(0));
730
731 PacketSocketAddress socket;
732 socket.SetSingleDevice(sta_device->GetIfIndex());
733 socket.SetPhysicalAddress(ap_device->GetAddress());
734 socket.SetProtocol(1);
735
736 // give packet socket powers to nodes.
737 PacketSocketHelper packetSocket;
738 packetSocket.Install(wifiStaNode);
739 packetSocket.Install(wifiApNode);
740
741 Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient>();
742 client->SetAttribute("PacketSize", UintegerValue(1460));
743 client->SetRemote(socket);
744 wifiStaNode.Get(0)->AddApplication(client);
745 client->SetStartTime(Seconds(1));
746 client->SetStopTime(Seconds(51.0));
747
748 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
749 server->SetLocal(socket);
750 wifiApNode.Get(0)->AddApplication(server);
751 server->SetStartTime(Seconds(0.0));
752 server->SetStopTime(Seconds(52.0));
753
754 Config::Connect("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
756
759 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
760 StringValue("800"));
761
764
766
767 bool result = (m_received > 0);
769 result,
770 true,
771 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
772}
773
774//-----------------------------------------------------------------------------
783{
784 public:
786 ~QosFragmentationTestCase() override;
787
788 void DoRun() override;
789
790 private:
793
800 void Receive(std::string context, Ptr<const Packet> p, const Address& adr);
801
808 void Transmit(std::string context, Ptr<const Packet> p, double power);
809};
810
812 : TestCase("Test case for fragmentation with QoS stations"),
813 m_received(0),
814 m_fragments(0)
815{
816}
817
819{
820}
821
822void
824{
825 if (p->GetSize() == 1400)
826 {
827 m_received++;
828 }
829}
830
831void
832QosFragmentationTestCase::Transmit(std::string context, Ptr<const Packet> p, double power)
833{
834 WifiMacHeader hdr;
835 p->PeekHeader(hdr);
836 if (hdr.IsQosData())
837 {
838 NS_TEST_EXPECT_MSG_LT_OR_EQ(p->GetSize(), 400, "Unexpected fragment size");
839 m_fragments++;
840 }
841}
842
843void
845{
846 NodeContainer wifiStaNode;
847 wifiStaNode.Create(1);
848
849 NodeContainer wifiApNode;
850 wifiApNode.Create(1);
851
854 phy.SetChannel(channel.Create());
855
856 WifiHelper wifi;
857 wifi.SetStandard(WIFI_STANDARD_80211n);
858 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", "DataMode", StringValue("HtMcs7"));
859
860 WifiMacHelper mac;
861 Ssid ssid = Ssid("ns-3-ssid");
862 mac.SetType("ns3::StaWifiMac", "Ssid", SsidValue(ssid), "ActiveProbing", BooleanValue(false));
863
864 NetDeviceContainer staDevices;
865 staDevices = wifi.Install(phy, mac, wifiStaNode);
866
867 mac.SetType("ns3::ApWifiMac", "Ssid", SsidValue(ssid), "BeaconGeneration", BooleanValue(true));
868
869 NetDeviceContainer apDevices;
870 apDevices = wifi.Install(phy, mac, wifiApNode);
871
872 MobilityHelper mobility;
873 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
874
875 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
876 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
877 mobility.SetPositionAllocator(positionAlloc);
878
879 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
880 mobility.Install(wifiApNode);
881 mobility.Install(wifiStaNode);
882
883 Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice>(apDevices.Get(0));
884 Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice>(staDevices.Get(0));
885
886 // set the TXOP limit on BE AC
887 PointerValue ptr;
888 sta_device->GetMac()->GetAttribute("BE_Txop", ptr);
889 ptr.Get<QosTxop>()->SetTxopLimit(MicroSeconds(3008));
890
891 PacketSocketAddress socket;
892 socket.SetSingleDevice(sta_device->GetIfIndex());
893 socket.SetPhysicalAddress(ap_device->GetAddress());
894 socket.SetProtocol(1);
895
896 // give packet socket powers to nodes.
897 PacketSocketHelper packetSocket;
898 packetSocket.Install(wifiStaNode);
899 packetSocket.Install(wifiApNode);
900
901 Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient>();
902 client->SetAttribute("PacketSize", UintegerValue(1400));
903 client->SetAttribute("MaxPackets", UintegerValue(1));
904 client->SetRemote(socket);
905 wifiStaNode.Get(0)->AddApplication(client);
906 client->SetStartTime(Seconds(1));
907 client->SetStopTime(Seconds(3.0));
908
909 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
910 server->SetLocal(socket);
911 wifiApNode.Get(0)->AddApplication(server);
912 server->SetStartTime(Seconds(0.0));
913 server->SetStopTime(Seconds(4.0));
914
915 Config::Connect("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
917
918 Config::Set("/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
919 StringValue("400"));
920 Config::Connect("/NodeList/0/DeviceList/0/Phy/PhyTxBegin",
922
925
927
928 NS_TEST_ASSERT_MSG_EQ(m_received, 1, "Unexpected number of received packets");
929 NS_TEST_ASSERT_MSG_EQ(m_fragments, 4, "Unexpected number of transmitted fragments");
930}
931
939{
940 public:
942
943 void DoRun() override;
944
945 private:
952};
953
955 : TestCase("Test case for setting WifiPhy channel and frequency")
956{
957}
958
961{
962 Ptr<WifiNetDevice> wnd = nc.Get(0)->GetObject<WifiNetDevice>();
963 Ptr<WifiPhy> wp = wnd->GetPhy();
964 return wp->GetObject<YansWifiPhy>();
965}
966
967void
969{
970 NodeContainer wifiStaNode;
971 wifiStaNode.Create(1);
972 NodeContainer wifiApNode;
973 wifiApNode.Create(1);
974
977 phy.SetChannel(channel.Create());
978
979 // Configure and declare other generic components of this example
980 Ssid ssid;
981 ssid = Ssid("wifi-phy-configuration");
982 WifiMacHelper macSta;
983 macSta.SetType("ns3::StaWifiMac",
984 "Ssid",
985 SsidValue(ssid),
986 "ActiveProbing",
987 BooleanValue(false));
988 NetDeviceContainer staDevice;
989 Ptr<YansWifiPhy> phySta;
990
991 // Cases taken from src/wifi/examples/wifi-phy-configuration.cc example
992 {
993 // case 0:
994 // Default configuration, without WifiHelper::SetStandard or WifiHelper
995 phySta = CreateObject<YansWifiPhy>();
996 // The default results in an invalid configuration
997 NS_TEST_ASSERT_MSG_EQ(phySta->GetOperatingChannel().IsSet(),
998 false,
999 "default configuration");
1000 }
1001 {
1002 // case 1:
1003 WifiHelper wifi;
1004 wifi.SetStandard(WIFI_STANDARD_80211a);
1005 wifi.SetRemoteStationManager("ns3::ArfWifiManager");
1006 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1007 phySta = GetYansWifiPhyPtr(staDevice);
1008 // We expect channel 36, width 20, frequency 5180
1009 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "default configuration");
1010 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "default configuration");
1011 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "default configuration");
1012 }
1013 {
1014 // case 2:
1015 WifiHelper wifi;
1016 wifi.SetStandard(WIFI_STANDARD_80211b);
1017 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1018 phySta = GetYansWifiPhyPtr(staDevice);
1019 // We expect channel 1, width 22, frequency 2412
1020 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11b configuration");
1021 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 22, "802.11b configuration");
1022 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11b configuration");
1023 }
1024 {
1025 // case 3:
1026 WifiHelper wifi;
1027 wifi.SetStandard(WIFI_STANDARD_80211g);
1028 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1029 phySta = GetYansWifiPhyPtr(staDevice);
1030 // We expect channel 1, width 20, frequency 2412
1031 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11g configuration");
1032 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11g configuration");
1033 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11g configuration");
1034 }
1035 {
1036 // case 4:
1037 WifiHelper wifi;
1038 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1039 wifi.SetStandard(WIFI_STANDARD_80211n);
1040 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_5GHZ, 0}"));
1041 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1042 phySta = GetYansWifiPhyPtr(staDevice);
1043 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11n-5GHz configuration");
1044 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11n-5GHz configuration");
1045 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11n-5GHz configuration");
1046 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1047 }
1048 {
1049 // case 5:
1050 WifiHelper wifi;
1051 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1052 wifi.SetStandard(WIFI_STANDARD_80211n);
1053 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1054 phySta = GetYansWifiPhyPtr(staDevice);
1055 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11n-2.4GHz configuration");
1056 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11n-2.4GHz configuration");
1057 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11n-2.4GHz configuration");
1058 }
1059 {
1060 // case 6:
1061 WifiHelper wifi;
1062 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1063 wifi.SetStandard(WIFI_STANDARD_80211ac);
1064 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1065 phySta = GetYansWifiPhyPtr(staDevice);
1066 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 42, "802.11ac configuration");
1067 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 80, "802.11ac configuration");
1068 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5210, "802.11ac configuration");
1069 }
1070 {
1071 // case 7:
1072 // By default, WifiHelper will use WIFI_PHY_STANDARD_80211ax
1073 WifiHelper wifi;
1074 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1075 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_2_4GHZ, 0}"));
1076 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1077 phySta = GetYansWifiPhyPtr(staDevice);
1078 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 1, "802.11ax-2.4GHz configuration");
1079 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11ax-2.4GHz configuration");
1080 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2412, "802.11ax-2.4GHz configuration");
1081 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1082 }
1083 {
1084 // case 8:
1085 WifiHelper wifi;
1086 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1087 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1088 phySta = GetYansWifiPhyPtr(staDevice);
1089 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 42, "802.11ax-5GHz configuration");
1090 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 80, "802.11ax-5GHz configuration");
1091 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5210, "802.11ax-5GHz configuration");
1092 }
1093 {
1094 // case 9:
1095 WifiHelper wifi;
1096 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1097 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_6GHZ, 0}"));
1098 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1099 phySta = GetYansWifiPhyPtr(staDevice);
1100 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 7, "802.11ax-6GHz configuration");
1101 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 80, "802.11ax-6GHz configuration");
1102 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5985, "802.11ax-6GHz configuration");
1103 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1104 }
1105 {
1106 // case 10:
1107 WifiHelper wifi;
1108 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1109 wifi.SetStandard(WIFI_STANDARD_80211p);
1110 phy.Set("ChannelSettings", StringValue("{0, 10, BAND_5GHZ, 0}"));
1111 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1112 phySta = GetYansWifiPhyPtr(staDevice);
1113 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 172, "802.11p 10Mhz configuration");
1114 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 10, "802.11p 10Mhz configuration");
1115 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5860, "802.11p 10Mhz configuration");
1116 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1117 }
1118 {
1119 // case 11:
1120 WifiHelper wifi;
1121 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1122 wifi.SetStandard(WIFI_STANDARD_80211p);
1123 phy.Set("ChannelSettings", StringValue("{0, 5, BAND_5GHZ, 0}"));
1124 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1125 phySta = GetYansWifiPhyPtr(staDevice);
1126 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 171, "802.11p 5Mhz configuration");
1127 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 5, "802.11p 5Mhz configuration");
1128 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5860, "802.11p 5Mhz configuration");
1129 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1130 }
1131 {
1132 // case 12:
1133 WifiHelper wifi;
1134 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1135 wifi.SetStandard(WIFI_STANDARD_80211n);
1136 phy.Set("ChannelSettings", StringValue("{44, 20, BAND_5GHZ, 0}"));
1137 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1138 phySta = GetYansWifiPhyPtr(staDevice);
1139 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 44, "802.11 5GHz configuration");
1140 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1141 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5220, "802.11 5GHz configuration");
1142 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1143 }
1144 {
1145 // case 13:
1146 WifiHelper wifi;
1147 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1148 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1149 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1150 phySta = GetYansWifiPhyPtr(staDevice);
1151 // Post-install reconfiguration to channel number 40
1152 std::ostringstream path;
1153 path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex()
1154 << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1155 Config::Set(path.str(), StringValue("{40, 0, BAND_5GHZ, 0}"));
1156 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1157 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1158 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1159 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1160 }
1161 {
1162 // case 14:
1163 WifiHelper wifi;
1164 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1165 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1166 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1167 phySta = GetYansWifiPhyPtr(staDevice);
1168 // Post-install reconfiguration to a 40 MHz channel
1169 std::ostringstream path;
1170 path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex()
1171 << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1172 Config::Set(path.str(), StringValue("{46, 0, BAND_5GHZ, 0}"));
1173 // Although channel 44 is configured originally for 20 MHz, we
1174 // allow it to be used for 40 MHz here
1175 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 46, "802.11 5GHz configuration");
1176 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 40, "802.11 5GHz configuration");
1177 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5230, "802.11 5GHz configuration");
1178 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1179 }
1180 {
1181 // case 15:
1182 WifiHelper wifi;
1183 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1184 wifi.SetStandard(WIFI_STANDARD_80211n);
1185 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1186 phySta = GetYansWifiPhyPtr(staDevice);
1187 phySta->SetAttribute("ChannelSettings", StringValue("{3, 20, BAND_2_4GHZ, 0}"));
1188 return;
1189 // Post-install reconfiguration to a 40 MHz channel
1190 std::ostringstream path;
1191 path << "/NodeList/*/DeviceList/" << staDevice.Get(0)->GetIfIndex()
1192 << "/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1193 Config::Set(path.str(), StringValue("{4, 40, BAND_2_4GHZ, 0}"));
1194 // Although channel 44 is configured originally for 20 MHz, we
1195 // allow it to be used for 40 MHz here
1196 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 4, "802.11 5GHz configuration");
1197 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 40, "802.11 5GHz configuration");
1198 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 2427, "802.11 5GHz configuration");
1199 phy.Set("ChannelSettings", StringValue("{0, 0, BAND_UNSPECIFIED, 0}")); // restore default
1200 }
1201 {
1202 // case 16:
1203 WifiHelper wifi;
1204 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1205 // Test that setting Frequency to a non-standard value will throw an exception
1206 wifi.SetStandard(WIFI_STANDARD_80211n);
1207 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1208 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1209 phySta = GetYansWifiPhyPtr(staDevice);
1210 bool exceptionThrown = false;
1211 try
1212 {
1213 phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
1214 }
1215 catch (const std::runtime_error&)
1216 {
1217 exceptionThrown = true;
1218 }
1219 // We expect that an exception is thrown
1220 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1221 }
1222 {
1223 // case 17:
1224 WifiHelper wifi;
1225 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1226 wifi.SetStandard(WIFI_STANDARD_80211n);
1227 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1228 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1229 phySta = GetYansWifiPhyPtr(staDevice);
1230 // Test that setting channel to a standard value will set the
1231 // frequency correctly
1232 phySta->SetAttribute("ChannelSettings", StringValue("{100, 0, BAND_5GHZ, 0}"));
1233 // We expect frequency to be 5500 due to channel number being 100
1234 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 100, "802.11 5GHz configuration");
1235 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1236 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5500, "802.11 5GHz configuration");
1237 }
1238 {
1239 // case 18:
1240 // Set a wrong channel after initialization
1241 WifiHelper wifi;
1242 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1243 wifi.SetStandard(WIFI_STANDARD_80211n);
1244 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1245 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1246 phySta = GetYansWifiPhyPtr(staDevice);
1247 bool exceptionThrown = false;
1248 try
1249 {
1250 phySta->SetOperatingChannel(WifiPhy::ChannelTuple{99, 40, WIFI_PHY_BAND_5GHZ, 0});
1251 }
1252 catch (const std::runtime_error&)
1253 {
1254 exceptionThrown = true;
1255 }
1256 // We expect that an exception is thrown
1257 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1258 }
1259 {
1260 // case 19:
1261 WifiHelper wifi;
1262 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1263 // Test how channel number behaves when frequency is non-standard
1264 wifi.SetStandard(WIFI_STANDARD_80211n);
1265 phy.Set("ChannelSettings", StringValue("{44, 0, BAND_5GHZ, 0}"));
1266 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1267 phySta = GetYansWifiPhyPtr(staDevice);
1268 bool exceptionThrown = false;
1269 try
1270 {
1271 phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
1272 }
1273 catch (const std::runtime_error&)
1274 {
1275 exceptionThrown = true;
1276 }
1277 // We expect that an exception is thrown due to unknown channel number 45
1278 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1279 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1280 // We expect channel number to be 36 due to known center frequency 5180
1281 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1282 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1283 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1284 exceptionThrown = false;
1285 try
1286 {
1287 phySta->SetAttribute("ChannelSettings", StringValue("{43, 0, BAND_5GHZ, 0}"));
1288 }
1289 catch (const std::runtime_error&)
1290 {
1291 exceptionThrown = true;
1292 }
1293 // We expect that an exception is thrown due to unknown channel number 43
1294 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1295 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1296 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1297 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1298 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1299 }
1300 {
1301 // case 20:
1302 WifiHelper wifi;
1303 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
1304 phy.Set("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
1305 wifi.SetStandard(WIFI_STANDARD_80211n);
1306 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1307 phySta = GetYansWifiPhyPtr(staDevice);
1308 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1309 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1310 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1311 // Set both channel and frequency to consistent values after initialization
1312 wifi.SetStandard(WIFI_STANDARD_80211n);
1313 staDevice = wifi.Install(phy, macSta, wifiStaNode.Get(0));
1314 phySta = GetYansWifiPhyPtr(staDevice);
1315 phySta->SetAttribute("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
1316 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1317 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1318 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1319
1320 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1321 // We expect channel number to be 36
1322 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1323 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1324 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1325 phySta->SetAttribute("ChannelSettings", StringValue("{40, 0, BAND_5GHZ, 0}"));
1326 // We expect channel number to be 40
1327 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 40, "802.11 5GHz configuration");
1328 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1329 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5200, "802.11 5GHz configuration");
1330 bool exceptionThrown = false;
1331 try
1332 {
1333 phySta->SetAttribute("ChannelSettings", StringValue("{45, 0, BAND_5GHZ, 0}"));
1334 }
1335 catch (const std::runtime_error&)
1336 {
1337 exceptionThrown = true;
1338 }
1339 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1340 // We expect channel number to be 36 and an exception to be thrown
1341 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1342 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1343 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1344 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1345 phySta->SetAttribute("ChannelSettings", StringValue("{36, 0, BAND_5GHZ, 0}"));
1346 exceptionThrown = false;
1347 try
1348 {
1349 phySta->SetAttribute("ChannelSettings", StringValue("{43, 0, BAND_5GHZ, 0}"));
1350 }
1351 catch (const std::runtime_error&)
1352 {
1353 exceptionThrown = true;
1354 }
1355 // We expect channel number to be 36 and an exception to be thrown
1356 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelNumber(), 36, "802.11 5GHz configuration");
1357 NS_TEST_ASSERT_MSG_EQ(phySta->GetChannelWidth(), 20, "802.11 5GHz configuration");
1358 NS_TEST_ASSERT_MSG_EQ(phySta->GetFrequency(), 5180, "802.11 5GHz configuration");
1359 NS_TEST_ASSERT_MSG_EQ(exceptionThrown, true, "802.11 5GHz configuration");
1360 }
1361
1363}
1364
1365//-----------------------------------------------------------------------------
1374{
1375 public:
1377 ~Bug2222TestCase() override;
1378
1379 void DoRun() override;
1380
1381 private:
1383
1389 void TxDataFailedTrace(std::string context, Mac48Address adr);
1390};
1391
1393 : TestCase("Test case for Bug 2222"),
1394 m_countInternalCollisions(0)
1395{
1396}
1397
1399{
1400}
1401
1402void
1404{
1405 // Indicate the long retry counter has been increased in the wifi remote station manager
1407}
1408
1409void
1411{
1413
1414 // Generate same backoff for AC_VI and AC_VO
1415 // The below combination will work
1418 int64_t streamNumber = 100;
1419
1420 NodeContainer wifiNodes;
1421 wifiNodes.Create(2);
1422
1425 phy.SetChannel(channel.Create());
1426
1427 WifiHelper wifi;
1428 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
1429 "DataMode",
1430 StringValue("OfdmRate54Mbps"),
1431 "ControlMode",
1432 StringValue("OfdmRate24Mbps"));
1433 WifiMacHelper mac;
1434 Ssid ssid = Ssid("ns-3-ssid");
1435 mac.SetType("ns3::AdhocWifiMac", "QosSupported", BooleanValue(true));
1436
1437 NetDeviceContainer wifiDevices;
1438 wifiDevices = wifi.Install(phy, mac, wifiNodes);
1439
1440 // Assign fixed streams to random variables in use
1441 wifi.AssignStreams(wifiDevices, streamNumber);
1442
1443 MobilityHelper mobility;
1444 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1445
1446 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1447 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1448 mobility.SetPositionAllocator(positionAlloc);
1449
1450 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1451 mobility.Install(wifiNodes);
1452
1453 Ptr<WifiNetDevice> device1 = DynamicCast<WifiNetDevice>(wifiDevices.Get(0));
1454 Ptr<WifiNetDevice> device2 = DynamicCast<WifiNetDevice>(wifiDevices.Get(1));
1455
1456 PacketSocketAddress socket;
1457 socket.SetSingleDevice(device1->GetIfIndex());
1458 socket.SetPhysicalAddress(device2->GetAddress());
1459 socket.SetProtocol(1);
1460
1461 PacketSocketHelper packetSocket;
1462 packetSocket.Install(wifiNodes);
1463
1464 Ptr<PacketSocketClient> clientLowPriority = CreateObject<PacketSocketClient>();
1465 clientLowPriority->SetAttribute("PacketSize", UintegerValue(1460));
1466 clientLowPriority->SetAttribute("MaxPackets", UintegerValue(1));
1467 clientLowPriority->SetAttribute("Priority", UintegerValue(4)); // AC_VI
1468 clientLowPriority->SetRemote(socket);
1469 wifiNodes.Get(0)->AddApplication(clientLowPriority);
1470 clientLowPriority->SetStartTime(Seconds(0.0));
1471 clientLowPriority->SetStopTime(Seconds(1.0));
1472
1473 Ptr<PacketSocketClient> clientHighPriority = CreateObject<PacketSocketClient>();
1474 clientHighPriority->SetAttribute("PacketSize", UintegerValue(1460));
1475 clientHighPriority->SetAttribute("MaxPackets", UintegerValue(1));
1476 clientHighPriority->SetAttribute("Priority", UintegerValue(6)); // AC_VO
1477 clientHighPriority->SetRemote(socket);
1478 wifiNodes.Get(0)->AddApplication(clientHighPriority);
1479 clientHighPriority->SetStartTime(Seconds(0.0));
1480 clientHighPriority->SetStopTime(Seconds(1.0));
1481
1482 Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer>();
1483 server->SetLocal(socket);
1484 wifiNodes.Get(1)->AddApplication(server);
1485 server->SetStartTime(Seconds(0.0));
1486 server->SetStopTime(Seconds(1.0));
1487
1488 Config::Connect("/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1490
1494
1496 1,
1497 "unexpected number of internal collisions!");
1498}
1499
1500//-----------------------------------------------------------------------------
1514{
1515 public:
1517 ~Bug2843TestCase() override;
1518 void DoRun() override;
1519
1520 private:
1525 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1527 std::vector<FreqWidthSubbandModulationTuple>
1530
1537 void StoreDistinctTuple(std::string context, Ptr<SpectrumSignalParameters> txParams);
1544 void SendPacketBurst(uint8_t numPackets,
1545 Ptr<NetDevice> sourceDevice,
1546 Address& destination) const;
1547
1549};
1550
1552 : TestCase("Test case for Bug 2843"),
1553 m_channelWidth(20)
1554{
1555}
1556
1558{
1559}
1560
1561void
1563{
1564 // Extract starting frequency and number of subbands
1565 Ptr<const SpectrumModel> c = txParams->psd->GetSpectrumModel();
1566 std::size_t numBands = c->GetNumBands();
1567 double startingFreq = c->Begin()->fl;
1568
1569 // Get channel bandwidth and modulation class
1571 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1572
1573 Ptr<WifiPpdu> ppdu = wifiTxParams->ppdu->Copy();
1574 WifiTxVector txVector = ppdu->GetTxVector();
1575 m_channelWidth = txVector.GetChannelWidth();
1576 WifiModulationClass modulationClass = txVector.GetMode().GetModulationClass();
1577
1578 // Build a tuple and check if seen before (if so store it)
1579 FreqWidthSubbandModulationTuple tupleForCurrentTx =
1580 std::make_tuple(startingFreq, m_channelWidth, numBands, modulationClass);
1581 bool found = false;
1582 for (std::vector<FreqWidthSubbandModulationTuple>::const_iterator it = m_distinctTuples.begin();
1583 it != m_distinctTuples.end();
1584 it++)
1585 {
1586 if (*it == tupleForCurrentTx)
1587 {
1588 found = true;
1589 }
1590 }
1591 if (!found)
1592 {
1593 m_distinctTuples.push_back(tupleForCurrentTx);
1594 }
1595}
1596
1597void
1599 Ptr<NetDevice> sourceDevice,
1600 Address& destination) const
1601{
1602 for (uint8_t i = 0; i < numPackets; i++)
1603 {
1604 Ptr<Packet> pkt = Create<Packet>(1000); // 1000 dummy bytes of data
1605 sourceDevice->Send(pkt, destination, 0);
1606 }
1607}
1608
1609void
1611{
1612 uint16_t channelWidth = 40; // at least 40 MHz expected here
1613
1614 NodeContainer wifiStaNode;
1615 wifiStaNode.Create(1);
1616
1617 NodeContainer wifiApNode;
1618 wifiApNode.Create(1);
1619
1620 SpectrumWifiPhyHelper spectrumPhy;
1621 Ptr<MultiModelSpectrumChannel> spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
1622 Ptr<FriisPropagationLossModel> lossModel = CreateObject<FriisPropagationLossModel>();
1623 lossModel->SetFrequency(5.190e9);
1624 spectrumChannel->AddPropagationLossModel(lossModel);
1625
1627 CreateObject<ConstantSpeedPropagationDelayModel>();
1628 spectrumChannel->SetPropagationDelayModel(delayModel);
1629
1630 spectrumPhy.SetChannel(spectrumChannel);
1631 spectrumPhy.SetErrorRateModel("ns3::NistErrorRateModel");
1632 spectrumPhy.Set("ChannelSettings", StringValue("{38, 40, BAND_5GHZ, 0}"));
1633 spectrumPhy.Set("TxPowerStart", DoubleValue(10));
1634 spectrumPhy.Set("TxPowerEnd", DoubleValue(10));
1635
1636 WifiHelper wifi;
1637 wifi.SetStandard(WIFI_STANDARD_80211ac);
1638 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
1639 "DataMode",
1640 StringValue("VhtMcs8"),
1641 "ControlMode",
1642 StringValue("VhtMcs8"),
1643 "RtsCtsThreshold",
1644 StringValue("500")); // so as to force RTS/CTS for data frames
1645
1646 WifiMacHelper mac;
1647 mac.SetType("ns3::StaWifiMac");
1648 NetDeviceContainer staDevice;
1649 staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode);
1650
1651 mac.SetType("ns3::ApWifiMac");
1652 NetDeviceContainer apDevice;
1653 apDevice = wifi.Install(spectrumPhy, mac, wifiApNode);
1654
1655 MobilityHelper mobility;
1656 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
1657 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1658 positionAlloc->Add(Vector(1.0, 0.0, 0.0)); // put close enough in order to use MCS
1659 mobility.SetPositionAllocator(positionAlloc);
1660
1661 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
1662 mobility.Install(wifiApNode);
1663 mobility.Install(wifiStaNode);
1664
1665 // Send two 5 packet-bursts
1668 this,
1669 5,
1670 apDevice.Get(0),
1671 staDevice.Get(0)->GetAddress());
1674 this,
1675 5,
1676 apDevice.Get(0),
1677 staDevice.Get(0)->GetAddress());
1678
1679 Config::Connect("/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1681
1684
1686
1687 // {starting frequency, channelWidth, Number of subbands in SpectrumModel, modulation type}
1688 // tuples
1689 std::size_t numberTuples = m_distinctTuples.size();
1690 NS_TEST_ASSERT_MSG_EQ(numberTuples, 2, "Only two distinct tuples expected");
1691 NS_TEST_ASSERT_MSG_EQ(std::get<0>(m_distinctTuples[0]) - 20e6,
1692 std::get<0>(m_distinctTuples[1]),
1693 "The starting frequency of the first tuple should be shifted 20 MHz to "
1694 "the right wrt second tuple");
1695 // Note that the first tuple should the one initiated by the beacon, i.e. non-HT OFDM (20 MHz)
1697 20,
1698 "First tuple's channel width should be 20 MHz");
1700 193,
1701 "First tuple should have 193 subbands (64+DC, 20MHz+DC, inband and 64*2 "
1702 "out-of-band, 20MHz on each side)");
1704 WifiModulationClass::WIFI_MOD_CLASS_OFDM,
1705 "First tuple should be OFDM");
1706 // Second tuple
1708 channelWidth,
1709 "Second tuple's channel width should be 40 MHz");
1711 385,
1712 "Second tuple should have 385 subbands (128+DC, 40MHz+DC, inband and "
1713 "128*2 out-of-band, 40MHz on each side)");
1715 WifiModulationClass::WIFI_MOD_CLASS_VHT,
1716 "Second tuple should be VHT_OFDM");
1717}
1718
1719//-----------------------------------------------------------------------------
1732{
1733 public:
1735 ~Bug2831TestCase() override;
1736 void DoRun() override;
1737
1738 private:
1749 void RxCallback(std::string context, Ptr<const Packet> p, RxPowerWattPerChannelBand rxPowersW);
1750
1753
1760};
1761
1763 : TestCase("Test case for Bug 2831"),
1764 m_assocReqCount(0),
1765 m_assocRespCount(0),
1766 m_countOperationalChannelWidth20(0),
1767 m_countOperationalChannelWidth40(0)
1768{
1769}
1770
1772{
1773}
1774
1775void
1777{
1780}
1781
1782void
1785 RxPowerWattPerChannelBand rxPowersW)
1786{
1787 Ptr<Packet> packet = p->Copy();
1788 WifiMacHeader hdr;
1789 packet->RemoveHeader(hdr);
1790 if (hdr.IsAssocReq())
1791 {
1793 }
1794 else if (hdr.IsAssocResp())
1795 {
1797 }
1798 else if (hdr.IsBeacon())
1799 {
1800 MgtBeaconHeader beacon;
1801 packet->RemoveHeader(beacon);
1802 const auto& htOperation = beacon.Get<HtOperation>();
1803 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1804 {
1806 }
1807 else
1808 {
1810 }
1811 }
1812}
1813
1814void
1816{
1817 Ptr<YansWifiChannel> channel = CreateObject<YansWifiChannel>();
1818 ObjectFactory propDelay;
1819 propDelay.SetTypeId("ns3::ConstantSpeedPropagationDelayModel");
1820 Ptr<PropagationDelayModel> propagationDelay = propDelay.Create<PropagationDelayModel>();
1821 Ptr<PropagationLossModel> propagationLoss = CreateObject<FriisPropagationLossModel>();
1822 channel->SetPropagationDelayModel(propagationDelay);
1823 channel->SetPropagationLossModel(propagationLoss);
1824
1825 Ptr<Node> apNode = CreateObject<Node>();
1826 Ptr<WifiNetDevice> apDev = CreateObject<WifiNetDevice>();
1827 apNode->AddDevice(apDev);
1828 apDev->SetStandard(WIFI_STANDARD_80211ax);
1829 Ptr<HtConfiguration> apHtConfiguration = CreateObject<HtConfiguration>();
1830 apDev->SetHtConfiguration(apHtConfiguration);
1831 ObjectFactory manager;
1832 manager.SetTypeId("ns3::ConstantRateWifiManager");
1833 apDev->SetRemoteStationManager(manager.Create<WifiRemoteStationManager>());
1834
1835 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1836 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1837 apNode->AggregateObject(apMobility);
1838
1839 auto error = CreateObject<YansErrorRateModel>();
1840 m_apPhy = CreateObject<YansWifiPhy>();
1841 apDev->SetPhy(m_apPhy);
1842 Ptr<InterferenceHelper> apInterferenceHelper = CreateObject<InterferenceHelper>();
1843 m_apPhy->SetInterferenceHelper(apInterferenceHelper);
1844 m_apPhy->SetErrorRateModel(error);
1845 m_apPhy->SetChannel(channel);
1846 m_apPhy->SetMobility(apMobility);
1847 m_apPhy->SetDevice(apDev);
1850
1851 ObjectFactory mac;
1852 mac.SetTypeId("ns3::ApWifiMac");
1853 mac.Set("EnableBeaconJitter", BooleanValue(false));
1854 mac.Set("QosSupported", BooleanValue(true));
1855 Ptr<WifiMac> apMac = mac.Create<WifiMac>();
1856 apMac->SetDevice(apDev);
1857 apMac->SetAddress(Mac48Address::Allocate());
1858 apDev->SetMac(apMac);
1859 apMac->ConfigureStandard(WIFI_STANDARD_80211ax);
1860 apMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1861 Ptr<FrameExchangeManager> fem = apMac->GetFrameExchangeManager();
1862 Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager>();
1863 protectionManager->SetWifiMac(apMac);
1864 fem->SetProtectionManager(protectionManager);
1865 Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager>();
1866 ackManager->SetWifiMac(apMac);
1867 fem->SetAckManager(ackManager);
1868
1869 Ptr<Node> staNode = CreateObject<Node>();
1870 Ptr<WifiNetDevice> staDev = CreateObject<WifiNetDevice>();
1871 staNode->AddDevice(staDev);
1872 staDev->SetStandard(WIFI_STANDARD_80211ax);
1873 Ptr<HtConfiguration> staHtConfiguration = CreateObject<HtConfiguration>();
1874 staDev->SetHtConfiguration(staHtConfiguration);
1875 staDev->SetRemoteStationManager(manager.Create<WifiRemoteStationManager>());
1876
1877 Ptr<ConstantPositionMobilityModel> staMobility = CreateObject<ConstantPositionMobilityModel>();
1878 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1879 staNode->AggregateObject(staMobility);
1880
1881 m_staPhy = CreateObject<YansWifiPhy>();
1882 staDev->SetPhy(m_staPhy);
1883 Ptr<InterferenceHelper> staInterferenceHelper = CreateObject<InterferenceHelper>();
1884 m_staPhy->SetInterferenceHelper(staInterferenceHelper);
1886 m_staPhy->SetChannel(channel);
1887 m_staPhy->SetMobility(staMobility);
1888 m_staPhy->SetDevice(apDev);
1891
1892 mac.SetTypeId("ns3::StaWifiMac");
1893 auto staMac = mac.Create<WifiMac>();
1894 staDev->SetMac(staMac);
1895 staMac->SetDevice(staDev);
1896 staMac->SetAddress(Mac48Address::Allocate());
1897 staMac->ConfigureStandard(WIFI_STANDARD_80211ax);
1898 StaticCast<StaWifiMac>(staMac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
1899 staMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1900 fem = staMac->GetFrameExchangeManager();
1901 protectionManager = CreateObject<WifiDefaultProtectionManager>();
1902 protectionManager->SetWifiMac(staMac);
1903 fem->SetProtectionManager(protectionManager);
1904 ackManager = CreateObject<WifiDefaultAckManager>();
1905 ackManager->SetWifiMac(staMac);
1906 fem->SetAckManager(ackManager);
1907
1908 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1910
1912
1916
1917 NS_TEST_ASSERT_MSG_EQ(m_assocReqCount, 2, "Second Association request not received");
1918 NS_TEST_ASSERT_MSG_EQ(m_assocRespCount, 2, "Second Association response not received");
1920 10,
1921 "Incorrect operational channel width before channel change");
1923 20,
1924 "Incorrect operational channel width after channel change");
1925}
1926
1927//-----------------------------------------------------------------------------
1944{
1945 public:
1947 ~StaWifiMacScanningTestCase() override;
1948 void DoRun() override;
1949
1950 private:
1956 void AssocCallback(std::string context, Mac48Address bssid);
1961 void TurnBeaconGenerationOn(Ptr<Node> apNode);
1966 void TurnApOff(Ptr<Node> apNode);
1973 NodeContainer Setup(bool nearestApBeaconGeneration, bool staActiveProbe);
1974
1976};
1977
1979 : TestCase("Test case for StaWifiMac scanning capability")
1980{
1981}
1982
1984{
1985}
1986
1987void
1989{
1990 m_associatedApBssid = bssid;
1991}
1992
1993void
1995{
1996 Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice>(apNode->GetDevice(0));
1997 Ptr<ApWifiMac> mac = DynamicCast<ApWifiMac>(netDevice->GetMac());
1998 mac->SetAttribute("BeaconGeneration", BooleanValue(true));
1999}
2000
2001void
2003{
2004 Ptr<WifiNetDevice> netDevice = DynamicCast<WifiNetDevice>(apNode->GetDevice(0));
2005 Ptr<WifiPhy> phy = netDevice->GetPhy();
2006 phy->SetOffMode();
2007}
2008
2010StaWifiMacScanningTestCase::Setup(bool nearestApBeaconGeneration, bool staActiveProbe)
2011{
2014 int64_t streamNumber = 1;
2015
2016 NodeContainer apNodes;
2017 apNodes.Create(2);
2018
2019 Ptr<Node> apNodeNearest = CreateObject<Node>();
2020 Ptr<Node> staNode = CreateObject<Node>();
2021
2024 phy.SetChannel(channel.Create());
2025
2026 WifiHelper wifi;
2027 wifi.SetStandard(WIFI_STANDARD_80211n);
2028 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager");
2029
2030 WifiMacHelper mac;
2031 NetDeviceContainer apDevice;
2032 NetDeviceContainer apDeviceNearest;
2033 mac.SetType("ns3::ApWifiMac", "BeaconGeneration", BooleanValue(true));
2034 apDevice = wifi.Install(phy, mac, apNodes);
2035 mac.SetType("ns3::ApWifiMac", "BeaconGeneration", BooleanValue(nearestApBeaconGeneration));
2036 apDeviceNearest = wifi.Install(phy, mac, apNodeNearest);
2037
2038 NetDeviceContainer staDevice;
2039 mac.SetType("ns3::StaWifiMac", "ActiveProbing", BooleanValue(staActiveProbe));
2040 staDevice = wifi.Install(phy, mac, staNode);
2041
2042 // Assign fixed streams to random variables in use
2043 wifi.AssignStreams(apDevice, streamNumber);
2044 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2045 wifi.AssignStreams(staDevice, streamNumber + 2);
2046
2047 MobilityHelper mobility;
2048 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2049 positionAlloc->Add(Vector(0.0, 0.0, 0.0)); // Furthest AP
2050 positionAlloc->Add(Vector(10.0, 0.0, 0.0)); // Second nearest AP
2051 positionAlloc->Add(Vector(5.0, 5.0, 0.0)); // Nearest AP
2052 positionAlloc->Add(Vector(6.0, 5.0, 0.0)); // STA
2053 mobility.SetPositionAllocator(positionAlloc);
2054
2055 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2056 mobility.Install(apNodes);
2057 mobility.Install(apNodeNearest);
2058 mobility.Install(staNode);
2059
2060 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2062
2063 NodeContainer allNodes = NodeContainer(apNodes, apNodeNearest, staNode);
2064 return allNodes;
2065}
2066
2067void
2069{
2070 {
2071 NodeContainer nodes = Setup(false, false);
2072 Ptr<Node> nearestAp = nodes.Get(2);
2073 Mac48Address nearestApAddr =
2074 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2075
2078 this,
2079 nearestAp);
2080
2084
2086 nearestApAddr,
2087 "STA is associated to the wrong AP");
2088 }
2090 {
2091 NodeContainer nodes = Setup(true, true);
2092 Ptr<Node> nearestAp = nodes.Get(2);
2093 Mac48Address nearestApAddr =
2094 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2095
2099
2101 nearestApAddr,
2102 "STA is associated to the wrong AP");
2103 }
2105 {
2106 NodeContainer nodes = Setup(true, false);
2107 Ptr<Node> nearestAp = nodes.Get(2);
2108 Mac48Address secondNearestApAddr =
2109 DynamicCast<WifiNetDevice>(nodes.Get(1)->GetDevice(0))->GetMac()->GetAddress();
2110
2112
2116
2118 secondNearestApAddr,
2119 "STA is associated to the wrong AP");
2120 }
2121}
2122
2123//-----------------------------------------------------------------------------
2147{
2148 public:
2150 ~Bug2470TestCase() override;
2151 void DoRun() override;
2152
2153 private:
2162 void AddbaStateChangedCallback(std::string context,
2163 Time t,
2164 Mac48Address recipient,
2165 uint8_t tid,
2175 void TxCallback(Ptr<ListErrorModel> rxErrorModel,
2176 std::string context,
2177 WifiConstPsduMap psduMap,
2178 WifiTxVector txVector,
2179 double txPowerW);
2180
2191 void RxCallback(std::string context,
2193 uint16_t channelFreqMhz,
2194 WifiTxVector txVector,
2195 MpduInfo aMpdu,
2196 SignalNoiseDbm signalNoise,
2197 uint16_t staId);
2204 void RxErrorCallback(std::string context, Ptr<const Packet> p, double snr);
2211 void SendPacketBurst(uint32_t numPackets,
2212 Ptr<NetDevice> sourceDevice,
2213 Address& destination) const;
2218 void RunSubtest(TypeOfStation rcvErrorType);
2219
2226 uint16_t
2228 uint16_t
2231};
2232
2234 : TestCase("Test case for Bug 2470"),
2235 m_receivedNormalMpduCount(0),
2236 m_receivedAmpduCount(0),
2237 m_failedActionCount(0),
2238 m_addbaEstablishedCount(0),
2239 m_addbaPendingCount(0),
2240 m_addbaRejectedCount(0),
2241 m_addbaNoReplyCount(0),
2242 m_addbaResetCount(0)
2243{
2244}
2245
2247{
2248}
2249
2250void
2252 Time t,
2253 Mac48Address recipient,
2254 uint8_t tid,
2256{
2257 switch (state)
2258 {
2261 break;
2264 break;
2267 break;
2270 break;
2273 break;
2274 }
2275}
2276
2277void
2279 std::string context,
2280 WifiConstPsduMap psduMap,
2281 WifiTxVector txVector,
2282 double txPowerW)
2283{
2284 auto psdu = psduMap.begin()->second;
2285
2286 // The sender is transmitting an ADDBA_REQUEST or ADDBA_RESPONSE frame. If this is
2287 // the first attempt at establishing a BA agreement (i.e., before the second set of packets
2288 // is generated), make the reception of the frame fail at the receiver.
2289 if (psdu->GetHeader(0).GetType() == WIFI_MAC_MGT_ACTION && Simulator::Now() < Seconds(0.8))
2290 {
2291 auto uid = psdu->GetPayload(0)->GetUid();
2292 rxErrorModel->SetList({uid});
2293 }
2294}
2295
2296void
2299 uint16_t channelFreqMhz,
2300 WifiTxVector txVector,
2301 MpduInfo aMpdu,
2302 SignalNoiseDbm signalNoise,
2303 uint16_t staId)
2304{
2305 Ptr<Packet> packet = p->Copy();
2306 if (aMpdu.type != MpduType::NORMAL_MPDU)
2307 {
2309 }
2310 else
2311 {
2312 WifiMacHeader hdr;
2313 packet->RemoveHeader(hdr);
2314 if (hdr.IsData())
2315 {
2317 }
2318 }
2319}
2320
2321void
2322Bug2470TestCase::RxErrorCallback(std::string context, Ptr<const Packet> p, double snr)
2323{
2324 Ptr<Packet> packet = p->Copy();
2325 WifiMacHeader hdr;
2326 packet->RemoveHeader(hdr);
2327 if (hdr.IsAction())
2328 {
2330 }
2331}
2332
2333void
2335 Ptr<NetDevice> sourceDevice,
2336 Address& destination) const
2337{
2338 for (uint32_t i = 0; i < numPackets; i++)
2339 {
2340 Ptr<Packet> pkt = Create<Packet>(1000); // 1000 dummy bytes of data
2341 sourceDevice->Send(pkt, destination, 0);
2342 }
2343}
2344
2345void
2347{
2350 int64_t streamNumber = 200;
2351
2352 NodeContainer wifiApNode;
2353 NodeContainer wifiStaNode;
2354 wifiApNode.Create(1);
2355 wifiStaNode.Create(1);
2356
2359 phy.SetChannel(channel.Create());
2360
2361 WifiHelper wifi;
2362 wifi.SetStandard(WIFI_STANDARD_80211n);
2363 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
2364 "DataMode",
2365 StringValue("HtMcs7"),
2366 "ControlMode",
2367 StringValue("HtMcs7"));
2368
2369 WifiMacHelper mac;
2370 NetDeviceContainer apDevice;
2371 phy.Set("ChannelSettings", StringValue("{36, 20, BAND_5GHZ, 0}"));
2372 mac.SetType("ns3::ApWifiMac", "EnableBeaconJitter", BooleanValue(false));
2373 apDevice = wifi.Install(phy, mac, wifiApNode);
2374
2375 NetDeviceContainer staDevice;
2376 mac.SetType("ns3::StaWifiMac");
2377 staDevice = wifi.Install(phy, mac, wifiStaNode);
2378
2379 // Assign fixed streams to random variables in use
2380 wifi.AssignStreams(apDevice, streamNumber);
2381 wifi.AssignStreams(staDevice, streamNumber);
2382
2383 MobilityHelper mobility;
2384 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2385 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2386 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2387 mobility.SetPositionAllocator(positionAlloc);
2388
2389 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2390 mobility.Install(wifiApNode);
2391 mobility.Install(wifiStaNode);
2392
2393 auto rxErrorModel = CreateObject<ListErrorModel>();
2394 Ptr<WifiMac> wifiMac;
2395 switch (rcvErrorType)
2396 {
2397 case AP:
2398 wifiMac = DynamicCast<WifiNetDevice>(apDevice.Get(0))->GetMac();
2399 break;
2400 case STA:
2401 wifiMac = DynamicCast<WifiNetDevice>(staDevice.Get(0))->GetMac();
2402 break;
2403 default:
2404 NS_ABORT_MSG("Station type " << +rcvErrorType << " cannot be used here");
2405 }
2406 wifiMac->GetWifiPhy(0)->SetPostReceptionErrorModel(rxErrorModel);
2407
2409 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2411 Config::Connect("/NodeList/*/DeviceList/*/Phy/State/RxError",
2413 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2414 "BlockAckManager/AgreementState",
2416 Config::Connect("/NodeList/" + std::to_string(rcvErrorType == STA ? 0 /* AP */ : 1 /* STA */) +
2417 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2418 MakeCallback(&Bug2470TestCase::TxCallback, this).Bind(rxErrorModel));
2419
2422 this,
2423 1,
2424 apDevice.Get(0),
2425 staDevice.Get(0)->GetAddress());
2428 this,
2429 4,
2430 apDevice.Get(0),
2431 staDevice.Get(0)->GetAddress());
2434 this,
2435 1,
2436 apDevice.Get(0),
2437 staDevice.Get(0)->GetAddress());
2440 this,
2441 4,
2442 apDevice.Get(0),
2443 staDevice.Get(0)->GetAddress());
2444
2448}
2449
2450void
2452{
2453 {
2454 RunSubtest(STA);
2455 NS_TEST_ASSERT_MSG_EQ(m_failedActionCount, 7, "ADDBA request packets are not failed");
2456 // There are two sets of 5 packets to be transmitted. The first 5 packets should be sent by
2457 // normal MPDU because of failed ADDBA handshake. For the second set, the first packet
2458 // should be sent by normal MPDU, and the rest with A-MPDU. In total we expect to receive 6
2459 // normal MPDU packets and 4 A-MPDU packet.
2461 6,
2462 "Receiving incorrect number of normal MPDU packet on subtest 1");
2464 4,
2465 "Receiving incorrect number of A-MPDU packets on subtest 1");
2466
2468 1,
2469 "Incorrect number of times the ADDBA state machine was in "
2470 "established state on subtest 1");
2473 2,
2474 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2477 0,
2478 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2481 1,
2482 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2485 1,
2486 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2487 }
2488
2497
2498 {
2499 RunSubtest(AP);
2500 NS_TEST_ASSERT_MSG_EQ(m_failedActionCount, 7, "ADDBA response packets are not failed");
2501 // Similar to subtest 1, we also expect to receive 6 normal MPDU packets and 4 A-MPDU
2502 // packets.
2504 6,
2505 "Receiving incorrect number of normal MPDU packet on subtest 2");
2507 4,
2508 "Receiving incorrect number of A-MPDU packet on subtest 2");
2509
2511 1,
2512 "Incorrect number of times the ADDBA state machine was in "
2513 "established state on subtest 2");
2516 2,
2517 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2520 0,
2521 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2524 1,
2525 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2528 1,
2529 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2530 }
2531
2532 // TODO: In the second test set, it does not go to reset state since ADDBA response is received
2533 // after timeout (NO_REPLY) but before it does not enter RESET state. More tests should be
2534 // written to verify all possible scenarios.
2535}
2536
2537//-----------------------------------------------------------------------------
2553{
2554 public:
2556 ~Issue40TestCase() override;
2557 void DoRun() override;
2558
2559 private:
2564 void RunOne(bool useAmpdu);
2565
2571 void RxSuccessCallback(std::string context, Ptr<const Packet> p);
2578 void SendPackets(uint8_t numPackets, Ptr<NetDevice> sourceDevice, Address& destination);
2584 void TxFinalDataFailedCallback(std::string context, Mac48Address address);
2585
2586 uint16_t m_rxCount;
2587 uint16_t m_txCount;
2588 uint16_t
2590};
2591
2593 : TestCase("Test case for issue #40"),
2594 m_rxCount(0),
2595 m_txCount(0),
2596 m_txMacFinalDataFailedCount(0)
2597{
2598}
2599
2601{
2602}
2603
2604void
2606{
2607 m_rxCount++;
2608}
2609
2610void
2611Issue40TestCase::SendPackets(uint8_t numPackets, Ptr<NetDevice> sourceDevice, Address& destination)
2612{
2613 for (uint8_t i = 0; i < numPackets; i++)
2614 {
2615 Ptr<Packet> pkt = Create<Packet>(1000); // 1000 dummy bytes of data
2616 sourceDevice->Send(pkt, destination, 0);
2617 m_txCount++;
2618 }
2619}
2620
2621void
2623{
2625}
2626
2627void
2629{
2630 m_rxCount = 0;
2631 m_txCount = 0;
2633
2636 int64_t streamNumber = 100;
2637
2638 NodeContainer wifiApNode;
2639 NodeContainer wifiStaNode;
2640 wifiApNode.Create(1);
2641 wifiStaNode.Create(1);
2642
2645 phy.SetChannel(channel.Create());
2646
2647 WifiHelper wifi;
2648 wifi.SetStandard(WIFI_STANDARD_80211ac);
2649 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
2650
2651 WifiMacHelper mac;
2652 NetDeviceContainer apDevice;
2653 mac.SetType("ns3::ApWifiMac");
2654 apDevice = wifi.Install(phy, mac, wifiApNode);
2655
2656 NetDeviceContainer staDevice;
2657 mac.SetType("ns3::StaWifiMac");
2658 staDevice = wifi.Install(phy, mac, wifiStaNode);
2659
2660 // Assign fixed streams to random variables in use
2661 wifi.AssignStreams(apDevice, streamNumber);
2662 wifi.AssignStreams(staDevice, streamNumber);
2663
2664 MobilityHelper mobility;
2665 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2666 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2667 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2668 mobility.SetPositionAllocator(positionAlloc);
2669
2670 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2671 mobility.Install(wifiApNode);
2672
2673 mobility.SetMobilityModel("ns3::WaypointMobilityModel");
2674 mobility.Install(wifiStaNode);
2675
2676 Config::Connect("/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2678 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
2680
2681 Ptr<WaypointMobilityModel> staWaypointMobility =
2682 DynamicCast<WaypointMobilityModel>(wifiStaNode.Get(0)->GetObject<MobilityModel>());
2683 staWaypointMobility->AddWaypoint(Waypoint(Seconds(1.0), Vector(10.0, 0.0, 0.0)));
2684 staWaypointMobility->AddWaypoint(Waypoint(Seconds(1.5), Vector(50.0, 0.0, 0.0)));
2685
2686 if (useAmpdu)
2687 {
2688 // Disable use of BAR that are sent with the lowest modulation so that we can also reproduce
2689 // the problem with A-MPDU, i.e. the lack of feedback about SNR change
2690 Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice>(apDevice.Get(0));
2691 PointerValue ptr;
2692 ap_device->GetMac()->GetAttribute("BE_Txop", ptr);
2693 ptr.Get<QosTxop>()->SetAttribute("UseExplicitBarAfterMissedBlockAck", BooleanValue(false));
2694 }
2695
2696 // Transmit a first data packet before the station moves: it should be sent with a high
2697 // modulation and successfully received
2700 this,
2701 useAmpdu ? 2 : 1,
2702 apDevice.Get(0),
2703 staDevice.Get(0)->GetAddress());
2704
2705 // Transmit a second data packet once the station is away from the access point: it should be
2706 // sent with the same high modulation and be unsuccessfuly received
2709 this,
2710 useAmpdu ? 2 : 1,
2711 apDevice.Get(0),
2712 staDevice.Get(0)->GetAddress());
2713
2714 // Keep on transmitting data packets while the station is away from the access point: it should
2715 // be sent with a lower modulation and be successfully received
2718 this,
2719 useAmpdu ? 2 : 1,
2720 apDevice.Get(0),
2721 staDevice.Get(0)->GetAddress());
2724 this,
2725 useAmpdu ? 2 : 1,
2726 apDevice.Get(0),
2727 staDevice.Get(0)->GetAddress());
2730 this,
2731 useAmpdu ? 2 : 1,
2732 apDevice.Get(0),
2733 staDevice.Get(0)->GetAddress());
2736 this,
2737 useAmpdu ? 2 : 1,
2738 apDevice.Get(0),
2739 staDevice.Get(0)->GetAddress());
2742 this,
2743 useAmpdu ? 2 : 1,
2744 apDevice.Get(0),
2745 staDevice.Get(0)->GetAddress());
2746
2749
2751 (useAmpdu ? 14 : 7),
2752 "Incorrect number of transmitted packets");
2754 (useAmpdu ? 12 : 6),
2755 "Incorrect number of successfully received packets");
2756 NS_TEST_ASSERT_MSG_EQ(m_txMacFinalDataFailedCount, 1, "Incorrect number of dropped TX packets");
2757
2759}
2760
2761void
2763{
2764 // Test without A-MPDU
2765 RunOne(false);
2766
2767 // Test with A-MPDU
2768 RunOne(true);
2769}
2770
2771//-----------------------------------------------------------------------------
2785{
2786 public:
2788 ~Issue169TestCase() override;
2789 void DoRun() override;
2790
2791 private:
2799 void SendPackets(uint8_t numPackets,
2800 Ptr<NetDevice> sourceDevice,
2801 Address& destination,
2802 uint8_t priority);
2803
2811 void TxCallback(std::string context,
2812 WifiConstPsduMap psdus,
2813 WifiTxVector txVector,
2814 double txPowerW);
2815};
2816
2818 : TestCase("Test case for issue #169")
2819{
2820}
2821
2823{
2824}
2825
2826void
2828 Ptr<NetDevice> sourceDevice,
2829 Address& destination,
2830 uint8_t priority)
2831{
2832 SocketPriorityTag priorityTag;
2833 priorityTag.SetPriority(priority);
2834 for (uint8_t i = 0; i < numPackets; i++)
2835 {
2836 Ptr<Packet> packet = Create<Packet>(1000); // 1000 dummy bytes of data
2837 packet->AddPacketTag(priorityTag);
2838 sourceDevice->Send(packet, destination, 0);
2839 }
2840}
2841
2842void
2844 WifiConstPsduMap psdus,
2845 WifiTxVector txVector,
2846 double txPowerW)
2847{
2848 if (psdus.begin()->second->GetSize() >= 1000)
2849 {
2851 WifiModulationClass::WIFI_MOD_CLASS_VHT,
2852 "Ideal rate manager selected incorrect modulation class");
2853 }
2854}
2855
2856void
2858{
2861 int64_t streamNumber = 100;
2862
2863 NodeContainer wifiApNode;
2864 NodeContainer wifiStaNode;
2865 wifiApNode.Create(1);
2866 wifiStaNode.Create(1);
2867
2870 phy.SetChannel(channel.Create());
2871
2872 WifiHelper wifi;
2873 wifi.SetStandard(WIFI_STANDARD_80211ac);
2874 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
2875
2876 WifiMacHelper mac;
2877 NetDeviceContainer apDevice;
2878 mac.SetType("ns3::ApWifiMac");
2879 apDevice = wifi.Install(phy, mac, wifiApNode);
2880
2881 NetDeviceContainer staDevice;
2882 mac.SetType("ns3::StaWifiMac");
2883 staDevice = wifi.Install(phy, mac, wifiStaNode);
2884
2885 // Assign fixed streams to random variables in use
2886 wifi.AssignStreams(apDevice, streamNumber);
2887 wifi.AssignStreams(staDevice, streamNumber);
2888
2889 MobilityHelper mobility;
2890 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
2891 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2892 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2893 mobility.SetPositionAllocator(positionAlloc);
2894
2895 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2896 mobility.Install(wifiApNode);
2897 mobility.Install(wifiStaNode);
2898
2899 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2901
2902 // Send best-effort packet (i.e. priority 0)
2905 this,
2906 1,
2907 apDevice.Get(0),
2908 staDevice.Get(0)->GetAddress(),
2909 0);
2910
2911 // Send non best-effort (voice) packet (i.e. priority 6)
2914 this,
2915 1,
2916 apDevice.Get(0),
2917 staDevice.Get(0)->GetAddress(),
2918 6);
2919
2922
2924}
2925
2926//-----------------------------------------------------------------------------
2942{
2943 public:
2946 void DoRun() override;
2947
2948 private:
2953 void ChangeChannelWidth(uint16_t channelWidth);
2954
2960 void SendPacket(Ptr<NetDevice> sourceDevice, Address& destination);
2961
2969 void TxCallback(std::string context,
2970 WifiConstPsduMap psduMap,
2971 WifiTxVector txVector,
2972 double txPowerW);
2973
2978 void CheckLastSelectedMode(WifiMode expectedMode);
2979
2981};
2982
2984 : TestCase("Test case for use of channel bonding with Ideal rate manager")
2985{
2986}
2987
2989{
2990}
2991
2992void
2994{
2995 Config::Set("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
2996 StringValue("{0, " + std::to_string(channelWidth) + ", BAND_5GHZ, 0}"));
2997}
2998
2999void
3001{
3002 Ptr<Packet> packet = Create<Packet>(1000);
3003 sourceDevice->Send(packet, destination, 0);
3004}
3005
3006void
3008 WifiConstPsduMap psduMap,
3009 WifiTxVector txVector,
3010 double txPowerW)
3011{
3012 if (psduMap.begin()->second->GetSize() >= 1000)
3013 {
3014 m_txMode = txVector.GetMode();
3015 }
3016}
3017
3018void
3020{
3022 expectedMode,
3023 "Last selected WifiMode "
3024 << m_txMode << " does not match expected WifiMode " << expectedMode);
3025}
3026
3027void
3029{
3032 int64_t streamNumber = 100;
3033
3034 NodeContainer wifiApNode;
3035 NodeContainer wifiStaNode;
3036 wifiApNode.Create(1);
3037 wifiStaNode.Create(1);
3038
3041 phy.SetChannel(channel.Create());
3042
3043 WifiHelper wifi;
3044 wifi.SetStandard(WIFI_STANDARD_80211ac);
3045 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
3046
3047 WifiMacHelper mac;
3048 NetDeviceContainer apDevice;
3049 mac.SetType("ns3::ApWifiMac");
3050 apDevice = wifi.Install(phy, mac, wifiApNode);
3051
3052 NetDeviceContainer staDevice;
3053 mac.SetType("ns3::StaWifiMac");
3054 staDevice = wifi.Install(phy, mac, wifiStaNode);
3055
3056 // Assign fixed streams to random variables in use
3057 wifi.AssignStreams(apDevice, streamNumber);
3058 wifi.AssignStreams(staDevice, streamNumber);
3059
3060 MobilityHelper mobility;
3061 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
3062 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3063 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3064 mobility.SetPositionAllocator(positionAlloc);
3065
3066 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
3067 mobility.Install(wifiApNode);
3068 mobility.Install(wifiStaNode);
3069
3070 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3072
3073 // Set channel width to 80 MHz & send packet
3076 this,
3077 80);
3080 this,
3081 apDevice.Get(0),
3082 staDevice.Get(0)->GetAddress());
3083 // Selected rate should be VHT-MCS 1
3086 this,
3088
3089 // Set channel width to 20 MHz & send packet
3092 this,
3093 20);
3096 this,
3097 apDevice.Get(0),
3098 staDevice.Get(0)->GetAddress());
3099 // Selected rate should be VHT-MCS 3 since SNR should be 6 dB higher than previously
3102 this,
3104
3105 // Set channel width to 40 MHz & send packet
3108 this,
3109 40);
3112 this,
3113 apDevice.Get(0),
3114 staDevice.Get(0)->GetAddress());
3115 // Selected rate should be VHT-MCS 2 since SNR should be 3 dB lower than previously
3118 this,
3120
3123
3125}
3126
3127//-----------------------------------------------------------------------------
3137{
3138 public:
3140 ~IdealRateManagerMimoTest() override;
3141 void DoRun() override;
3142
3143 private:
3149 void SetApMimoSettings(uint8_t antennas, uint8_t maxStreams);
3155 void SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams);
3161 void SendPacket(Ptr<NetDevice> sourceDevice, Address& destination);
3162
3170 void TxCallback(std::string context,
3171 WifiConstPsduMap psdus,
3172 WifiTxVector txVector,
3173 double txPowerW);
3174
3179 void CheckLastSelectedMode(WifiMode expectedMode);
3184 void CheckLastSelectedNss(uint8_t expectedNss);
3185
3187};
3188
3190 : TestCase("Test case for use of imbalanced MIMO settings with Ideal rate manager")
3191{
3192}
3193
3195{
3196}
3197
3198void
3199IdealRateManagerMimoTest::SetApMimoSettings(uint8_t antennas, uint8_t maxStreams)
3200{
3201 Config::Set("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3202 UintegerValue(antennas));
3203 Config::Set("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3204 UintegerValue(maxStreams));
3205 Config::Set("/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3206 UintegerValue(maxStreams));
3207}
3208
3209void
3210IdealRateManagerMimoTest::SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams)
3211{
3212 Config::Set("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3213 UintegerValue(antennas));
3214 Config::Set("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3215 UintegerValue(maxStreams));
3216 Config::Set("/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3217 UintegerValue(maxStreams));
3218}
3219
3220void
3222{
3223 Ptr<Packet> packet = Create<Packet>(1000);
3224 sourceDevice->Send(packet, destination, 0);
3225}
3226
3227void
3229 WifiConstPsduMap psdus,
3230 WifiTxVector txVector,
3231 double txPowerW)
3232{
3233 if (psdus.begin()->second->GetSize() >= 1000)
3234 {
3235 m_txVector = txVector;
3236 }
3237}
3238
3239void
3241{
3243 expectedNss,
3244 "Last selected Nss " << m_txVector.GetNss()
3245 << " does not match expected Nss " << expectedNss);
3246}
3247
3248void
3250{
3252 expectedMode,
3253 "Last selected WifiMode " << m_txVector.GetMode()
3254 << " does not match expected WifiMode "
3255 << expectedMode);
3256}
3257
3258void
3260{
3263 int64_t streamNumber = 100;
3264
3265 NodeContainer wifiApNode;
3266 NodeContainer wifiStaNode;
3267 wifiApNode.Create(1);
3268 wifiStaNode.Create(1);
3269
3272 phy.SetChannel(channel.Create());
3273
3274 WifiHelper wifi;
3275 wifi.SetStandard(WIFI_STANDARD_80211ac);
3276 wifi.SetRemoteStationManager("ns3::IdealWifiManager");
3277
3278 WifiMacHelper mac;
3279 NetDeviceContainer apDevice;
3280 mac.SetType("ns3::ApWifiMac");
3281 apDevice = wifi.Install(phy, mac, wifiApNode);
3282
3283 NetDeviceContainer staDevice;
3284 mac.SetType("ns3::StaWifiMac");
3285 staDevice = wifi.Install(phy, mac, wifiStaNode);
3286
3287 // Assign fixed streams to random variables in use
3288 wifi.AssignStreams(apDevice, streamNumber);
3289 wifi.AssignStreams(staDevice, streamNumber);
3290
3291 MobilityHelper mobility;
3292 Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
3293 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3294 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3295 mobility.SetPositionAllocator(positionAlloc);
3296
3297 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
3298 mobility.Install(wifiApNode);
3299 mobility.Install(wifiStaNode);
3300
3301 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3303
3304 // TX: 1 antenna
3306 // RX: 1 antenna
3308 // Send packets (2 times to get one feedback)
3311 this,
3312 apDevice.Get(0),
3313 staDevice.Get(0)->GetAddress());
3316 this,
3317 apDevice.Get(0),
3318 staDevice.Get(0)->GetAddress());
3319 // Selected NSS should be 1 since both TX and RX support a single antenna
3321 // Selected rate should be VHT-MCS 2 because of settings and distance between TX and RX
3324 this,
3326
3327 // TX: 1 antenna
3329 // RX: 2 antennas, but only supports 1 spatial stream
3331 // Send packets (2 times to get one feedback)
3334 this,
3335 apDevice.Get(0),
3336 staDevice.Get(0)->GetAddress());
3339 this,
3340 apDevice.Get(0),
3341 staDevice.Get(0)->GetAddress());
3342 // Selected NSS should be 1 since both TX and RX support a single antenna
3344 // Selected rate should be increased to VHT-MCS 3 because of RX diversity resulting in SNR
3345 // improvement of about 3dB
3348 this,
3350
3351 // TX: 1 antenna
3353 // RX: 2 antennas, and supports 2 spatial streams
3355 // Send packets (2 times to get one feedback)
3358 this,
3359 apDevice.Get(0),
3360 staDevice.Get(0)->GetAddress());
3363 this,
3364 apDevice.Get(0),
3365 staDevice.Get(0)->GetAddress());
3366 // Selected NSS should be 1 since TX supports a single antenna
3368 // Selected rate should be as previously
3371 this,
3373
3374 // TX: 2 antennas, but only supports 1 spatial stream
3376 // RX: 1 antenna
3378 // Send packets (2 times to get one feedback)
3381 this,
3382 apDevice.Get(0),
3383 staDevice.Get(0)->GetAddress());
3386 this,
3387 apDevice.Get(0),
3388 staDevice.Get(0)->GetAddress());
3389 // Selected NSS should be 1 since both TX and RX support a single antenna
3391 // Selected rate should be VHT-MCS 2 because we do no longer have diversity in this scenario
3392 // (more antennas at TX does not result in SNR improvement in AWGN channel)
3395 this,
3397
3398 // TX: 2 antennas, but only supports 1 spatial stream
3400 // RX: 2 antennas, but only supports 1 spatial stream
3402 // Send packets (2 times to get one feedback)
3405 this,
3406 apDevice.Get(0),
3407 staDevice.Get(0)->GetAddress());
3410 this,
3411 apDevice.Get(0),
3412 staDevice.Get(0)->GetAddress());
3413 // Selected NSS should be 1 since both TX and RX support a single antenna
3415 // Selected rate should be increased to VHT-MCS 3 because of RX diversity resulting in SNR
3416 // improvement of about 3dB (more antennas at TX does not result in SNR improvement in AWGN
3417 // channel)
3420 this,
3422
3423 // TX: 2 antennas, but only supports 1 spatial stream
3425 // RX: 2 antennas, and supports 2 spatial streams
3427 // Send packets (2 times to get one feedback)
3430 this,
3431 apDevice.Get(0),
3432 staDevice.Get(0)->GetAddress());
3435 this,
3436 apDevice.Get(0),
3437 staDevice.Get(0)->GetAddress());
3438 // Selected NSS should be 1 since TX supports a single antenna
3440 // Selected rate should be as previously
3443 this,
3445
3446 // TX: 2 antennas, and supports 2 spatial streams
3448 // RX: 1 antenna
3450 // Send packets (2 times to get one feedback)
3453 this,
3454 apDevice.Get(0),
3455 staDevice.Get(0)->GetAddress());
3458 this,
3459 apDevice.Get(0),
3460 staDevice.Get(0)->GetAddress());
3461 // Selected NSS should be 1 since RX supports a single antenna
3463 // Selected rate should be VHT-MCS 2 because we do no longer have diversity in this scenario
3464 // (more antennas at TX does not result in SNR improvement in AWGN channel)
3467 this,
3469
3470 // TX: 2 antennas, and supports 2 spatial streams
3472 // RX: 2 antennas, but only supports 1 spatial stream
3474 // Send packets (2 times to get one feedback)
3477 this,
3478 apDevice.Get(0),
3479 staDevice.Get(0)->GetAddress());
3482 this,
3483 apDevice.Get(0),
3484 staDevice.Get(0)->GetAddress());
3485 // Selected NSS should be 1 since RX supports a single antenna
3487 // Selected rate should be increased to VHT-MCS 3 because of RX diversity resulting in SNR
3488 // improvement of about 3dB (more antennas at TX does not result in SNR improvement in AWGN
3489 // channel)
3492 this,
3494
3495 // TX: 2 antennas, and supports 2 spatial streams
3497 // RX: 2 antennas, and supports 2 spatial streams
3499 // Send packets (2 times to get one feedback)
3502 this,
3503 apDevice.Get(0),
3504 staDevice.Get(0)->GetAddress());
3507 this,
3508 apDevice.Get(0),
3509 staDevice.Get(0)->GetAddress());
3510 // Selected NSS should be 2 since both TX and RX support 2 antennas
3512 // Selected rate should be the same as without diversity, as it uses 2 spatial streams so there
3513 // is no more benefits from diversity in AWGN channels
3516 this,
3518
3519 // Verify we can go back to initial situation
3524 this,
3525 apDevice.Get(0),
3526 staDevice.Get(0)->GetAddress());
3530 this,
3532
3533 Simulator::Stop(Seconds(10.2));
3536}
3537
3538//-----------------------------------------------------------------------------
3546{
3547 public:
3549
3550 private:
3561 bool CheckDataRate(HeRu::RuType ruType,
3562 std::string mcs,
3563 uint8_t nss,
3564 uint16_t guardInterval,
3565 uint16_t expectedDataRate);
3566 void DoRun() override;
3567};
3568
3570 : TestCase("Check data rates for different RU types.")
3571{
3572}
3573
3574bool
3576 std::string mcs,
3577 uint8_t nss,
3578 uint16_t guardInterval,
3579 uint16_t expectedDataRate)
3580{
3581 uint16_t approxWidth = HeRu::GetBandwidth(ruType);
3582 WifiMode mode(mcs);
3583 uint64_t dataRate = round(mode.GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3584 NS_ABORT_MSG_IF(dataRate > 65535, "Rate is way too high");
3585 if (static_cast<uint16_t>(dataRate) != expectedDataRate)
3586 {
3587 std::cerr << "RU=" << ruType << " mode=" << mode << " Nss=" << +nss
3588 << " guardInterval=" << guardInterval << " expected=" << expectedDataRate
3589 << " x100kbps"
3590 << " computed=" << static_cast<uint16_t>(dataRate) << " x100kbps" << std::endl;
3591 return false;
3592 }
3593 return true;
3594}
3595
3596void
3598{
3599 bool retval = true;
3600
3601 // 26-tone RU, browse over all MCSs, GIs and Nss's (up to 4, current max)
3602 retval = retval && CheckDataRate(HeRu::RU_26_TONE, "HeMcs0", 1, 800, 9) &&
3603 CheckDataRate(HeRu::RU_26_TONE, "HeMcs1", 1, 1600, 17) &&
3604 CheckDataRate(HeRu::RU_26_TONE, "HeMcs2", 1, 3200, 23) &&
3605 CheckDataRate(HeRu::RU_26_TONE, "HeMcs3", 1, 3200, 30) &&
3606 CheckDataRate(HeRu::RU_26_TONE, "HeMcs4", 2, 1600, 100) &&
3607 CheckDataRate(HeRu::RU_26_TONE, "HeMcs5", 3, 1600, 200) &&
3608 CheckDataRate(HeRu::RU_26_TONE, "HeMcs6", 4, 1600, 300) &&
3609 CheckDataRate(HeRu::RU_26_TONE, "HeMcs7", 4, 3200, 300) &&
3610 CheckDataRate(HeRu::RU_26_TONE, "HeMcs8", 4, 1600, 400) &&
3611 CheckDataRate(HeRu::RU_26_TONE, "HeMcs9", 4, 3200, 400) &&
3612 CheckDataRate(HeRu::RU_26_TONE, "HeMcs10", 4, 1600, 500) &&
3613 CheckDataRate(HeRu::RU_26_TONE, "HeMcs11", 4, 3200, 500);
3614
3616 retval,
3617 true,
3618 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3619
3620 // Check other RU sizes
3621 retval = retval && CheckDataRate(HeRu::RU_52_TONE, "HeMcs2", 1, 1600, 50) &&
3622 CheckDataRate(HeRu::RU_106_TONE, "HeMcs9", 1, 800, 500) &&
3623 CheckDataRate(HeRu::RU_242_TONE, "HeMcs5", 1, 1600, 650) &&
3624 CheckDataRate(HeRu::RU_484_TONE, "HeMcs3", 1, 1600, 650) &&
3625 CheckDataRate(HeRu::RU_996_TONE, "HeMcs5", 1, 3200, 2450) &&
3626 CheckDataRate(HeRu::RU_2x996_TONE, "HeMcs3", 1, 3200, 2450);
3627
3628 NS_TEST_EXPECT_MSG_EQ(retval,
3629 true,
3630 "Data rate verification for RUs above 52-tone RU (included) failed");
3631}
3632
3635 std::tuple<SupportedRates, std::optional<ExtendedSupportedRatesIE>, std::vector<Ssid>>;
3636
3643class MgtTestHeader : public WifiMgtHeader<MgtTestHeader, MgtTestElems>
3644{
3645 public:
3646 ~MgtTestHeader() override = default;
3647
3652 static TypeId GetTypeId();
3653
3657 TypeId GetInstanceTypeId() const override;
3658
3659 using WifiMgtHeader<MgtTestHeader, MgtTestElems>::GetSerializedSize;
3660 using WifiMgtHeader<MgtTestHeader, MgtTestElems>::Serialize;
3661 using WifiMgtHeader<MgtTestHeader, MgtTestElems>::Deserialize;
3662};
3663
3664TypeId
3666{
3667 static TypeId tid = TypeId("ns3::MgtTestHeader")
3668 .SetParent<Header>()
3669 .SetGroupName("Wifi")
3670 .AddConstructor<MgtTestHeader>();
3671 return tid;
3672}
3673
3674TypeId
3676{
3677 return GetTypeId();
3678}
3679
3687{
3688 public:
3690 ~WifiMgtHeaderTest() override = default;
3691
3692 private:
3693 void DoRun() override;
3694};
3695
3697 : HeaderSerializationTestCase("Check (de)serialization of a test management header")
3698{
3699}
3700
3701void
3703{
3704 MgtTestHeader frame;
3705
3706 // Add the mandatory Information Element (SupportedRates)
3707 AllSupportedRates allRates;
3708 allRates.AddSupportedRate(1000000);
3709 allRates.AddSupportedRate(2000000);
3710 allRates.AddSupportedRate(3000000);
3711 allRates.AddSupportedRate(4000000);
3712 allRates.AddSupportedRate(5000000);
3713
3714 frame.Get<SupportedRates>() = allRates.rates;
3715 frame.Get<ExtendedSupportedRatesIE>() = allRates.extendedRates;
3716
3717 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3718 true,
3719 "Expected a SupportedRates IE to be included");
3720 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3721 false,
3722 "Expected no ExtendedSupportedRatesIE to be included");
3723 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 0, "Expected no Ssid IE to be included");
3724
3726
3727 // Add more rates, so that the optional Information Element (ExtendedSupportedRatesIE) is added
3728 allRates.AddSupportedRate(6000000);
3729 allRates.AddSupportedRate(7000000);
3730 allRates.AddSupportedRate(8000000);
3731 allRates.AddSupportedRate(9000000);
3732 allRates.AddSupportedRate(10000000);
3733
3734 frame.Get<SupportedRates>() = allRates.rates;
3735 frame.Get<ExtendedSupportedRatesIE>() = allRates.extendedRates;
3736
3737 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3738 true,
3739 "Expected a SupportedRates IE to be included");
3740 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3741 true,
3742 "Expected an ExtendedSupportedRatesIE to be included");
3743 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 0, "Expected no Ssid IE to be included");
3744
3746
3747 // Add a first Ssid IE
3748 Ssid one("Ssid One");
3749 frame.Get<Ssid>().push_back(one);
3750
3751 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3752 true,
3753 "Expected a SupportedRates IE to be included");
3754 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3755 true,
3756 "Expected an ExtendedSupportedRatesIE to be included");
3757 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 1, "Expected one Ssid IE to be included");
3758 NS_TEST_EXPECT_MSG_EQ(std::string(frame.Get<Ssid>().front().PeekString()),
3759 "Ssid One",
3760 "Incorrect SSID");
3761
3763
3764 // Add a second Ssid IE
3765 frame.Get<Ssid>().emplace_back("Ssid Two");
3766
3767 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
3768 true,
3769 "Expected a SupportedRates IE to be included");
3770 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
3771 true,
3772 "Expected an ExtendedSupportedRatesIE to be included");
3773 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().size(), 2, "Expected two Ssid IEs to be included");
3774 NS_TEST_EXPECT_MSG_EQ(std::string(frame.Get<Ssid>().front().PeekString()),
3775 "Ssid One",
3776 "Incorrect first SSID");
3777 NS_TEST_EXPECT_MSG_EQ(std::string(frame.Get<Ssid>().back().PeekString()),
3778 "Ssid Two",
3779 "Incorrect second SSID");
3780
3782}
3783
3791{
3792 public:
3793 WifiTestSuite();
3794};
3795
3797 : TestSuite("wifi-devices", UNIT)
3798{
3811 AddTestCase(new Issue40TestCase, TestCase::QUICK); // Issue #40
3812 AddTestCase(new Issue169TestCase, TestCase::QUICK); // Issue #169
3817}
3818
Make sure that when virtual collision occurs the wifi remote station manager is triggered and the ret...
Definition: wifi-test.cc:1374
~Bug2222TestCase() override
Definition: wifi-test.cc:1398
uint32_t m_countInternalCollisions
count internal collisions
Definition: wifi-test.cc:1382
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:1410
void TxDataFailedTrace(std::string context, Mac48Address adr)
Transmit data failed function.
Definition: wifi-test.cc:1403
Make sure that the ADDBA handshake process is protected.
Definition: wifi-test.cc:2147
void RxErrorCallback(std::string context, Ptr< const Packet > p, double snr)
Callback when packet is dropped.
Definition: wifi-test.cc:2322
void RunSubtest(TypeOfStation rcvErrorType)
Run subtest for this test suite.
Definition: wifi-test.cc:2346
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2451
uint16_t m_addbaResetCount
Count number of times ADDBA state machine is in reset state.
Definition: wifi-test.cc:2230
uint16_t m_addbaRejectedCount
Count number of times ADDBA state machine is in rejected state.
Definition: wifi-test.cc:2227
void AddbaStateChangedCallback(std::string context, Time t, Mac48Address recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)
Callback when ADDBA state changed.
Definition: wifi-test.cc:2251
uint16_t m_failedActionCount
Count failed ADDBA request/response.
Definition: wifi-test.cc:2222
void TxCallback(Ptr< ListErrorModel > rxErrorModel, std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback when a frame is transmitted.
Definition: wifi-test.cc:2278
uint16_t m_addbaEstablishedCount
Count number of times ADDBA state machine is in established state.
Definition: wifi-test.cc:2223
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:2297
~Bug2470TestCase() override
Definition: wifi-test.cc:2246
uint16_t m_receivedNormalMpduCount
Count received normal MPDU packets on STA.
Definition: wifi-test.cc:2220
uint16_t m_addbaNoReplyCount
Count number of times ADDBA state machine is in no_reply state.
Definition: wifi-test.cc:2229
uint16_t m_addbaPendingCount
Count number of times ADDBA state machine is in pending state.
Definition: wifi-test.cc:2225
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:2334
uint16_t m_receivedAmpduCount
Count received A-MPDU packets on STA.
Definition: wifi-test.cc:2221
Make sure that the channel width and the channel number can be changed at runtime.
Definition: wifi-test.cc:1732
uint16_t m_countOperationalChannelWidth20
count number of beacon frames announcing a 20 MHz operating channel width
Definition: wifi-test.cc:1756
void ChangeSupportedChannelWidth()
Function called to change the supported channel width at runtime.
Definition: wifi-test.cc:1776
uint16_t m_countOperationalChannelWidth40
count number of beacon frames announcing a 40 MHz operating channel width
Definition: wifi-test.cc:1758
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:1783
uint16_t m_assocReqCount
count number of association requests
Definition: wifi-test.cc:1754
Ptr< YansWifiPhy > m_apPhy
AP PHY.
Definition: wifi-test.cc:1751
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:1815
Ptr< YansWifiPhy > m_staPhy
STA PHY.
Definition: wifi-test.cc:1752
uint16_t m_assocRespCount
count number of association responses
Definition: wifi-test.cc:1755
~Bug2831TestCase() override
Definition: wifi-test.cc:1771
Make sure that the correct channel width and center frequency have been set for OFDM basic rate trans...
Definition: wifi-test.cc:1514
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:1598
void StoreDistinctTuple(std::string context, Ptr< SpectrumSignalParameters > txParams)
Stores the distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Definition: wifi-test.cc:1562
std::vector< FreqWidthSubbandModulationTuple > m_distinctTuples
vector of distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Definition: wifi-test.cc:1528
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:1610
uint16_t m_channelWidth
channel width (in MHz)
Definition: wifi-test.cc:1548
~Bug2843TestCase() override
Definition: wifi-test.cc:1557
std::tuple< double, uint16_t, uint32_t, WifiModulationClass > FreqWidthSubbandModulationTuple
A tuple of {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Definition: wifi-test.cc:1526
Make sure that when changing the fragmentation threshold during the simulation, the TCP transmission ...
Definition: wifi-test.cc:644
~Bug730TestCase() override
Definition: wifi-test.cc:669
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Receive function.
Definition: wifi-test.cc:674
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:683
uint32_t m_received
received
Definition: wifi-test.cc:652
Make sure that when multiple broadcast packets are queued on the same device in a short succession,...
Definition: wifi-test.cc:476
void NotifyPhyTxBegin(Ptr< const Packet > p, double txPowerW)
Notify Phy transmit begin.
Definition: wifi-test.cc:511
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:532
ObjectFactory m_propDelay
propagation delay
Definition: wifi-test.cc:491
unsigned int m_numSentPackets
number of sent packets
Definition: wifi-test.cc:495
Time m_secondTransmissionTime
second transmission time
Definition: wifi-test.cc:494
Time m_firstTransmissionTime
first transmission time
Definition: wifi-test.cc:493
ObjectFactory m_manager
manager
Definition: wifi-test.cc:489
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
Definition: wifi-test.cc:525
Data rate verification test for MCSs of different RU sizes.
Definition: wifi-test.cc:3546
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:3575
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3597
Make sure that Ideal rate manager properly selects MCS based on the configured channel width.
Definition: wifi-test.cc:2942
WifiMode m_txMode
Store the last selected mode to send data packet.
Definition: wifi-test.cc:2980
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3028
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:3000
void CheckLastSelectedMode(WifiMode expectedMode)
Check if the selected WifiMode is correct.
Definition: wifi-test.cc:3019
void TxCallback(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
Definition: wifi-test.cc:3007
void ChangeChannelWidth(uint16_t channelWidth)
Change the configured channel width for all nodes.
Definition: wifi-test.cc:2993
~IdealRateManagerChannelWidthTest() override
Definition: wifi-test.cc:2988
Test to validate that Ideal rate manager properly selects TXVECTOR in scenarios where MIMO is used.
Definition: wifi-test.cc:3137
~IdealRateManagerMimoTest() override
Definition: wifi-test.cc:3194
void CheckLastSelectedNss(uint8_t expectedNss)
Check if the selected Nss is correct.
Definition: wifi-test.cc:3240
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3259
void TxCallback(std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
Definition: wifi-test.cc:3228
void SetApMimoSettings(uint8_t antennas, uint8_t maxStreams)
Change the configured MIMO settings for AP node.
Definition: wifi-test.cc:3199
WifiTxVector m_txVector
Store the last TXVECTOR used to transmit Data.
Definition: wifi-test.cc:3186
void SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams)
Change the configured MIMO settings for STA node.
Definition: wifi-test.cc:3210
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:3221
void CheckLastSelectedMode(WifiMode expectedMode)
Check if the selected WifiMode is correct.
Definition: wifi-test.cc:3249
void SwitchCh(Ptr< WifiNetDevice > dev)
Switch channel function.
Definition: wifi-test.cc:328
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
Definition: wifi-test.cc:321
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:376
ObjectFactory m_manager
manager
Definition: wifi-test.cc:310
ObjectFactory m_propDelay
propagation delay
Definition: wifi-test.cc:312
Ptr< Node > CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Create one function.
Definition: wifi-test.cc:335
Make sure that Ideal rate manager is able to handle non best-effort traffic.
Definition: wifi-test.cc:2785
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:2827
~Issue169TestCase() override
Definition: wifi-test.cc:2822
void TxCallback(std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
Definition: wifi-test.cc:2843
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2857
Make sure that Ideal rate manager recovers when the station is moving away from the access point.
Definition: wifi-test.cc:2553
uint16_t m_txCount
Count number of transmitted data packets.
Definition: wifi-test.cc:2587
uint16_t m_txMacFinalDataFailedCount
Count number of unsuccessfuly transmitted data packets.
Definition: wifi-test.cc:2589
void RunOne(bool useAmpdu)
Run one function.
Definition: wifi-test.cc:2628
uint16_t m_rxCount
Count number of successfully received data packets.
Definition: wifi-test.cc:2586
void RxSuccessCallback(std::string context, Ptr< const Packet > p)
Callback when packet is successfully received.
Definition: wifi-test.cc:2605
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2762
void TxFinalDataFailedCallback(std::string context, Mac48Address address)
Transmit final data failed function.
Definition: wifi-test.cc:2622
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:2611
~Issue40TestCase() override
Definition: wifi-test.cc:2600
Test management header.
Definition: wifi-test.cc:3644
static TypeId GetTypeId()
Register this type.
Definition: wifi-test.cc:3665
~MgtTestHeader() override=default
TypeId GetInstanceTypeId() const override
Definition: wifi-test.cc:3675
Make sure that fragmentation works with QoS stations.
Definition: wifi-test.cc:783
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:844
uint32_t m_received
received packets
Definition: wifi-test.cc:791
~QosFragmentationTestCase() override
Definition: wifi-test.cc:818
uint32_t m_fragments
transmitted fragments
Definition: wifi-test.cc:792
void Transmit(std::string context, Ptr< const Packet > p, double power)
Callback invoked when PHY transmits a packet.
Definition: wifi-test.cc:832
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Receive function.
Definition: wifi-test.cc:823
Qos Utils Is Old Packet Test.
Definition: wifi-test.cc:243
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:250
Set Channel Frequency Test.
Definition: wifi-test.cc:939
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc) const
Get yans wifi phy function.
Definition: wifi-test.cc:960
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:968
Make sure that Wifi STA is correctly associating to the best AP (i.e., nearest from STA).
Definition: wifi-test.cc:1944
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:2068
void TurnBeaconGenerationOn(Ptr< Node > apNode)
Turn beacon generation on the AP node.
Definition: wifi-test.cc:1994
Mac48Address m_associatedApBssid
Associated AP's bssid.
Definition: wifi-test.cc:1975
~StaWifiMacScanningTestCase() override
Definition: wifi-test.cc:1983
void TurnApOff(Ptr< Node > apNode)
Turn the AP node off.
Definition: wifi-test.cc:2002
NodeContainer Setup(bool nearestApBeaconGeneration, bool staActiveProbe)
Setup test.
Definition: wifi-test.cc:2010
void AssocCallback(std::string context, Mac48Address bssid)
Callback function on STA assoc event.
Definition: wifi-test.cc:1988
Mgt header (de)serialization Test Suite.
Definition: wifi-test.cc:3687
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:3702
~WifiMgtHeaderTest() override=default
Wifi Test.
Definition: wifi-test.cc:104
void CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Create one function.
Definition: wifi-test.cc:143
void RunOne()
Run one function.
Definition: wifi-test.cc:187
void DoRun() override
Implementation to actually run this TestCase.
Definition: wifi-test.cc:206
ObjectFactory m_mac
MAC.
Definition: wifi-test.cc:126
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
Definition: wifi-test.cc:136
ObjectFactory m_manager
manager
Definition: wifi-test.cc:125
ObjectFactory m_propDelay
propagation delay
Definition: wifi-test.cc:127
Wifi Test Suite.
Definition: wifi-test.cc:3791
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:51
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
@ WIFI_MAC_MGT_ACTION
std::map< WifiSpectrumBandInfo, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
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:67
static WifiTestSuite g_wifiTestSuite
the test suite
Definition: wifi-test.cc:3819
std::tuple< SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::vector< Ssid > > MgtTestElems
List of Information Elements included in the test management frame.
Definition: wifi-test.cc:3635