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"
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);
167 if (mac->GetTypeOfStation() ==
STA)
169 StaticCast<StaWifiMac>(mac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
171 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
174 protectionManager->SetWifiMac(mac);
175 fem->SetProtectionManager(protectionManager);
177 ackManager->SetWifiMac(mac);
178 fem->SetAckManager(ackManager);
180 mobility->SetPosition(pos);
181 node->AggregateObject(mobility);
192 channel->SetPropagationDelayModel(propDelay);
193 channel->SetPropagationLossModel(propLoss);
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);
255 "2047 is new in comparison to 0");
263 "0 is new in comparison to 4095");
269 "2047 is old in comparison to 4095");
273 "4095 is new in comparison to 2048");
277 "0 is new in comparison to 2049");
289 void DoRun()
override;
316 :
TestCase(
"InterferenceHelperSequence")
324 dev->Send(p, dev->GetBroadcast(), 1);
339 node->AddDevice(dev);
341 auto mobility = CreateObject<ConstantPositionMobilityModel>();
342 auto phy = CreateObject<YansWifiPhy>();
344 phy->SetInterferenceHelper(interferenceHelper);
345 auto error = CreateObject<YansErrorRateModel>();
346 phy->SetErrorRateModel(error);
347 phy->SetChannel(channel);
349 phy->SetMobility(mobility);
353 dev->SetRemoteStationManager(manager);
360 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
363 protectionManager->SetWifiMac(mac);
364 fem->SetProtectionManager(protectionManager);
366 ackManager->SetWifiMac(mac);
367 fem->SetAckManager(ackManager);
369 mobility->SetPosition(pos);
370 node->AggregateObject(mobility);
385 channel->SetPropagationDelayModel(propDelay);
386 channel->SetPropagationLossModel(propLoss);
396 propLoss->SetDefaultLoss(999);
401 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
406 DynamicCast<WifiNetDevice>(rxOnly->GetDevice(0)));
411 DynamicCast<WifiNetDevice>(senderA->GetDevice(0)));
416 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
480 void DoRun()
override;
506 :
TestCase(
"Test case for DCF immediate access with broadcast frames")
528 dev->Send(p, dev->GetBroadcast(), 1);
546 channel->SetPropagationDelayModel(propDelay);
547 channel->SetPropagationLossModel(propLoss);
555 txPhy->SetInterferenceHelper(txInterferenceHelper);
557 txPhy->SetErrorRateModel(txError);
558 txPhy->SetChannel(channel);
559 txPhy->SetDevice(txDev);
560 txPhy->SetMobility(txMobility);
563 txPhy->TraceConnectWithoutContext(
567 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
568 txNode->AggregateObject(txMobility);
569 txDev->SetPhy(txPhy);
571 txNode->AddDevice(txDev);
576 txDev->SetMac(txMac);
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);
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!");
626 expectedSecondTransmissionTime,
627 "The second transmission time not correct!");
649 void DoRun()
override;
664 :
TestCase(
"Test case for Bug 730"),
691 wifiApNode.Create(1);
695 phy.SetChannel(channel.Create());
699 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
710 staDevices = wifi.Install(phy, mac, wifiStaNode);
715 apDevices = wifi.Install(phy, mac, wifiApNode);
720 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
721 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
722 mobility.SetPositionAllocator(positionAlloc);
724 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
725 mobility.Install(wifiApNode);
726 mobility.Install(wifiStaNode);
738 packetSocket.
Install(wifiStaNode);
739 packetSocket.
Install(wifiApNode);
743 client->SetRemote(socket);
745 client->SetStartTime(
Seconds(1));
746 client->SetStopTime(
Seconds(51.0));
749 server->SetLocal(socket);
750 wifiApNode.Get(0)->AddApplication(server);
751 server->SetStartTime(
Seconds(0.0));
752 server->SetStopTime(
Seconds(52.0));
754 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
759 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
771 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
788 void DoRun()
override;
812 :
TestCase(
"Test case for fragmentation with QoS stations"),
825 if (p->GetSize() == 1400)
850 wifiApNode.Create(1);
854 phy.SetChannel(channel.Create());
858 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
"DataMode",
StringValue(
"HtMcs7"));
865 staDevices = wifi.Install(phy, mac, wifiStaNode);
870 apDevices = wifi.Install(phy, mac, wifiApNode);
875 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
876 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
877 mobility.SetPositionAllocator(positionAlloc);
879 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
880 mobility.Install(wifiApNode);
881 mobility.Install(wifiStaNode);
888 sta_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
893 socket.SetPhysicalAddress(ap_device->GetAddress());
894 socket.SetProtocol(1);
898 packetSocket.
Install(wifiStaNode);
899 packetSocket.
Install(wifiApNode);
904 client->SetRemote(socket);
906 client->SetStartTime(
Seconds(1));
907 client->SetStopTime(
Seconds(3.0));
910 server->SetLocal(socket);
911 wifiApNode.Get(0)->AddApplication(server);
912 server->SetStartTime(
Seconds(0.0));
913 server->SetStopTime(
Seconds(4.0));
915 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
918 Config::Set(
"/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
943 void DoRun()
override;
955 :
TestCase(
"Test case for setting WifiPhy channel and frequency")
973 wifiApNode.Create(1);
977 phy.SetChannel(channel.Create());
981 ssid =
Ssid(
"wifi-phy-configuration");
983 macSta.
SetType(
"ns3::StaWifiMac",
995 phySta = CreateObject<YansWifiPhy>();
999 "default configuration");
1005 wifi.SetRemoteStationManager(
"ns3::ArfWifiManager");
1006 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1017 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1028 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1038 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1040 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_5GHZ, 0}"));
1041 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1046 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1051 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1053 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1062 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1064 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
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));
1081 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1086 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1087 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1096 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1097 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_6GHZ, 0}"));
1098 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1103 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1108 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1110 phy.Set(
"ChannelSettings",
StringValue(
"{0, 10, BAND_5GHZ, 0}"));
1111 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1116 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1121 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1123 phy.Set(
"ChannelSettings",
StringValue(
"{0, 5, BAND_5GHZ, 0}"));
1124 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1129 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1134 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1136 phy.Set(
"ChannelSettings",
StringValue(
"{44, 20, BAND_5GHZ, 0}"));
1137 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1142 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1147 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1148 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1149 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1152 std::ostringstream path;
1153 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1154 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1159 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1164 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1165 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1166 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1169 std::ostringstream path;
1170 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1171 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1178 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1183 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1185 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1187 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{3, 20, BAND_2_4GHZ, 0}"));
1190 std::ostringstream path;
1191 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1192 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1199 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1204 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1207 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1208 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1210 bool exceptionThrown =
false;
1213 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1215 catch (
const std::runtime_error&)
1217 exceptionThrown =
true;
1225 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1227 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1228 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1232 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{100, 0, BAND_5GHZ, 0}"));
1242 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1244 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1245 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1247 bool exceptionThrown =
false;
1252 catch (
const std::runtime_error&)
1254 exceptionThrown =
true;
1262 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1265 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1266 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1268 bool exceptionThrown =
false;
1271 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1273 catch (
const std::runtime_error&)
1275 exceptionThrown =
true;
1279 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1284 exceptionThrown =
false;
1287 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{43, 0, BAND_5GHZ, 0}"));
1289 catch (
const std::runtime_error&)
1291 exceptionThrown =
true;
1295 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1303 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1304 phy.Set(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1306 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1313 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1315 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1320 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1325 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1330 bool exceptionThrown =
false;
1333 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1335 catch (
const std::runtime_error&)
1337 exceptionThrown =
true;
1339 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1345 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1346 exceptionThrown =
false;
1349 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{43, 0, BAND_5GHZ, 0}"));
1351 catch (
const std::runtime_error&)
1353 exceptionThrown =
true;
1379 void DoRun()
override;
1393 :
TestCase(
"Test case for Bug 2222"),
1394 m_countInternalCollisions(0)
1418 int64_t streamNumber = 100;
1425 phy.SetChannel(channel.Create());
1428 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1435 mac.SetType(
"ns3::AdhocWifiMac",
"QosSupported",
BooleanValue(
true));
1438 wifiDevices = wifi.Install(phy, mac, wifiNodes);
1441 wifi.AssignStreams(wifiDevices, streamNumber);
1446 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1447 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1448 mobility.SetPositionAllocator(positionAlloc);
1450 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1451 mobility.Install(wifiNodes);
1462 packetSocket.
Install(wifiNodes);
1465 clientLowPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1466 clientLowPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1467 clientLowPriority->SetAttribute(
"Priority",
UintegerValue(4));
1468 clientLowPriority->SetRemote(socket);
1470 clientLowPriority->SetStartTime(
Seconds(0.0));
1471 clientLowPriority->SetStopTime(
Seconds(1.0));
1474 clientHighPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1475 clientHighPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1476 clientHighPriority->SetAttribute(
"Priority",
UintegerValue(6));
1477 clientHighPriority->SetRemote(socket);
1479 clientHighPriority->SetStartTime(
Seconds(0.0));
1480 clientHighPriority->SetStopTime(
Seconds(1.0));
1483 server->SetLocal(socket);
1485 server->SetStartTime(
Seconds(0.0));
1486 server->SetStopTime(
Seconds(1.0));
1488 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1497 "unexpected number of internal collisions!");
1518 void DoRun()
override;
1525 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1527 std::vector<FreqWidthSubbandModulationTuple>
1552 :
TestCase(
"Test case for Bug 2843"),
1566 std::size_t numBands = c->GetNumBands();
1567 double startingFreq = c->Begin()->fl;
1571 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1580 std::make_tuple(startingFreq,
m_channelWidth, numBands, modulationClass);
1582 for (std::vector<FreqWidthSubbandModulationTuple>::const_iterator it =
m_distinctTuples.begin();
1586 if (*it == tupleForCurrentTx)
1602 for (uint8_t i = 0; i < numPackets; i++)
1605 sourceDevice->Send(pkt, destination, 0);
1612 uint16_t channelWidth = 40;
1618 wifiApNode.Create(1);
1623 lossModel->SetFrequency(5.190e9);
1624 spectrumChannel->AddPropagationLossModel(lossModel);
1627 CreateObject<ConstantSpeedPropagationDelayModel>();
1628 spectrumChannel->SetPropagationDelayModel(delayModel);
1632 spectrumPhy.
Set(
"ChannelSettings",
StringValue(
"{38, 40, BAND_5GHZ, 0}"));
1638 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1647 mac.SetType(
"ns3::StaWifiMac");
1649 staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode);
1651 mac.SetType(
"ns3::ApWifiMac");
1653 apDevice = wifi.Install(spectrumPhy, mac, wifiApNode);
1657 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1658 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
1659 mobility.SetPositionAllocator(positionAlloc);
1661 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1662 mobility.Install(wifiApNode);
1663 mobility.Install(wifiStaNode);
1671 staDevice.
Get(0)->GetAddress());
1677 staDevice.
Get(0)->GetAddress());
1679 Config::Connect(
"/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1693 "The starting frequency of the first tuple should be shifted 20 MHz to "
1694 "the right wrt second tuple");
1698 "First tuple's channel width should be 20 MHz");
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");
1709 "Second tuple's channel width should be 40 MHz");
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");
1736 void DoRun()
override;
1763 :
TestCase(
"Test case for Bug 2831"),
1765 m_assocRespCount(0),
1766 m_countOperationalChannelWidth20(0),
1767 m_countOperationalChannelWidth40(0)
1789 packet->RemoveHeader(hdr);
1801 packet->RemoveHeader(beacon);
1802 const auto& htOperation = beacon.Get<
HtOperation>();
1803 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1819 propDelay.
SetTypeId(
"ns3::ConstantSpeedPropagationDelayModel");
1822 channel->SetPropagationDelayModel(propagationDelay);
1823 channel->SetPropagationLossModel(propagationLoss);
1825 Ptr<Node> apNode = CreateObject<Node>();
1827 apNode->AddDevice(apDev);
1830 apDev->SetHtConfiguration(apHtConfiguration);
1832 manager.
SetTypeId(
"ns3::ConstantRateWifiManager");
1835 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1836 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1837 apNode->AggregateObject(apMobility);
1839 auto error = CreateObject<YansErrorRateModel>();
1840 m_apPhy = CreateObject<YansWifiPhy>();
1852 mac.SetTypeId(
"ns3::ApWifiMac");
1856 apMac->SetDevice(apDev);
1858 apDev->SetMac(apMac);
1860 apMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1863 protectionManager->SetWifiMac(apMac);
1864 fem->SetProtectionManager(protectionManager);
1866 ackManager->SetWifiMac(apMac);
1867 fem->SetAckManager(ackManager);
1869 Ptr<Node> staNode = CreateObject<Node>();
1871 staNode->AddDevice(staDev);
1874 staDev->SetHtConfiguration(staHtConfiguration);
1878 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1879 staNode->AggregateObject(staMobility);
1881 m_staPhy = CreateObject<YansWifiPhy>();
1892 mac.SetTypeId(
"ns3::StaWifiMac");
1893 auto staMac = mac.Create<
WifiMac>();
1894 staDev->SetMac(staMac);
1895 staMac->SetDevice(staDev);
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);
1908 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1921 "Incorrect operational channel width before channel change");
1924 "Incorrect operational channel width after channel change");
1948 void DoRun()
override;
1979 :
TestCase(
"Test case for StaWifiMac scanning capability")
1997 Ptr<ApWifiMac> mac = DynamicCast<ApWifiMac>(netDevice->GetMac());
1998 mac->SetAttribute(
"BeaconGeneration",
BooleanValue(
true));
2014 int64_t streamNumber = 1;
2019 Ptr<Node> apNodeNearest = CreateObject<Node>();
2020 Ptr<Node> staNode = CreateObject<Node>();
2024 phy.SetChannel(channel.Create());
2028 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager");
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);
2039 mac.SetType(
"ns3::StaWifiMac",
"ActiveProbing",
BooleanValue(staActiveProbe));
2040 staDevice = wifi.Install(phy, mac, staNode);
2043 wifi.AssignStreams(apDevice, streamNumber);
2044 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2045 wifi.AssignStreams(staDevice, streamNumber + 2);
2049 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2050 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2051 positionAlloc->Add(Vector(5.0, 5.0, 0.0));
2052 positionAlloc->Add(Vector(6.0, 5.0, 0.0));
2053 mobility.SetPositionAllocator(positionAlloc);
2055 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2056 mobility.Install(apNodes);
2057 mobility.Install(apNodeNearest);
2058 mobility.Install(staNode);
2060 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2074 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2087 "STA is associated to the wrong AP");
2094 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2102 "STA is associated to the wrong AP");
2118 secondNearestApAddr,
2119 "STA is associated to the wrong AP");
2151 void DoRun()
override;
2176 std::string context,
2193 uint16_t channelFreqMhz,
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)
2279 std::string context,
2284 auto psdu = psduMap.begin()->second;
2291 auto uid = psdu->GetPayload(0)->GetUid();
2292 rxErrorModel->SetList({uid});
2299 uint16_t channelFreqMhz,
2306 if (aMpdu.
type != MpduType::NORMAL_MPDU)
2313 packet->RemoveHeader(hdr);
2326 packet->RemoveHeader(hdr);
2338 for (
uint32_t i = 0; i < numPackets; i++)
2341 sourceDevice->Send(pkt, destination, 0);
2350 int64_t streamNumber = 200;
2354 wifiApNode.Create(1);
2359 phy.SetChannel(channel.Create());
2363 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
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);
2376 mac.SetType(
"ns3::StaWifiMac");
2377 staDevice = wifi.Install(phy, mac, wifiStaNode);
2380 wifi.AssignStreams(apDevice, streamNumber);
2381 wifi.AssignStreams(staDevice, streamNumber);
2385 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2386 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2387 mobility.SetPositionAllocator(positionAlloc);
2389 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2390 mobility.Install(wifiApNode);
2391 mobility.Install(wifiStaNode);
2393 auto rxErrorModel = CreateObject<ListErrorModel>();
2395 switch (rcvErrorType)
2398 wifiMac = DynamicCast<WifiNetDevice>(apDevice.
Get(0))->GetMac();
2401 wifiMac = DynamicCast<WifiNetDevice>(staDevice.
Get(0))->GetMac();
2404 NS_ABORT_MSG(
"Station type " << +rcvErrorType <<
" cannot be used here");
2406 wifiMac->GetWifiPhy(0)->SetPostReceptionErrorModel(rxErrorModel);
2409 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2413 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2414 "BlockAckManager/AgreementState",
2417 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2425 staDevice.
Get(0)->GetAddress());
2431 staDevice.
Get(0)->GetAddress());
2437 staDevice.
Get(0)->GetAddress());
2443 staDevice.
Get(0)->GetAddress());
2462 "Receiving incorrect number of normal MPDU packet on subtest 1");
2465 "Receiving incorrect number of A-MPDU packets on subtest 1");
2469 "Incorrect number of times the ADDBA state machine was in "
2470 "established state on subtest 1");
2474 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2478 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2482 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2486 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2505 "Receiving incorrect number of normal MPDU packet on subtest 2");
2508 "Receiving incorrect number of A-MPDU packet on subtest 2");
2512 "Incorrect number of times the ADDBA state machine was in "
2513 "established state on subtest 2");
2517 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2521 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2525 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2529 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2557 void DoRun()
override;
2564 void RunOne(
bool useAmpdu);
2593 :
TestCase(
"Test case for issue #40"),
2596 m_txMacFinalDataFailedCount(0)
2613 for (uint8_t i = 0; i < numPackets; i++)
2616 sourceDevice->Send(pkt, destination, 0);
2636 int64_t streamNumber = 100;
2640 wifiApNode.Create(1);
2645 phy.SetChannel(channel.Create());
2649 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2653 mac.SetType(
"ns3::ApWifiMac");
2654 apDevice = wifi.Install(phy, mac, wifiApNode);
2657 mac.SetType(
"ns3::StaWifiMac");
2658 staDevice = wifi.Install(phy, mac, wifiStaNode);
2661 wifi.AssignStreams(apDevice, streamNumber);
2662 wifi.AssignStreams(staDevice, streamNumber);
2666 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2667 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2668 mobility.SetPositionAllocator(positionAlloc);
2670 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2671 mobility.Install(wifiApNode);
2673 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel");
2674 mobility.Install(wifiStaNode);
2676 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2678 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
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)));
2692 ap_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
2703 staDevice.
Get(0)->GetAddress());
2712 staDevice.
Get(0)->GetAddress());
2721 staDevice.
Get(0)->GetAddress());
2727 staDevice.
Get(0)->GetAddress());
2733 staDevice.
Get(0)->GetAddress());
2739 staDevice.
Get(0)->GetAddress());
2745 staDevice.
Get(0)->GetAddress());
2751 (useAmpdu ? 14 : 7),
2752 "Incorrect number of transmitted packets");
2754 (useAmpdu ? 12 : 6),
2755 "Incorrect number of successfully received packets");
2789 void DoRun()
override;
2818 :
TestCase(
"Test case for issue #169")
2834 for (uint8_t i = 0; i < numPackets; i++)
2837 packet->AddPacketTag(priorityTag);
2838 sourceDevice->Send(packet, destination, 0);
2848 if (psdus.begin()->second->GetSize() >= 1000)
2851 WifiModulationClass::WIFI_MOD_CLASS_VHT,
2852 "Ideal rate manager selected incorrect modulation class");
2861 int64_t streamNumber = 100;
2865 wifiApNode.Create(1);
2870 phy.SetChannel(channel.Create());
2874 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2878 mac.SetType(
"ns3::ApWifiMac");
2879 apDevice = wifi.Install(phy, mac, wifiApNode);
2882 mac.SetType(
"ns3::StaWifiMac");
2883 staDevice = wifi.Install(phy, mac, wifiStaNode);
2886 wifi.AssignStreams(apDevice, streamNumber);
2887 wifi.AssignStreams(staDevice, streamNumber);
2891 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2892 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2893 mobility.SetPositionAllocator(positionAlloc);
2895 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2896 mobility.Install(wifiApNode);
2897 mobility.Install(wifiStaNode);
2899 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2908 staDevice.
Get(0)->GetAddress(),
2917 staDevice.
Get(0)->GetAddress(),
2946 void DoRun()
override;
2984 :
TestCase(
"Test case for use of channel bonding with Ideal rate manager")
2995 Config::Set(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
2996 StringValue(
"{0, " + std::to_string(channelWidth) +
", BAND_5GHZ, 0}"));
3003 sourceDevice->Send(packet, destination, 0);
3012 if (psduMap.begin()->second->GetSize() >= 1000)
3023 "Last selected WifiMode "
3024 <<
m_txMode <<
" does not match expected WifiMode " << expectedMode);
3032 int64_t streamNumber = 100;
3036 wifiApNode.Create(1);
3041 phy.SetChannel(channel.Create());
3045 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3049 mac.SetType(
"ns3::ApWifiMac");
3050 apDevice = wifi.Install(phy, mac, wifiApNode);
3053 mac.SetType(
"ns3::StaWifiMac");
3054 staDevice = wifi.Install(phy, mac, wifiStaNode);
3057 wifi.AssignStreams(apDevice, streamNumber);
3058 wifi.AssignStreams(staDevice, streamNumber);
3062 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3063 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3064 mobility.SetPositionAllocator(positionAlloc);
3066 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3067 mobility.Install(wifiApNode);
3068 mobility.Install(wifiStaNode);
3070 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3082 staDevice.
Get(0)->GetAddress());
3098 staDevice.
Get(0)->GetAddress());
3114 staDevice.
Get(0)->GetAddress());
3141 void DoRun()
override;
3190 :
TestCase(
"Test case for use of imbalanced MIMO settings with Ideal rate manager")
3201 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3203 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3205 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3212 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3214 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3216 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3224 sourceDevice->Send(packet, destination, 0);
3233 if (psdus.begin()->second->GetSize() >= 1000)
3245 <<
" does not match expected Nss " << expectedNss);
3254 <<
" does not match expected WifiMode "
3263 int64_t streamNumber = 100;
3267 wifiApNode.Create(1);
3272 phy.SetChannel(channel.Create());
3276 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3280 mac.SetType(
"ns3::ApWifiMac");
3281 apDevice = wifi.Install(phy, mac, wifiApNode);
3284 mac.SetType(
"ns3::StaWifiMac");
3285 staDevice = wifi.Install(phy, mac, wifiStaNode);
3288 wifi.AssignStreams(apDevice, streamNumber);
3289 wifi.AssignStreams(staDevice, streamNumber);
3293 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3294 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3295 mobility.SetPositionAllocator(positionAlloc);
3297 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3298 mobility.Install(wifiApNode);
3299 mobility.Install(wifiStaNode);
3301 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3313 staDevice.
Get(0)->GetAddress());
3318 staDevice.
Get(0)->GetAddress());
3336 staDevice.
Get(0)->GetAddress());
3341 staDevice.
Get(0)->GetAddress());
3360 staDevice.
Get(0)->GetAddress());
3365 staDevice.
Get(0)->GetAddress());
3383 staDevice.
Get(0)->GetAddress());
3388 staDevice.
Get(0)->GetAddress());
3407 staDevice.
Get(0)->GetAddress());
3412 staDevice.
Get(0)->GetAddress());
3432 staDevice.
Get(0)->GetAddress());
3437 staDevice.
Get(0)->GetAddress());
3455 staDevice.
Get(0)->GetAddress());
3460 staDevice.
Get(0)->GetAddress());
3479 staDevice.
Get(0)->GetAddress());
3484 staDevice.
Get(0)->GetAddress());
3504 staDevice.
Get(0)->GetAddress());
3509 staDevice.
Get(0)->GetAddress());
3526 staDevice.
Get(0)->GetAddress());
3564 uint16_t guardInterval,
3565 uint16_t expectedDataRate);
3566 void DoRun()
override;
3570 :
TestCase(
"Check data rates for different RU types.")
3578 uint16_t guardInterval,
3579 uint16_t expectedDataRate)
3583 uint64_t dataRate = round(mode.
GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3585 if (
static_cast<uint16_t
>(dataRate) != expectedDataRate)
3587 std::cerr <<
"RU=" << ruType <<
" mode=" << mode <<
" Nss=" << +nss
3588 <<
" guardInterval=" << guardInterval <<
" expected=" << expectedDataRate
3590 <<
" computed=" <<
static_cast<uint16_t
>(dataRate) <<
" x100kbps" << std::endl;
3618 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3630 "Data rate verification for RUs above 52-tone RU (included) failed");
3635 std::tuple<SupportedRates, std::optional<ExtendedSupportedRatesIE>, std::vector<Ssid>>;
3669 .SetGroupName(
"Wifi")
3693 void DoRun()
override;
3719 "Expected a SupportedRates IE to be included");
3722 "Expected no ExtendedSupportedRatesIE to be included");
3739 "Expected a SupportedRates IE to be included");
3742 "Expected an ExtendedSupportedRatesIE to be included");
3748 Ssid one(
"Ssid One");
3749 frame.Get<
Ssid>().push_back(one);
3753 "Expected a SupportedRates IE to be included");
3756 "Expected an ExtendedSupportedRatesIE to be included");
3765 frame.Get<
Ssid>().emplace_back(
"Ssid Two");
3769 "Expected a SupportedRates IE to be included");
3772 "Expected an ExtendedSupportedRatesIE to be included");
3776 "Incorrect first SSID");
3779 "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 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.
Hold objects of type Ptr<T>.
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, TestDuration 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.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
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.