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);
79 mac->GetAttribute(
"VO_Txop", ptr);
83 mac->GetAttribute(
"VI_Txop", ptr);
87 mac->GetAttribute(
"BE_Txop", ptr);
91 mac->GetAttribute(
"BK_Txop", ptr);
108 void DoRun()
override;
149 auto mobility = CreateObject<ConstantPositionMobilityModel>();
150 auto phy = CreateObject<YansWifiPhy>();
152 phy->SetInterferenceHelper(interferenceHelper);
153 auto error = CreateObject<YansErrorRateModel>();
154 phy->SetErrorRateModel(error);
164 mac->SetAddress(Mac48Address::Allocate());
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);
192 channel->SetPropagationDelayModel(propDelay);
193 channel->SetPropagationLossModel(propLoss);
199 Simulator::Stop(
Seconds(10.0));
202 Simulator::Destroy();
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")
341 auto mobility = CreateObject<ConstantPositionMobilityModel>();
342 auto phy = CreateObject<YansWifiPhy>();
344 phy->SetInterferenceHelper(interferenceHelper);
345 auto error = CreateObject<YansErrorRateModel>();
346 phy->SetErrorRateModel(error);
357 mac->SetAddress(Mac48Address::Allocate());
360 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
363 protectionManager->SetWifiMac(
mac);
364 fem->SetProtectionManager(protectionManager);
366 ackManager->SetWifiMac(
mac);
367 fem->SetAckManager(ackManager);
385 channel->SetPropagationDelayModel(propDelay);
386 channel->SetPropagationLossModel(propLoss);
396 propLoss->SetDefaultLoss(999);
398 Simulator::Schedule(
Seconds(1.0),
401 DynamicCast<WifiNetDevice>(senderB->
GetDevice(0)));
403 Simulator::Schedule(
Seconds(1.0000001),
406 DynamicCast<WifiNetDevice>(rxOnly->
GetDevice(0)));
408 Simulator::Schedule(
Seconds(5.0),
411 DynamicCast<WifiNetDevice>(senderA->
GetDevice(0)));
413 Simulator::Schedule(
Seconds(7.0),
416 DynamicCast<WifiNetDevice>(senderB->
GetDevice(0)));
418 Simulator::Stop(
Seconds(100.0));
421 Simulator::Destroy();
480 void DoRun()
override;
506 :
TestCase(
"Test case for DCF immediate access with broadcast frames")
540 RngSeedManager::SetSeed(1);
541 RngSeedManager::SetRun(40);
546 channel->SetPropagationDelayModel(propDelay);
547 channel->SetPropagationLossModel(propLoss);
567 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
575 txMac->SetAddress(Mac48Address::Allocate());
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);
597 Simulator::Schedule(
Seconds(1.0),
608 Simulator::Destroy();
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"),
699 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
707 mac.SetType(
"ns3::StaWifiMac",
"Ssid", SsidValue(
ssid),
"ActiveProbing",
BooleanValue(
false));
712 mac.SetType(
"ns3::ApWifiMac",
"Ssid", SsidValue(
ssid),
"BeaconGeneration",
BooleanValue(
true));
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");
738 packetSocket.
Install(wifiStaNode);
743 client->SetRemote(socket);
754 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
757 Simulator::Schedule(
Seconds(10.0),
759 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
765 Simulator::Destroy();
771 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
788 void DoRun()
override;
812 :
TestCase(
"Test case for fragmentation with QoS stations"),
858 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
"DataMode",
StringValue(
"HtMcs7"));
862 mac.SetType(
"ns3::StaWifiMac",
"Ssid", SsidValue(
ssid),
"ActiveProbing",
BooleanValue(
false));
867 mac.SetType(
"ns3::ApWifiMac",
"Ssid", SsidValue(
ssid),
"BeaconGeneration",
BooleanValue(
true));
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");
893 socket.SetPhysicalAddress(ap_device->
GetAddress());
894 socket.SetProtocol(1);
898 packetSocket.
Install(wifiStaNode);
904 client->SetRemote(socket);
915 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
918 Config::Set(
"/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
926 Simulator::Destroy();
943 void DoRun()
override;
955 :
TestCase(
"Test case for setting WifiPhy channel and frequency")
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");
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");
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");
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));
1189 std::ostringstream path;
1190 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1191 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1198 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1203 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1206 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1207 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1209 bool exceptionThrown =
false;
1214 catch (
const std::runtime_error&)
1216 exceptionThrown =
true;
1224 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1226 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1227 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1241 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1243 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1244 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1246 bool exceptionThrown =
false;
1251 catch (
const std::runtime_error&)
1253 exceptionThrown =
true;
1261 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1264 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1265 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1267 bool exceptionThrown =
false;
1272 catch (
const std::runtime_error&)
1274 exceptionThrown =
true;
1283 exceptionThrown =
false;
1288 catch (
const std::runtime_error&)
1290 exceptionThrown =
true;
1302 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1303 phy.Set(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1305 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1312 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1329 bool exceptionThrown =
false;
1334 catch (
const std::runtime_error&)
1336 exceptionThrown =
true;
1345 exceptionThrown =
false;
1350 catch (
const std::runtime_error&)
1352 exceptionThrown =
true;
1361 Simulator::Destroy();
1378 void DoRun()
override;
1392 :
TestCase(
"Test case for Bug 2222"),
1393 m_countInternalCollisions(0)
1415 RngSeedManager::SetSeed(1);
1416 RngSeedManager::SetRun(1);
1417 int64_t streamNumber = 100;
1427 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1437 wifiDevices =
wifi.Install(
phy,
mac, wifiNodes);
1440 wifi.AssignStreams(wifiDevices, streamNumber);
1445 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1446 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1447 mobility.SetPositionAllocator(positionAlloc);
1449 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1461 packetSocket.
Install(wifiNodes);
1464 clientLowPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1465 clientLowPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1466 clientLowPriority->SetAttribute(
"Priority",
UintegerValue(4));
1467 clientLowPriority->SetRemote(socket);
1469 clientLowPriority->SetStartTime(
Seconds(0.0));
1470 clientLowPriority->SetStopTime(
Seconds(1.0));
1473 clientHighPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1474 clientHighPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1475 clientHighPriority->SetAttribute(
"Priority",
UintegerValue(6));
1476 clientHighPriority->SetRemote(socket);
1478 clientHighPriority->SetStartTime(
Seconds(0.0));
1479 clientHighPriority->SetStopTime(
Seconds(1.0));
1482 server->SetLocal(socket);
1487 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1490 Simulator::Stop(
Seconds(1.0));
1492 Simulator::Destroy();
1496 "unexpected number of internal collisions!");
1517 void DoRun()
override;
1524 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1526 std::vector<FreqWidthSubbandModulationTuple>
1551 :
TestCase(
"Test case for Bug 2843"),
1566 double startingFreq = c->
Begin()->fl;
1570 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1579 std::make_tuple(startingFreq,
m_channelWidth, numBands, modulationClass);
1583 if (*it == tupleForCurrentTx)
1599 for (uint8_t i = 0; i < numPackets; i++)
1602 sourceDevice->Send(pkt, destination, 0);
1609 uint16_t channelWidth = 40;
1620 lossModel->SetFrequency(5.190e9);
1621 spectrumChannel->AddPropagationLossModel(lossModel);
1624 CreateObject<ConstantSpeedPropagationDelayModel>();
1625 spectrumChannel->SetPropagationDelayModel(delayModel);
1629 spectrumPhy.
Set(
"ChannelSettings",
StringValue(
"{38, 40, BAND_5GHZ, 0}"));
1635 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1644 mac.SetType(
"ns3::StaWifiMac");
1646 staDevice =
wifi.Install(spectrumPhy,
mac, wifiStaNode);
1648 mac.SetType(
"ns3::ApWifiMac");
1654 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1655 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
1656 mobility.SetPositionAllocator(positionAlloc);
1658 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1663 Simulator::Schedule(
Seconds(0.5),
1668 staDevice.
Get(0)->GetAddress());
1669 Simulator::Schedule(
Seconds(0.6),
1674 staDevice.
Get(0)->GetAddress());
1676 Config::Connect(
"/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1679 Simulator::Stop(
Seconds(0.8));
1682 Simulator::Destroy();
1690 "The starting frequency of the first tuple should be shifted 20 MHz to "
1691 "the right wrt second tuple");
1695 "First tuple's channel width should be 20 MHz");
1698 "First tuple should have 193 subbands (64+DC, 20MHz+DC, inband and 64*2 "
1699 "out-of-band, 20MHz on each side)");
1702 "First tuple should be OFDM");
1706 "Second tuple's channel width should be 40 MHz");
1709 "Second tuple should have 385 subbands (128+DC, 40MHz+DC, inband and "
1710 "128*2 out-of-band, 40MHz on each side)");
1713 "Second tuple should be VHT_OFDM");
1733 void DoRun()
override;
1760 :
TestCase(
"Test case for Bug 2831"),
1762 m_assocRespCount(0),
1763 m_countOperationalChannelWidth20(0),
1764 m_countOperationalChannelWidth40(0)
1799 const auto& htOperation = beacon.Get<
HtOperation>();
1800 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1816 propDelay.
SetTypeId(
"ns3::ConstantSpeedPropagationDelayModel");
1819 channel->SetPropagationDelayModel(propagationDelay);
1820 channel->SetPropagationLossModel(propagationLoss);
1822 Ptr<Node> apNode = CreateObject<Node>();
1829 manager.
SetTypeId(
"ns3::ConstantRateWifiManager");
1832 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1833 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1836 auto error = CreateObject<YansErrorRateModel>();
1837 m_apPhy = CreateObject<YansWifiPhy>();
1849 mac.SetTypeId(
"ns3::ApWifiMac");
1860 protectionManager->SetWifiMac(apMac);
1861 fem->SetProtectionManager(protectionManager);
1863 ackManager->SetWifiMac(apMac);
1864 fem->SetAckManager(ackManager);
1866 Ptr<Node> staNode = CreateObject<Node>();
1875 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1878 m_staPhy = CreateObject<YansWifiPhy>();
1889 mac.SetTypeId(
"ns3::StaWifiMac");
1892 staMac->SetDevice(staDev);
1893 staMac->SetAddress(Mac48Address::Allocate());
1895 StaticCast<StaWifiMac>(staMac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
1896 staMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1897 fem = staMac->GetFrameExchangeManager();
1898 protectionManager = CreateObject<WifiDefaultProtectionManager>();
1899 protectionManager->SetWifiMac(staMac);
1900 fem->SetProtectionManager(protectionManager);
1901 ackManager = CreateObject<WifiDefaultAckManager>();
1902 ackManager->SetWifiMac(staMac);
1903 fem->SetAckManager(ackManager);
1905 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1910 Simulator::Stop(
Seconds(3.0));
1912 Simulator::Destroy();
1918 "Incorrect operational channel width before channel change");
1921 "Incorrect operational channel width after channel change");
1945 void DoRun()
override;
1976 :
TestCase(
"Test case for StaWifiMac scanning capability")
2009 RngSeedManager::SetSeed(1);
2010 RngSeedManager::SetRun(1);
2011 int64_t streamNumber = 1;
2016 Ptr<Node> apNodeNearest = CreateObject<Node>();
2017 Ptr<Node> staNode = CreateObject<Node>();
2025 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager");
2030 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
true));
2032 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(nearestApBeaconGeneration));
2033 apDeviceNearest =
wifi.Install(
phy,
mac, apNodeNearest);
2036 mac.SetType(
"ns3::StaWifiMac",
"ActiveProbing",
BooleanValue(staActiveProbe));
2040 wifi.AssignStreams(apDevice, streamNumber);
2041 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2042 wifi.AssignStreams(staDevice, streamNumber + 2);
2046 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2047 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2048 positionAlloc->Add(Vector(5.0, 5.0, 0.0));
2049 positionAlloc->Add(Vector(6.0, 5.0, 0.0));
2050 mobility.SetPositionAllocator(positionAlloc);
2052 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2057 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2071 DynamicCast<WifiNetDevice>(nearestAp->
GetDevice(0))->GetMac()->GetAddress();
2073 Simulator::Schedule(
Seconds(0.05),
2078 Simulator::Stop(
Seconds(0.2));
2080 Simulator::Destroy();
2084 "STA is associated to the wrong AP");
2091 DynamicCast<WifiNetDevice>(nearestAp->
GetDevice(0))->GetMac()->GetAddress();
2093 Simulator::Stop(
Seconds(0.2));
2095 Simulator::Destroy();
2099 "STA is associated to the wrong AP");
2110 Simulator::Stop(
Seconds(1.5));
2112 Simulator::Destroy();
2115 secondNearestApAddr,
2116 "STA is associated to the wrong AP");
2148 void DoRun()
override;
2173 std::string context,
2190 uint16_t channelFreqMhz,
2231 :
TestCase(
"Test case for Bug 2470"),
2232 m_receivedNormalMpduCount(0),
2233 m_receivedAmpduCount(0),
2234 m_failedActionCount(0),
2235 m_addbaEstablishedCount(0),
2236 m_addbaPendingCount(0),
2237 m_addbaRejectedCount(0),
2238 m_addbaNoReplyCount(0),
2239 m_addbaResetCount(0)
2256 case OriginatorBlockAckAgreement::ESTABLISHED:
2259 case OriginatorBlockAckAgreement::PENDING:
2262 case OriginatorBlockAckAgreement::REJECTED:
2265 case OriginatorBlockAckAgreement::NO_REPLY:
2268 case OriginatorBlockAckAgreement::RESET:
2276 std::string context,
2281 auto psdu = psduMap.begin()->second;
2288 auto uid = psdu->GetPayload(0)->GetUid();
2296 uint16_t channelFreqMhz,
2335 for (uint32_t i = 0; i < numPackets; i++)
2338 sourceDevice->Send(pkt, destination, 0);
2345 RngSeedManager::SetSeed(1);
2346 RngSeedManager::SetRun(1);
2347 int64_t streamNumber = 200;
2360 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
2368 phy.Set(
"ChannelSettings",
StringValue(
"{36, 20, BAND_5GHZ, 0}"));
2369 mac.SetType(
"ns3::ApWifiMac",
"EnableBeaconJitter",
BooleanValue(
false));
2373 mac.SetType(
"ns3::StaWifiMac");
2374 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
2377 wifi.AssignStreams(apDevice, streamNumber);
2378 wifi.AssignStreams(staDevice, streamNumber);
2382 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2383 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2384 mobility.SetPositionAllocator(positionAlloc);
2386 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2390 auto rxErrorModel = CreateObject<ListErrorModel>();
2392 switch (rcvErrorType)
2395 wifiMac = DynamicCast<WifiNetDevice>(apDevice.
Get(0))->GetMac();
2398 wifiMac = DynamicCast<WifiNetDevice>(staDevice.
Get(0))->GetMac();
2401 NS_ABORT_MSG(
"Station type " << +rcvErrorType <<
" cannot be used here");
2406 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2410 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2411 "BlockAckManager/AgreementState",
2414 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2417 Simulator::Schedule(
Seconds(0.5),
2422 staDevice.
Get(0)->GetAddress());
2428 staDevice.
Get(0)->GetAddress());
2429 Simulator::Schedule(
Seconds(0.8),
2434 staDevice.
Get(0)->GetAddress());
2440 staDevice.
Get(0)->GetAddress());
2442 Simulator::Stop(
Seconds(1.0));
2444 Simulator::Destroy();
2459 "Receiving incorrect number of normal MPDU packet on subtest 1");
2462 "Receiving incorrect number of A-MPDU packets on subtest 1");
2466 "Incorrect number of times the ADDBA state machine was in "
2467 "established state on subtest 1");
2471 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2475 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2479 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2483 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2502 "Receiving incorrect number of normal MPDU packet on subtest 2");
2505 "Receiving incorrect number of A-MPDU packet on subtest 2");
2509 "Incorrect number of times the ADDBA state machine was in "
2510 "established state on subtest 2");
2514 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2518 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2522 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2526 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2554 void DoRun()
override;
2561 void RunOne(
bool useAmpdu);
2590 :
TestCase(
"Test case for issue #40"),
2593 m_txMacFinalDataFailedCount(0)
2610 for (uint8_t i = 0; i < numPackets; i++)
2613 sourceDevice->Send(pkt, destination, 0);
2631 RngSeedManager::SetSeed(1);
2632 RngSeedManager::SetRun(1);
2633 int64_t streamNumber = 100;
2646 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2650 mac.SetType(
"ns3::ApWifiMac");
2654 mac.SetType(
"ns3::StaWifiMac");
2655 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
2658 wifi.AssignStreams(apDevice, streamNumber);
2659 wifi.AssignStreams(staDevice, streamNumber);
2663 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2664 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2665 mobility.SetPositionAllocator(positionAlloc);
2667 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2670 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel");
2673 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2675 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
2695 Simulator::Schedule(
Seconds(0.5),
2700 staDevice.
Get(0)->GetAddress());
2704 Simulator::Schedule(
Seconds(2.0),
2709 staDevice.
Get(0)->GetAddress());
2713 Simulator::Schedule(
Seconds(2.1),
2718 staDevice.
Get(0)->GetAddress());
2719 Simulator::Schedule(
Seconds(2.2),
2724 staDevice.
Get(0)->GetAddress());
2725 Simulator::Schedule(
Seconds(2.3),
2730 staDevice.
Get(0)->GetAddress());
2731 Simulator::Schedule(
Seconds(2.4),
2736 staDevice.
Get(0)->GetAddress());
2737 Simulator::Schedule(
Seconds(2.5),
2742 staDevice.
Get(0)->GetAddress());
2744 Simulator::Stop(
Seconds(3.0));
2748 (useAmpdu ? 14 : 7),
2749 "Incorrect number of transmitted packets");
2751 (useAmpdu ? 12 : 6),
2752 "Incorrect number of successfully received packets");
2755 Simulator::Destroy();
2786 void DoRun()
override;
2815 :
TestCase(
"Test case for issue #169")
2831 for (uint8_t i = 0; i < numPackets; i++)
2835 sourceDevice->Send(packet, destination, 0);
2845 if (psdus.begin()->second->GetSize() >= 1000)
2849 "Ideal rate manager selected incorrect modulation class");
2856 RngSeedManager::SetSeed(1);
2857 RngSeedManager::SetRun(1);
2858 int64_t streamNumber = 100;
2871 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2875 mac.SetType(
"ns3::ApWifiMac");
2879 mac.SetType(
"ns3::StaWifiMac");
2880 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
2883 wifi.AssignStreams(apDevice, streamNumber);
2884 wifi.AssignStreams(staDevice, streamNumber);
2888 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2889 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2890 mobility.SetPositionAllocator(positionAlloc);
2892 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2896 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2900 Simulator::Schedule(
Seconds(0.5),
2905 staDevice.
Get(0)->GetAddress(),
2909 Simulator::Schedule(
Seconds(1.0),
2914 staDevice.
Get(0)->GetAddress(),
2917 Simulator::Stop(
Seconds(2.0));
2920 Simulator::Destroy();
2943 void DoRun()
override;
2981 :
TestCase(
"Test case for use of channel bonding with Ideal rate manager")
2992 Config::Set(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
3000 sourceDevice->Send(packet, destination, 0);
3009 if (psduMap.begin()->second->GetSize() >= 1000)
3020 "Last selected WifiMode "
3021 <<
m_txMode <<
" does not match expected WifiMode " << expectedMode);
3027 RngSeedManager::SetSeed(1);
3028 RngSeedManager::SetRun(1);
3029 int64_t streamNumber = 100;
3042 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3046 mac.SetType(
"ns3::ApWifiMac");
3050 mac.SetType(
"ns3::StaWifiMac");
3051 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
3054 wifi.AssignStreams(apDevice, streamNumber);
3055 wifi.AssignStreams(staDevice, streamNumber);
3059 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3060 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3061 mobility.SetPositionAllocator(positionAlloc);
3063 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3067 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3071 Simulator::Schedule(
Seconds(0.5),
3075 Simulator::Schedule(
Seconds(1.0),
3079 staDevice.
Get(0)->GetAddress());
3081 Simulator::Schedule(
Seconds(1.1),
3084 VhtPhy::GetVhtMcs1());
3087 Simulator::Schedule(
Seconds(1.5),
3091 Simulator::Schedule(
Seconds(2.0),
3095 staDevice.
Get(0)->GetAddress());
3097 Simulator::Schedule(
Seconds(2.1),
3100 VhtPhy::GetVhtMcs3());
3103 Simulator::Schedule(
Seconds(2.5),
3107 Simulator::Schedule(
Seconds(3.0),
3111 staDevice.
Get(0)->GetAddress());
3113 Simulator::Schedule(
Seconds(3.1),
3116 VhtPhy::GetVhtMcs2());
3118 Simulator::Stop(
Seconds(3.2));
3121 Simulator::Destroy();
3138 void DoRun()
override;
3187 :
TestCase(
"Test case for use of imbalanced MIMO settings with Ideal rate manager")
3198 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3200 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3202 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3209 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3211 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3213 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3221 sourceDevice->Send(packet, destination, 0);
3230 if (psdus.begin()->second->GetSize() >= 1000)
3242 <<
" does not match expected Nss " << expectedNss);
3251 <<
" does not match expected WifiMode "
3258 RngSeedManager::SetSeed(1);
3259 RngSeedManager::SetRun(1);
3260 int64_t streamNumber = 100;
3273 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3277 mac.SetType(
"ns3::ApWifiMac");
3281 mac.SetType(
"ns3::StaWifiMac");
3282 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
3285 wifi.AssignStreams(apDevice, streamNumber);
3286 wifi.AssignStreams(staDevice, streamNumber);
3290 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3291 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3292 mobility.SetPositionAllocator(positionAlloc);
3294 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3298 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3306 Simulator::Schedule(
Seconds(1.0),
3310 staDevice.
Get(0)->GetAddress());
3311 Simulator::Schedule(
Seconds(1.1),
3315 staDevice.
Get(0)->GetAddress());
3319 Simulator::Schedule(
Seconds(1.2),
3322 VhtPhy::GetVhtMcs2());
3329 Simulator::Schedule(
Seconds(2.0),
3333 staDevice.
Get(0)->GetAddress());
3334 Simulator::Schedule(
Seconds(2.1),
3338 staDevice.
Get(0)->GetAddress());
3343 Simulator::Schedule(
Seconds(2.2),
3346 VhtPhy::GetVhtMcs3());
3353 Simulator::Schedule(
Seconds(3.0),
3357 staDevice.
Get(0)->GetAddress());
3358 Simulator::Schedule(
Seconds(3.1),
3362 staDevice.
Get(0)->GetAddress());
3366 Simulator::Schedule(
Seconds(3.2),
3369 VhtPhy::GetVhtMcs3());
3376 Simulator::Schedule(
Seconds(4.0),
3380 staDevice.
Get(0)->GetAddress());
3381 Simulator::Schedule(
Seconds(4.1),
3385 staDevice.
Get(0)->GetAddress());
3390 Simulator::Schedule(
Seconds(4.2),
3393 VhtPhy::GetVhtMcs2());
3400 Simulator::Schedule(
Seconds(5.0),
3404 staDevice.
Get(0)->GetAddress());
3405 Simulator::Schedule(
Seconds(5.1),
3409 staDevice.
Get(0)->GetAddress());
3415 Simulator::Schedule(
Seconds(5.2),
3418 VhtPhy::GetVhtMcs3());
3425 Simulator::Schedule(
Seconds(6.0),
3429 staDevice.
Get(0)->GetAddress());
3430 Simulator::Schedule(
Seconds(6.1),
3434 staDevice.
Get(0)->GetAddress());
3438 Simulator::Schedule(
Seconds(6.2),
3441 VhtPhy::GetVhtMcs3());
3448 Simulator::Schedule(
Seconds(7.0),
3452 staDevice.
Get(0)->GetAddress());
3453 Simulator::Schedule(
Seconds(7.1),
3457 staDevice.
Get(0)->GetAddress());
3462 Simulator::Schedule(
Seconds(7.2),
3465 VhtPhy::GetVhtMcs2());
3472 Simulator::Schedule(
Seconds(8.0),
3476 staDevice.
Get(0)->GetAddress());
3477 Simulator::Schedule(
Seconds(8.1),
3481 staDevice.
Get(0)->GetAddress());
3487 Simulator::Schedule(
Seconds(8.2),
3490 VhtPhy::GetVhtMcs3());
3497 Simulator::Schedule(
Seconds(9.0),
3501 staDevice.
Get(0)->GetAddress());
3502 Simulator::Schedule(
Seconds(9.1),
3506 staDevice.
Get(0)->GetAddress());
3511 Simulator::Schedule(
Seconds(9.2),
3514 VhtPhy::GetVhtMcs2());
3519 Simulator::Schedule(
Seconds(10.0),
3523 staDevice.
Get(0)->GetAddress());
3525 Simulator::Schedule(
Seconds(10.1),
3528 VhtPhy::GetVhtMcs2());
3530 Simulator::Stop(
Seconds(10.2));
3532 Simulator::Destroy();
3561 uint16_t guardInterval,
3562 uint16_t expectedDataRate);
3563 void DoRun()
override;
3567 :
TestCase(
"Check data rates for different RU types.")
3575 uint16_t guardInterval,
3576 uint16_t expectedDataRate)
3578 uint16_t approxWidth = HeRu::GetBandwidth(ruType);
3580 uint64_t dataRate = round(mode.
GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3582 if (
static_cast<uint16_t
>(dataRate) != expectedDataRate)
3584 std::cerr <<
"RU=" << ruType <<
" mode=" << mode <<
" Nss=" << +nss
3585 <<
" guardInterval=" << guardInterval <<
" expected=" << expectedDataRate
3587 <<
" computed=" <<
static_cast<uint16_t
>(dataRate) <<
" x100kbps" << std::endl;
3599 retval = retval &&
CheckDataRate(HeRu::RU_26_TONE,
"HeMcs0", 1, 800, 9) &&
3615 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3618 retval = retval &&
CheckDataRate(HeRu::RU_52_TONE,
"HeMcs2", 1, 1600, 50) &&
3622 CheckDataRate(HeRu::RU_996_TONE,
"HeMcs5", 1, 3200, 2450) &&
3623 CheckDataRate(HeRu::RU_2x996_TONE,
"HeMcs3", 1, 3200, 2450);
3627 "Data rate verification for RUs above 52-tone RU (included) failed");
3632 std::tuple<SupportedRates, std::optional<ExtendedSupportedRatesIE>, std::vector<Ssid>>;
3666 .SetGroupName(
"Wifi")
3690 void DoRun()
override;
3716 "Expected a SupportedRates IE to be included");
3719 "Expected no ExtendedSupportedRatesIE to be included");
3736 "Expected a SupportedRates IE to be included");
3739 "Expected an ExtendedSupportedRatesIE to be included");
3745 Ssid one(
"Ssid One");
3746 frame.Get<
Ssid>().push_back(one);
3750 "Expected a SupportedRates IE to be included");
3753 "Expected an ExtendedSupportedRatesIE to be included");
3762 frame.Get<
Ssid>().emplace_back(
"Ssid Two");
3766 "Expected a SupportedRates IE to be included");
3769 "Expected an ExtendedSupportedRatesIE to be included");
3773 "Incorrect first SSID");
3776 "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
This class can be used to hold variables of floating point type such as 'double' or 'float'.
The Extended Supported Rates Information Element.
RuType
The different HE Resource Unit (RU) types.
The HT Operation Information Element.
void SetList(const std::list< uint64_t > &packetlist)
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 AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
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.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
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.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
State
Represents the state for this agreement.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< Packet > Copy() const
performs a COW copy of the packet.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
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.
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
indicates whether the socket has a priority set.
void SetPriority(uint8_t priority)
Set the tag's priority.
size_t GetNumBands() const
Bands::const_iterator Begin() const
Const Iterator to the model Bands container start.
Ptr< const SpectrumModel > GetSpectrumModel() const
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.
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.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
Vector3D Vector
Vector alias typedef for compatibility with mobility models.
void AddWaypoint(const Waypoint &waypoint)
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.
Ptr< FrameExchangeManager > GetFrameExchangeManager(uint8_t linkId=SINGLE_LINK_OP_ID) const
Get the Frame Exchange Manager associated with the given link.
virtual void SetMacQueueScheduler(Ptr< WifiMacQueueScheduler > scheduler)
Set the wifi MAC queue scheduler.
virtual void SetAddress(Mac48Address address)
virtual void ConfigureStandard(WifiStandard standard)
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
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 SetMac(const Ptr< WifiMac > mac)
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Address GetBroadcast() const override
Ptr< WifiMac > GetMac() const
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
void SetStandard(WifiStandard standard)
Set the Wifi standard.
Ptr< WifiPhy > GetPhy() const
uint32_t GetIfIndex() const override
void SetPhy(const Ptr< WifiPhy > phy)
Address GetAddress() const override
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.
uint16_t GetChannelWidth() const
uint16_t GetFrequency() const
virtual void ConfigureStandard(WifiStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
void SetPostReceptionErrorModel(const Ptr< ErrorModel > em)
Attach a receive ErrorModel to the WifiPhy.
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
uint8_t GetChannelNumber() const
Return current channel number.
virtual void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
void SetMobility(const Ptr< MobilityModel > mobility)
assign a mobility model to this device
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
bool IsSet() const
Return true if a valid channel has been set, false otherwise.
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.
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.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#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.
@ WIFI_MOD_CLASS_OFDM
OFDM (Clause 17)
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
Send one packet.
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
Ptr< SpectrumValue > psd
The Power Spectral Density of the waveform, in linear units.
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.