7#include "ns3/ap-wifi-mac.h"
9#include "ns3/attribute-container.h"
10#include "ns3/boolean.h"
12#include "ns3/error-model.h"
14#include "ns3/mac48-address.h"
15#include "ns3/mgt-action-headers.h"
16#include "ns3/mgt-headers.h"
17#include "ns3/mobility-helper.h"
18#include "ns3/node-container.h"
19#include "ns3/object-factory.h"
20#include "ns3/rng-seed-manager.h"
21#include "ns3/simulator.h"
22#include "ns3/spectrum-helper.h"
23#include "ns3/string.h"
26#include "ns3/wifi-mac-header.h"
27#include "ns3/wifi-mac-helper.h"
28#include "ns3/wifi-net-device.h"
29#include "ns3/wifi-psdu.h"
30#include "ns3/wifi-utils.h"
31#include "ns3/yans-wifi-helper.h"
32#include "ns3/yans-wifi-phy.h"
63static const auto DEFAULT_SSID =
"01234567890123456789012345678901";
149 std::optional<FilsDiscHeader>
GetFilsDiscFrame(
const PsduCapture& psduCapt);
153 void DoRun()
override;
177 phy.SetChannel(channel);
184 phy.Set(
"ChannelSettings", channelValue);
190 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager");
194 mac.SetType(
"ns3::ApWifiMac",
201 "FdBeaconInterval6GHz",
203 "SendUnsolProbeResp",
208 mac.SetType(
"ns3::StaWifiMac",
214 auto testDevs = wifi.Install(phy, mac, node);
217 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
218 mobility.Install(node);
248 auto phy =
m_ap->GetPhy();
249 phy->TraceConnectWithoutContext(
"PhyTxPsduBegin",
261 "Number of FILS or Unsolicited Response Frames per Beacon Interval is not expected");
281 "Timing of FILS or Unsolicited Response frames is not as expected at time "
285std::optional<FilsDiscHeader>
290 pkt->RemoveHeader(actionHdr);
295 pkt->PeekHeader(filsDisc);
306 auto hdr = psduCapt.psdu->GetHeader(0);
317 else if (hdr.IsAction())
339 "FILS Discovery frame channel width mismatch");
342 "FILS Discovery frame NSS mismatch");
345 "FILS Discovery frame PHY idx mismatch");
389 params.expChWidFld = 0;
390 params.expNssFld = 0;
394 params.ssid =
"BW20MHZ_NSS3";
396 params.filsIntrvl = 15 *
WIFI_TU;
397 params.expChWidFld = 0;
398 params.expNssFld = 2;
402 params.ssid =
"BW40MHZ_NSS2";
404 params.filsIntrvl = 10 *
WIFI_TU;
405 params.expChWidFld = 1;
406 params.expNssFld = 1;
410 params.ssid =
"BW80MHZ_NSS2";
412 params.filsIntrvl = 7 *
WIFI_TU;
413 params.expChWidFld = 2;
414 params.expNssFld = 1;
418 params.ssid =
"BW160MHZ_NSS2";
420 params.filsIntrvl = 5 *
WIFI_TU;
421 params.expChWidFld = 3;
422 params.expNssFld = 1;
426 params.ssid =
"BW160MHZ_NSS2";
428 params.unsolProbeRespEn =
true;
429 params.expChWidFld = 3;
430 params.expNssFld = 1;
451 std::vector<WifiFilsFrameTestParams> testCases{
459 for (
const auto& tc : testCases)
Ptr< WifiNetDevice > m_ap
AP device.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< WifiNetDevice > m_client
Client device.
void PsduTxCallback(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
callback connected to PSDU TX begin trace source
Ptr< WifiNetDevice > SetupDevice(Ptr< YansWifiChannel > &channel, bool isAp)
setup a WifiNetDevice
std::vector< PsduCapture > m_txPsdus
TX PSDUS frame infos.
void ValidateCnt(const PsduCapture &psduCapt)
Check the number of FILS Discovery frames or unsolicited Probe Response frames transmitted since the ...
void ValidateTiming(const PsduCapture &psduCapt)
check the timing of the transmitted FILS Discovery or unsolicited Probe Response
TimeStats m_timeStats
collected timing statistic
void ValidateFilsDiscFrame(const FilsDiscHeader &filsDisc)
validate the given FILS Discovery frame
void ValidateTest()
check the correctness of the test
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
WifiFilsFrameTest(const WifiFilsFrameTestParams ¶ms)
constructor
WifiFilsFrameTestParams m_params
Test parameters.
std::optional< FilsDiscHeader > GetFilsDiscFrame(const PsduCapture &psduCapt)
Get the FILS Discovery header, if present in the given frame.
WiFi FILS frame Test Suite.
A container for one type of attribute.
void Set(const T &c)
Copy items from container c.
Helper class used to assign positions and mobility models to nodes.
Keep track of the current position and velocity of an object.
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.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
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 void Destroy()
Execute the events scheduled with ScheduleDestroy().
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
The IEEE 802.11 SSID Information Element.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
int64_t GetTimeStep() const
Get the raw time value, in the current resolution unit.
AttributeValue implementation for Tuple.
Hold an unsigned integer type.
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.
std::vector< ChannelTuple > ChannelSegments
segments identifying an operating channel
Ptr< const Packet > GetPayload(std::size_t i) const
Get the payload of the i-th MPDU.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Ptr< YansWifiChannel > Create() const
Make it easy to create and manage PHY objects for the YANS model.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
const Time WIFI_TU
Wi-Fi Time Unit (see IEEE 802.11-2020 sec. 3.1)
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...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Ptr< const WifiPsdu > psdu
PSDU.
Timing statistic for test validation.
Time filsOrUnsolProbeRespTimeDelta
time between last FILS Discovery or Unsolicited Probe Response and last Beacon
Time bcnTimeSt
last Beacon timestamp
Time filsOrUnsolProbeRespTimeSt
last FILS Discovery or Unsolicited Probe Response timestamp
size_t cntFilsOrUnsolProbeResps
FILS Discovery or Unsolicited Probe Response count.
size_t cntBcns
Beacon frames count.
Wi-Fi FILS frame test parameters.
Time filsIntrvl
Time between FILS frames.
uint8_t nss
Number of spatial streams.
std::string ssid
SSID name.
uint8_t expNssFld
Expected NSS field.
bool unsolProbeRespEn
Unsolicited Probe Response enable.
Time bcnIntrvl
Time between Beacons.
MHz_u bw
Operation bandwidth.
uint8_t expChWidFld
Expected Channel Width field.
static const auto DEFAULT_SSID
static const auto DUMMY_AP_ADDR
static const auto DEFAULT_UNSOL_PROBE_RESP_EN
static const auto DEFAULT_BANDWIDTH
Fast Initial Link Setup (FILS) frame Test Suite Test suite intended to test (de)serialization and tim...
static const uint8_t WIFI_6GHZ_FD_PHY_IDX
static const auto DEFAULT_STREAM_INDEX
static const auto DEFAULT_STANDARD
static const auto INVALID_CHAN_NUM
WifiFilsFrameTestCase
Testcases for FILS frame test.
static const auto DEFAULT_RNG_RUN
static const auto DEFAULT_PRIMARY_INDEX
static WifiFilsFrameTestSuite g_WifiFilsFrameTestSuite
static const auto DEFAULT_BCN_INTRVL
static const auto DEFAULT_AP_LOC
static const auto DEFAULT_OUTDIR
static const auto DEFAULT_CLIENT_LOC
static const auto DEFAULT_BAND
WifiFilsFrameTestParams WifiFilsFrameTestBuildCase(const WifiFilsFrameTestCase &tc)
static const auto DEFAULT_ENABLE_PCAP
static const auto DEFAULT_TIMING_TOLERANCE
static const auto DEFAULT_FILS_INTRVL
static const auto DEFAULT_RNG_SEED
static const auto DEFAULT_PCAP_PREFIX
static const auto DEFAULT_SIM_STOP_TIME