A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-operating-channel-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
7 */
8
9#include "ns3/he-phy.h"
10#include "ns3/he-ppdu.h"
11#include "ns3/interference-helper.h"
12#include "ns3/log.h"
13#include "ns3/multi-model-spectrum-channel.h"
14#include "ns3/nist-error-rate-model.h"
15#include "ns3/node.h"
16#include "ns3/spectrum-wifi-phy.h"
17#include "ns3/string.h"
18#include "ns3/test.h"
19#include "ns3/wifi-net-device.h"
20#include "ns3/wifi-phy-operating-channel.h"
21#include "ns3/wifi-psdu.h"
22#include "ns3/wifi-utils.h"
23
24using namespace ns3;
25
26NS_LOG_COMPONENT_DEFINE("WifiOperatingChannelTest");
27
28/**
29 * @ingroup wifi-test
30 * @ingroup tests
31 *
32 * @brief Test the WifiPhyOperatingChannel::Set() method.
33 */
35{
36 public:
37 /**
38 * Constructor
39 */
41 ~SetWifiOperatingChannelTest() override = default;
42
43 private:
44 void DoRun() override;
45
46 /**
47 * Run one function.
48 * @param runInfo the string that indicates info about the test case to run
49 * @param segments the info about each frequency segment to set for the operating channel
50 * @param standard the 802.11 standard to consider for the test
51 * @param band the PHY band to consider for the test
52 * @param expectExceptionThrown flag to indicate whether an exception is expected to be thrown
53 * @param expectedWidth the expected width type of the operating channel
54 * @param expectedSegments the info about the expected frequency segments of the operating
55 * channel
56 */
57 void RunOne(const std::string& runInfo,
58 const std::vector<FrequencyChannelInfo>& segments,
59 WifiStandard standard,
60 WifiPhyBand band,
61 bool expectExceptionThrown,
62 WifiChannelWidthType expectedWidth = WifiChannelWidthType::UNKNOWN,
63 const std::vector<FrequencyChannelInfo>& expectedSegments = {});
64
65 WifiPhyOperatingChannel m_channel; //!< operating channel
66};
67
69 : TestCase("Check configuration of the operating channel")
70{
71}
72
73void
74SetWifiOperatingChannelTest::RunOne(const std::string& runInfo,
75 const std::vector<FrequencyChannelInfo>& segments,
76 WifiStandard standard,
77 WifiPhyBand band,
78 bool expectExceptionThrown,
79 WifiChannelWidthType expectedWidth,
80 const std::vector<FrequencyChannelInfo>& expectedSegments)
81{
82 NS_LOG_FUNCTION(this << runInfo);
83
84 bool exceptionThrown = false;
85 try
86 {
87 m_channel.Set(segments, standard);
88 }
89 catch (const std::runtime_error&)
90 {
91 exceptionThrown = true;
92 }
93 NS_TEST_ASSERT_MSG_EQ(exceptionThrown,
94 expectExceptionThrown,
95 "Exception thrown mismatch for run: " << runInfo);
96 if (!exceptionThrown)
97 {
100 expectedWidth,
101 "Operating channel has an incorrect channel width type for run: " << runInfo);
103 expectedSegments.size(),
104 "Incorrect number of frequency segments for run: " << runInfo);
105 for (std::size_t i = 0; i < m_channel.GetNSegments(); ++i)
106 {
107 const auto& frequencyChannelInfo = expectedSegments.at(i);
109 frequencyChannelInfo.number,
110 "Operating channel has an incorrect channel number at segment "
111 << i << " for run: " << runInfo);
113 frequencyChannelInfo.frequency,
114 "Operating channel has an incorrect center frequency at segment "
115 << i << " for run: " << runInfo);
117 frequencyChannelInfo.width,
118 "Operating channel has an incorrect channel width at segment "
119 << i << " for run: " << runInfo);
121 frequencyChannelInfo.band,
122 "Operating channel has an incorrect band for run: " << runInfo);
123 }
124 }
125}
126
127void
129{
130 RunOne("dummy channel with all inputs unset",
131 {{}},
134 true);
135
136 RunOne("default 20 MHz OFDM channel operating on channel 36",
137 {{36, MHz_u{0}, MHz_u{20}, WIFI_PHY_BAND_5GHZ}},
140 false,
141 WifiChannelWidthType::CW_20MHZ,
142 {{36, MHz_u{5180}, MHz_u{20}, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
143
144 RunOne("default 40 MHz OFDM channel operating on channel 38",
145 {{38, MHz_u{0}, MHz_u{40}, WIFI_PHY_BAND_5GHZ}},
148 false,
149 WifiChannelWidthType::CW_40MHZ,
150 {{38, MHz_u{5190}, MHz_u{40}, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
151
152 RunOne("default 80 MHz OFDM channel operating on channel 42",
153 {{42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
156 false,
157 WifiChannelWidthType::CW_80MHZ,
158 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
159
160 RunOne("default 160 MHz (contiguous) OFDM channel operating on channel 50",
161 {{50, MHz_u{0}, MHz_u{160}, WIFI_PHY_BAND_5GHZ}},
164 false,
165 WifiChannelWidthType::CW_160MHZ,
166 {{50, MHz_u{5250}, MHz_u{160}, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
167
168 RunOne("valid 80+80 MHz (non-contiguous) OFDM channel operating on channels 42 and 106",
169 {{42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
170 {106, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
173 false,
174 WifiChannelWidthType::CW_80_PLUS_80MHZ,
175 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM},
176 {106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ, FrequencyChannelType::OFDM}});
177
178 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel higher channel not being 80 MHz",
179 {{42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
180 {102, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
183 true);
184
185 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel lower channel not being 80 MHz",
186 {{36, MHz_u{0}, MHz_u{20}, WIFI_PHY_BAND_5GHZ},
187 {106, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
190 true);
191
192 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with both segments configured on the "
193 "same channel",
194 {{42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
195 {42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
198 true);
199
200 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with segments configured to be "
201 "contiguous (lower before higher)",
202 {{42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
203 {58, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
206 true);
207
208 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with segments configured to be "
209 "contiguous (higher before lower)",
210 {{58, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
211 {42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
214 true);
215
216 RunOne("invalid 80+80 MHz (non-contiguous) OFDM channel with each segments configured on a "
217 "different band",
218 {{42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
219 {215, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_6GHZ}},
222 true);
223
224 RunOne("default 320 MHz OFDM channel operating on channel 31",
225 {{31, 0, 320, WIFI_PHY_BAND_6GHZ}},
228 false,
229 WifiChannelWidthType::CW_320MHZ,
230 {{31, 6105, 320, WIFI_PHY_BAND_6GHZ, FrequencyChannelType::OFDM}});
231}
232
233/**
234 * @ingroup wifi-test
235 * @ingroup tests
236 *
237 * @brief Test the conversion from PHY ChannelSettings attribute to WifiPhyOperatingChannel.
238 */
240{
241 public:
242 /**
243 * Constructor
244 */
247
248 private:
249 void DoSetup() override;
250 void DoTeardown() override;
251 void DoRun() override;
252
253 /**
254 * Run one function.
255 * @param channelSettings the string to set the ChannelSettings attribute
256 * @param expectedWidthType the expected width type of the operating channel
257 * @param expectedSegments the info about each expected segment of the operating channel
258 * @param expectedP20Index the expected index of the P20
259 */
260 void RunOne(const std::string& channelSettings,
261 WifiChannelWidthType expectedWidthType,
262 const std::vector<FrequencyChannelInfo>& expectedSegments,
263 uint8_t expectedP20Index);
264
266};
267
269 : TestCase("Check conversion from attribute to the operating channel")
270{
271}
272
273void
275{
276 auto spectrumChannel = CreateObject<MultiModelSpectrumChannel>();
277 auto node = CreateObject<Node>();
278 auto dev = CreateObject<WifiNetDevice>();
280 auto interferenceHelper = CreateObject<InterferenceHelper>();
281 m_phy->SetInterferenceHelper(interferenceHelper);
283 m_phy->SetErrorRateModel(error);
284 m_phy->SetDevice(dev);
285 m_phy->AddChannel(spectrumChannel);
286 m_phy->ConfigureStandard(WIFI_STANDARD_80211be);
287 dev->SetPhy(m_phy);
288 node->AddDevice(dev);
289}
290
291void
293{
294 m_phy->Dispose();
295 m_phy = nullptr;
296}
297
298void
300 const std::string& channelSettings,
301 WifiChannelWidthType expectedWidthType,
302 const std::vector<FrequencyChannelInfo>& expectedSegments,
303 uint8_t expectedP20Index)
304{
305 NS_LOG_FUNCTION(this << channelSettings);
306
307 bool exceptionThrown = false;
308 try
309 {
310 m_phy->SetAttribute("ChannelSettings", StringValue(channelSettings));
311 }
312 catch (const std::runtime_error&)
313 {
314 exceptionThrown = true;
315 }
316 NS_TEST_ASSERT_MSG_EQ(exceptionThrown,
317 expectedSegments.empty(),
318 "Exception thrown mismatch for channel settings " << channelSettings);
319
320 if (exceptionThrown)
321 {
322 return;
323 }
324
326 m_phy->GetOperatingChannel().GetWidthType(),
327 expectedWidthType,
328 "Operating channel has an incorrect channel width type for channel settings "
329 << channelSettings);
330
331 const auto numSegments = m_phy->GetOperatingChannel().GetNSegments();
333 numSegments,
334 expectedSegments.size(),
335 "Operating channel has an incorrect number of segments for channel settings "
336 << channelSettings);
337
338 for (std::size_t i = 0; i < numSegments; ++i)
339 {
340 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetNumber(i),
341 expectedSegments.at(i).number,
342 "Operating channel has an incorrect channel number at segment "
343 << i << " for channel settings " << channelSettings);
344 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetFrequency(i),
345 expectedSegments.at(i).frequency,
346 "Operating channel has an incorrect center frequency at segment "
347 << i << " for channel settings " << channelSettings);
348 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetWidth(i),
349 expectedSegments.at(i).width,
350 "Operating channel has an incorrect channel width at segment "
351 << i << " for channel settings " << channelSettings);
352 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetPhyBand(),
353 expectedSegments.at(i).band,
354 "Operating channel has an incorrect band for channel settings "
355 << channelSettings);
356 }
357
358 NS_TEST_ASSERT_MSG_EQ(m_phy->GetOperatingChannel().GetPrimaryChannelIndex(MHz_u{20}),
359 expectedP20Index,
360 "Operating channel has an incorrect P20 index for channel settings "
361 << channelSettings);
362}
363
364void
366{
367 // Test invalid combination
368 RunOne("{36, 40, BAND_UNSPECIFIED, 0}", WifiChannelWidthType::UNKNOWN, {}, 0);
369
370 // Test default with a single frequency segment
371 RunOne("{0, 0, BAND_UNSPECIFIED, 0}",
372 WifiChannelWidthType::CW_80MHZ,
373 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
374 0);
375
376 // Test default with two frequency segments unspecified
377 RunOne("{0, 0, BAND_UNSPECIFIED, 0};{0, 0, BAND_UNSPECIFIED, 0}",
378 WifiChannelWidthType::CW_80_PLUS_80MHZ,
379 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
380 {106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
381 0);
382
383 // Test default with two frequency segments and first is specified (but equals default)
384 RunOne("{42, 0, BAND_UNSPECIFIED, 0};{0, 0, BAND_UNSPECIFIED, 0}",
385 WifiChannelWidthType::CW_80_PLUS_80MHZ,
386 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
387 {106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
388 0);
389
390 // Test default with second segment specified to be at the first available 80 MHz segment
391 RunOne("{0, 0, BAND_UNSPECIFIED, 0};{42, 0, BAND_UNSPECIFIED, 0}",
392 WifiChannelWidthType::UNKNOWN,
393 {},
394 0);
395
396 // Test default with two frequency segments and first is specified (and differs from default)
397 RunOne("{106, 0, BAND_UNSPECIFIED, 0};{0, 0, BAND_UNSPECIFIED, 0}",
398 WifiChannelWidthType::CW_80_PLUS_80MHZ,
399 {{106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
400 {138, MHz_u{5690}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
401 0);
402
403 // Test unique channel 36 (20 MHz)
404 RunOne("{36, 0, BAND_UNSPECIFIED, 0}",
405 WifiChannelWidthType::CW_20MHZ,
406 {{36, MHz_u{5180}, MHz_u{20}, WIFI_PHY_BAND_5GHZ}},
407 0);
408
409 // Test unique channel 38 (40 MHz)
410 RunOne("{38, 0, BAND_UNSPECIFIED, 0}",
411 WifiChannelWidthType::CW_40MHZ,
412 {{38, MHz_u{5190}, MHz_u{40}, WIFI_PHY_BAND_5GHZ}},
413 0);
414
415 // Test unique channel 42 (80 MHz)
416 RunOne("{42, 0, BAND_UNSPECIFIED, 0}",
417 WifiChannelWidthType::CW_80MHZ,
418 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
419 0);
420
421 // Test unique channel 50 (160 MHz)
422 RunOne("{50, 0, BAND_UNSPECIFIED, 0}",
423 WifiChannelWidthType::CW_160MHZ,
424 {{50, MHz_u{5250}, MHz_u{160}, WIFI_PHY_BAND_5GHZ}},
425 0);
426
427 // Test unique channel 31 (320 MHz)
428 // TODO: logic should be changed to support passing BAND_UNSPECIFIED
429 RunOne("{31, 0, BAND_6GHZ, 0}",
430 WifiChannelWidthType::CW_320MHZ,
431 {{31, 6105, 320, WIFI_PHY_BAND_6GHZ}},
432 0);
433
434 // Test 80+80 MHz
435 RunOne("{42, 0, BAND_UNSPECIFIED, 0};{106, 0, BAND_UNSPECIFIED, 0}",
436 WifiChannelWidthType::CW_80_PLUS_80MHZ,
437 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
438 {106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
439 0);
440
441 // Test P20 for 80+80 MHz: second value shall be ignored
442 RunOne("{42, 0, BAND_UNSPECIFIED, 1};{106, 0, BAND_UNSPECIFIED, 2}",
443 WifiChannelWidthType::CW_80_PLUS_80MHZ,
444 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
445 {106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
446 1);
447
448 // Test default 20 MHz channel
449 RunOne("{0, 20, BAND_UNSPECIFIED, 0}",
450 WifiChannelWidthType::CW_20MHZ,
451 {{36, MHz_u{5180}, MHz_u{20}, WIFI_PHY_BAND_5GHZ}},
452 0);
453
454 // Test default 40 MHz channel
455 RunOne("{0, 40, BAND_UNSPECIFIED, 0}",
456 WifiChannelWidthType::CW_40MHZ,
457 {{38, MHz_u{5190}, MHz_u{40}, WIFI_PHY_BAND_5GHZ}},
458 0);
459
460 // Test default 80 MHz channel
461 RunOne("{0, 80, BAND_UNSPECIFIED, 0}",
462 WifiChannelWidthType::CW_80MHZ,
463 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
464 0);
465
466 // Test default 160 MHz channel
467 RunOne("{0, 160, BAND_UNSPECIFIED, 0}",
468 WifiChannelWidthType::CW_160MHZ,
469 {{50, MHz_u{5250}, MHz_u{160}, WIFI_PHY_BAND_5GHZ}},
470 0);
471
472 // Test default 80+80 MHz channel
473 RunOne("{0, 80, BAND_UNSPECIFIED, 0};{0, 80, BAND_UNSPECIFIED, 0}",
474 WifiChannelWidthType::CW_80_PLUS_80MHZ,
475 {{42, MHz_u{5210}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
476 {106, MHz_u{5530}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
477 0);
478
479 // Test default 320 MHz channel
480 // TODO: logic should be changed to support passing BAND_UNSPECIFIED
481 RunOne("{0, 320, BAND_6GHZ, 0}",
482 WifiChannelWidthType::CW_320MHZ,
483 {{31, 6105, 320, WIFI_PHY_BAND_6GHZ}},
484 0);
485}
486
487/**
488 * @ingroup wifi-test
489 * @ingroup tests
490 *
491 * @brief Test the operating channel functions for 80+80MHz.
492 */
494{
495 public:
496 /**
497 * Constructor
498 */
500 ~WifiPhyChannel80Plus80Test() override = default;
501
502 private:
503 void DoRun() override;
504
505 /**
506 * Create a dummy PSDU whose payload is 1000 bytes
507 * @return a dummy PSDU whose payload is 1000 bytes
508 */
510
511 /**
512 * Create a HE PPDU
513 * @param bandwidth the bandwidth used for the transmission the PPDU
514 * @param channel the operating channel of the PHY used for the transmission
515 * @return a HE PPDU
516 */
518
519 WifiPhyOperatingChannel m_channel; //!< operating channel
520};
521
523 : TestCase("Check operating channel functions for 80+80MHz")
524{
525}
526
529{
530 Ptr<Packet> pkt = Create<Packet>(1000);
531 WifiMacHeader hdr;
533 hdr.SetQosTid(0);
534 return Create<WifiPsdu>(pkt, hdr);
535}
536
539 const WifiPhyOperatingChannel& channel)
540{
542 0,
544 NanoSeconds(800),
545 1,
546 1,
547 0,
548 bandwidth,
549 false);
551 return Create<HePpdu>(psdu, txVector, channel, MicroSeconds(100), 0);
552}
553
554void
556{
557 // P20 is in first segment and segments are provided in increasing frequency order
558 {
560 {106, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
563
564 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{160});
565 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
566 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{80});
567 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 0, "Primary 80 MHz channel shall have index 0");
568 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{40});
569 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 1, "Primary 40 MHz channel shall have index 1");
570 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{20});
571 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 3, "Primary 20 MHz channel shall have index 3");
572
573 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{80});
574 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
575 1,
576 "Secondary 80 MHz channel shall have index 1");
577 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{40});
578 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
579 0,
580 "Secondary 40 MHz channel shall have index 0");
581 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{20});
582 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
583 2,
584 "Secondary 20 MHz channel shall have index 2");
585
586 const auto primary80MhzCenterFrequency =
588 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
589 MHz_u{5210},
590 "Primary 80 MHz channel center frequency shall be 5210 MHz");
591 const auto primary40MhzCenterFrequency =
593 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
594 MHz_u{5230},
595 "Primary 40 MHz channel center frequency shall be 5230 MHz");
596 const auto primary20MhzCenterFrequency =
598 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
599 MHz_u{5240},
600 "Primary 20 MHz channel center frequency shall be 5240 MHz");
601
602 const auto secondary80MhzCenterFrequency =
604 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
605 MHz_u{5530},
606 "Secondary 80 MHz channel center frequency shall be 5530 MHz");
607 const auto secondary40MhzCenterFrequency =
609 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
610 MHz_u{5190},
611 "Secondary 40 MHz channel center frequency shall be 5190 MHz");
612 const auto secondary20MhzCenterFrequency =
614 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
615 MHz_u{5220},
616 "Secondary 20 MHz channel center frequency shall be 5220 MHz");
617
618 const auto primary80MhzChannelNumber =
620 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
621 42,
622 "Primary 80 MHz channel number shall be 42");
623 const auto primary40MhzChannelNumber =
625 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
626 46,
627 "Primary 40 MHz channel number shall be 46");
628 const auto primary20MhzChannelNumber =
630 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
631 48,
632 "Primary 20 MHz channel number shall be 48");
633
634 auto ppdu160MHz = CreateDummyHePpdu(MHz_u{160}, m_channel);
635 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
636 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
637 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
638 MHz_u{5210},
639 "Center frequency of first segment shall be 5210 MHz");
640 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
641 MHz_u{5530},
642 "Center frequency of second segment shall be 5530 MHz");
643 auto ppdu80MHz = CreateDummyHePpdu(MHz_u{80}, m_channel);
644 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
645 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
646 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
647 MHz_u{5210},
648 "Center frequency for 80 MHz shall be 5210 MHz");
649 auto ppdu40MHz = CreateDummyHePpdu(MHz_u{40}, m_channel);
650 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
651 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
652 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
653 MHz_u{5230},
654 "Center frequency for 40 MHz shall be 5230 MHz");
655 auto ppdu20MHz = CreateDummyHePpdu(MHz_u{20}, m_channel);
656 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
657 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
658 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
659 MHz_u{5240},
660 "Center frequency for 20 MHz shall be 5240 MHz");
661 }
662
663 // P20 is in second segment and segments are provided in increasing frequency order
664 {
666 {106, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
669
670 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{160});
671 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
672 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{80});
673 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 1, "Primary 80 MHz channel shall have index 1");
674 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{40});
675 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 2, "Primary 40 MHz channel shall have index 2");
676 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{20});
677 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 4, "Primary 20 MHz channel shall have index 4");
678
679 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{80});
680 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
681 0,
682 "Secondary 80 MHz channel shall have index 0");
683 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{40});
684 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
685 3,
686 "Secondary 40 MHz channel shall have index 3");
687 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{20});
688 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
689 5,
690 "Secondary 20 MHz channel shall have index 5");
691
692 const auto primary80MhzCenterFrequency =
694 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
695 MHz_u{5530},
696 "Primary 80 MHz channel center frequency shall be 5530 MHz");
697 const auto primary40MhzCenterFrequency =
699 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
700 MHz_u{5510},
701 "Primary 40 MHz channel center frequency shall be 5510 MHz");
702 const auto primary20MhzCenterFrequency =
704 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
705 MHz_u{5500},
706 "Primary 20 MHz channel center frequency shall be 5500 MHz");
707
708 const auto secondary80MhzCenterFrequency =
710 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
711 MHz_u{5210},
712 "Secondary 80 MHz channel center frequency shall be 5210 MHz");
713 const auto secondary40MhzCenterFrequency =
715 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
716 MHz_u{5550},
717 "Secondary 40 MHz channel center frequency shall be 5550 MHz");
718 const auto secondary20MhzCenterFrequency =
720 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
721 MHz_u{5520},
722 "Secondary 20 MHz channel center frequency shall be 5520 MHz");
723
724 const auto primary80MhzChannelNumber =
726 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
727 106,
728 "Primary 80 MHz channel number shall be 106");
729 const auto primary40MhzChannelNumber =
731 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
732 102,
733 "Primary 40 MHz channel number shall be 102");
734 const auto primary20MhzChannelNumber =
736 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
737 100,
738 "Primary 20 MHz channel number shall be 100");
739
740 auto ppdu160MHz = CreateDummyHePpdu(MHz_u{160}, m_channel);
741 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
742 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
743 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
744 MHz_u{5530},
745 "Center frequency of first segment shall be 5530 MHz");
746 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
747 MHz_u{5210},
748 "Center frequency of second segment shall be 5210 MHz");
749 auto ppdu80MHz = CreateDummyHePpdu(MHz_u{80}, m_channel);
750 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
751 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
752 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
753 MHz_u{5530},
754 "Center frequency for 80 MHz shall be 5530 MHz");
755 auto ppdu40MHz = CreateDummyHePpdu(MHz_u{40}, m_channel);
756 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
757 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
758 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
759 MHz_u{5510},
760 "Center frequency for 40 MHz shall be 5510 MHz");
761 auto ppdu20MHz = CreateDummyHePpdu(MHz_u{20}, m_channel);
762 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
763 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
764 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
765 MHz_u{5500},
766 "Center frequency for 20 MHz shall be 5500 MHz");
767 }
768
769 // P20 is in first segment and segments are provided in decreasing frequency order
770 {
771 m_channel.Set({{106, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
772 {42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
775
776 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{160});
777 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
778 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{80});
779 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 0, "Primary 80 MHz channel shall have index 0");
780 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{40});
781 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 1, "Primary 40 MHz channel shall have index 1");
782 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{20});
783 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 3, "Primary 20 MHz channel shall have index 3");
784
785 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{80});
786 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
787 1,
788 "Secondary 80 MHz channel shall have index 1");
789 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{40});
790 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
791 0,
792 "Secondary 40 MHz channel shall have index 0");
793 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{20});
794 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
795 2,
796 "Secondary 20 MHz channel shall have index 2");
797
798 const auto primary80MhzCenterFrequency =
800 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
801 MHz_u{5210},
802 "Primary 80 MHz channel center frequency shall be 5210 MHz");
803 const auto primary40MhzCenterFrequency =
805 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
806 MHz_u{5230},
807 "Primary 40 MHz channel center frequency shall be 5230 MHz");
808 const auto primary20MhzCenterFrequency =
810 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
811 MHz_u{5240},
812 "Primary 20 MHz channel center frequency shall be 5240 MHz");
813
814 const auto secondary80MhzCenterFrequency =
816 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
817 MHz_u{5530},
818 "Secondary 80 MHz channel center frequency shall be 5530 MHz");
819 const auto secondary40MhzCenterFrequency =
821 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
822 MHz_u{5190},
823 "Secondary 40 MHz channel center frequency shall be 5190 MHz");
824 const auto secondary20MhzCenterFrequency =
826 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
827 MHz_u{5220},
828 "Secondary 20 MHz channel center frequency shall be 5220 MHz");
829
830 const auto primary80MhzChannelNumber =
832 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
833 42,
834 "Primary 80 MHz channel number shall be 42");
835 const auto primary40MhzChannelNumber =
837 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
838 46,
839 "Primary 40 MHz channel number shall be 46");
840 const auto primary20MhzChannelNumber =
842 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
843 48,
844 "Primary 20 MHz channel number shall be 48");
845
846 auto ppdu160MHz = CreateDummyHePpdu(MHz_u{160}, m_channel);
847 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
848 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
849 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
850 MHz_u{5210},
851 "Center frequency of first segment shall be 5210 MHz");
852 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
853 MHz_u{5530},
854 "Center frequency of second segment shall be 5530 MHz");
855 auto ppdu80MHz = CreateDummyHePpdu(MHz_u{80}, m_channel);
856 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
857 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
858 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
859 MHz_u{5210},
860 "Center frequency for 80 MHz shall be 5210 MHz");
861 auto ppdu40MHz = CreateDummyHePpdu(MHz_u{40}, m_channel);
862 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
863 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
864 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
865 MHz_u{5230},
866 "Center frequency for 40 MHz shall be 5230 MHz");
867 auto ppdu20MHz = CreateDummyHePpdu(MHz_u{20}, m_channel);
868 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
869 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
870 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
871 MHz_u{5240},
872 "Center frequency for 20 MHz shall be 5240 MHz");
873 }
874
875 // P20 is in second segment and segments are provided in decreasing frequency order
876 {
877 m_channel.Set({{106, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ},
878 {42, MHz_u{0}, MHz_u{80}, WIFI_PHY_BAND_5GHZ}},
881
882 const auto indexPrimary160Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{160});
883 NS_TEST_ASSERT_MSG_EQ(indexPrimary160Mhz, 0, "Primary 160 MHz channel shall have index 0");
884 const auto indexPrimary80Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{80});
885 NS_TEST_ASSERT_MSG_EQ(indexPrimary80Mhz, 1, "Primary 80 MHz channel shall have index 1");
886 const auto indexPrimary40Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{40});
887 NS_TEST_ASSERT_MSG_EQ(indexPrimary40Mhz, 2, "Primary 40 MHz channel shall have index 2");
888 const auto indexPrimary20Mhz = m_channel.GetPrimaryChannelIndex(MHz_u{20});
889 NS_TEST_ASSERT_MSG_EQ(indexPrimary20Mhz, 4, "Primary 20 MHz channel shall have index 4");
890
891 const auto indexSecondary80Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{80});
892 NS_TEST_ASSERT_MSG_EQ(indexSecondary80Mhz,
893 0,
894 "Secondary 80 MHz channel shall have index 0");
895 const auto indexSecondary40Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{40});
896 NS_TEST_ASSERT_MSG_EQ(indexSecondary40Mhz,
897 3,
898 "Secondary 40 MHz channel shall have index 3");
899 const auto indexSecondary20Mhz = m_channel.GetSecondaryChannelIndex(MHz_u{20});
900 NS_TEST_ASSERT_MSG_EQ(indexSecondary20Mhz,
901 5,
902 "Secondary 20 MHz channel shall have index 5");
903
904 const auto primary80MhzCenterFrequency =
906 NS_TEST_ASSERT_MSG_EQ(primary80MhzCenterFrequency,
907 MHz_u{5530},
908 "Primary 80 MHz channel center frequency shall be 5530 MHz");
909 const auto primary40MhzCenterFrequency =
911 NS_TEST_ASSERT_MSG_EQ(primary40MhzCenterFrequency,
912 MHz_u{5510},
913 "Primary 40 MHz channel center frequency shall be 5510 MHz");
914 const auto primary20MhzCenterFrequency =
916 NS_TEST_ASSERT_MSG_EQ(primary20MhzCenterFrequency,
917 MHz_u{5500},
918 "Primary 20 MHz channel center frequency shall be 5500 MHz");
919
920 const auto secondary80MhzCenterFrequency =
922 NS_TEST_ASSERT_MSG_EQ(secondary80MhzCenterFrequency,
923 MHz_u{5210},
924 "Secondary 80 MHz channel center frequency shall be 5210 MHz");
925 const auto secondary40MhzCenterFrequency =
927 NS_TEST_ASSERT_MSG_EQ(secondary40MhzCenterFrequency,
928 MHz_u{5550},
929 "Secondary 40 MHz channel center frequency shall be 5550 MHz");
930 const auto secondary20MhzCenterFrequency =
932 NS_TEST_ASSERT_MSG_EQ(secondary20MhzCenterFrequency,
933 MHz_u{5520},
934 "Secondary 20 MHz channel center frequency shall be 5520 MHz");
935
936 const auto primary80MhzChannelNumber =
938 NS_TEST_ASSERT_MSG_EQ(primary80MhzChannelNumber,
939 106,
940 "Primary 80 MHz channel number shall be 106");
941 const auto primary40MhzChannelNumber =
943 NS_TEST_ASSERT_MSG_EQ(primary40MhzChannelNumber,
944 102,
945 "Primary 40 MHz channel number shall be 102");
946 const auto primary20MhzChannelNumber =
948 NS_TEST_ASSERT_MSG_EQ(primary20MhzChannelNumber,
949 100,
950 "Primary 20 MHz channel number shall be 100");
951
952 auto ppdu160MHz = CreateDummyHePpdu(MHz_u{160}, m_channel);
953 auto txCenterFreqs160MHz = ppdu160MHz->GetTxCenterFreqs();
954 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.size(), 2, "2 segments are covered by 160 MHz");
955 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.front(),
956 MHz_u{5530},
957 "Center frequency of first segment shall be 5530 MHz");
958 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs160MHz.back(),
959 MHz_u{5210},
960 "Center frequency of second segment shall be 5210 MHz");
961 auto ppdu80MHz = CreateDummyHePpdu(MHz_u{80}, m_channel);
962 auto txCenterFreqs80MHz = ppdu80MHz->GetTxCenterFreqs();
963 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.size(), 1, "1 segment is covered by 80 MHz");
964 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs80MHz.front(),
965 MHz_u{5530},
966 "Center frequency for 80 MHz shall be 5530 MHz");
967 auto ppdu40MHz = CreateDummyHePpdu(MHz_u{40}, m_channel);
968 auto txCenterFreqs40MHz = ppdu40MHz->GetTxCenterFreqs();
969 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.size(), 1, "1 segment is covered by 40 MHz");
970 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs40MHz.front(),
971 MHz_u{5510},
972 "Center frequency for 40 MHz shall be 5510 MHz");
973 auto ppdu20MHz = CreateDummyHePpdu(MHz_u{20}, m_channel);
974 auto txCenterFreqs20MHz = ppdu20MHz->GetTxCenterFreqs();
975 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.size(), 1, "1 segment is covered by 20 MHz");
976 NS_TEST_ASSERT_MSG_EQ(txCenterFreqs20MHz.front(),
977 MHz_u{5500},
978 "Center frequency for 20 MHz shall be 5500 MHz");
979 }
980
982}
983
984/**
985 * @ingroup wifi-test
986 * @ingroup tests
987 *
988 * @brief wifi operating channel test suite
989 */
991{
992 public:
994};
995
997 : TestSuite("wifi-operating-channel", Type::UNIT)
998{
999 AddTestCase(new SetWifiOperatingChannelTest(), TestCase::Duration::QUICK);
1000 AddTestCase(new PhyChannelSettingsToOperatingChannelTest(), TestCase::Duration::QUICK);
1001 AddTestCase(new WifiPhyChannel80Plus80Test(), TestCase::Duration::QUICK);
1002}
1003
Test the conversion from PHY ChannelSettings attribute to WifiPhyOperatingChannel.
~PhyChannelSettingsToOperatingChannelTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
void RunOne(const std::string &channelSettings, WifiChannelWidthType expectedWidthType, const std::vector< FrequencyChannelInfo > &expectedSegments, uint8_t expectedP20Index)
Run one function.
Test the WifiPhyOperatingChannel::Set() method.
WifiPhyOperatingChannel m_channel
operating channel
~SetWifiOperatingChannelTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
void RunOne(const std::string &runInfo, const std::vector< FrequencyChannelInfo > &segments, WifiStandard standard, WifiPhyBand band, bool expectExceptionThrown, WifiChannelWidthType expectedWidth=WifiChannelWidthType::UNKNOWN, const std::vector< FrequencyChannelInfo > &expectedSegments={})
Run one function.
wifi operating channel test suite
Test the operating channel functions for 80+80MHz.
Ptr< HePpdu > CreateDummyHePpdu(MHz_u bandwidth, const WifiPhyOperatingChannel &channel)
Create a HE PPDU.
Ptr< WifiPsdu > CreateDummyPsdu()
Create a dummy PSDU whose payload is 1000 bytes.
WifiPhyOperatingChannel m_channel
operating channel
~WifiPhyChannel80Plus80Test() override=default
void DoRun() override
Implementation to actually run this TestCase.
static WifiMode GetHeMcs0()
Return MCS 0 from HE MCS values.
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
Hold variables of type string.
Definition string.h:45
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
Implements the IEEE 802.11 MAC header.
virtual void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Class that keeps track of all information about the current PHY operating channel.
uint8_t GetNumber(std::size_t segment=0) const
Return the channel number for a given frequency segment.
WifiChannelWidthType GetWidthType() const
Return the width type of the operating channel.
MHz_u GetSecondaryChannelCenterFrequency(MHz_u secondaryChannelWidth) const
Get the center frequency of the secondary channel of the given width.
void SetPrimary20Index(uint8_t index)
Set the index of the primary 20 MHz channel (0 indicates the 20 MHz subchannel with the lowest center...
uint8_t GetSecondaryChannelIndex(MHz_u secondaryChannelWidth) const
If the operating channel width is made of a multiple of 20 MHz, return the index of the secondary cha...
std::size_t GetNSegments() const
Get the number of frequency segments in the operating channel.
void Set(const std::vector< FrequencyChannelInfo > &segments, WifiStandard standard)
Set the channel according to the specified parameters if a unique frequency channel matches the speci...
MHz_u GetWidth(std::size_t segment=0) const
Return the channel width for a given frequency segment.
uint8_t GetPrimaryChannelIndex(MHz_u primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
MHz_u GetPrimaryChannelCenterFrequency(MHz_u primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
MHz_u GetFrequency(std::size_t segment=0) const
Return the center frequency for a given frequency segment.
WifiPhyBand GetPhyBand() const
Return the PHY band of the operating channel.
uint8_t GetPrimaryChannelNumber(MHz_u primaryChannelWidth, WifiStandard standard) const
Get channel number of the primary channel.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#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.
Definition test.h:134
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1369
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1381
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPhyBand
Identifies the PHY band.
WifiChannelWidthType
Enumeration of the possible channel widths.
Definition wifi-types.h:28
@ WIFI_STANDARD_80211be
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_PREAMBLE_HE_SU
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ WIFI_MAC_QOSDATA
static WifiOperatingChannelTestSuite g_wifiOperatingChannelTestSuite
the test suite