9#include "ns3/ap-wifi-mac.h"
10#include "ns3/common-info-probe-req-mle.h"
11#include "ns3/config.h"
12#include "ns3/ctrl-headers.h"
13#include "ns3/eht-configuration.h"
14#include "ns3/error-model.h"
15#include "ns3/frame-exchange-manager.h"
17#include "ns3/mac48-address.h"
18#include "ns3/mgt-headers.h"
19#include "ns3/mobility-helper.h"
20#include "ns3/multi-link-element.h"
21#include "ns3/multi-model-spectrum-channel.h"
22#include "ns3/node-container.h"
23#include "ns3/object-factory.h"
24#include "ns3/rng-seed-manager.h"
25#include "ns3/simulator.h"
26#include "ns3/spectrum-helper.h"
27#include "ns3/spectrum-wifi-helper.h"
28#include "ns3/sta-wifi-mac.h"
29#include "ns3/string.h"
32#include "ns3/wifi-mac-header.h"
33#include "ns3/wifi-mac-helper.h"
34#include "ns3/wifi-mac-queue.h"
35#include "ns3/wifi-mode.h"
36#include "ns3/wifi-net-device.h"
37#include "ns3/wifi-phy-common.h"
38#include "ns3/wifi-psdu.h"
39#include "ns3/wifi-tx-vector.h"
40#include "ns3/wifi-utils.h"
75 std::vector<std::string>
apChs{};
114 using ChannelMap = std::map<FrequencyRange, Ptr<MultiModelSpectrumChannel>>;
143 const std::vector<std::string>&
channels,
182 void DoRun()
override;
213 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
229 mac.SetType(
"ns3::ApWifiMac",
238 mac.SetType(
"ns3::StaWifiMac",
251 "Too many streams used (" <<
streamsUsed <<
"), increase the stream increment");
255 "Too many streams used (" <<
streamsUsed <<
"), increase the stream increment");
264 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
271 const std::vector<std::string>&
channels,
282 for (
const auto& [band, channel] :
channelMap)
284 helper.AddChannel(channel, band);
291 auto mac = dev->GetMac();
293 return mac->GetFrameExchangeManager(linkId)->GetAddress();
299 for (uint8_t
idx = 0;
idx < dev->GetNPhys(); ++
idx)
302 "/DeviceList/*/$ns3::WifiNetDevice/Phys/" + std::to_string(
idx) +
315 auto psdu = psduMap.begin()->second;
316 if (psdu->GetHeader(0).IsMgt())
318 m_mgtPsdus.push_back({psdu, txVector, linkId});
362 auto macHdr = psdu->GetHeader(0);
366 "Probe Request transmission link mismatch");
368 auto packet = psdu->GetPayload(0);
374 "Multi-link Element expectation mismatch");
376 if (!
mle.has_value())
390 "Per-STA Profile Link ID mismatch");
398 auto macHdr = psdu->GetHeader(0);
401 "Probe Response expected, actual =" << macHdr);
404 "Probe Response transmission link mismatch");
406 auto packet = psdu->GetPayload(0);
413 "Multi-link Element expectation mismatch");
415 if (!
mle.has_value())
430 "Per-STA Profile Link ID mismatch");
481 using ChCfgVec = std::vector<std::string>;
487 ChCfgVec ap3Links{
"{2, 0, BAND_2_4GHZ, 0}",
"{36, 0, BAND_5GHZ, 0}",
"{1, 0, BAND_6GHZ, 0}"};
488 ChCfgVec clientChCfg{
"{2, 0, BAND_2_4GHZ, 0}",
"{36, 0, BAND_5GHZ, 0}",
"{1, 0, BAND_6GHZ, 0}"};
489 std::vector<ProbeExchTestVector>
vecs{
490 {.name =
"Single link AP, non-AP MLD sends Probe Request on link 2",
493 .isMultiLinkReq =
false,
500 {.name =
"Single link AP, non-AP MLD sends Probe Request on link 1",
503 .isMultiLinkReq =
false,
510 {.name =
"Single link AP, non-AP MLD sends Probe Request on link 0",
513 .isMultiLinkReq =
false,
520 {.name =
"Non-AP MLD sends Multi-Link Probe Request on link 0 requesting a different link",
523 .isMultiLinkReq =
true,
530 {.name =
"Non-AP MLD sends Multi-Link Probe Request with broadcast Addr1 and Addr3",
533 .isMultiLinkReq =
true,
535 .reqLinkIds = {0, 1, 2},
540 {.name =
"Non-AP MLD sends Multi-Link Probe Request on link 2 requesting the same link",
543 .isMultiLinkReq =
true,
550 {.name =
"Non-AP MLD sends Probe Request to AP MLD",
553 .isMultiLinkReq =
false,
560 {.name =
"Non-AP MLD sends Multi-Link Probe Request to AP MLD with 3 links requesting all "
564 .isMultiLinkReq =
true,
566 .reqLinkIds = {0, 1, 2},
570 .respLinkIds = {1, 2}},
571 {.name =
"Non-AP MLD sends Multi-Link Probe Request on link 1 to AP MLD with 2 links "
572 "requesting all links",
575 .isMultiLinkReq =
true,
577 .reqLinkIds = {0, 1},
582 {.name =
"Non-AP MLD sends Multi-Link Probe Request on link 0 to AP MLD with 2 links "
583 "requesting all links",
586 .isMultiLinkReq =
true,
588 .reqLinkIds = {0, 1},
593 {.name =
"Non-AP MLD sends Multi-Link Probe Request with no Per-STA-Profile",
596 .isMultiLinkReq =
true,
602 .respLinkIds = {1, 2}},
603 {.name =
"Non-AP MLD sends Multi-Link Probe Request with broadcast Addr1",
606 .isMultiLinkReq =
true,
608 .reqLinkIds = {1, 2},
613 {.name =
"Duplicate requested Link IDs",
616 .isMultiLinkReq =
true,
618 .reqLinkIds = {0, 1, 1, 2, 2},
622 .respLinkIds = {1, 2}},
Probe Request-Probe Response exchange.
void DoRun() override
Implementation to actually run this TestCase.
ProbeExchTestVector m_testVec
Test vector.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
std::vector< TxPsdu > m_mgtPsdus
Tx PSDUs.
void SetChannels(SpectrumWifiPhyHelper &helper, const std::vector< std::string > &channels, const ChannelMap &channelMap)
Setup the PHY Helper based on input channel settings.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void ValidateTest()
Check expected outcome of test case run.
void ValidateProbeReq(const TxPsdu &txPsdu)
Check Probe Request contents.
void CollectTxTrace(uint8_t linkId, std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Traced callback when FEM passes PSDUs to the PHY.
void SetupDevices()
Setup WifiNetDevices.
void SendProbeReq()
Send Probe Request based on test vector input.
Mac48Address GetLinkMacAddr(Ptr< WifiNetDevice > dev, uint8_t linkId)
Get Link MAC address for input device on specified link.
std::map< FrequencyRange, Ptr< MultiModelSpectrumChannel > > ChannelMap
PHY band-indexed map of spectrum channels.
void SetupTxTrace(Ptr< WifiNetDevice > dev, std::size_t nodeId)
Setup PSDU Tx trace.
void ValidateProbeResp(const TxPsdu &txPsdu)
Check Probe Response contents.
ProbeExchTest(ProbeExchTestVector testVec, std::string testCase)
Constructor.
Ptr< WifiNetDevice > m_apDev
AP MLD WifiNetDevice.
Ptr< WifiNetDevice > m_clientDev
Non-AP MLD WifiNetDevice.
wifi probe exchange Test Suite
AttributeValue implementation for Boolean.
static Mac48Address GetBroadcast()
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
AttributeValue implementation for Ssid.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
create MAC layers for a ns3::WifiNetDevice.
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void Connect(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ
Identifier for the frequency range covering the wifi spectrum in the 6 GHz band.
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...
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
information on transmitted PSDU
Ptr< const WifiPsdu > psdu
WifiPsdu.
uint8_t linkId
Tx link ID.
WifiTxVector txVec
TXVECTOR.
Parameters and expected results for a test case.
LinkIds respLinkIds
Expected link IDs included in Multi-link Probe Response if any.
bool addr3Bcast
Flag for Probe Request ADDR3 broadcast.
bool addr1Bcast
Flag for Probe Request ADDR1 broadcast.
std::vector< std::string > clientChs
Non-AP MLD channels.
std::vector< std::string > apChs
AP MLD channels.
bool isMultiLinkReq
Send Multi-link Prpbe Req.
std::string name
Test case name.
LinkIds reqLinkIds
Link IDs included in Multi-link Probe Request if any.
uint8_t reqTxLinkId
Probe Request Tx Link ID.
uint8_t respTxLinkId
Probe Response Tx Link ID.
std::vector< uint8_t > LinkIds
Link identifiers.
const auto DEFAULT_STREAM_INDEX
const auto DEFAULT_PROBE_REQ_TX_TIME
const auto DEFAULT_RNG_RUN
const auto DEFAULT_MULTI_LINK_PROBE_REQ
const uint8_t DEFAULT_AP_MLD_ID
const auto DEFAULT_PROBE_REQ_ADDR3_BCAST
static ProbeExchTestSuite g_probeExchTestSuite
const auto DEFAULT_DATA_MODE
const auto DEFAULT_PROBE_REQ_ADDR1_BCAST
const auto DEFAULT_RNG_SEED
const auto DEFAULT_CONTROL_MODE
const auto DEFAULT_WIFI_STANDARD
const auto DEFAULT_SIM_STOP_TIME
const uint64_t DEFAULT_STREAM_INCREMENT
const uint8_t DEFAULT_PRB_EXCH_LINK_ID