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"
67 int64_t currentStream = stream;
69 if (!mac->GetQosSupported())
71 mac->GetAttribute(
"Txop", ptr);
73 currentStream += txop->AssignStreams(currentStream);
77 mac->GetAttribute(
"VO_Txop", ptr);
79 currentStream += vo_txop->AssignStreams(currentStream);
81 mac->GetAttribute(
"VI_Txop", ptr);
83 currentStream += vi_txop->AssignStreams(currentStream);
85 mac->GetAttribute(
"BE_Txop", ptr);
87 currentStream += be_txop->AssignStreams(currentStream);
89 mac->GetAttribute(
"BK_Txop", ptr);
91 bk_txop->AssignStreams(currentStream);
106 void DoRun()
override;
137 dev->Send(p, dev->GetBroadcast(), 1);
145 node->AddDevice(dev);
147 auto mobility = CreateObject<ConstantPositionMobilityModel>();
148 auto phy = CreateObject<YansWifiPhy>();
150 phy->SetInterferenceHelper(interferenceHelper);
151 auto error = CreateObject<YansErrorRateModel>();
152 phy->SetErrorRateModel(error);
153 phy->SetChannel(channel);
158 dev->SetRemoteStationManager(manager);
165 if (mac->GetTypeOfStation() ==
STA)
167 StaticCast<StaWifiMac>(mac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
169 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
172 protectionManager->SetWifiMac(mac);
173 fem->SetProtectionManager(protectionManager);
175 ackManager->SetWifiMac(mac);
176 fem->SetAckManager(ackManager);
178 mobility->SetPosition(pos);
179 node->AggregateObject(mobility);
190 channel->SetPropagationDelayModel(propDelay);
191 channel->SetPropagationLossModel(propLoss);
193 CreateOne(Vector(0.0, 0.0, 0.0), channel);
194 CreateOne(Vector(5.0, 0.0, 0.0), channel);
195 CreateOne(Vector(5.0, 0.0, 0.0), channel);
253 "2047 is new in comparison to 0");
261 "0 is new in comparison to 4095");
267 "2047 is old in comparison to 4095");
271 "4095 is new in comparison to 2048");
275 "0 is new in comparison to 2049");
287 void DoRun()
override;
314 :
TestCase(
"InterferenceHelperSequence")
322 dev->Send(p, dev->GetBroadcast(), 1);
337 node->AddDevice(dev);
339 auto mobility = CreateObject<ConstantPositionMobilityModel>();
340 auto phy = CreateObject<YansWifiPhy>();
342 phy->SetInterferenceHelper(interferenceHelper);
343 auto error = CreateObject<YansErrorRateModel>();
344 phy->SetErrorRateModel(error);
345 phy->SetChannel(channel);
347 phy->SetMobility(mobility);
351 dev->SetRemoteStationManager(manager);
358 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
361 protectionManager->SetWifiMac(mac);
362 fem->SetProtectionManager(protectionManager);
364 ackManager->SetWifiMac(mac);
365 fem->SetAckManager(ackManager);
367 mobility->SetPosition(pos);
368 node->AggregateObject(mobility);
383 channel->SetPropagationDelayModel(propDelay);
384 channel->SetPropagationLossModel(propLoss);
394 propLoss->SetDefaultLoss(999);
399 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
404 DynamicCast<WifiNetDevice>(rxOnly->GetDevice(0)));
409 DynamicCast<WifiNetDevice>(senderA->GetDevice(0)));
414 DynamicCast<WifiNetDevice>(senderB->GetDevice(0)));
478 void DoRun()
override;
504 :
TestCase(
"Test case for DCF immediate access with broadcast frames")
526 dev->Send(p, dev->GetBroadcast(), 1);
544 channel->SetPropagationDelayModel(propDelay);
545 channel->SetPropagationLossModel(propLoss);
553 txPhy->SetInterferenceHelper(txInterferenceHelper);
555 txPhy->SetErrorRateModel(txError);
556 txPhy->SetChannel(channel);
557 txPhy->SetDevice(txDev);
558 txPhy->SetMobility(txMobility);
561 txPhy->TraceConnectWithoutContext(
565 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
566 txNode->AggregateObject(txMobility);
567 txDev->SetPhy(txPhy);
569 txNode->AddDevice(txDev);
574 txDev->SetMac(txMac);
576 txMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
577 auto fem = txMac->GetFrameExchangeManager();
578 auto protectionManager = CreateObject<WifiDefaultProtectionManager>();
579 protectionManager->SetWifiMac(txMac);
580 fem->SetProtectionManager(protectionManager);
581 auto ackManager = CreateObject<WifiDefaultAckManager>();
582 ackManager->SetWifiMac(txMac);
583 fem->SetAckManager(ackManager);
616 uint32_t expectedWait1 = 1408 + (1 * 9) + 16 + (2 * 9);
617 Time expectedSecondTransmissionTime =
618 expectedFirstTransmissionTime +
MicroSeconds(expectedWait1);
620 expectedFirstTransmissionTime,
621 "The first transmission time not correct!");
624 expectedSecondTransmissionTime,
625 "The second transmission time not correct!");
647 void DoRun()
override;
662 :
TestCase(
"Test case for Bug 730"),
689 wifiApNode.Create(1);
693 phy.SetChannel(channel.Create());
697 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
708 staDevices = wifi.Install(phy, mac, wifiStaNode);
713 apDevices = wifi.Install(phy, mac, wifiApNode);
718 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
719 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
720 mobility.SetPositionAllocator(positionAlloc);
722 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
723 mobility.Install(wifiApNode);
724 mobility.Install(wifiStaNode);
736 packetSocket.
Install(wifiStaNode);
737 packetSocket.
Install(wifiApNode);
741 client->SetRemote(socket);
743 client->SetStartTime(
Seconds(1));
744 client->SetStopTime(
Seconds(51.0));
747 server->SetLocal(socket);
748 wifiApNode.Get(0)->AddApplication(server);
749 server->SetStartTime(
Seconds(0.0));
750 server->SetStopTime(
Seconds(52.0));
752 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
757 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
769 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
786 void DoRun()
override;
810 :
TestCase(
"Test case for fragmentation with QoS stations"),
823 if (p->GetSize() == 1400)
848 wifiApNode.Create(1);
852 phy.SetChannel(channel.Create());
856 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
"DataMode",
StringValue(
"HtMcs7"));
863 staDevices = wifi.Install(phy, mac, wifiStaNode);
868 apDevices = wifi.Install(phy, mac, wifiApNode);
873 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
874 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
875 mobility.SetPositionAllocator(positionAlloc);
877 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
878 mobility.Install(wifiApNode);
879 mobility.Install(wifiStaNode);
886 sta_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
891 socket.SetPhysicalAddress(ap_device->GetAddress());
892 socket.SetProtocol(1);
896 packetSocket.
Install(wifiStaNode);
897 packetSocket.
Install(wifiApNode);
902 client->SetRemote(socket);
904 client->SetStartTime(
Seconds(1));
905 client->SetStopTime(
Seconds(3.0));
908 server->SetLocal(socket);
909 wifiApNode.Get(0)->AddApplication(server);
910 server->SetStartTime(
Seconds(0.0));
911 server->SetStopTime(
Seconds(4.0));
913 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
916 Config::Set(
"/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
941 void DoRun()
override;
953 :
TestCase(
"Test case for setting WifiPhy channel and frequency")
971 wifiApNode.Create(1);
975 phy.SetChannel(channel.Create());
979 ssid =
Ssid(
"wifi-phy-configuration");
981 macSta.
SetType(
"ns3::StaWifiMac",
993 phySta = CreateObject<YansWifiPhy>();
997 "default configuration");
1003 wifi.SetRemoteStationManager(
"ns3::ArfWifiManager");
1004 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1015 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1026 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1036 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1038 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_5GHZ, 0}"));
1039 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1044 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1049 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1051 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1060 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1062 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1072 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1073 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_2_4GHZ, 0}"));
1074 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1079 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1084 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1085 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1094 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1095 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_6GHZ, 0}"));
1096 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1101 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1106 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1108 phy.Set(
"ChannelSettings",
StringValue(
"{0, 10, BAND_5GHZ, 0}"));
1109 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1114 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1119 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1121 phy.Set(
"ChannelSettings",
StringValue(
"{0, 5, BAND_5GHZ, 0}"));
1122 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1127 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1132 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1134 phy.Set(
"ChannelSettings",
StringValue(
"{44, 20, BAND_5GHZ, 0}"));
1135 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1140 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1145 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1146 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1147 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1150 std::ostringstream path;
1151 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1152 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1157 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1162 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1163 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1164 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1167 std::ostringstream path;
1168 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1169 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1176 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1181 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1183 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1185 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{3, 20, BAND_2_4GHZ, 0}"));
1188 std::ostringstream path;
1189 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1190 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1197 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1202 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1205 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1206 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1208 bool exceptionThrown =
false;
1211 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1213 catch (
const std::runtime_error&)
1215 exceptionThrown =
true;
1223 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1225 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1226 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1230 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{100, 0, BAND_5GHZ, 0}"));
1240 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1242 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1243 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1245 bool exceptionThrown =
false;
1250 catch (
const std::runtime_error&)
1252 exceptionThrown =
true;
1260 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1263 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1264 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1266 bool exceptionThrown =
false;
1269 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1271 catch (
const std::runtime_error&)
1273 exceptionThrown =
true;
1277 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1282 exceptionThrown =
false;
1285 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{43, 0, BAND_5GHZ, 0}"));
1287 catch (
const std::runtime_error&)
1289 exceptionThrown =
true;
1293 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1301 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1302 phy.Set(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1304 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1311 staDevice = wifi.Install(phy, macSta, wifiStaNode.
Get(0));
1313 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1318 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1323 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1328 bool exceptionThrown =
false;
1331 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{45, 0, BAND_5GHZ, 0}"));
1333 catch (
const std::runtime_error&)
1335 exceptionThrown =
true;
1337 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1343 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
1344 exceptionThrown =
false;
1347 phySta->SetAttribute(
"ChannelSettings",
StringValue(
"{43, 0, BAND_5GHZ, 0}"));
1349 catch (
const std::runtime_error&)
1351 exceptionThrown =
true;
1377 void DoRun()
override;
1391 :
TestCase(
"Test case for Bug 2222"),
1392 m_countInternalCollisions(0)
1416 int64_t streamNumber = 100;
1423 phy.SetChannel(channel.Create());
1426 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1433 mac.SetType(
"ns3::AdhocWifiMac",
"QosSupported",
BooleanValue(
true));
1436 wifiDevices = wifi.Install(phy, mac, wifiNodes);
1439 wifi.AssignStreams(wifiDevices, streamNumber);
1444 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1445 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1446 mobility.SetPositionAllocator(positionAlloc);
1448 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1449 mobility.Install(wifiNodes);
1460 packetSocket.
Install(wifiNodes);
1463 clientLowPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1464 clientLowPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1465 clientLowPriority->SetAttribute(
"Priority",
UintegerValue(4));
1466 clientLowPriority->SetRemote(socket);
1468 clientLowPriority->SetStartTime(
Seconds(0.0));
1469 clientLowPriority->SetStopTime(
Seconds(1.0));
1472 clientHighPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1473 clientHighPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1474 clientHighPriority->SetAttribute(
"Priority",
UintegerValue(6));
1475 clientHighPriority->SetRemote(socket);
1477 clientHighPriority->SetStartTime(
Seconds(0.0));
1478 clientHighPriority->SetStopTime(
Seconds(1.0));
1481 server->SetLocal(socket);
1483 server->SetStartTime(
Seconds(0.0));
1484 server->SetStopTime(
Seconds(1.0));
1486 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1495 "unexpected number of internal collisions!");
1516 void DoRun()
override;
1523 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1525 std::vector<FreqWidthSubbandModulationTuple>
1550 :
TestCase(
"Test case for Bug 2843"),
1564 std::size_t numBands = c->GetNumBands();
1565 double startingFreq = c->Begin()->fl;
1569 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1578 std::make_tuple(startingFreq,
m_channelWidth, numBands, modulationClass);
1580 for (std::vector<FreqWidthSubbandModulationTuple>::const_iterator it =
m_distinctTuples.begin();
1584 if (*it == tupleForCurrentTx)
1600 for (uint8_t i = 0; i < numPackets; i++)
1603 sourceDevice->Send(pkt, destination, 0);
1610 uint16_t channelWidth = 40;
1616 wifiApNode.Create(1);
1621 lossModel->SetFrequency(5.190e9);
1622 spectrumChannel->AddPropagationLossModel(lossModel);
1625 CreateObject<ConstantSpeedPropagationDelayModel>();
1626 spectrumChannel->SetPropagationDelayModel(delayModel);
1630 spectrumPhy.
Set(
"ChannelSettings",
StringValue(
"{38, 40, BAND_5GHZ, 0}"));
1636 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1645 mac.SetType(
"ns3::StaWifiMac");
1647 staDevice = wifi.Install(spectrumPhy, mac, wifiStaNode);
1649 mac.SetType(
"ns3::ApWifiMac");
1651 apDevice = wifi.Install(spectrumPhy, mac, wifiApNode);
1655 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1656 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
1657 mobility.SetPositionAllocator(positionAlloc);
1659 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1660 mobility.Install(wifiApNode);
1661 mobility.Install(wifiStaNode);
1669 staDevice.
Get(0)->GetAddress());
1675 staDevice.
Get(0)->GetAddress());
1677 Config::Connect(
"/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1691 "The starting frequency of the first tuple should be shifted 20 MHz to "
1692 "the right wrt second tuple");
1696 "First tuple's channel width should be 20 MHz");
1699 "First tuple should have 193 subbands (64+DC, 20MHz+DC, inband and 64*2 "
1700 "out-of-band, 20MHz on each side)");
1702 WifiModulationClass::WIFI_MOD_CLASS_OFDM,
1703 "First tuple should be OFDM");
1707 "Second tuple's channel width should be 40 MHz");
1710 "Second tuple should have 385 subbands (128+DC, 40MHz+DC, inband and "
1711 "128*2 out-of-band, 40MHz on each side)");
1713 WifiModulationClass::WIFI_MOD_CLASS_VHT,
1714 "Second tuple should be VHT_OFDM");
1734 void DoRun()
override;
1761 :
TestCase(
"Test case for Bug 2831"),
1763 m_assocRespCount(0),
1764 m_countOperationalChannelWidth20(0),
1765 m_countOperationalChannelWidth40(0)
1787 packet->RemoveHeader(hdr);
1799 packet->RemoveHeader(beacon);
1800 const auto& htOperation = beacon.Get<
HtOperation>();
1801 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1817 propDelay.
SetTypeId(
"ns3::ConstantSpeedPropagationDelayModel");
1820 channel->SetPropagationDelayModel(propagationDelay);
1821 channel->SetPropagationLossModel(propagationLoss);
1823 Ptr<Node> apNode = CreateObject<Node>();
1825 apNode->AddDevice(apDev);
1828 apDev->SetHtConfiguration(apHtConfiguration);
1830 manager.
SetTypeId(
"ns3::ConstantRateWifiManager");
1833 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1834 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1835 apNode->AggregateObject(apMobility);
1837 auto error = CreateObject<YansErrorRateModel>();
1838 m_apPhy = CreateObject<YansWifiPhy>();
1850 mac.SetTypeId(
"ns3::ApWifiMac");
1854 apMac->SetDevice(apDev);
1856 apDev->SetMac(apMac);
1858 apMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1861 protectionManager->SetWifiMac(apMac);
1862 fem->SetProtectionManager(protectionManager);
1864 ackManager->SetWifiMac(apMac);
1865 fem->SetAckManager(ackManager);
1867 Ptr<Node> staNode = CreateObject<Node>();
1869 staNode->AddDevice(staDev);
1872 staDev->SetHtConfiguration(staHtConfiguration);
1876 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1877 staNode->AggregateObject(staMobility);
1879 m_staPhy = CreateObject<YansWifiPhy>();
1890 mac.SetTypeId(
"ns3::StaWifiMac");
1891 auto staMac = mac.Create<
WifiMac>();
1892 staDev->SetMac(staMac);
1893 staMac->SetDevice(staDev);
1896 StaticCast<StaWifiMac>(staMac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
1897 staMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1898 fem = staMac->GetFrameExchangeManager();
1899 protectionManager = CreateObject<WifiDefaultProtectionManager>();
1900 protectionManager->SetWifiMac(staMac);
1901 fem->SetProtectionManager(protectionManager);
1902 ackManager = CreateObject<WifiDefaultAckManager>();
1903 ackManager->SetWifiMac(staMac);
1904 fem->SetAckManager(ackManager);
1906 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1919 "Incorrect operational channel width before channel change");
1922 "Incorrect operational channel width after channel change");
1946 void DoRun()
override;
1977 :
TestCase(
"Test case for StaWifiMac scanning capability")
1995 Ptr<ApWifiMac> mac = DynamicCast<ApWifiMac>(netDevice->GetMac());
1996 mac->SetAttribute(
"BeaconGeneration",
BooleanValue(
true));
2012 int64_t streamNumber = 1;
2017 Ptr<Node> apNodeNearest = CreateObject<Node>();
2018 Ptr<Node> staNode = CreateObject<Node>();
2022 phy.SetChannel(channel.Create());
2026 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager");
2031 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
true));
2032 apDevice = wifi.Install(phy, mac, apNodes);
2033 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(nearestApBeaconGeneration));
2034 apDeviceNearest = wifi.Install(phy, mac, apNodeNearest);
2037 mac.SetType(
"ns3::StaWifiMac",
"ActiveProbing",
BooleanValue(staActiveProbe));
2038 staDevice = wifi.Install(phy, mac, staNode);
2041 wifi.AssignStreams(apDevice, streamNumber);
2042 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2043 wifi.AssignStreams(staDevice, streamNumber + 2);
2047 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2048 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2049 positionAlloc->Add(Vector(5.0, 5.0, 0.0));
2050 positionAlloc->Add(Vector(6.0, 5.0, 0.0));
2051 mobility.SetPositionAllocator(positionAlloc);
2053 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2054 mobility.Install(apNodes);
2055 mobility.Install(apNodeNearest);
2056 mobility.Install(staNode);
2058 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2072 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2085 "STA is associated to the wrong AP");
2092 DynamicCast<WifiNetDevice>(nearestAp->GetDevice(0))->GetMac()->GetAddress();
2100 "STA is associated to the wrong AP");
2116 secondNearestApAddr,
2117 "STA is associated to the wrong AP");
2149 void DoRun()
override;
2174 std::string context,
2191 uint16_t channelFreqMhz,
2232 :
TestCase(
"Test case for Bug 2470"),
2233 m_receivedNormalMpduCount(0),
2234 m_receivedAmpduCount(0),
2235 m_failedActionCount(0),
2236 m_addbaEstablishedCount(0),
2237 m_addbaPendingCount(0),
2238 m_addbaRejectedCount(0),
2239 m_addbaNoReplyCount(0),
2240 m_addbaResetCount(0)
2277 std::string context,
2282 auto psdu = psduMap.begin()->second;
2289 auto uid = psdu->GetPayload(0)->GetUid();
2290 rxErrorModel->SetList({uid});
2297 uint16_t channelFreqMhz,
2304 if (aMpdu.
type != MpduType::NORMAL_MPDU)
2311 packet->RemoveHeader(hdr);
2324 packet->RemoveHeader(hdr);
2336 for (
uint32_t i = 0; i < numPackets; i++)
2339 sourceDevice->Send(pkt, destination, 0);
2348 int64_t streamNumber = 200;
2352 wifiApNode.Create(1);
2357 phy.SetChannel(channel.Create());
2361 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
2369 phy.Set(
"ChannelSettings",
StringValue(
"{36, 20, BAND_5GHZ, 0}"));
2370 mac.SetType(
"ns3::ApWifiMac",
"EnableBeaconJitter",
BooleanValue(
false));
2371 apDevice = wifi.Install(phy, mac, wifiApNode);
2374 mac.SetType(
"ns3::StaWifiMac");
2375 staDevice = wifi.Install(phy, mac, wifiStaNode);
2378 wifi.AssignStreams(apDevice, streamNumber);
2379 wifi.AssignStreams(staDevice, streamNumber);
2383 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2384 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2385 mobility.SetPositionAllocator(positionAlloc);
2387 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2388 mobility.Install(wifiApNode);
2389 mobility.Install(wifiStaNode);
2391 auto rxErrorModel = CreateObject<ListErrorModel>();
2393 switch (rcvErrorType)
2396 wifiMac = DynamicCast<WifiNetDevice>(apDevice.
Get(0))->GetMac();
2399 wifiMac = DynamicCast<WifiNetDevice>(staDevice.
Get(0))->GetMac();
2402 NS_ABORT_MSG(
"Station type " << +rcvErrorType <<
" cannot be used here");
2404 wifiMac->GetWifiPhy(0)->SetPostReceptionErrorModel(rxErrorModel);
2407 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2411 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2412 "BlockAckManager/AgreementState",
2415 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2423 staDevice.
Get(0)->GetAddress());
2429 staDevice.
Get(0)->GetAddress());
2435 staDevice.
Get(0)->GetAddress());
2441 staDevice.
Get(0)->GetAddress());
2460 "Receiving incorrect number of normal MPDU packet on subtest 1");
2463 "Receiving incorrect number of A-MPDU packets on subtest 1");
2467 "Incorrect number of times the ADDBA state machine was in "
2468 "established state on subtest 1");
2472 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2476 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2480 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2484 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2503 "Receiving incorrect number of normal MPDU packet on subtest 2");
2506 "Receiving incorrect number of A-MPDU packet on subtest 2");
2510 "Incorrect number of times the ADDBA state machine was in "
2511 "established state on subtest 2");
2515 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2519 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2523 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2527 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2555 void DoRun()
override;
2562 void RunOne(
bool useAmpdu);
2591 :
TestCase(
"Test case for issue #40"),
2594 m_txMacFinalDataFailedCount(0)
2611 for (uint8_t i = 0; i < numPackets; i++)
2614 sourceDevice->Send(pkt, destination, 0);
2634 int64_t streamNumber = 100;
2638 wifiApNode.Create(1);
2643 phy.SetChannel(channel.Create());
2647 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2651 mac.SetType(
"ns3::ApWifiMac");
2652 apDevice = wifi.Install(phy, mac, wifiApNode);
2655 mac.SetType(
"ns3::StaWifiMac");
2656 staDevice = wifi.Install(phy, mac, wifiStaNode);
2659 wifi.AssignStreams(apDevice, streamNumber);
2660 wifi.AssignStreams(staDevice, streamNumber);
2664 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2665 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2666 mobility.SetPositionAllocator(positionAlloc);
2668 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2669 mobility.Install(wifiApNode);
2671 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel");
2672 mobility.Install(wifiStaNode);
2674 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2676 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
2681 staWaypointMobility->AddWaypoint(
Waypoint(
Seconds(1.0), Vector(10.0, 0.0, 0.0)));
2682 staWaypointMobility->AddWaypoint(
Waypoint(
Seconds(1.5), Vector(50.0, 0.0, 0.0)));
2690 ap_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
2701 staDevice.
Get(0)->GetAddress());
2710 staDevice.
Get(0)->GetAddress());
2719 staDevice.
Get(0)->GetAddress());
2725 staDevice.
Get(0)->GetAddress());
2731 staDevice.
Get(0)->GetAddress());
2737 staDevice.
Get(0)->GetAddress());
2743 staDevice.
Get(0)->GetAddress());
2749 (useAmpdu ? 14 : 7),
2750 "Incorrect number of transmitted packets");
2752 (useAmpdu ? 12 : 6),
2753 "Incorrect number of successfully received packets");
2787 void DoRun()
override;
2816 :
TestCase(
"Test case for issue #169")
2832 for (uint8_t i = 0; i < numPackets; i++)
2835 packet->AddPacketTag(priorityTag);
2836 sourceDevice->Send(packet, destination, 0);
2846 if (psdus.begin()->second->GetSize() >= 1000)
2849 WifiModulationClass::WIFI_MOD_CLASS_VHT,
2850 "Ideal rate manager selected incorrect modulation class");
2859 int64_t streamNumber = 100;
2863 wifiApNode.Create(1);
2868 phy.SetChannel(channel.Create());
2872 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2876 mac.SetType(
"ns3::ApWifiMac");
2877 apDevice = wifi.Install(phy, mac, wifiApNode);
2880 mac.SetType(
"ns3::StaWifiMac");
2881 staDevice = wifi.Install(phy, mac, wifiStaNode);
2884 wifi.AssignStreams(apDevice, streamNumber);
2885 wifi.AssignStreams(staDevice, streamNumber);
2889 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2890 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2891 mobility.SetPositionAllocator(positionAlloc);
2893 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2894 mobility.Install(wifiApNode);
2895 mobility.Install(wifiStaNode);
2897 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2906 staDevice.
Get(0)->GetAddress(),
2915 staDevice.
Get(0)->GetAddress(),
2944 void DoRun()
override;
2982 :
TestCase(
"Test case for use of channel bonding with Ideal rate manager")
2993 Config::Set(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
2994 StringValue(
"{0, " + std::to_string(channelWidth) +
", BAND_5GHZ, 0}"));
3001 sourceDevice->Send(packet, destination, 0);
3010 if (psduMap.begin()->second->GetSize() >= 1000)
3021 "Last selected WifiMode "
3022 <<
m_txMode <<
" does not match expected WifiMode " << expectedMode);
3030 int64_t streamNumber = 100;
3034 wifiApNode.Create(1);
3039 phy.SetChannel(channel.Create());
3043 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3047 mac.SetType(
"ns3::ApWifiMac");
3048 apDevice = wifi.Install(phy, mac, wifiApNode);
3051 mac.SetType(
"ns3::StaWifiMac");
3052 staDevice = wifi.Install(phy, mac, wifiStaNode);
3055 wifi.AssignStreams(apDevice, streamNumber);
3056 wifi.AssignStreams(staDevice, streamNumber);
3060 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3061 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3062 mobility.SetPositionAllocator(positionAlloc);
3064 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3065 mobility.Install(wifiApNode);
3066 mobility.Install(wifiStaNode);
3068 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3080 staDevice.
Get(0)->GetAddress());
3096 staDevice.
Get(0)->GetAddress());
3112 staDevice.
Get(0)->GetAddress());
3139 void DoRun()
override;
3188 :
TestCase(
"Test case for use of imbalanced MIMO settings with Ideal rate manager")
3199 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3201 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3203 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3210 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3212 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3214 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3222 sourceDevice->Send(packet, destination, 0);
3231 if (psdus.begin()->second->GetSize() >= 1000)
3243 <<
" does not match expected Nss " << expectedNss);
3252 <<
" does not match expected WifiMode "
3261 int64_t streamNumber = 100;
3265 wifiApNode.Create(1);
3270 phy.SetChannel(channel.Create());
3274 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3278 mac.SetType(
"ns3::ApWifiMac");
3279 apDevice = wifi.Install(phy, mac, wifiApNode);
3282 mac.SetType(
"ns3::StaWifiMac");
3283 staDevice = wifi.Install(phy, mac, wifiStaNode);
3286 wifi.AssignStreams(apDevice, streamNumber);
3287 wifi.AssignStreams(staDevice, streamNumber);
3291 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3292 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3293 mobility.SetPositionAllocator(positionAlloc);
3295 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3296 mobility.Install(wifiApNode);
3297 mobility.Install(wifiStaNode);
3299 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3311 staDevice.
Get(0)->GetAddress());
3316 staDevice.
Get(0)->GetAddress());
3334 staDevice.
Get(0)->GetAddress());
3339 staDevice.
Get(0)->GetAddress());
3358 staDevice.
Get(0)->GetAddress());
3363 staDevice.
Get(0)->GetAddress());
3381 staDevice.
Get(0)->GetAddress());
3386 staDevice.
Get(0)->GetAddress());
3405 staDevice.
Get(0)->GetAddress());
3410 staDevice.
Get(0)->GetAddress());
3430 staDevice.
Get(0)->GetAddress());
3435 staDevice.
Get(0)->GetAddress());
3453 staDevice.
Get(0)->GetAddress());
3458 staDevice.
Get(0)->GetAddress());
3477 staDevice.
Get(0)->GetAddress());
3482 staDevice.
Get(0)->GetAddress());
3502 staDevice.
Get(0)->GetAddress());
3507 staDevice.
Get(0)->GetAddress());
3524 staDevice.
Get(0)->GetAddress());
3562 uint16_t guardInterval,
3563 uint16_t expectedDataRate);
3564 void DoRun()
override;
3568 :
TestCase(
"Check data rates for different RU types.")
3576 uint16_t guardInterval,
3577 uint16_t expectedDataRate)
3581 uint64_t dataRate = round(mode.
GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3583 if (
static_cast<uint16_t
>(dataRate) != expectedDataRate)
3585 std::cerr <<
"RU=" << ruType <<
" mode=" << mode <<
" Nss=" << +nss
3586 <<
" guardInterval=" << guardInterval <<
" expected=" << expectedDataRate
3588 <<
" computed=" <<
static_cast<uint16_t
>(dataRate) <<
" x100kbps" << std::endl;
3616 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3628 "Data rate verification for RUs above 52-tone RU (included) failed");
3633 std::tuple<SupportedRates, std::optional<ExtendedSupportedRatesIE>, std::vector<Ssid>>;
3667 .SetGroupName(
"Wifi")
3691 void DoRun()
override;
3717 "Expected a SupportedRates IE to be included");
3720 "Expected no ExtendedSupportedRatesIE to be included");
3737 "Expected a SupportedRates IE to be included");
3740 "Expected an ExtendedSupportedRatesIE to be included");
3746 Ssid one(
"Ssid One");
3747 frame.Get<
Ssid>().push_back(one);
3751 "Expected a SupportedRates IE to be included");
3754 "Expected an ExtendedSupportedRatesIE to be included");
3763 frame.Get<
Ssid>().emplace_back(
"Ssid Two");
3767 "Expected a SupportedRates IE to be included");
3770 "Expected an ExtendedSupportedRatesIE to be included");
3774 "Incorrect first SSID");
3777 "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< WifiSpectrumBand, 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.