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/ht-configuration.h"
31 #include "ns3/interference-helper.h"
32 #include "ns3/mgt-headers.h"
33 #include "ns3/mobility-helper.h"
34 #include "ns3/multi-model-spectrum-channel.h"
35 #include "ns3/packet-socket-client.h"
36 #include "ns3/packet-socket-helper.h"
37 #include "ns3/packet-socket-server.h"
38 #include "ns3/pointer.h"
39 #include "ns3/propagation-loss-model.h"
40 #include "ns3/rng-seed-manager.h"
41 #include "ns3/socket.h"
42 #include "ns3/spectrum-wifi-helper.h"
43 #include "ns3/string.h"
45 #include "ns3/vht-phy.h"
46 #include "ns3/waypoint-mobility-model.h"
47 #include "ns3/wifi-default-ack-manager.h"
48 #include "ns3/wifi-default-assoc-manager.h"
49 #include "ns3/wifi-default-protection-manager.h"
50 #include "ns3/wifi-net-device.h"
51 #include "ns3/wifi-ppdu.h"
52 #include "ns3/wifi-psdu.h"
53 #include "ns3/wifi-spectrum-signal-parameters.h"
54 #include "ns3/yans-error-rate-model.h"
55 #include "ns3/yans-wifi-helper.h"
56 #include "ns3/yans-wifi-phy.h"
65 int64_t currentStream = stream;
67 if (!
mac->GetQosSupported())
69 mac->GetAttribute(
"Txop", ptr);
75 mac->GetAttribute(
"VO_Txop", ptr);
79 mac->GetAttribute(
"VI_Txop", ptr);
83 mac->GetAttribute(
"BE_Txop", ptr);
87 mac->GetAttribute(
"BK_Txop", ptr);
104 void DoRun()
override;
145 auto mobility = CreateObject<ConstantPositionMobilityModel>();
146 auto phy = CreateObject<YansWifiPhy>();
148 phy->SetInterferenceHelper(interferenceHelper);
149 auto error = CreateObject<YansErrorRateModel>();
150 phy->SetErrorRateModel(error);
160 mac->SetAddress(Mac48Address::Allocate());
163 if (
mac->GetTypeOfStation() ==
STA)
165 StaticCast<StaWifiMac>(
mac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
167 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
170 protectionManager->SetWifiMac(
mac);
171 fem->SetProtectionManager(protectionManager);
173 ackManager->SetWifiMac(
mac);
174 fem->SetAckManager(ackManager);
188 channel->SetPropagationDelayModel(propDelay);
189 channel->SetPropagationLossModel(propLoss);
195 Simulator::Stop(
Seconds(10.0));
198 Simulator::Destroy();
251 "2047 is new in comparison to 0");
259 "0 is new in comparison to 4095");
265 "2047 is old in comparison to 4095");
269 "4095 is new in comparison to 2048");
273 "0 is new in comparison to 2049");
285 void DoRun()
override;
312 :
TestCase(
"InterferenceHelperSequence")
337 auto mobility = CreateObject<ConstantPositionMobilityModel>();
338 auto phy = CreateObject<YansWifiPhy>();
340 phy->SetInterferenceHelper(interferenceHelper);
341 auto error = CreateObject<YansErrorRateModel>();
342 phy->SetErrorRateModel(error);
353 mac->SetAddress(Mac48Address::Allocate());
356 mac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
359 protectionManager->SetWifiMac(
mac);
360 fem->SetProtectionManager(protectionManager);
362 ackManager->SetWifiMac(
mac);
363 fem->SetAckManager(ackManager);
381 channel->SetPropagationDelayModel(propDelay);
382 channel->SetPropagationLossModel(propLoss);
392 propLoss->SetDefaultLoss(999);
394 Simulator::Schedule(
Seconds(1.0),
397 DynamicCast<WifiNetDevice>(senderB->
GetDevice(0)));
399 Simulator::Schedule(
Seconds(1.0000001),
402 DynamicCast<WifiNetDevice>(rxOnly->
GetDevice(0)));
404 Simulator::Schedule(
Seconds(5.0),
407 DynamicCast<WifiNetDevice>(senderA->
GetDevice(0)));
409 Simulator::Schedule(
Seconds(7.0),
412 DynamicCast<WifiNetDevice>(senderB->
GetDevice(0)));
414 Simulator::Stop(
Seconds(100.0));
417 Simulator::Destroy();
476 void DoRun()
override;
502 :
TestCase(
"Test case for DCF immediate access with broadcast frames")
536 RngSeedManager::SetSeed(1);
537 RngSeedManager::SetRun(40);
542 channel->SetPropagationDelayModel(propDelay);
543 channel->SetPropagationLossModel(propLoss);
563 txMobility->SetPosition(Vector(0.0, 0.0, 0.0));
571 txMac->SetAddress(Mac48Address::Allocate());
574 txMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
575 auto fem = txMac->GetFrameExchangeManager();
576 auto protectionManager = CreateObject<WifiDefaultProtectionManager>();
577 protectionManager->SetWifiMac(txMac);
578 fem->SetProtectionManager(protectionManager);
579 auto ackManager = CreateObject<WifiDefaultAckManager>();
580 ackManager->SetWifiMac(txMac);
581 fem->SetAckManager(ackManager);
593 Simulator::Schedule(
Seconds(1.0),
604 Simulator::Destroy();
614 uint32_t expectedWait1 = 1408 + (1 * 9) + 16 + (2 * 9);
615 Time expectedSecondTransmissionTime =
616 expectedFirstTransmissionTime +
MicroSeconds(expectedWait1);
618 expectedFirstTransmissionTime,
619 "The first transmission time not correct!");
622 expectedSecondTransmissionTime,
623 "The second transmission time not correct!");
645 void DoRun()
override;
660 :
TestCase(
"Test case for Bug 730"),
695 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
716 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
717 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
718 mobility.SetPositionAllocator(positionAlloc);
720 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
734 packetSocket.
Install(wifiStaNode);
739 client->SetRemote(socket);
741 client->SetStartTime(
Seconds(1));
742 client->SetStopTime(
Seconds(51.0));
745 server->SetLocal(socket);
747 server->SetStartTime(
Seconds(0.0));
748 server->SetStopTime(
Seconds(52.0));
750 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
753 Simulator::Schedule(
Seconds(10.0),
755 "/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
761 Simulator::Destroy();
767 "packet reception unexpectedly stopped after adapting fragmentation threshold!");
784 void DoRun()
override;
808 :
TestCase(
"Test case for fragmentation with QoS stations"),
854 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
"DataMode",
StringValue(
"HtMcs7"));
871 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
872 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
873 mobility.SetPositionAllocator(positionAlloc);
875 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
889 socket.SetPhysicalAddress(ap_device->
GetAddress());
890 socket.SetProtocol(1);
894 packetSocket.
Install(wifiStaNode);
900 client->SetRemote(socket);
902 client->SetStartTime(
Seconds(1));
903 client->SetStopTime(
Seconds(3.0));
906 server->SetLocal(socket);
908 server->SetStartTime(
Seconds(0.0));
909 server->SetStopTime(
Seconds(4.0));
911 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
914 Config::Set(
"/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
922 Simulator::Destroy();
939 void DoRun()
override;
951 :
TestCase(
"Test case for setting WifiPhy channel and frequency")
977 ssid =
Ssid(
"wifi-phy-configuration");
979 macSta.
SetType(
"ns3::StaWifiMac",
991 phySta = CreateObject<YansWifiPhy>();
995 "default configuration");
1001 wifi.SetRemoteStationManager(
"ns3::ArfWifiManager");
1002 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1013 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1024 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1034 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1037 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1042 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1047 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1049 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1058 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1060 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1070 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1071 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_2_4GHZ, 0}"));
1072 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1077 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1082 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1083 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1092 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1094 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1099 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1104 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1106 phy.Set(
"ChannelSettings",
StringValue(
"{0, 10, BAND_5GHZ, 0}"));
1107 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1112 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1117 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1120 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1125 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1130 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1132 phy.Set(
"ChannelSettings",
StringValue(
"{44, 20, BAND_5GHZ, 0}"));
1133 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1138 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1143 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1144 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1145 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1148 std::ostringstream
path;
1149 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1150 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1155 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1160 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1161 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1162 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1165 std::ostringstream
path;
1166 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1167 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1174 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1179 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1181 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1186 std::ostringstream
path;
1187 path <<
"/NodeList/*/DeviceList/" << staDevice.
Get(0)->GetIfIndex()
1188 <<
"/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelSettings";
1195 phy.Set(
"ChannelSettings",
StringValue(
"{0, 0, BAND_UNSPECIFIED, 0}"));
1200 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1203 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1204 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1206 bool exceptionThrown =
false;
1211 catch (
const std::runtime_error&)
1213 exceptionThrown =
true;
1221 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1223 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1224 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1238 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1240 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1241 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1243 bool exceptionThrown =
false;
1248 catch (
const std::runtime_error&)
1250 exceptionThrown =
true;
1258 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1261 phy.Set(
"ChannelSettings",
StringValue(
"{44, 0, BAND_5GHZ, 0}"));
1262 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1264 bool exceptionThrown =
false;
1269 catch (
const std::runtime_error&)
1271 exceptionThrown =
true;
1280 exceptionThrown =
false;
1285 catch (
const std::runtime_error&)
1287 exceptionThrown =
true;
1299 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1300 phy.Set(
"ChannelSettings",
StringValue(
"{40, 0, BAND_5GHZ, 0}"));
1302 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1309 staDevice =
wifi.Install(
phy, macSta, wifiStaNode.
Get(0));
1326 bool exceptionThrown =
false;
1331 catch (
const std::runtime_error&)
1333 exceptionThrown =
true;
1342 exceptionThrown =
false;
1347 catch (
const std::runtime_error&)
1349 exceptionThrown =
true;
1358 Simulator::Destroy();
1375 void DoRun()
override;
1389 :
TestCase(
"Test case for Bug 2222"),
1390 m_countInternalCollisions(0)
1412 RngSeedManager::SetSeed(1);
1413 RngSeedManager::SetRun(1);
1414 int64_t streamNumber = 100;
1424 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1434 wifiDevices =
wifi.Install(
phy,
mac, wifiNodes);
1437 wifi.AssignStreams(wifiDevices, streamNumber);
1442 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1443 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
1444 mobility.SetPositionAllocator(positionAlloc);
1446 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1458 packetSocket.
Install(wifiNodes);
1461 clientLowPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1462 clientLowPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1463 clientLowPriority->SetAttribute(
"Priority",
UintegerValue(4));
1464 clientLowPriority->SetRemote(socket);
1466 clientLowPriority->SetStartTime(
Seconds(0.0));
1467 clientLowPriority->SetStopTime(
Seconds(1.0));
1470 clientHighPriority->SetAttribute(
"PacketSize",
UintegerValue(1460));
1471 clientHighPriority->SetAttribute(
"MaxPackets",
UintegerValue(1));
1472 clientHighPriority->SetAttribute(
"Priority",
UintegerValue(6));
1473 clientHighPriority->SetRemote(socket);
1475 clientHighPriority->SetStartTime(
Seconds(0.0));
1476 clientHighPriority->SetStopTime(
Seconds(1.0));
1479 server->SetLocal(socket);
1481 server->SetStartTime(
Seconds(0.0));
1482 server->SetStopTime(
Seconds(1.0));
1484 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxDataFailed",
1487 Simulator::Stop(
Seconds(1.0));
1489 Simulator::Destroy();
1493 "unexpected number of internal collisions!");
1514 void DoRun()
override;
1521 typedef std::tuple<double, uint16_t, uint32_t, WifiModulationClass>
1523 std::vector<FreqWidthSubbandModulationTuple>
1548 :
TestCase(
"Test case for Bug 2843"),
1563 double startingFreq = c->
Begin()->fl;
1567 DynamicCast<WifiSpectrumSignalParameters>(txParams);
1576 std::make_tuple(startingFreq,
m_channelWidth, numBands, modulationClass);
1578 for (std::vector<FreqWidthSubbandModulationTuple>::const_iterator it =
m_distinctTuples.begin();
1582 if (*it == tupleForCurrentTx)
1598 for (uint8_t i = 0; i < numPackets; i++)
1601 sourceDevice->Send(pkt, destination, 0);
1608 uint16_t channelWidth = 40;
1619 lossModel->SetFrequency(5.190e9);
1620 spectrumChannel->AddPropagationLossModel(lossModel);
1623 CreateObject<ConstantSpeedPropagationDelayModel>();
1624 spectrumChannel->SetPropagationDelayModel(delayModel);
1628 spectrumPhy.
Set(
"ChannelSettings",
StringValue(
"{38, 40, BAND_5GHZ, 0}"));
1634 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
1643 mac.SetType(
"ns3::StaWifiMac");
1645 staDevice =
wifi.Install(spectrumPhy,
mac, wifiStaNode);
1647 mac.SetType(
"ns3::ApWifiMac");
1653 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1654 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
1655 mobility.SetPositionAllocator(positionAlloc);
1657 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1662 Simulator::Schedule(
Seconds(0.5),
1667 staDevice.
Get(0)->GetAddress());
1668 Simulator::Schedule(
Seconds(0.6),
1673 staDevice.
Get(0)->GetAddress());
1675 Config::Connect(
"/ChannelList/*/$ns3::MultiModelSpectrumChannel/TxSigParams",
1678 Simulator::Stop(
Seconds(0.8));
1681 Simulator::Destroy();
1689 "The starting frequency of the first tuple should be shifted 20 MHz to "
1690 "the right wrt second tuple");
1694 "First tuple's channel width should be 20 MHz");
1697 "First tuple should have 193 subbands (64+DC, 20MHz+DC, inband and 64*2 "
1698 "out-of-band, 20MHz on each side)");
1701 "First tuple should be OFDM");
1705 "Second tuple's channel width should be 40 MHz");
1708 "Second tuple should have 385 subbands (128+DC, 40MHz+DC, inband and "
1709 "128*2 out-of-band, 40MHz on each side)");
1712 "Second tuple should be VHT_OFDM");
1732 void DoRun()
override;
1759 :
TestCase(
"Test case for Bug 2831"),
1761 m_assocRespCount(0),
1762 m_countOperationalChannelWidth20(0),
1763 m_countOperationalChannelWidth40(0)
1799 if (htOperation.has_value() && htOperation->GetStaChannelWidth() > 0)
1815 propDelay.
SetTypeId(
"ns3::ConstantSpeedPropagationDelayModel");
1818 channel->SetPropagationDelayModel(propagationDelay);
1819 channel->SetPropagationLossModel(propagationLoss);
1821 Ptr<Node> apNode = CreateObject<Node>();
1828 manager.
SetTypeId(
"ns3::ConstantRateWifiManager");
1831 auto apMobility = CreateObject<ConstantPositionMobilityModel>();
1832 apMobility->SetPosition(Vector(0.0, 0.0, 0.0));
1835 auto error = CreateObject<YansErrorRateModel>();
1836 m_apPhy = CreateObject<YansWifiPhy>();
1848 mac.SetTypeId(
"ns3::ApWifiMac");
1859 protectionManager->SetWifiMac(apMac);
1860 fem->SetProtectionManager(protectionManager);
1862 ackManager->SetWifiMac(apMac);
1863 fem->SetAckManager(ackManager);
1865 Ptr<Node> staNode = CreateObject<Node>();
1874 staMobility->SetPosition(Vector(1.0, 0.0, 0.0));
1877 m_staPhy = CreateObject<YansWifiPhy>();
1888 mac.SetTypeId(
"ns3::StaWifiMac");
1891 staMac->SetDevice(staDev);
1892 staMac->SetAddress(Mac48Address::Allocate());
1894 StaticCast<StaWifiMac>(staMac)->SetAssocManager(CreateObject<WifiDefaultAssocManager>());
1895 staMac->SetMacQueueScheduler(CreateObject<FcfsWifiQueueScheduler>());
1896 fem = staMac->GetFrameExchangeManager();
1897 protectionManager = CreateObject<WifiDefaultProtectionManager>();
1898 protectionManager->SetWifiMac(staMac);
1899 fem->SetProtectionManager(protectionManager);
1900 ackManager = CreateObject<WifiDefaultAckManager>();
1901 ackManager->SetWifiMac(staMac);
1902 fem->SetAckManager(ackManager);
1904 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyRxBegin",
1909 Simulator::Stop(
Seconds(3.0));
1911 Simulator::Destroy();
1917 "Incorrect operational channel width before channel change");
1920 "Incorrect operational channel width after channel change");
1944 void DoRun()
override;
1975 :
TestCase(
"Test case for StaWifiMac scanning capability")
2008 RngSeedManager::SetSeed(1);
2009 RngSeedManager::SetRun(1);
2010 int64_t streamNumber = 1;
2015 Ptr<Node> apNodeNearest = CreateObject<Node>();
2016 Ptr<Node> staNode = CreateObject<Node>();
2024 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager");
2029 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(
true));
2031 mac.SetType(
"ns3::ApWifiMac",
"BeaconGeneration",
BooleanValue(nearestApBeaconGeneration));
2032 apDeviceNearest =
wifi.Install(
phy,
mac, apNodeNearest);
2035 mac.SetType(
"ns3::StaWifiMac",
"ActiveProbing",
BooleanValue(staActiveProbe));
2039 wifi.AssignStreams(apDevice, streamNumber);
2040 wifi.AssignStreams(apDeviceNearest, streamNumber + 1);
2041 wifi.AssignStreams(staDevice, streamNumber + 2);
2045 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2046 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2047 positionAlloc->Add(Vector(5.0, 5.0, 0.0));
2048 positionAlloc->Add(Vector(6.0, 5.0, 0.0));
2049 mobility.SetPositionAllocator(positionAlloc);
2051 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2056 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::StaWifiMac/Assoc",
2070 DynamicCast<WifiNetDevice>(nearestAp->
GetDevice(0))->GetMac()->GetAddress();
2072 Simulator::Schedule(
Seconds(0.05),
2077 Simulator::Stop(
Seconds(0.2));
2079 Simulator::Destroy();
2083 "STA is associated to the wrong AP");
2090 DynamicCast<WifiNetDevice>(nearestAp->
GetDevice(0))->GetMac()->GetAddress();
2092 Simulator::Stop(
Seconds(0.2));
2094 Simulator::Destroy();
2098 "STA is associated to the wrong AP");
2109 Simulator::Stop(
Seconds(1.5));
2111 Simulator::Destroy();
2114 secondNearestApAddr,
2115 "STA is associated to the wrong AP");
2147 void DoRun()
override;
2172 std::string context,
2189 uint16_t channelFreqMhz,
2230 :
TestCase(
"Test case for Bug 2470"),
2231 m_receivedNormalMpduCount(0),
2232 m_receivedAmpduCount(0),
2233 m_failedActionCount(0),
2234 m_addbaEstablishedCount(0),
2235 m_addbaPendingCount(0),
2236 m_addbaRejectedCount(0),
2237 m_addbaNoReplyCount(0),
2238 m_addbaResetCount(0)
2255 case OriginatorBlockAckAgreement::ESTABLISHED:
2258 case OriginatorBlockAckAgreement::PENDING:
2261 case OriginatorBlockAckAgreement::REJECTED:
2264 case OriginatorBlockAckAgreement::NO_REPLY:
2267 case OriginatorBlockAckAgreement::RESET:
2275 std::string context,
2280 auto psdu = psduMap.begin()->second;
2287 auto uid = psdu->GetPayload(0)->GetUid();
2295 uint16_t channelFreqMhz,
2334 for (uint32_t i = 0; i < numPackets; i++)
2337 sourceDevice->Send(pkt, destination, 0);
2344 RngSeedManager::SetSeed(1);
2345 RngSeedManager::SetRun(1);
2346 int64_t streamNumber = 200;
2359 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
2367 phy.Set(
"ChannelSettings",
StringValue(
"{36, 20, BAND_5GHZ, 0}"));
2368 mac.SetType(
"ns3::ApWifiMac",
"EnableBeaconJitter",
BooleanValue(
false));
2372 mac.SetType(
"ns3::StaWifiMac");
2373 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
2376 wifi.AssignStreams(apDevice, streamNumber);
2377 wifi.AssignStreams(staDevice, streamNumber);
2381 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2382 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2383 mobility.SetPositionAllocator(positionAlloc);
2385 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2389 auto rxErrorModel = CreateObject<ListErrorModel>();
2391 switch (rcvErrorType)
2394 wifiMac = DynamicCast<WifiNetDevice>(apDevice.
Get(0))->GetMac();
2397 wifiMac = DynamicCast<WifiNetDevice>(staDevice.
Get(0))->GetMac();
2400 NS_ABORT_MSG(
"Station type " << +rcvErrorType <<
" cannot be used here");
2405 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/MonitorSnifferRx",
2409 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/BE_Txop/"
2410 "BlockAckManager/AgreementState",
2413 "/DeviceList/*/$ns3::WifiNetDevice/Phys/0/PhyTxPsduBegin",
2416 Simulator::Schedule(
Seconds(0.5),
2421 staDevice.
Get(0)->GetAddress());
2427 staDevice.
Get(0)->GetAddress());
2428 Simulator::Schedule(
Seconds(0.8),
2433 staDevice.
Get(0)->GetAddress());
2439 staDevice.
Get(0)->GetAddress());
2441 Simulator::Stop(
Seconds(1.0));
2443 Simulator::Destroy();
2458 "Receiving incorrect number of normal MPDU packet on subtest 1");
2461 "Receiving incorrect number of A-MPDU packets on subtest 1");
2465 "Incorrect number of times the ADDBA state machine was in "
2466 "established state on subtest 1");
2470 "Incorrect number of times the ADDBA state machine was in pending state on subtest 1");
2474 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 1");
2478 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 1");
2482 "Incorrect number of times the ADDBA state machine was in reset state on subtest 1");
2501 "Receiving incorrect number of normal MPDU packet on subtest 2");
2504 "Receiving incorrect number of A-MPDU packet on subtest 2");
2508 "Incorrect number of times the ADDBA state machine was in "
2509 "established state on subtest 2");
2513 "Incorrect number of times the ADDBA state machine was in pending state on subtest 2");
2517 "Incorrect number of times the ADDBA state machine was in rejected state on subtest 2");
2521 "Incorrect number of times the ADDBA state machine was in no_reply state on subtest 2");
2525 "Incorrect number of times the ADDBA state machine was in reset state on subtest 2");
2553 void DoRun()
override;
2560 void RunOne(
bool useAmpdu);
2589 :
TestCase(
"Test case for issue #40"),
2592 m_txMacFinalDataFailedCount(0)
2609 for (uint8_t i = 0; i < numPackets; i++)
2612 sourceDevice->Send(pkt, destination, 0);
2630 RngSeedManager::SetSeed(1);
2631 RngSeedManager::SetRun(1);
2632 int64_t streamNumber = 100;
2645 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2649 mac.SetType(
"ns3::ApWifiMac");
2653 mac.SetType(
"ns3::StaWifiMac");
2654 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
2657 wifi.AssignStreams(apDevice, streamNumber);
2658 wifi.AssignStreams(staDevice, streamNumber);
2662 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2663 positionAlloc->Add(Vector(10.0, 0.0, 0.0));
2664 mobility.SetPositionAllocator(positionAlloc);
2666 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2669 mobility.SetMobilityModel(
"ns3::WaypointMobilityModel");
2672 Config::Connect(
"/NodeList/*/DeviceList/*/RemoteStationManager/MacTxFinalDataFailed",
2674 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::WifiMac/MacRx",
2694 Simulator::Schedule(
Seconds(0.5),
2699 staDevice.
Get(0)->GetAddress());
2703 Simulator::Schedule(
Seconds(2.0),
2708 staDevice.
Get(0)->GetAddress());
2712 Simulator::Schedule(
Seconds(2.1),
2717 staDevice.
Get(0)->GetAddress());
2718 Simulator::Schedule(
Seconds(2.2),
2723 staDevice.
Get(0)->GetAddress());
2724 Simulator::Schedule(
Seconds(2.3),
2729 staDevice.
Get(0)->GetAddress());
2730 Simulator::Schedule(
Seconds(2.4),
2735 staDevice.
Get(0)->GetAddress());
2736 Simulator::Schedule(
Seconds(2.5),
2741 staDevice.
Get(0)->GetAddress());
2743 Simulator::Stop(
Seconds(3.0));
2747 (useAmpdu ? 14 : 7),
2748 "Incorrect number of transmitted packets");
2750 (useAmpdu ? 12 : 6),
2751 "Incorrect number of successfully received packets");
2754 Simulator::Destroy();
2785 void DoRun()
override;
2814 :
TestCase(
"Test case for issue #169")
2830 for (uint8_t i = 0; i < numPackets; i++)
2834 sourceDevice->Send(packet, destination, 0);
2844 if (psdus.begin()->second->GetSize() >= 1000)
2848 "Ideal rate manager selected incorrect modulation class");
2855 RngSeedManager::SetSeed(1);
2856 RngSeedManager::SetRun(1);
2857 int64_t streamNumber = 100;
2870 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
2874 mac.SetType(
"ns3::ApWifiMac");
2878 mac.SetType(
"ns3::StaWifiMac");
2879 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
2882 wifi.AssignStreams(apDevice, streamNumber);
2883 wifi.AssignStreams(staDevice, streamNumber);
2887 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2888 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2889 mobility.SetPositionAllocator(positionAlloc);
2891 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2895 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
2899 Simulator::Schedule(
Seconds(0.5),
2904 staDevice.
Get(0)->GetAddress(),
2908 Simulator::Schedule(
Seconds(1.0),
2913 staDevice.
Get(0)->GetAddress(),
2916 Simulator::Stop(
Seconds(2.0));
2919 Simulator::Destroy();
2942 void DoRun()
override;
2980 :
TestCase(
"Test case for use of channel bonding with Ideal rate manager")
2991 Config::Set(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelSettings",
2992 StringValue(
"{0, " + std::to_string(channelWidth) +
", BAND_5GHZ, 0}"));
2999 sourceDevice->Send(packet, destination, 0);
3008 if (psduMap.begin()->second->GetSize() >= 1000)
3019 "Last selected WifiMode "
3020 <<
m_txMode <<
" does not match expected WifiMode " << expectedMode);
3026 RngSeedManager::SetSeed(1);
3027 RngSeedManager::SetRun(1);
3028 int64_t streamNumber = 100;
3041 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3045 mac.SetType(
"ns3::ApWifiMac");
3049 mac.SetType(
"ns3::StaWifiMac");
3050 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
3053 wifi.AssignStreams(apDevice, streamNumber);
3054 wifi.AssignStreams(staDevice, streamNumber);
3058 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3059 positionAlloc->Add(Vector(50.0, 0.0, 0.0));
3060 mobility.SetPositionAllocator(positionAlloc);
3062 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3066 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3070 Simulator::Schedule(
Seconds(0.5),
3074 Simulator::Schedule(
Seconds(1.0),
3078 staDevice.
Get(0)->GetAddress());
3080 Simulator::Schedule(
Seconds(1.1),
3083 VhtPhy::GetVhtMcs1());
3086 Simulator::Schedule(
Seconds(1.5),
3090 Simulator::Schedule(
Seconds(2.0),
3094 staDevice.
Get(0)->GetAddress());
3096 Simulator::Schedule(
Seconds(2.1),
3099 VhtPhy::GetVhtMcs3());
3102 Simulator::Schedule(
Seconds(2.5),
3106 Simulator::Schedule(
Seconds(3.0),
3110 staDevice.
Get(0)->GetAddress());
3112 Simulator::Schedule(
Seconds(3.1),
3115 VhtPhy::GetVhtMcs2());
3117 Simulator::Stop(
Seconds(3.2));
3120 Simulator::Destroy();
3137 void DoRun()
override;
3186 :
TestCase(
"Test case for use of imbalanced MIMO settings with Ideal rate manager")
3197 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3199 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3201 Config::Set(
"/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3208 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/Antennas",
3210 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedTxSpatialStreams",
3212 Config::Set(
"/NodeList/1/DeviceList/*/$ns3::WifiNetDevice/Phy/MaxSupportedRxSpatialStreams",
3220 sourceDevice->Send(packet, destination, 0);
3229 if (psdus.begin()->second->GetSize() >= 1000)
3241 <<
" does not match expected Nss " << expectedNss);
3250 <<
" does not match expected WifiMode "
3257 RngSeedManager::SetSeed(1);
3258 RngSeedManager::SetRun(1);
3259 int64_t streamNumber = 100;
3272 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
3276 mac.SetType(
"ns3::ApWifiMac");
3280 mac.SetType(
"ns3::StaWifiMac");
3281 staDevice =
wifi.Install(
phy,
mac, wifiStaNode);
3284 wifi.AssignStreams(apDevice, streamNumber);
3285 wifi.AssignStreams(staDevice, streamNumber);
3289 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
3290 positionAlloc->Add(Vector(40.0, 0.0, 0.0));
3291 mobility.SetPositionAllocator(positionAlloc);
3293 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
3297 Config::Connect(
"/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::WifiPhy/PhyTxPsduBegin",
3305 Simulator::Schedule(
Seconds(1.0),
3309 staDevice.
Get(0)->GetAddress());
3310 Simulator::Schedule(
Seconds(1.1),
3314 staDevice.
Get(0)->GetAddress());
3318 Simulator::Schedule(
Seconds(1.2),
3321 VhtPhy::GetVhtMcs2());
3328 Simulator::Schedule(
Seconds(2.0),
3332 staDevice.
Get(0)->GetAddress());
3333 Simulator::Schedule(
Seconds(2.1),
3337 staDevice.
Get(0)->GetAddress());
3342 Simulator::Schedule(
Seconds(2.2),
3345 VhtPhy::GetVhtMcs3());
3352 Simulator::Schedule(
Seconds(3.0),
3356 staDevice.
Get(0)->GetAddress());
3357 Simulator::Schedule(
Seconds(3.1),
3361 staDevice.
Get(0)->GetAddress());
3365 Simulator::Schedule(
Seconds(3.2),
3368 VhtPhy::GetVhtMcs3());
3375 Simulator::Schedule(
Seconds(4.0),
3379 staDevice.
Get(0)->GetAddress());
3380 Simulator::Schedule(
Seconds(4.1),
3384 staDevice.
Get(0)->GetAddress());
3389 Simulator::Schedule(
Seconds(4.2),
3392 VhtPhy::GetVhtMcs2());
3399 Simulator::Schedule(
Seconds(5.0),
3403 staDevice.
Get(0)->GetAddress());
3404 Simulator::Schedule(
Seconds(5.1),
3408 staDevice.
Get(0)->GetAddress());
3414 Simulator::Schedule(
Seconds(5.2),
3417 VhtPhy::GetVhtMcs3());
3424 Simulator::Schedule(
Seconds(6.0),
3428 staDevice.
Get(0)->GetAddress());
3429 Simulator::Schedule(
Seconds(6.1),
3433 staDevice.
Get(0)->GetAddress());
3437 Simulator::Schedule(
Seconds(6.2),
3440 VhtPhy::GetVhtMcs3());
3447 Simulator::Schedule(
Seconds(7.0),
3451 staDevice.
Get(0)->GetAddress());
3452 Simulator::Schedule(
Seconds(7.1),
3456 staDevice.
Get(0)->GetAddress());
3461 Simulator::Schedule(
Seconds(7.2),
3464 VhtPhy::GetVhtMcs2());
3471 Simulator::Schedule(
Seconds(8.0),
3475 staDevice.
Get(0)->GetAddress());
3476 Simulator::Schedule(
Seconds(8.1),
3480 staDevice.
Get(0)->GetAddress());
3486 Simulator::Schedule(
Seconds(8.2),
3489 VhtPhy::GetVhtMcs3());
3496 Simulator::Schedule(
Seconds(9.0),
3500 staDevice.
Get(0)->GetAddress());
3501 Simulator::Schedule(
Seconds(9.1),
3505 staDevice.
Get(0)->GetAddress());
3510 Simulator::Schedule(
Seconds(9.2),
3513 VhtPhy::GetVhtMcs2());
3518 Simulator::Schedule(
Seconds(10.0),
3522 staDevice.
Get(0)->GetAddress());
3524 Simulator::Schedule(
Seconds(10.1),
3527 VhtPhy::GetVhtMcs2());
3529 Simulator::Stop(
Seconds(10.2));
3531 Simulator::Destroy();
3560 uint16_t guardInterval,
3561 uint16_t expectedDataRate);
3562 void DoRun()
override;
3566 :
TestCase(
"Check data rates for different RU types.")
3574 uint16_t guardInterval,
3575 uint16_t expectedDataRate)
3577 uint16_t approxWidth = HeRu::GetBandwidth(ruType);
3579 uint64_t dataRate = round(mode.
GetDataRate(approxWidth, guardInterval, nss) / 100000.0);
3581 if (
static_cast<uint16_t
>(dataRate) != expectedDataRate)
3583 std::cerr <<
"RU=" << ruType <<
" mode=" << mode <<
" Nss=" << +nss
3584 <<
" guardInterval=" << guardInterval <<
" expected=" << expectedDataRate
3586 <<
" computed=" <<
static_cast<uint16_t
>(dataRate) <<
" x100kbps" << std::endl;
3598 retval = retval &&
CheckDataRate(HeRu::RU_26_TONE,
"HeMcs0", 1, 800, 9) &&
3614 "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed");
3617 retval = retval &&
CheckDataRate(HeRu::RU_52_TONE,
"HeMcs2", 1, 1600, 50) &&
3621 CheckDataRate(HeRu::RU_996_TONE,
"HeMcs5", 1, 3200, 2450) &&
3622 CheckDataRate(HeRu::RU_2x996_TONE,
"HeMcs3", 1, 3200, 2450);
3626 "Data rate verification for RUs above 52-tone RU (included) failed");
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'.
RuType
The different HE Resource Unit (RU) types.
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(Ptr< SpectrumChannel > channel)
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
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.
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.
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.
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.
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.
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.
TypeOfStation
Enumeration for type of station.
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.
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