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/he-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"
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"
69 int64_t currentStream = stream;
71 if (!mac->GetQosSupported())
73 mac->GetAttribute(
"Txop", ptr);
75 currentStream += txop->AssignStreams(currentStream);
79 mac->GetAttribute(
"VO_Txop", ptr);
81 currentStream += vo_txop->AssignStreams(currentStream);
83 mac->GetAttribute(
"VI_Txop", ptr);
85 currentStream += vi_txop->AssignStreams(currentStream);
87 mac->GetAttribute(
"BE_Txop", ptr);
89 currentStream += be_txop->AssignStreams(currentStream);
91 mac->GetAttribute(
"BK_Txop", ptr);
93 bk_txop->AssignStreams(currentStream);
108 void DoRun()
override;
139 dev->Send(p, dev->GetBroadcast(), 1);
147 node->AddDevice(dev);
149 auto mobility = CreateObject<ConstantPositionMobilityModel>();
150 auto phy = CreateObject<YansWifiPhy>();
152 phy->SetInterferenceHelper(interferenceHelper);
153 auto error = CreateObject<YansErrorRateModel>();
154 phy->SetErrorRateModel(error);
155 phy->SetChannel(channel);
160 dev->SetRemoteStationManager(manager);
162 auto txop = CreateObjectWithAttributes<Txop>(
"AcIndex",
StringValue(
"AC_BE_NQOS"));
168 mac->SetChannelAccessManagers({CreateObject<ChannelAccessManager>()});
169 mac->SetFrameExchangeManagers({CreateObject<FrameExchangeManager>()});
170 if (mac->GetTypeOfStation() ==
STA)
172 StaticCast<StaWifiMac>(mac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
174 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
176 fem->SetAddress(mac->GetAddress());
178 protectionManager->SetWifiMac(mac);
179 fem->SetProtectionManager(protectionManager);
181 ackManager->SetWifiMac(mac);
182 fem->SetAckManager(ackManager);
184 mobility->SetPosition(pos);
185 node->AggregateObject(mobility);
196 channel->SetPropagationDelayModel(propDelay);
197 channel->SetPropagationLossModel(propLoss);
199 CreateOne(Vector(0.0, 0.0, 0.0), channel);
200 CreateOne(Vector(5.0, 0.0, 0.0), channel);
201 CreateOne(Vector(5.0, 0.0, 0.0), channel);
259 "2047 is new in comparison to 0");
267 "0 is new in comparison to 4095");
273 "2047 is old in comparison to 4095");
277 "4095 is new in comparison to 2048");
281 "0 is new in comparison to 2049");
293 void DoRun()
override;
320 :
TestCase(
"InterferenceHelperSequence")
328 dev->Send(p, dev->GetBroadcast(), 1);
343 node->AddDevice(dev);
345 auto mobility = CreateObject<ConstantPositionMobilityModel>();
346 auto phy = CreateObject<YansWifiPhy>();
348 phy->SetInterferenceHelper(interferenceHelper);
349 auto error = CreateObject<YansErrorRateModel>();
350 phy->SetErrorRateModel(error);
351 phy->SetChannel(channel);
353 phy->SetMobility(mobility);
357 dev->SetRemoteStationManager(manager);
359 auto txop = CreateObjectWithAttributes<Txop>(
"AcIndex",
StringValue(
"AC_BE_NQOS"));
365 mac->SetChannelAccessManagers({CreateObject<ChannelAccessManager>()});
366 mac->SetFrameExchangeManagers({CreateObject<FrameExchangeManager>()});
367 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
369 fem->SetAddress(mac->GetAddress());
371 protectionManager->SetWifiMac(mac);
372 fem->SetProtectionManager(protectionManager);
374 ackManager->SetWifiMac(mac);
375 fem->SetAckManager(ackManager);
377 mobility->SetPosition(pos);
378 node->AggregateObject(mobility);
393 channel->SetPropagationDelayModel(propDelay);
394 channel->SetPropagationLossModel(propLoss);
404 propLoss->SetDefaultLoss(999);
409 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
414 DynamicCast<WifiNetDevice>(rxOnly->GetDevice(0)));
419 DynamicCast<WifiNetDevice>(senderA->GetDevice(0)));
424 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
488 void DoRun()
override;
514 :
TestCase(
"Test case for DCF immediate access with broadcast frames")
536 dev->Send(p, dev->GetBroadcast(), 1);
554 channel->SetPropagationDelayModel(propDelay);
555 channel->SetPropagationLossModel(propLoss);
563 txPhy->SetInterferenceHelper(txInterferenceHelper);
565 txPhy->SetErrorRateModel(txError);
566 txPhy->SetChannel(channel);
567 txPhy->SetDevice(txDev);
568 txPhy->SetMobility(txMobility);
571 txPhy->TraceConnectWithoutContext(
575 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
576 txNode->AggregateObject(txMobility);
577 txDev->SetPhy(txPhy);
579 txNode->AddDevice(txDev);
581 auto txop = CreateObjectWithAttributes<Txop>(
"AcIndex",
StringValue(
"AC_BE_NQOS"));
586 txDev->SetMac(txMac);
587 txMac->SetChannelAccessManagers({CreateObject<ChannelAccessManager>()});
588 txMac->SetFrameExchangeManagers({CreateObject<FrameExchangeManager>()});
589 txMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
590 auto fem = txMac->GetFrameExchangeManager();
591 fem->SetAddress(txMac->GetAddress());
592 auto protectionManager = CreateObject<WifiDefaultProtectionManager>();
593 protectionManager->SetWifiMac(txMac);
594 fem->SetProtectionManager(protectionManager);
595 auto ackManager = CreateObject<WifiDefaultAckManager>();
596 ackManager->SetWifiMac(txMac);
597 fem->SetAckManager(ackManager);
630 uint32_t expectedWait1 = 1408 + (1 * 9) + 16 + (2 * 9);
631 Time expectedSecondTransmissionTime =
632 expectedFirstTransmissionTime +
MicroSeconds(expectedWait1);
634 expectedFirstTransmissionTime,
635 "The first transmission time not correct!");
638 expectedSecondTransmissionTime,
639 "The second transmission time not correct!");
661 void DoRun()
override;
676 :
TestCase(
"Test case for Bug 730"),
703 wifiApNode.Create(1);
707 phy.SetChannel(channel.Create());
711 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
722 staDevices = wifi.Install(phy, mac, wifiStaNode);
727 apDevices = wifi.Install(phy, mac, wifiApNode);
732 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
733 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
734 mobility.SetPositionAllocator(positionAlloc);
736 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
737 mobility.Install(wifiApNode);
738 mobility.Install(wifiStaNode);
750 packetSocket.
Install(wifiStaNode);
751 packetSocket.
Install(wifiApNode);
755 client->SetRemote(socket);
757 client->SetStartTime(
Seconds(1));
758 client->SetStopTime(
Seconds(51.0));
761 server->SetLocal(socket);
762 wifiApNode.Get(0)->AddApplication(server);
763 server->SetStartTime(
Seconds(0.0));
764 server->SetStopTime(
Seconds(52.0));
766 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
771 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
783 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
800 void DoRun()
override;
824 :
TestCase(
"Test case for fragmentation with QoS stations"),
837 if (p->GetSize() == 1400)
862 wifiApNode.Create(1);
866 phy.SetChannel(channel.Create());
870 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
"DataMode",
StringValue(
"HtMcs7"));
877 staDevices = wifi.Install(phy, mac, wifiStaNode);
882 apDevices = wifi.Install(phy, mac, wifiApNode);
887 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
888 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
889 mobility.SetPositionAllocator(positionAlloc);
891 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
892 mobility.Install(wifiApNode);
893 mobility.Install(wifiStaNode);
900 sta_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
905 socket.SetPhysicalAddress(ap_device->GetAddress());
906 socket.SetProtocol(1);
910 packetSocket.
Install(wifiStaNode);
911 packetSocket.
Install(wifiApNode);
916 client->SetRemote(socket);
918 client->SetStartTime(
Seconds(1));
919 client->SetStopTime(
Seconds(3.0));
922 server->SetLocal(socket);
923 wifiApNode.Get(0)->AddApplication(server);
924 server->SetStartTime(
Seconds(0.0));
925 server->SetStopTime(
Seconds(4.0));
927 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
930 Config::Set(
"/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
955 void DoRun()
override;
967 :
TestCase(
"Test case for setting WifiPhy channel and frequency")
985 wifiApNode.Create(1);
989 phy.SetChannel(channel.Create());
993 ssid =
Ssid(
"wifi-phy-configuration");
995 macSta.
SetType(
"ns3::StaWifiMac",
1007 phySta = CreateObject<YansWifiPhy>();
1011 "default configuration");
1017 wifi.SetRemoteStationManager(
"ns3::ArfWifiManager");
1018 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1029 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1040 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1050 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1052 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_5GHZ, 0}"));
1053 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1058 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1063 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1065 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1074 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1076 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1086 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1087 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_2_4GHZ, 0}"));
1088 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1093 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1098 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1099 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1108 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1109 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_6GHZ, 0}"));
1110 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1115 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1120 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1122 phy.Set(
"ChannelSettings",
StringValue(
"{0, 10, BAND_5GHZ, 0}"));
1123 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1128 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1133 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1135 phy.Set(
"ChannelSettings",
StringValue(
"{0, 5, BAND_5GHZ, 0}"));
1136 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1141 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1146 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1148 phy.Set(
"ChannelSettings",
StringValue(
"{44, 20, BAND_5GHZ, 0}"));
1149 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1154 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1159 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1160 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1161 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1164 std::ostringstream path;
1165 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1166 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1171 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1176 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1177 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1178 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1181 std::ostringstream path;
1182 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1183 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1190 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1195 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1197 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1199 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{3, 20, BAND_2_4GHZ, 0}"));
1201 std::ostringstream path;
1202 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1203 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1210 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1215 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1218 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1219 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1221 bool exceptionThrown =
false;
1224 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1226 catch (
const std::runtime_error&)
1228 exceptionThrown =
true;
1236 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1238 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1239 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1243 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{100, 0, BAND_5GHZ, 0}"));
1253 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1255 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1256 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1258 bool exceptionThrown =
false;
1263 catch (
const std::runtime_error&)
1265 exceptionThrown =
true;
1273 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1276 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1277 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1279 bool exceptionThrown =
false;
1282 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1284 catch (
const std::runtime_error&)
1286 exceptionThrown =
true;
1290 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1295 exceptionThrown =
false;
1298 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{43, 0, BAND_5GHZ, 0}"));
1300 catch (
const std::runtime_error&)
1302 exceptionThrown =
true;
1306 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1314 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1315 phy.Set(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1317 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1324 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1326 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1331 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1336 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1341 bool exceptionThrown =
false;
1344 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1346 catch (
const std::runtime_error&)
1348 exceptionThrown =
true;
1350 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1356 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1357 exceptionThrown =
false;
1360 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{43, 0, BAND_5GHZ, 0}"));
1362 catch (
const std::runtime_error&)
1364 exceptionThrown =
true;
1390 void DoRun()
override;
1404 :
TestCase(
"Test case for Bug 2222"),
1405 m_countInternalCollisions(0)
1429 int64_t streamNumber = 100;
1436 phy.SetChannel(channel.Create());
1439 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1446 mac.SetType(
"ns3::AdhocWifiMac",
"QosSupported",
BooleanValue(
true));
1449 wifiDevices = wifi.Install(phy, mac, wifiNodes);
1452 wifi.AssignStreams(wifiDevices, streamNumber);
1457 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1458 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1459 mobility.SetPositionAllocator(positionAlloc);
1461 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1462 mobility.Install(wifiNodes);
1473 packetSocket.
Install(wifiNodes);
1476 clientLowPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1477 clientLowPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1478 clientLowPriority->SetAttribute(
"Priority",
UintegerValue(4));
1479 clientLowPriority->SetRemote(socket);
1481 clientLowPriority->SetStartTime(
Seconds(0.0));
1482 clientLowPriority->SetStopTime(
Seconds(1.0));
1485 clientHighPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1486 clientHighPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1487 clientHighPriority->SetAttribute(
"Priority",
UintegerValue(6));
1488 clientHighPriority->SetRemote(socket);
1490 clientHighPriority->SetStartTime(
Seconds(0.0));
1491 clientHighPriority->SetStopTime(
Seconds(1.0));
1494 server->SetLocal(socket);
1496 server->SetStartTime(
Seconds(0.0));
1497 server->SetStopTime(
Seconds(1.0));
1499 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1508 "unexpected number of internal collisions!");
1529 void DoRun()
override;
1536 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1538 std::vector<FreqWidthSubbandModulationTuple>
1563 :
TestCase(
"Test case for Bug 2843"),
1577 std::size_t numBands = c->GetNumBands();
1578 double startingFreq = c->Begin()->fl;
1582 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1591 std::make_tuple(startingFreq,
m_channelWidth, numBands, modulationClass);
1595 if (*it == tupleForCurrentTx)
1611 for (uint8_t i = 0; i < numPackets; i++)
1614 sourceDevice->Send(pkt, destination, 0);
1621 uint16_t channelWidth = 40;
1627 wifiApNode.Create(1);
1632 lossModel->SetFrequency(5.190e9);
1633 spectrumChannel->AddPropagationLossModel(lossModel);
1636 CreateObject<ConstantSpeedPropagationDelayModel>();
1637 spectrumChannel->SetPropagationDelayModel(delayModel);
1641 spectrumPhy.
Set(
"ChannelSettings",
StringValue(
"{38, 40, BAND_5GHZ, 0}"));
1647 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1656 mac.SetType(
"ns3::StaWifiMac");
1658 staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode);
1660 mac.SetType(
"ns3::ApWifiMac");
1662 apDevice = wifi.Install(spectrumPhy, mac, wifiApNode);
1666 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1667 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
1668 mobility.SetPositionAllocator(positionAlloc);
1670 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1671 mobility.Install(wifiApNode);
1672 mobility.Install(wifiStaNode);
1680 staDevice.
Get(0)->GetAddress());
1686 staDevice.
Get(0)->GetAddress());
1688 Config::Connect(
"/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1702 "The starting frequency of the first tuple should be shifted 20 MHz to "
1703 "the right wrt second tuple");
1707 "First tuple's channel width should be 20 MHz");
1710 "First tuple should have 193 subbands (64+DC, 20MHz+DC, inband and 64*2 "
1711 "out-of-band, 20MHz on each side)");
1713 WifiModulationClass::WIFI_MOD_CLASS_OFDM,
1714 "First tuple should be OFDM");
1718 "Second tuple's channel width should be 40 MHz");
1721 "Second tuple should have 385 subbands (128+DC, 40MHz+DC, inband and "
1722 "128*2 out-of-band, 40MHz on each side)");
1724 WifiModulationClass::WIFI_MOD_CLASS_VHT,
1725 "Second tuple should be VHT_OFDM");
1745 void DoRun()
override;
1772 :
TestCase(
"Test case for Bug 2831"),
1774 m_assocRespCount(0),
1775 m_countOperationalChannelWidth20(0),
1776 m_countOperationalChannelWidth40(0)
1798 packet->RemoveHeader(hdr);
1810 packet->RemoveHeader(beacon);
1811 const auto& htOperation = beacon.Get<
HtOperation>();
1812 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1828 propDelay.
SetTypeId(
"ns3::ConstantSpeedPropagationDelayModel");
1831 channel->SetPropagationDelayModel(propagationDelay);
1832 channel->SetPropagationLossModel(propagationLoss);
1834 Ptr<Node> apNode = CreateObject<Node>();
1836 apNode->AddDevice(apDev);
1839 apDev->SetHtConfiguration(apHtConfiguration);
1841 manager.
SetTypeId(
"ns3::ConstantRateWifiManager");
1844 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1845 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1846 apNode->AggregateObject(apMobility);
1848 auto error = CreateObject<YansErrorRateModel>();
1849 m_apPhy = CreateObject<YansWifiPhy>();
1861 mac.SetTypeId(
"ns3::ApWifiMac");
1864 for (
const std::string ac : {
"BE",
"BK",
"VI",
"VO"})
1867 CreateObjectWithAttributes<QosTxop>(
"AcIndex",
StringValue(std::string(
"AC_") + ac));
1870 auto apMac = mac.Create<
WifiMac>();
1873 apDev->SetMac(apMac);
1874 apMac->SetChannelAccessManagers({CreateObject<ChannelAccessManager>()});
1875 apMac->SetFrameExchangeManagers({CreateObject<HeFrameExchangeManager>()});
1876 apMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1878 fem->SetAddress(apMac->GetAddress());
1880 protectionManager->SetWifiMac(apMac);
1881 fem->SetProtectionManager(protectionManager);
1883 ackManager->SetWifiMac(apMac);
1884 fem->SetAckManager(ackManager);
1886 Ptr<Node> staNode = CreateObject<Node>();
1888 staNode->AddDevice(staDev);
1891 staDev->SetHtConfiguration(staHtConfiguration);
1895 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1896 staNode->AggregateObject(staMobility);
1898 m_staPhy = CreateObject<YansWifiPhy>();
1909 mac.SetTypeId(
"ns3::StaWifiMac");
1910 for (
const std::string ac : {
"BE",
"BK",
"VI",
"VO"})
1913 CreateObjectWithAttributes<QosTxop>(
"AcIndex",
StringValue(std::string(
"AC_") + ac));
1916 auto staMac = mac.Create<
WifiMac>();
1917 staDev->SetMac(staMac);
1918 staMac->SetDevice(staDev);
1920 staMac->SetChannelAccessManagers({CreateObject<ChannelAccessManager>()});
1921 staMac->SetFrameExchangeManagers({CreateObject<HeFrameExchangeManager>()});
1922 StaticCast<StaWifiMac>(staMac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
1923 staMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1924 fem = staMac->GetFrameExchangeManager();
1925 fem->SetAddress(staMac->GetAddress());
1926 protectionManager = CreateObject<WifiDefaultProtectionManager>();
1927 protectionManager->SetWifiMac(staMac);
1928 fem->SetProtectionManager(protectionManager);
1929 ackManager = CreateObject<WifiDefaultAckManager>();
1930 ackManager->SetWifiMac(staMac);
1931 fem->SetAckManager(ackManager);
1933 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1946 "Incorrect operational channel width before channel change");
1949 "Incorrect operational channel width after channel change");
1973 void DoRun()
override;
2004 :
TestCase(
"Test case for StaWifiMac scanning capability")
2022 Ptr<ApWifiMac> mac = DynamicCast<ApWifiMac>(netDevice->GetMac());
2023 mac->SetAttribute(
"BeaconGeneration",
BooleanValue(
true));
2039 int64_t streamNumber = 1;
2044 Ptr<Node> apNodeNearest = CreateObject<Node>();
2045 Ptr<Node> staNode = CreateObject<Node>();
2049 phy.SetChannel(channel.Create());
2053 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager");
2058 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
true));
2059 apDevice = wifi.Install(phy, mac, apNodes);
2060 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(nearestApBeaconGeneration));
2061 apDeviceNearest = wifi.Install(phy, mac, apNodeNearest);
2064 mac.SetType(
"ns3::StaWifiMac",
"ActiveProbing",
BooleanValue(staActiveProbe));
2065 staDevice = wifi.Install(phy, mac, staNode);
2068 wifi.AssignStreams(apDevice, streamNumber);
2069 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2070 wifi.AssignStreams(staDevice, streamNumber + 2);
2074 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2075 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2076 positionAlloc->Add(Vector(5.0, 5.0, 0.0));
2077 positionAlloc->Add(Vector(6.0, 5.0, 0.0));
2078 mobility.SetPositionAllocator(positionAlloc);
2080 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2081 mobility.Install(apNodes);
2082 mobility.Install(apNodeNearest);
2083 mobility.Install(staNode);
2085 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2099 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2112 "STA is associated to the wrong AP");
2119 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2127 "STA is associated to the wrong AP");
2143 secondNearestApAddr,
2144 "STA is associated to the wrong AP");
2176 void DoRun()
override;
2201 std::string context,
2218 uint16_t channelFreqMhz,
2259 :
TestCase(
"Test case for Bug 2470"),
2260 m_receivedNormalMpduCount(0),
2261 m_receivedAmpduCount(0),
2262 m_failedActionCount(0),
2263 m_addbaEstablishedCount(0),
2264 m_addbaPendingCount(0),
2265 m_addbaRejectedCount(0),
2266 m_addbaNoReplyCount(0),
2267 m_addbaResetCount(0)
2304 std::string context,
2309 auto psdu = psduMap.begin()->second;
2316 auto uid = psdu->GetPayload(0)->GetUid();
2317 rxErrorModel->SetList({uid});
2324 uint16_t channelFreqMhz,
2331 if (aMpdu.
type != MpduType::NORMAL_MPDU)
2338 packet->RemoveHeader(hdr);
2351 packet->RemoveHeader(hdr);
2363 for (
uint32_t i = 0; i < numPackets; i++)
2366 sourceDevice->Send(pkt, destination, 0);
2375 int64_t streamNumber = 200;
2379 wifiApNode.Create(1);
2384 phy.SetChannel(channel.Create());
2388 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
2396 phy.Set(
"ChannelSettings",
StringValue(
"{36, 20, BAND_5GHZ, 0}"));
2397 mac.SetType(
"ns3::ApWifiMac",
"EnableBeaconJitter",
BooleanValue(
false));
2398 apDevice = wifi.Install(phy, mac, wifiApNode);
2401 mac.SetType(
"ns3::StaWifiMac");
2402 staDevice = wifi.Install(phy, mac, wifiStaNode);
2405 wifi.AssignStreams(apDevice, streamNumber);
2406 wifi.AssignStreams(staDevice, streamNumber);
2410 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2411 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2412 mobility.SetPositionAllocator(positionAlloc);
2414 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2415 mobility.Install(wifiApNode);
2416 mobility.Install(wifiStaNode);
2418 auto rxErrorModel = CreateObject<ListErrorModel>();
2420 switch (rcvErrorType)
2423 wifiMac = DynamicCast<WifiNetDevice>(apDevice.
Get(0))->GetMac();
2426 wifiMac = DynamicCast<WifiNetDevice>(staDevice.
Get(0))->GetMac();
2429 NS_ABORT_MSG(
"Station type " << +rcvErrorType <<
" cannot be used here");
2431 wifiMac->GetWifiPhy(0)->SetPostReceptionErrorModel(rxErrorModel);
2434 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2438 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2439 "BlockAckManager/AgreementState",
2442 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2450 staDevice.
Get(0)->GetAddress());
2456 staDevice.
Get(0)->GetAddress());
2462 staDevice.
Get(0)->GetAddress());
2468 staDevice.
Get(0)->GetAddress());
2487 "Receiving incorrect number of normal MPDU packet on subtest 1");
2490 "Receiving incorrect number of A-MPDU packets on subtest 1");
2494 "Incorrect number of times the ADDBA state machine was in "
2495 "established state on subtest 1");
2499 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2503 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2507 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2511 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2530 "Receiving incorrect number of normal MPDU packet on subtest 2");
2533 "Receiving incorrect number of A-MPDU packet on subtest 2");
2537 "Incorrect number of times the ADDBA state machine was in "
2538 "established state on subtest 2");
2542 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2546 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2550 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2554 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2582 void DoRun()
override;
2589 void RunOne(
bool useAmpdu);
2618 :
TestCase(
"Test case for issue #40"),
2621 m_txMacFinalDataFailedCount(0)
2638 for (uint8_t i = 0; i < numPackets; i++)
2641 sourceDevice->Send(pkt, destination, 0);
2661 int64_t streamNumber = 100;
2665 wifiApNode.Create(1);
2670 phy.SetChannel(channel.Create());
2674 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2678 mac.SetType(
"ns3::ApWifiMac");
2679 apDevice = wifi.Install(phy, mac, wifiApNode);
2682 mac.SetType(
"ns3::StaWifiMac");
2683 staDevice = wifi.Install(phy, mac, wifiStaNode);
2686 wifi.AssignStreams(apDevice, streamNumber);
2687 wifi.AssignStreams(staDevice, streamNumber);
2691 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2692 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2693 mobility.SetPositionAllocator(positionAlloc);
2695 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2696 mobility.Install(wifiApNode);
2698 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel");
2699 mobility.Install(wifiStaNode);
2701 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2703 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
2708 staWaypointMobility->AddWaypoint(
Waypoint(
Seconds(1.0), Vector(10.0, 0.0, 0.0)));
2709 staWaypointMobility->AddWaypoint(
Waypoint(
Seconds(1.5), Vector(50.0, 0.0, 0.0)));
2717 ap_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
2728 staDevice.
Get(0)->GetAddress());
2737 staDevice.
Get(0)->GetAddress());
2746 staDevice.
Get(0)->GetAddress());
2752 staDevice.
Get(0)->GetAddress());
2758 staDevice.
Get(0)->GetAddress());
2764 staDevice.
Get(0)->GetAddress());
2770 staDevice.
Get(0)->GetAddress());
2776 (useAmpdu ? 14 : 7),
2777 "Incorrect number of transmitted packets");
2779 (useAmpdu ? 12 : 6),
2780 "Incorrect number of successfully received packets");
2814 void DoRun()
override;
2843 :
TestCase(
"Test case for issue #169")
2859 for (uint8_t i = 0; i < numPackets; i++)
2862 packet->AddPacketTag(priorityTag);
2863 sourceDevice->Send(packet, destination, 0);
2873 if (psdus.begin()->second->GetSize() >= 1000)
2876 WifiModulationClass::WIFI_MOD_CLASS_VHT,
2877 "Ideal rate manager selected incorrect modulation class");
2886 int64_t streamNumber = 100;
2890 wifiApNode.Create(1);
2895 phy.SetChannel(channel.Create());
2899 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2903 mac.SetType(
"ns3::ApWifiMac");
2904 apDevice = wifi.Install(phy, mac, wifiApNode);
2907 mac.SetType(
"ns3::StaWifiMac");
2908 staDevice = wifi.Install(phy, mac, wifiStaNode);
2911 wifi.AssignStreams(apDevice, streamNumber);
2912 wifi.AssignStreams(staDevice, streamNumber);
2916 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2917 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2918 mobility.SetPositionAllocator(positionAlloc);
2920 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2921 mobility.Install(wifiApNode);
2922 mobility.Install(wifiStaNode);
2924 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2933 staDevice.
Get(0)->GetAddress(),
2942 staDevice.
Get(0)->GetAddress(),
2971 void DoRun()
override;
3009 :
TestCase(
"Test case for use of channel bonding with Ideal rate manager")
3020 Config::Set(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
3021 StringValue(
"{0, " + std::to_string(channelWidth) +
", BAND_5GHZ, 0}"));
3028 sourceDevice->Send(packet, destination, 0);
3037 if (psduMap.begin()->second->GetSize() >= 1000)
3048 "Last selected WifiMode "
3049 <<
m_txMode <<
" does not match expected WifiMode " << expectedMode);
3057 int64_t streamNumber = 100;
3061 wifiApNode.Create(1);
3066 phy.SetChannel(channel.Create());
3070 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3074 mac.SetType(
"ns3::ApWifiMac");
3075 apDevice = wifi.Install(phy, mac, wifiApNode);
3078 mac.SetType(
"ns3::StaWifiMac");
3079 staDevice = wifi.Install(phy, mac, wifiStaNode);
3082 wifi.AssignStreams(apDevice, streamNumber);
3083 wifi.AssignStreams(staDevice, streamNumber);
3087 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3088 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3089 mobility.SetPositionAllocator(positionAlloc);
3091 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3092 mobility.Install(wifiApNode);
3093 mobility.Install(wifiStaNode);
3095 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3107 staDevice.
Get(0)->GetAddress());
3123 staDevice.
Get(0)->GetAddress());
3139 staDevice.
Get(0)->GetAddress());
3166 void DoRun()
override;
3215 :
TestCase(
"Test case for use of imbalanced MIMO settings with Ideal rate manager")
3226 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3228 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3230 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3237 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3239 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3241 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3249 sourceDevice->Send(packet, destination, 0);
3258 if (psdus.begin()->second->GetSize() >= 1000)
3270 <<
" does not match expected Nss " << expectedNss);
3279 <<
" does not match expected WifiMode "
3288 int64_t streamNumber = 100;
3292 wifiApNode.Create(1);
3297 phy.SetChannel(channel.Create());
3301 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3305 mac.SetType(
"ns3::ApWifiMac");
3306 apDevice = wifi.Install(phy, mac, wifiApNode);
3309 mac.SetType(
"ns3::StaWifiMac");
3310 staDevice = wifi.Install(phy, mac, wifiStaNode);
3313 wifi.AssignStreams(apDevice, streamNumber);
3314 wifi.AssignStreams(staDevice, streamNumber);
3318 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3319 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3320 mobility.SetPositionAllocator(positionAlloc);
3322 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3323 mobility.Install(wifiApNode);
3324 mobility.Install(wifiStaNode);
3326 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3338 staDevice.
Get(0)->GetAddress());
3343 staDevice.
Get(0)->GetAddress());
3361 staDevice.
Get(0)->GetAddress());
3366 staDevice.
Get(0)->GetAddress());
3385 staDevice.
Get(0)->GetAddress());
3390 staDevice.
Get(0)->GetAddress());
3408 staDevice.
Get(0)->GetAddress());
3413 staDevice.
Get(0)->GetAddress());
3432 staDevice.
Get(0)->GetAddress());
3437 staDevice.
Get(0)->GetAddress());
3457 staDevice.
Get(0)->GetAddress());
3462 staDevice.
Get(0)->GetAddress());
3480 staDevice.
Get(0)->GetAddress());
3485 staDevice.
Get(0)->GetAddress());
3504 staDevice.
Get(0)->GetAddress());
3509 staDevice.
Get(0)->GetAddress());
3529 staDevice.
Get(0)->GetAddress());
3534 staDevice.
Get(0)->GetAddress());
3551 staDevice.
Get(0)->GetAddress());
3589 uint16_t guardInterval,
3590 uint16_t expectedDataRate);
3591 void DoRun()
override;
3595 :
TestCase(
"Check data rates for different RU types.")
3603 uint16_t guardInterval,
3604 uint16_t expectedDataRate)
3608 uint64_t dataRate = round(mode.
GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3610 if (
static_cast<uint16_t
>(dataRate) != expectedDataRate)
3612 std::cerr <<
"RU=" << ruType <<
" mode=" << mode <<
" Nss=" << +nss
3613 <<
" guardInterval=" << guardInterval <<
" expected=" << expectedDataRate
3615 <<
" computed=" <<
static_cast<uint16_t
>(dataRate) <<
" x100kbps" << std::endl;
3643 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3655 "Data rate verification for RUs above 52-tone RU (included) failed");
3660 std::tuple<SupportedRates, std::optional<ExtendedSupportedRatesIE>, std::vector<Ssid>>;
3694 .SetGroupName(
"Wifi")
3718 void DoRun()
override;
3744 "Expected a SupportedRates IE to be included");
3747 "Expected no ExtendedSupportedRatesIE to be included");
3764 "Expected a SupportedRates IE to be included");
3767 "Expected an ExtendedSupportedRatesIE to be included");
3773 Ssid one(
"Ssid One");
3774 frame.Get<
Ssid>().push_back(one);
3778 "Expected a SupportedRates IE to be included");
3781 "Expected an ExtendedSupportedRatesIE to be included");
3790 frame.Get<
Ssid>().emplace_back(
"Ssid Two");
3794 "Expected a SupportedRates IE to be included");
3797 "Expected an ExtendedSupportedRatesIE to be included");
3801 "Incorrect first SSID");
3804 "Incorrect second SSID");
Make sure that when virtual collision occurs the wifi remote station manager is triggered and the ret...
~Bug2222TestCase() override
uint32_t m_countInternalCollisions
count internal collisions
void DoRun() override
Implementation to actually run this TestCase.
void TxDataFailedTrace(std::string context, Mac48Address adr)
Transmit data failed function.
Make sure that the ADDBA handshake process is protected.
void RxErrorCallback(std::string context, Ptr< const Packet > p, double snr)
Callback when packet is dropped.
void RunSubtest(TypeOfStation rcvErrorType)
Run subtest for this test suite.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_addbaResetCount
Count number of times ADDBA state machine is in reset state.
uint16_t m_addbaRejectedCount
Count number of times ADDBA state machine is in rejected state.
void AddbaStateChangedCallback(std::string context, Time t, Mac48Address recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)
Callback when ADDBA state changed.
uint16_t m_failedActionCount
Count failed ADDBA request/response.
void TxCallback(Ptr< ListErrorModel > rxErrorModel, std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback when a frame is transmitted.
uint16_t m_addbaEstablishedCount
Count number of times ADDBA state machine is in established state.
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.
~Bug2470TestCase() override
uint16_t m_receivedNormalMpduCount
Count received normal MPDU packets on STA.
uint16_t m_addbaNoReplyCount
Count number of times ADDBA state machine is in no_reply state.
uint16_t m_addbaPendingCount
Count number of times ADDBA state machine is in pending state.
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.
uint16_t m_receivedAmpduCount
Count received A-MPDU packets on STA.
Make sure that the channel width and the channel number can be changed at runtime.
uint16_t m_countOperationalChannelWidth20
count number of beacon frames announcing a 20 MHz operating channel width
void ChangeSupportedChannelWidth()
Function called to change the supported channel width at runtime.
uint16_t m_countOperationalChannelWidth40
count number of beacon frames announcing a 40 MHz operating channel width
void RxCallback(std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback triggered when a packet is received by the PHYs.
uint16_t m_assocReqCount
count number of association requests
Ptr< YansWifiPhy > m_apPhy
AP PHY.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< YansWifiPhy > m_staPhy
STA PHY.
uint16_t m_assocRespCount
count number of association responses
~Bug2831TestCase() override
Make sure that the correct channel width and center frequency have been set for OFDM basic rate trans...
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.
void StoreDistinctTuple(std::string context, Ptr< SpectrumSignalParameters > txParams)
Stores the distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
std::vector< FreqWidthSubbandModulationTuple > m_distinctTuples
vector of distinct {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_channelWidth
channel width (in MHz)
~Bug2843TestCase() override
std::tuple< double, uint16_t, uint32_t, WifiModulationClass > FreqWidthSubbandModulationTuple
A tuple of {starting frequency, channelWidth, Number of subbands in SpectrumModel,...
Make sure that when changing the fragmentation threshold during the simulation, the TCP transmission ...
~Bug730TestCase() override
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Receive function.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_received
received
Data rate verification test for MCSs of different RU sizes.
HeRuMcsDataRateTestCase()
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.
void DoRun() override
Implementation to actually run this TestCase.
Make sure that Ideal rate manager properly selects MCS based on the configured channel width.
WifiMode m_txMode
Store the last selected mode to send data packet.
IdealRateManagerChannelWidthTest()
void DoRun() override
Implementation to actually run this TestCase.
void SendPacket(Ptr< NetDevice > sourceDevice, Address &destination)
Triggers the transmission of a 1000 Byte-long data packet from the source device.
void CheckLastSelectedMode(WifiMode expectedMode)
Check if the selected WifiMode is correct.
void TxCallback(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
void ChangeChannelWidth(uint16_t channelWidth)
Change the configured channel width for all nodes.
~IdealRateManagerChannelWidthTest() override
Test to validate that Ideal rate manager properly selects TXVECTOR in scenarios where MIMO is used.
~IdealRateManagerMimoTest() override
void CheckLastSelectedNss(uint8_t expectedNss)
Check if the selected Nss is correct.
void DoRun() override
Implementation to actually run this TestCase.
void TxCallback(std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
void SetApMimoSettings(uint8_t antennas, uint8_t maxStreams)
Change the configured MIMO settings for AP node.
WifiTxVector m_txVector
Store the last TXVECTOR used to transmit Data.
void SetStaMimoSettings(uint8_t antennas, uint8_t maxStreams)
Change the configured MIMO settings for STA node.
void SendPacket(Ptr< NetDevice > sourceDevice, Address &destination)
Triggers the transmission of a 1000 Byte-long data packet from the source device.
void CheckLastSelectedMode(WifiMode expectedMode)
Check if the selected WifiMode is correct.
IdealRateManagerMimoTest()
void SwitchCh(Ptr< WifiNetDevice > dev)
Switch channel function.
InterferenceHelperSequenceTest()
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
void DoRun() override
Implementation to actually run this TestCase.
ObjectFactory m_manager
manager
ObjectFactory m_propDelay
propagation delay
Ptr< Node > CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Create one function.
Make sure that Ideal rate manager is able to handle non best-effort traffic.
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.
~Issue169TestCase() override
void TxCallback(std::string context, WifiConstPsduMap psdus, WifiTxVector txVector, double txPowerW)
Callback that indicates a PSDU is being transmitted.
void DoRun() override
Implementation to actually run this TestCase.
Make sure that Ideal rate manager recovers when the station is moving away from the access point.
uint16_t m_txCount
Count number of transmitted data packets.
uint16_t m_txMacFinalDataFailedCount
Count number of unsuccessfuly transmitted data packets.
void RunOne(bool useAmpdu)
Run one function.
uint16_t m_rxCount
Count number of successfully received data packets.
void RxSuccessCallback(std::string context, Ptr< const Packet > p)
Callback when packet is successfully received.
void DoRun() override
Implementation to actually run this TestCase.
void TxFinalDataFailedCallback(std::string context, Mac48Address address)
Transmit final data failed function.
void SendPackets(uint8_t numPackets, Ptr< NetDevice > sourceDevice, Address &destination)
Triggers the arrival of 1000 Byte-long packets in the source device.
~Issue40TestCase() override
Make sure that fragmentation works with QoS stations.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_received
received packets
QosFragmentationTestCase()
~QosFragmentationTestCase() override
uint32_t m_fragments
transmitted fragments
void Transmit(std::string context, Ptr< const Packet > p, double power)
Callback invoked when PHY transmits a packet.
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Receive function.
Qos Utils Is Old Packet Test.
void DoRun() override
Implementation to actually run this TestCase.
QosUtilsIsOldPacketTest()
Set Channel Frequency Test.
Ptr< YansWifiPhy > GetYansWifiPhyPtr(const NetDeviceContainer &nc) const
Get yans wifi phy function.
SetChannelFrequencyTest()
void DoRun() override
Implementation to actually run this TestCase.
Make sure that Wifi STA is correctly associating to the best AP (i.e., nearest from STA).
void DoRun() override
Implementation to actually run this TestCase.
StaWifiMacScanningTestCase()
void TurnBeaconGenerationOn(Ptr< Node > apNode)
Turn beacon generation on the AP node.
Mac48Address m_associatedApBssid
Associated AP's bssid.
~StaWifiMacScanningTestCase() override
void TurnApOff(Ptr< Node > apNode)
Turn the AP node off.
NodeContainer Setup(bool nearestApBeaconGeneration, bool staActiveProbe)
Setup test.
void AssocCallback(std::string context, Mac48Address bssid)
Callback function on STA assoc event.
void CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Create one function.
void RunOne()
Run one function.
void DoRun() override
Implementation to actually run this TestCase.
void SendOnePacket(Ptr< WifiNetDevice > dev)
Send one packet function.
ObjectFactory m_manager
manager
ObjectFactory m_propDelay
propagation delay
a polymophic address class
AttributeValue implementation for Boolean.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
The Extended Supported Rates Information Element.
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
RuType
The different HE Resource Unit (RU) types.
The HT Operation Information Element.
static Mac48Address Allocate()
Allocate a new Mac48Address.
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.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
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.
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.
AttributeValue implementation for Pointer.
calculate a propagation delay.
Smart pointer class similar to boost::intrusive_ptr.
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
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.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
indicates whether the socket has a priority set.
void SetPriority(uint8_t priority)
Set the tag's priority.
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.
char * PeekString() const
Peek the SSID.
AttributeValue implementation for Ssid.
Hold variables of type string.
The Supported Rates Information Element.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
Handle packet fragmentation and retransmissions for data and management frames.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
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.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
base class for all MAC-level wifi objects.
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
represent a single transmission mode
WifiModulationClass GetModulationClass() const
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Hold together all Wifi-related objects.
void Set(std::string name, const AttributeValue &v)
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
void SetErrorRateModel(const Ptr< ErrorRateModel > model)
Sets the error rate model.
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
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.
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)
void Set(std::string path, const AttributeValue &value)
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#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.
#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.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
TypeOfStation
Enumeration for type of WiFi station.
bool QosUtilsIsOldPacket(uint16_t startingSeq, uint16_t seqNumber)
This function checks if packet with sequence number seqNumber is an "old" packet.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
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...
std::map< WifiSpectrumBandInfo, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
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.
MpduType type
type of MPDU
SignalNoiseDbm structure.
static void AssignWifiRandomStreams(Ptr< WifiMac > mac, int64_t stream)
static WifiTestSuite g_wifiTestSuite
the test suite
std::tuple< SupportedRates, std::optional< ExtendedSupportedRatesIE >, std::vector< Ssid > > MgtTestElems
List of Information Elements included in the test management frame.