A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-eht-info-elems-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Universita' degli Studi di Napoli Federico II
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#include "ns3/address-utils.h"
21#include "ns3/header-serialization-test.h"
22#include "ns3/log.h"
23#include "ns3/mgt-headers.h"
24#include "ns3/multi-link-element.h"
25#include "ns3/reduced-neighbor-report.h"
26#include "ns3/tid-to-link-mapping-element.h"
27#include "ns3/wifi-phy-operating-channel.h"
28
29#include <optional>
30#include <sstream>
31#include <vector>
32
33using namespace ns3;
34
35NS_LOG_COMPONENT_DEFINE("WifiEhtInfoElemsTest");
36
44{
45 public:
51
61 const CommonInfoBasicMle& commonInfo,
62 std::vector<MultiLinkElement::PerStaProfileSubelement> subelements);
63
64 private:
65 void DoRun() override;
66
68};
69
72 "Check serialization and deserialization of Basic variant Multi-Link elements")
73{
74}
75
77{
78}
79
82 const CommonInfoBasicMle& commonInfo,
83 std::vector<MultiLinkElement::PerStaProfileSubelement> subelements)
84{
86 mle.SetMldMacAddress(commonInfo.m_mldMacAddress);
87 if (commonInfo.m_linkIdInfo.has_value())
88 {
89 mle.SetLinkIdInfo(*commonInfo.m_linkIdInfo);
90 }
91 if (commonInfo.m_bssParamsChangeCount.has_value())
92 {
94 }
95 if (commonInfo.m_mediumSyncDelayInfo.has_value())
96 {
98 MicroSeconds(32 * commonInfo.m_mediumSyncDelayInfo->mediumSyncDuration));
100 commonInfo.m_mediumSyncDelayInfo->mediumSyncOfdmEdThreshold - 72);
101 mle.SetMediumSyncMaxNTxops(commonInfo.m_mediumSyncDelayInfo->mediumSyncMaxNTxops + 1);
102 }
103 if (commonInfo.m_emlCapabilities.has_value())
104 {
105 auto padding = commonInfo.m_emlCapabilities->emlsrPaddingDelay;
106 mle.SetEmlsrPaddingDelay(MicroSeconds(padding == 0 ? 0 : (1 << (4 + padding))));
107 auto transitionD = commonInfo.m_emlCapabilities->emlsrTransitionDelay;
108 mle.SetEmlsrTransitionDelay(MicroSeconds(transitionD == 0 ? 0 : (1 << (3 + transitionD))));
109 auto transitionT = commonInfo.m_emlCapabilities->transitionTimeout;
110 mle.SetTransitionTimeout(MicroSeconds(transitionT == 0 ? 0 : (1 << (6 + transitionT))));
111 }
112
113 for (std::size_t i = 0; i < subelements.size(); ++i)
114 {
116 mle.GetPerStaProfile(i) = std::move(subelements[i]);
117 }
118
119 return mle;
120}
121
122void
124{
125 CommonInfoBasicMle commonInfo = {
126 .m_mldMacAddress = Mac48Address("01:23:45:67:89:ab"),
127 };
128
129 // Common Info with MLD MAC address
131
132 commonInfo.m_linkIdInfo = 3;
133
134 // Adding Link ID Info
136
137 commonInfo.m_bssParamsChangeCount = 1;
138
139 // Adding BSS Parameters Change Count
141
142 commonInfo.m_mediumSyncDelayInfo =
144 .mediumSyncOfdmEdThreshold = 4,
145 .mediumSyncMaxNTxops = 5};
146
147 // Adding Medium Sync Delay Information
149
151 .emlsrPaddingDelay = 4,
152 .emlsrTransitionDelay = 5,
153 .transitionTimeout = 10};
154
155 // Adding Medium Sync Delay Information
157
163 CapabilityInformation capabilities;
164 capabilities.SetShortPreamble(true);
165 capabilities.SetShortSlotTime(true);
166 capabilities.SetEss();
167
169 m_outerAssoc.Capabilities() = capabilities;
170 m_outerAssoc.Get<Ssid>() = Ssid("MySsid");
171
172 AllSupportedRates rates;
173 rates.AddSupportedRate(6e6);
174 rates.AddSupportedRate(9e6);
175 rates.AddSupportedRate(12e6);
176 rates.AddSupportedRate(18e6);
177 rates.AddSupportedRate(24e6);
178 rates.AddSupportedRate(36e6);
179 rates.AddSupportedRate(48e6);
180 rates.AddSupportedRate(54e6);
181 // extended rates
182 rates.AddSupportedRate(1e6);
183 rates.AddSupportedRate(2e6);
184
185 m_outerAssoc.Get<SupportedRates>() = rates.rates;
187
188 EhtCapabilities ehtCapabilities;
189 for (auto maxMcs : {7, 9, 11, 13})
190 {
192 maxMcs,
193 1);
195 maxMcs,
196 1);
197 }
198
199 m_outerAssoc.Get<HeCapabilities>().emplace();
200 m_outerAssoc.Get<EhtCapabilities>() = ehtCapabilities;
201
202 // The Association Request included in the first Per-STA Profile subelement is identical
203 // to the containing frame, so that all the IEs are inherited and the Per-STA Profile
204 // does not contain any Information Element.
205
207 perStaProfile1.SetLinkId(3);
208 perStaProfile1.SetCompleteProfile();
209 perStaProfile1.SetAssocRequest(m_outerAssoc);
210
211 /* Association Request included in the second Per-STA Profile subelement */
213 assoc.Capabilities() = capabilities;
214 // we simulate a "mistake" by adding an Ssid IE, which cannot be included in the
215 // Per-STA Profile subelement. We will check that this Ssid is not serialized
216 assoc.Get<Ssid>() = Ssid("OtherSsid");
217 // another "mistake" of the same type, except that a TID-To-Link Mapping element
218 // is not included in the containing frame
219 assoc.Get<TidToLinkMapping>().emplace();
220 // the SupportedRates IE is the same (hence not serialized) as in the containing frame,
221 // while the ExtendedSupportedRatesIE is different (hence serialized)
222 rates.AddSupportedRate(5.5e6);
223 rates.AddSupportedRate(11e6);
224 assoc.Get<SupportedRates>() = rates.rates;
225 assoc.Get<ExtendedSupportedRatesIE>() = rates.extendedRates;
226 // a VhtCapabilities IE is not present in the containing frame, hence it is serialized
227 assoc.Get<VhtCapabilities>().emplace();
228 // HeCapabilities IE is present in the containing frame and in the Per-STA Profile subelement,
229 // hence it is not serialized
230 assoc.Get<HeCapabilities>().emplace();
231 // EhtCapabilities IE is present in the containing frame but not in the Per-STA Profile
232 // subelement, hence it is listed in a Non-Inheritance element
233
235 perStaProfile2.SetLinkId(0);
236 perStaProfile2.SetCompleteProfile();
237 perStaProfile2.SetStaMacAddress(Mac48Address("ba:98:76:54:32:10"));
238 perStaProfile2.SetAssocRequest(assoc);
239
240 // The Association Request included in the third Per-STA Profile subelement has the
241 // EHT Capabilities element (which is inherited and not serialized) but it does not have the
242 // Ssid element, which is not listed in the Non-Inheritance element because it shall not
243 // appear in a Per-STA Profile subelement.
244 assoc.Get<Ssid>().reset();
245 assoc.Get<EhtCapabilities>() = ehtCapabilities;
246
247 auto perStaProfile3 = perStaProfile2;
248 perStaProfile3.SetAssocRequest(assoc);
249
250 // Adding MLE with two Per-STA Profile Subelements
252 GetMultiLinkElement(commonInfo, {perStaProfile1, perStaProfile2, perStaProfile3});
253
254 // first, check that serialization/deserialization of the whole Association Request works
256
257 // now, "manually" serialize and deserialize the header to check that the expected elements
258 // have been serialized
259 Buffer buffer;
260 buffer.AddAtStart(m_outerAssoc.GetSerializedSize());
261 m_outerAssoc.Serialize(buffer.Begin());
262
263 auto i = buffer.Begin();
265 i.ReadLsbtohU16(); // Listen interval
266
267 auto tmp = i;
268 i = Ssid().DeserializeIfPresent(tmp);
269 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "Ssid element not present");
270
272 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "SupportedRates element not present");
273
275 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp),
276 0,
277 "ExtendedSupportedRatesIE element not present");
278
280 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "HeCapabilities element not present");
281
282 // deserialize Multi-Link Element
283 NS_TEST_EXPECT_MSG_EQ(i.ReadU8(), IE_EXTENSION, "IE_EXTENSION expected at the begin of MLE");
284 i.ReadU8(); // length
285 NS_TEST_EXPECT_MSG_EQ(i.ReadU8(),
287 "IE_EXT_MULTI_LINK_ELEMENT expected");
288
289 uint16_t mlControl = i.ReadLsbtohU16();
290 auto nBytes = CommonInfoBasicMle().Deserialize(i, mlControl >> 4);
291 i.Next(nBytes);
292
293 // first Per-STA Profile subelement
294 NS_TEST_EXPECT_MSG_EQ(i.ReadU8(),
296 "PER_STA_PROFILE_SUBELEMENT_ID expected");
297 i.ReadU8(); // length
298 i.ReadLsbtohU16(); // STA Control field
299 i.ReadU8(); // STA Info Length
300 // no STA address
302 // no Information Element
303
304 // second Per-STA Profile subelement
305 NS_TEST_EXPECT_MSG_EQ(i.ReadU8(),
307 "PER_STA_PROFILE_SUBELEMENT_ID expected");
308 i.ReadU8(); // length
309 i.ReadLsbtohU16(); // STA Control field
310 i.ReadU8(); // STA Info Length
311 Mac48Address address;
312 ReadFrom(i, address);
314 // no Listen interval
315 // Ssid element not present (as mandated by specs)
316 // SupportedRates not present because it is inherited
317
319 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp),
320 0,
321 "ExtendedSupportedRatesIE element not present");
322
324 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "VhtCapabilities element not present");
325
326 // HeCapabilities not present because it is inherited
327 NonInheritance nonInheritance;
328 i = nonInheritance.DeserializeIfPresent(tmp = i);
329 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "Non-Inheritance element not present");
331 true,
332 "Non-Inheritance does not indicate EhtCapabilities");
333 NS_TEST_EXPECT_MSG_EQ(nonInheritance.m_elemIdList.size(),
334 0,
335 "Unexpected size for Elem ID list of Non-Inheritance element");
336 NS_TEST_EXPECT_MSG_EQ(nonInheritance.m_elemIdExtList.size(),
337 1,
338 "Unexpected size for Elem ID list of Non-Inheritance element");
339
340 // third Per-STA Profile subelement
341 NS_TEST_EXPECT_MSG_EQ(i.ReadU8(),
343 "PER_STA_PROFILE_SUBELEMENT_ID expected");
344 i.ReadU8(); // length
345 i.ReadLsbtohU16(); // STA Control field
346 i.ReadU8(); // STA Info Length
347 ReadFrom(i, address);
349 // no Listen interval
350 // Ssid element not present (as mandated by specs)
351 // SupportedRates not present because it is inherited
352
354 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp),
355 0,
356 "ExtendedSupportedRatesIE element not present");
357
359 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "VhtCapabilities element not present");
360
361 // HeCapabilities not present because it is inherited
362 // EhtCapabilities not present because it is inherited
363
364 // the Multi-Link Element is done, we shall now find the EHT Capabilities of the
365 // containing Association Request frame
366 ehtCapabilities = EhtCapabilities(true, m_outerAssoc.Get<HeCapabilities>().value());
367 i = ehtCapabilities.DeserializeIfPresent(tmp = i);
368 NS_TEST_EXPECT_MSG_GT(i.GetDistanceFrom(tmp), 0, "EhtCapabilities element not present");
369
375 auto count = frame.Deserialize(buffer.Begin());
376
377 NS_TEST_EXPECT_MSG_EQ(count, buffer.GetSize(), "Unexpected number of deserialized bytes");
378
379 // containing frame
380 NS_TEST_EXPECT_MSG_EQ(frame.Get<Ssid>().has_value(),
381 true,
382 "Containing frame should have SSID IE");
383 NS_TEST_EXPECT_MSG_EQ(frame.Get<SupportedRates>().has_value(),
384 true,
385 "Containing frame should have Supported Rates IE");
386 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedSupportedRatesIE>().has_value(),
387 true,
388 "Containing frame should have Extended Supported Rates IE");
389 NS_TEST_EXPECT_MSG_EQ(frame.Get<HtCapabilities>().has_value(),
390 false,
391 "Containing frame should not have HT Capabilities IE");
392 NS_TEST_EXPECT_MSG_EQ(frame.Get<ExtendedCapabilities>().has_value(),
393 false,
394 "Containing frame should not have Extended Capabilities IE");
395 NS_TEST_EXPECT_MSG_EQ(frame.Get<VhtCapabilities>().has_value(),
396 false,
397 "Containing frame should not have VHT Capabilities IE");
398 NS_TEST_EXPECT_MSG_EQ(frame.Get<HeCapabilities>().has_value(),
399 true,
400 "Containing frame should have HE Capabilities IE");
401 NS_TEST_EXPECT_MSG_EQ(frame.Get<MultiLinkElement>().has_value(),
402 true,
403 "Containing frame should have Multi-Link Element IE");
404 NS_TEST_EXPECT_MSG_EQ(frame.Get<EhtCapabilities>().has_value(),
405 true,
406 "Containing frame should have EHT Capabilities IE");
407 NS_TEST_EXPECT_MSG_EQ(frame.Get<TidToLinkMapping>().has_value(),
408 false,
409 "Containing frame should not have TID-to-Link Mapping IE");
410
411 auto& mle = frame.Get<MultiLinkElement>().value();
412
413 NS_TEST_EXPECT_MSG_EQ(mle.GetNPerStaProfileSubelements(),
414 3,
415 "Unexpected number of Per-STA Profile subelements");
416
417 // frame in first Per-STA Profile subelement has inherited all the IEs but SSID and
418 // Multi-Link Element IEs
419 auto& perSta1 = mle.GetPerStaProfile(0);
420 NS_TEST_EXPECT_MSG_EQ(perSta1.HasAssocRequest(),
421 true,
422 "First Per-STA Profile should contain an Association Request frame");
423 auto& perSta1Frame =
424 std::get<std::reference_wrapper<MgtAssocRequestHeader>>(perSta1.GetAssocRequest()).get();
425
426 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<Ssid>().has_value(),
427 false,
428 "Frame in first Per-STA Profile should not have SSID IE");
429 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<SupportedRates>().has_value(),
430 true,
431 "Frame in first Per-STA Profile should have Supported Rates IE");
433 (perSta1Frame.Get<SupportedRates>() == frame.Get<SupportedRates>()),
434 true,
435 "Supported Rates IE not correctly inherited by frame in first Per-STA Profile");
436 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<ExtendedSupportedRatesIE>().has_value(),
437 true,
438 "Frame in first Per-STA Profile should have Extended Supported Rates IE");
440 (perSta1Frame.Get<ExtendedSupportedRatesIE>() == frame.Get<ExtendedSupportedRatesIE>()),
441 true,
442 "Extended Supported Rates IE not correctly inherited by frame in first Per-STA Profile");
443 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<HtCapabilities>().has_value(),
444 false,
445 "Frame in first Per-STA Profile should not have HT Capabilities IE");
447 perSta1Frame.Get<ExtendedCapabilities>().has_value(),
448 false,
449 "Frame in first Per-STA Profile should not have Extended Capabilities IE");
450 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<VhtCapabilities>().has_value(),
451 false,
452 "Frame in first Per-STA Profile should not have VHT Capabilities IE");
453 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<HeCapabilities>().has_value(),
454 true,
455 "Frame in first Per-STA Profile should have HE Capabilities IE");
457 (perSta1Frame.Get<HeCapabilities>() == frame.Get<HeCapabilities>()),
458 true,
459 "HE Capabilities IE not correctly inherited by frame in first Per-STA Profile");
460 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<MultiLinkElement>().has_value(),
461 false,
462 "Frame in first Per-STA Profile should not have Multi-Link Element IE");
463 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<EhtCapabilities>().has_value(),
464 true,
465 "Frame in first Per-STA Profile should have EHT Capabilities IE");
467 (perSta1Frame.Get<EhtCapabilities>() == frame.Get<EhtCapabilities>()),
468 true,
469 "EHT Capabilities IE not correctly inherited by frame in first Per-STA Profile");
470 NS_TEST_EXPECT_MSG_EQ(perSta1Frame.Get<TidToLinkMapping>().has_value(),
471 false,
472 "Frame in first Per-STA Profile should not have TID-to-Link Mapping IE");
473
474 // frame in second Per-STA Profile subelement includes VHT Capabilities IE and has inherited
475 // all the IEs but SSID IE, Multi-Link Element IE, Extended Supported Rates IE (different
476 // than in containing frame) and EHT Capabilities IE (listed in Non-Inheritance IE).
477 auto& perSta2 = mle.GetPerStaProfile(1);
478 NS_TEST_EXPECT_MSG_EQ(perSta2.HasAssocRequest(),
479 true,
480 "Second Per-STA Profile should contain an Association Request frame");
481 auto& perSta2Frame =
482 std::get<std::reference_wrapper<MgtAssocRequestHeader>>(perSta2.GetAssocRequest()).get();
483
484 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<Ssid>().has_value(),
485 false,
486 "Frame in second Per-STA Profile should not have SSID IE");
487 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<SupportedRates>().has_value(),
488 true,
489 "Frame in second Per-STA Profile should have Supported Rates IE");
491 (perSta2Frame.Get<SupportedRates>() == frame.Get<SupportedRates>()),
492 true,
493 "Supported Rates IE not correctly inherited by frame in second Per-STA Profile");
495 perSta2Frame.Get<ExtendedSupportedRatesIE>().has_value(),
496 true,
497 "Frame in second Per-STA Profile should have Extended Supported Rates IE");
499 (perSta2Frame.Get<ExtendedSupportedRatesIE>() == frame.Get<ExtendedSupportedRatesIE>()),
500 false,
501 "Extended Supported Rates IE should have not been inherited by frame in second Per-STA "
502 "Profile");
503 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<HtCapabilities>().has_value(),
504 false,
505 "Frame in second Per-STA Profile should not have HT Capabilities IE");
507 perSta2Frame.Get<ExtendedCapabilities>().has_value(),
508 false,
509 "Frame in second Per-STA Profile should not have Extended Capabilities IE");
510 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<VhtCapabilities>().has_value(),
511 true,
512 "Frame in second Per-STA Profile should have VHT Capabilities IE");
513 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<HeCapabilities>().has_value(),
514 true,
515 "Frame in second Per-STA Profile should have HE Capabilities IE");
517 (perSta2Frame.Get<HeCapabilities>() == frame.Get<HeCapabilities>()),
518 true,
519 "HE Capabilities IE not correctly inherited by frame in second Per-STA Profile");
520 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<MultiLinkElement>().has_value(),
521 false,
522 "Frame in second Per-STA Profile should not have Multi-Link Element IE");
524 perSta2Frame.Get<EhtCapabilities>().has_value(),
525 false,
526 "Frame in second Per-STA Profile should have not inherited EHT Capabilities IE");
527 NS_TEST_EXPECT_MSG_EQ(perSta2Frame.Get<TidToLinkMapping>().has_value(),
528 false,
529 "Frame in second Per-STA Profile should not have TID-to-Link Mapping IE");
530
531 // frame in third Per-STA Profile subelement includes VHT Capabilities IE and has inherited
532 // all the IEs but SSID IE, Multi-Link Element IE and Extended Supported Rates IE (different
533 // than in containing frame).
534 auto& perSta3 = mle.GetPerStaProfile(2);
535 NS_TEST_EXPECT_MSG_EQ(perSta3.HasAssocRequest(),
536 true,
537 "Third Per-STA Profile should contain an Association Request frame");
538 auto& perSta3Frame =
539 std::get<std::reference_wrapper<MgtAssocRequestHeader>>(perSta3.GetAssocRequest()).get();
540
541 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<Ssid>().has_value(),
542 false,
543 "Frame in third Per-STA Profile should not have SSID IE");
544 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<SupportedRates>().has_value(),
545 true,
546 "Frame in third Per-STA Profile should have Supported Rates IE");
548 (perSta3Frame.Get<SupportedRates>() == frame.Get<SupportedRates>()),
549 true,
550 "Supported Rates IE not correctly inherited by frame in third Per-STA Profile");
551 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<ExtendedSupportedRatesIE>().has_value(),
552 true,
553 "Frame in third Per-STA Profile should have Extended Supported Rates IE");
555 (perSta3Frame.Get<ExtendedSupportedRatesIE>() == frame.Get<ExtendedSupportedRatesIE>()),
556 false,
557 "Extended Supported Rates IE should have not been inherited by frame in third Per-STA "
558 "Profile");
559 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<HtCapabilities>().has_value(),
560 false,
561 "Frame in third Per-STA Profile should not have HT Capabilities IE");
563 perSta3Frame.Get<ExtendedCapabilities>().has_value(),
564 false,
565 "Frame in third Per-STA Profile should not have Extended Capabilities IE");
566 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<VhtCapabilities>().has_value(),
567 true,
568 "Frame in third Per-STA Profile should have VHT Capabilities IE");
569 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<HeCapabilities>().has_value(),
570 true,
571 "Frame in third Per-STA Profile should have HE Capabilities IE");
573 (perSta3Frame.Get<HeCapabilities>() == frame.Get<HeCapabilities>()),
574 true,
575 "HE Capabilities IE not correctly inherited by frame in third Per-STA Profile");
576 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<MultiLinkElement>().has_value(),
577 false,
578 "Frame in third Per-STA Profile should not have Multi-Link Element IE");
580 perSta3Frame.Get<EhtCapabilities>().has_value(),
581 true,
582 "Frame in third Per-STA Profile should have inherited EHT Capabilities IE");
584 (perSta3Frame.Get<EhtCapabilities>() == frame.Get<EhtCapabilities>()),
585 true,
586 "EHT Capabilities IE not correctly inherited by frame in third Per-STA Profile");
587 NS_TEST_EXPECT_MSG_EQ(perSta3Frame.Get<TidToLinkMapping>().has_value(),
588 false,
589 "Frame in third Per-STA Profile should not have TID-to-Link Mapping IE");
590}
591
599{
600 public:
606
609
619 PhyOpChannelIt channel5It,
620 PhyOpChannelIt channel6It);
621
622 private:
623 void DoRun() override;
624};
625
628 "Check serialization and deserialization of Reduced Neighbor Report elements")
629{
630}
631
633{
634}
635
638 PhyOpChannelIt channel5It,
639 PhyOpChannelIt channel6It)
640{
642
643 std::stringstream info;
644
645 if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
646 {
647 WifiPhyOperatingChannel channel(channel2_4It);
648
649 info << "{Ch=" << +channel.GetNumber() << ", Bw=" << channel.GetWidth() << ", 2.4 GHz} ";
650 rnr.AddNbrApInfoField();
651 std::size_t nbrId = rnr.GetNNbrApInfoFields() - 1;
652 rnr.SetOperatingChannel(nbrId, channel);
653 // Add a TBTT Information Field
654 rnr.AddTbttInformationField(nbrId);
655 rnr.SetBssid(nbrId, 0, Mac48Address("00:00:00:00:00:24"));
656 rnr.SetShortSsid(nbrId, 0, 0);
657 rnr.SetBssParameters(nbrId, 0, 10);
658 rnr.SetPsd20MHz(nbrId, 0, 50);
659 rnr.SetMldParameters(nbrId, 0, 0, 2, 3);
660 }
661
662 if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
663 {
664 WifiPhyOperatingChannel channel(channel5It);
665
666 info << "{Ch=" << +channel.GetNumber() << ", Bw=" << channel.GetWidth() << ", 5 GHz} ";
667 rnr.AddNbrApInfoField();
668 std::size_t nbrId = rnr.GetNNbrApInfoFields() - 1;
669 rnr.SetOperatingChannel(nbrId, channel);
670 // Add a TBTT Information Field
671 rnr.AddTbttInformationField(nbrId);
672 rnr.SetBssid(nbrId, 0, Mac48Address("00:00:00:00:00:05"));
673 rnr.SetShortSsid(nbrId, 0, 0);
674 rnr.SetBssParameters(nbrId, 0, 20);
675 rnr.SetPsd20MHz(nbrId, 0, 60);
676 rnr.SetMldParameters(nbrId, 0, 0, 3, 4);
677 // Add another TBTT Information Field
678 rnr.AddTbttInformationField(nbrId);
679 rnr.SetBssid(nbrId, 1, Mac48Address("00:00:00:00:01:05"));
680 rnr.SetShortSsid(nbrId, 1, 0);
681 rnr.SetBssParameters(nbrId, 1, 30);
682 rnr.SetPsd20MHz(nbrId, 1, 70);
683 rnr.SetMldParameters(nbrId, 1, 0, 4, 5);
684 }
685
686 if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
687 {
688 WifiPhyOperatingChannel channel(channel6It);
689
690 info << "{Ch=" << +channel.GetNumber() << ", Bw=" << channel.GetWidth() << ", 6 GHz} ";
691 rnr.AddNbrApInfoField();
692 std::size_t nbrId = rnr.GetNNbrApInfoFields() - 1;
693 rnr.SetOperatingChannel(nbrId, channel);
694 // Add a TBTT Information Field
695 rnr.AddTbttInformationField(nbrId);
696 rnr.SetBssid(nbrId, 0, Mac48Address("00:00:00:00:00:06"));
697 rnr.SetShortSsid(nbrId, 0, 0);
698 rnr.SetBssParameters(nbrId, 0, 40);
699 rnr.SetPsd20MHz(nbrId, 0, 80);
700 rnr.SetMldParameters(nbrId, 0, 0, 5, 6);
701 }
702
703 NS_LOG_DEBUG(info.str());
704 return rnr;
705}
706
707void
709{
710 PhyOpChannelIt channel2_4It;
711 PhyOpChannelIt channel5It;
712 PhyOpChannelIt channel6It;
713 channel2_4It = channel5It = channel6It = WifiPhyOperatingChannel::m_frequencyChannels.cbegin();
714
715 // Test all available frequency channels
716 while (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend() ||
719 {
720 if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
721 {
722 channel2_4It = WifiPhyOperatingChannel::FindFirst(0,
723 0,
724 0,
727 channel2_4It);
728 }
729 if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
730 {
732 0,
733 0,
736 channel5It);
737 }
738 if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
739 {
741 0,
742 0,
745 channel6It);
746 }
747
748 TestHeaderSerialization(GetReducedNeighborReport(channel2_4It, channel5It, channel6It));
749
750 // advance all channel iterators
751 if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
752 {
753 channel2_4It++;
754 }
755 if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
756 {
757 channel5It++;
758 }
759 if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
760 {
761 channel6It++;
762 }
763 }
764}
765
773{
774 public:
780 WifiEhtCapabilitiesIeTest(bool is2_4Ghz, uint16_t channelWidth);
781 ~WifiEhtCapabilitiesIeTest() override = default;
782
789
798 EhtCapabilities GetEhtCapabilities(uint16_t maxMpduLength,
799 uint32_t maxAmpduSize,
800 uint8_t maxSupportedMcs) const;
801
808 Buffer SerializeIntoBuffer(const EhtCapabilities& ehtCapabilities);
809
817 void CheckSerializedByte(const Buffer& buffer, uint32_t position, uint8_t value);
818
825 void CheckEhtMacCapabilitiesInformation(const Buffer& buffer, uint8_t expectedValueFirstByte);
826
833 void CheckEhtPhyCapabilitiesInformation(const Buffer& buffer, uint8_t expectedValueSixthByte);
834
841 void CheckSupportedEhtMcsAndNssSet(const Buffer& buffer, uint8_t maxSupportedMcs);
842
843 private:
844 void DoRun() override;
845
847 uint16_t m_channelWidth;
848};
849
850WifiEhtCapabilitiesIeTest ::WifiEhtCapabilitiesIeTest(bool is2_4Ghz, uint16_t channelWidth)
851 : HeaderSerializationTestCase{"Check serialization and deserialization of EHT capabilities IE"},
852 m_is2_4Ghz{is2_4Ghz},
853 m_channelWidth{channelWidth}
854{
855}
856
859{
860 HeCapabilities capabilities;
861 uint8_t channelWidthSet = 0;
862 if ((m_channelWidth >= 40) && m_is2_4Ghz)
863 {
864 channelWidthSet |= 0x01;
865 }
866 if ((m_channelWidth >= 80) && !m_is2_4Ghz)
867 {
868 channelWidthSet |= 0x02;
869 }
870 if ((m_channelWidth >= 160) && !m_is2_4Ghz)
871 {
872 channelWidthSet |= 0x04;
873 }
874 capabilities.SetChannelWidthSet(channelWidthSet);
875 return capabilities;
876}
877
880 uint32_t maxAmpduSize,
881 uint8_t maxSupportedMcs) const
882{
883 EhtCapabilities capabilities;
884
885 if (m_is2_4Ghz)
886 {
887 capabilities.SetMaxMpduLength(maxMpduLength);
888 }
889 // round to the next power of two minus one
890 maxAmpduSize = (1UL << static_cast<uint32_t>(std::ceil(std::log2(maxAmpduSize + 1)))) - 1;
891 // The maximum A-MPDU length in EHT capabilities elements ranges from 2^23-1 to 2^24-1
892 capabilities.SetMaxAmpduLength(std::min(std::max(maxAmpduSize, 8388607U), 16777215U));
893
895 (maxSupportedMcs >= 12) ? 1 : 0;
897 (maxSupportedMcs >= 12) ? 1 : 0;
898 if (m_channelWidth == 20)
899 {
900 for (auto maxMcs : {7, 9, 11, 13})
901 {
903 maxMcs,
904 maxMcs <= maxSupportedMcs ? 1 : 0);
906 maxMcs,
907 maxMcs <= maxSupportedMcs ? 2 : 0);
908 }
909 }
910 else
911 {
912 for (auto maxMcs : {9, 11, 13})
913 {
914 capabilities.SetSupportedRxEhtMcsAndNss(
916 maxMcs,
917 maxMcs <= maxSupportedMcs ? 3 : 0);
918 capabilities.SetSupportedTxEhtMcsAndNss(
920 maxMcs,
921 maxMcs <= maxSupportedMcs ? 4 : 0);
922 }
923 }
924 if (m_channelWidth >= 160)
925 {
926 for (auto maxMcs : {9, 11, 13})
927 {
929 maxMcs,
930 maxMcs <= maxSupportedMcs ? 2 : 0);
932 maxMcs,
933 maxMcs <= maxSupportedMcs ? 1 : 0);
934 }
935 }
936 if (m_channelWidth == 320)
937 {
938 capabilities.m_phyCapabilities.support320MhzIn6Ghz = 1;
939 for (auto maxMcs : {9, 11, 13})
940 {
942 maxMcs,
943 maxMcs <= maxSupportedMcs ? 4 : 0);
945 maxMcs,
946 maxMcs <= maxSupportedMcs ? 3 : 0);
947 }
948 }
949 else
950 {
951 capabilities.m_phyCapabilities.support320MhzIn6Ghz = 0;
952 }
953
954 return capabilities;
955}
956
957Buffer
959{
960 Buffer buffer;
961 buffer.AddAtStart(ehtCapabilities.GetSerializedSize());
962 ehtCapabilities.Serialize(buffer.Begin());
963 return buffer;
964}
965
966void
968 uint32_t position,
969 uint8_t value)
970{
971 Buffer::Iterator it = buffer.Begin();
972 it.Next(position);
973 uint8_t byte = it.ReadU8();
974 NS_TEST_EXPECT_MSG_EQ(+byte, +value, "Unexpected byte at pos=" << position);
975}
976
977void
979 uint8_t expectedValueFirstByte)
980{
981 CheckSerializedByte(buffer, 3, expectedValueFirstByte);
982 CheckSerializedByte(buffer, 4, 0x00);
983}
984
985void
987 uint8_t expectedValueSixthByte)
988{
989 CheckSerializedByte(buffer, 5, (m_channelWidth == 320) ? 0x02 : 0x00);
990 CheckSerializedByte(buffer, 6, 0x00);
991 CheckSerializedByte(buffer, 7, 0x00);
992 CheckSerializedByte(buffer, 8, 0x00);
993 CheckSerializedByte(buffer, 9, 0x00);
994 CheckSerializedByte(buffer, 10, expectedValueSixthByte);
995 CheckSerializedByte(buffer, 11, 0x00);
996 CheckSerializedByte(buffer, 12, 0x00);
997 CheckSerializedByte(buffer, 13, 0x00);
998}
999
1000void
1002 uint8_t maxSupportedMcs)
1003{
1004 if (m_channelWidth == 20)
1005 {
1006 CheckSerializedByte(buffer, 14, 0x21); // first byte of Supported EHT-MCS And NSS Set
1008 buffer,
1009 15,
1010 maxSupportedMcs >= 8 ? 0x21 : 0x00); // second byte of Supported EHT-MCS And NSS Set
1012 buffer,
1013 16,
1014 maxSupportedMcs >= 10 ? 0x21 : 0x00); // third byte of Supported EHT-MCS And NSS Set
1016 buffer,
1017 17,
1018 maxSupportedMcs >= 12 ? 0x21 : 0x00); // fourth byte of Supported EHT-MCS And NSS Set
1019 }
1020 else
1021 {
1022 CheckSerializedByte(buffer, 14, 0x43); // first byte of Supported EHT-MCS And NSS Set
1024 buffer,
1025 15,
1026 maxSupportedMcs >= 10 ? 0x43 : 0x00); // second byte of Supported EHT-MCS And NSS Set
1028 buffer,
1029 16,
1030 maxSupportedMcs >= 12 ? 0x43 : 0x00); // third byte of Supported EHT-MCS And NSS Set
1031 }
1032 if (m_channelWidth >= 160)
1033 {
1034 CheckSerializedByte(buffer, 17, 0x12); // first byte of EHT-MCS Map (BW = 160 MHz)
1036 buffer,
1037 18,
1038 maxSupportedMcs >= 10 ? 0x12 : 0x00); // second byte of EHT-MCS Map (BW = 160 MHz)
1040 buffer,
1041 19,
1042 maxSupportedMcs >= 12 ? 0x12 : 0x00); // third byte of EHT-MCS Map (BW = 160 MHz)
1043 }
1044 if (m_channelWidth == 320)
1045 {
1046 CheckSerializedByte(buffer, 20, 0x34); // first byte of EHT-MCS Map (BW = 320 MHz)
1048 buffer,
1049 21,
1050 maxSupportedMcs >= 10 ? 0x34 : 0x00); // second byte of EHT-MCS Map (BW = 320 MHz)
1052 buffer,
1053 22,
1054 maxSupportedMcs >= 12 ? 0x34 : 0x00); // third byte of EHT-MCS Map (BW = 320 MHz)
1055 }
1056}
1057
1058void
1060{
1061 uint8_t maxMcs = 0;
1062 uint16_t expectedEhtMcsAndNssSetSize = 0;
1063 switch (m_channelWidth)
1064 {
1065 case 20:
1066 expectedEhtMcsAndNssSetSize = 4;
1067 break;
1068 case 40:
1069 case 80:
1070 expectedEhtMcsAndNssSetSize = 3;
1071 break;
1072 case 160:
1073 expectedEhtMcsAndNssSetSize = (2 * 3);
1074 break;
1075 case 320:
1076 expectedEhtMcsAndNssSetSize = (3 * 3);
1077 break;
1078 default:
1079 NS_ASSERT_MSG(false, "Invalid upper channel width " << m_channelWidth);
1080 }
1081
1082 uint16_t expectedSize = 1 + // Element ID
1083 1 + // Length
1084 1 + // Element ID Extension
1085 2 + // EHT MAC Capabilities Information
1086 9 + // EHT PHY Capabilities Information
1087 expectedEhtMcsAndNssSetSize; // Supported EHT-MCS And NSS Set
1088
1091
1092 {
1093 maxMcs = 11;
1094 HeCapabilities heCapabilities = GetHeCapabilities();
1095 EhtCapabilities ehtCapabilities = GetEhtCapabilities(3895, 65535, maxMcs);
1096
1097 NS_ASSERT(ehtCapabilities.GetHighestSupportedRxMcs(mapType) == maxMcs);
1098 NS_ASSERT(ehtCapabilities.GetHighestSupportedTxMcs(mapType) == maxMcs);
1099
1100 NS_TEST_EXPECT_MSG_EQ(ehtCapabilities.GetSerializedSize(),
1101 expectedSize,
1102 "Unexpected header size");
1103
1104 Buffer buffer = SerializeIntoBuffer(ehtCapabilities);
1105
1107
1109
1110 CheckSupportedEhtMcsAndNssSet(buffer, maxMcs);
1111
1112 TestHeaderSerialization(ehtCapabilities, m_is2_4Ghz, heCapabilities);
1113 }
1114
1115 {
1116 maxMcs = 11;
1117 HeCapabilities heCapabilities = GetHeCapabilities();
1118 EhtCapabilities ehtCapabilities = GetEhtCapabilities(11454, 65535, maxMcs);
1119
1120 NS_ASSERT(ehtCapabilities.GetHighestSupportedRxMcs(mapType) == maxMcs);
1121 NS_ASSERT(ehtCapabilities.GetHighestSupportedTxMcs(mapType) == maxMcs);
1122
1123 NS_TEST_EXPECT_MSG_EQ(ehtCapabilities.GetSerializedSize(),
1124 expectedSize,
1125 "Unexpected header size");
1126
1127 Buffer buffer = SerializeIntoBuffer(ehtCapabilities);
1128
1129 CheckEhtMacCapabilitiesInformation(buffer, m_is2_4Ghz ? 0x80 : 0x00);
1130
1132
1133 CheckSupportedEhtMcsAndNssSet(buffer, maxMcs);
1134
1135 TestHeaderSerialization(ehtCapabilities, m_is2_4Ghz, heCapabilities);
1136 }
1137
1138 {
1139 maxMcs = 13;
1140 HeCapabilities heCapabilities = GetHeCapabilities();
1141 EhtCapabilities ehtCapabilities = GetEhtCapabilities(3895, 65535, maxMcs);
1142
1143 NS_ASSERT(ehtCapabilities.GetHighestSupportedRxMcs(mapType) == maxMcs);
1144 NS_ASSERT(ehtCapabilities.GetHighestSupportedTxMcs(mapType) == maxMcs);
1145
1146 NS_TEST_EXPECT_MSG_EQ(ehtCapabilities.GetSerializedSize(),
1147 expectedSize,
1148 "Unexpected header size");
1149
1150 Buffer buffer = SerializeIntoBuffer(ehtCapabilities);
1151
1153
1155
1156 CheckSupportedEhtMcsAndNssSet(buffer, maxMcs);
1157
1158 TestHeaderSerialization(ehtCapabilities, m_is2_4Ghz, heCapabilities);
1159 }
1160
1161 {
1162 maxMcs = 11;
1163 HeCapabilities heCapabilities = GetHeCapabilities();
1164 EhtCapabilities ehtCapabilities = GetEhtCapabilities(3895, 65535, maxMcs);
1165
1166 NS_ASSERT(ehtCapabilities.GetHighestSupportedRxMcs(mapType) == maxMcs);
1167 NS_ASSERT(ehtCapabilities.GetHighestSupportedTxMcs(mapType) == maxMcs);
1168
1169 std::vector<std::pair<uint8_t, uint8_t>> ppeThresholds;
1170 ppeThresholds.emplace_back(1, 2); // NSS1 242-tones RU
1171 ppeThresholds.emplace_back(2, 3); // NSS1 484-tones RU
1172 ppeThresholds.emplace_back(3, 4); // NSS2 242-tones RU
1173 ppeThresholds.emplace_back(4, 3); // NSS2 484-tones RU
1174 ppeThresholds.emplace_back(3, 2); // NSS3 242-tones RU
1175 ppeThresholds.emplace_back(2, 1); // NSS3 484-tones RU
1176 ehtCapabilities.SetPpeThresholds(2, 0x03, ppeThresholds);
1177
1178 expectedSize += 6;
1179
1180 NS_TEST_EXPECT_MSG_EQ(ehtCapabilities.GetSerializedSize(),
1181 expectedSize,
1182 "Unexpected header size");
1183
1184 Buffer buffer = SerializeIntoBuffer(ehtCapabilities);
1185
1187
1189
1190 CheckSupportedEhtMcsAndNssSet(buffer, maxMcs);
1191
1192 TestHeaderSerialization(ehtCapabilities, m_is2_4Ghz, heCapabilities);
1193 }
1194}
1195
1203{
1204 public:
1212 template <typename... Args>
1213 TidToLinkMappingElementTest(TidLinkMapDir direction, Args&&... args);
1214
1215 ~TidToLinkMappingElementTest() override = default;
1216
1217 private:
1226 template <typename... Args>
1227 void SetLinkMapping(uint8_t tid, const std::list<uint8_t>& linkIds, Args&&... args);
1228
1233 {
1234 }
1235
1236 void DoRun() override;
1237
1239};
1240
1241template <typename... Args>
1244 "Check serialization and deserialization of TID-To-Link Mapping elements")
1245{
1248 SetLinkMapping(args...);
1249}
1250
1251template <typename... Args>
1252void
1254 const std::list<uint8_t>& linkIds,
1255 Args&&... args)
1256{
1259 SetLinkMapping(args...);
1260}
1261
1262void
1264{
1266}
1267
1275{
1276 public:
1292 uint8_t rxMaxNss0_7,
1293 uint8_t txMaxNss0_7,
1294 uint8_t rxMaxNss8_9,
1295 uint8_t txMaxNss8_9,
1296 uint8_t rxMaxNss10_11,
1297 uint8_t txMaxNss10_11,
1298 uint8_t rxMaxNss12_13,
1299 uint8_t txMaxNss12_13,
1300 std::optional<EhtOperation::EhtOpInfo> opInfo);
1301
1302 ~EhtOperationElementTest() override = default;
1303
1304 private:
1305 void DoRun() override;
1306
1308};
1309
1311 uint8_t rxMaxNss0_7,
1312 uint8_t txMaxNss0_7,
1313 uint8_t rxMaxNss8_9,
1314 uint8_t txMaxNss8_9,
1315 uint8_t rxMaxNss10_11,
1316 uint8_t txMaxNss10_11,
1317 uint8_t rxMaxNss12_13,
1318 uint8_t txMaxNss12_13,
1319 std::optional<EhtOperation::EhtOpInfo> opInfo)
1321 "Check serialization and deserialization of EHT Operation elements")
1322{
1323 m_ehtOperation.m_params = params;
1324 m_ehtOperation.SetMaxRxNss(rxMaxNss0_7, 0, 7);
1325 m_ehtOperation.SetMaxTxNss(txMaxNss0_7, 0, 7);
1326 m_ehtOperation.SetMaxRxNss(rxMaxNss8_9, 8, 9);
1327 m_ehtOperation.SetMaxTxNss(txMaxNss8_9, 8, 9);
1328 m_ehtOperation.SetMaxRxNss(rxMaxNss10_11, 10, 11);
1329 m_ehtOperation.SetMaxTxNss(txMaxNss10_11, 10, 11);
1330 m_ehtOperation.SetMaxRxNss(rxMaxNss12_13, 12, 13);
1331 m_ehtOperation.SetMaxTxNss(txMaxNss12_13, 12, 13);
1332 m_ehtOperation.m_opInfo = opInfo;
1333}
1334
1335void
1337{
1339}
1340
1348{
1349 public:
1351};
1352
1354 : TestSuite("wifi-eht-info-elems", UNIT)
1355{
1365 AddTestCase(new TidToLinkMappingElementTest(TidLinkMapDir::DOWNLINK), TestCase::QUICK);
1367 new TidToLinkMappingElementTest(TidLinkMapDir::UPLINK, 3, std::list<uint8_t>{0, 4, 6}),
1369 AddTestCase(new TidToLinkMappingElementTest(TidLinkMapDir::BOTH_DIRECTIONS,
1370 3,
1371 std::list<uint8_t>{0, 4, 6},
1372 6,
1373 std::list<uint8_t>{3, 7, 11, 14}),
1375 AddTestCase(new TidToLinkMappingElementTest(TidLinkMapDir::DOWNLINK,
1376 0,
1377 std::list<uint8_t>{0, 1, 2},
1378 1,
1379 std::list<uint8_t>{3, 4, 5},
1380 2,
1381 std::list<uint8_t>{6, 7},
1382 3,
1383 std::list<uint8_t>{8, 9, 10},
1384 4,
1385 std::list<uint8_t>{11, 12, 13},
1386 5,
1387 std::list<uint8_t>{14},
1388 6,
1389 std::list<uint8_t>{1, 3, 6},
1390 7,
1391 std::list<uint8_t>{11, 14}),
1393 AddTestCase(new EhtOperationElementTest({0, 0, 0, 0, 0}, 1, 2, 3, 4, 5, 6, 7, 8, std::nullopt),
1395 AddTestCase(new EhtOperationElementTest({1, 0, 0, 1, 0},
1396 1,
1397 2,
1398 3,
1399 4,
1400 5,
1401 6,
1402 7,
1403 8,
1404 EhtOperation::EhtOpInfo{{1}, 3, 5}),
1406 AddTestCase(new EhtOperationElementTest({1, 1, 1, 1, 2},
1407 1,
1408 2,
1409 3,
1410 4,
1411 5,
1412 6,
1413 7,
1414 8,
1415 EhtOperation::EhtOpInfo{{2}, 4, 6, 3000}),
1417}
1418
Test EHT Operation information element serialization and deserialization.
void DoRun() override
Implementation to actually run this TestCase.
EhtOperationElementTest(const EhtOperation::EhtOpParams &params, uint8_t rxMaxNss0_7, uint8_t txMaxNss0_7, uint8_t rxMaxNss8_9, uint8_t txMaxNss8_9, uint8_t rxMaxNss10_11, uint8_t txMaxNss10_11, uint8_t rxMaxNss12_13, uint8_t txMaxNss12_13, std::optional< EhtOperation::EhtOpInfo > opInfo)
Constructor.
EhtOperation m_ehtOperation
EHT Operation element.
~EhtOperationElementTest() override=default
Test Reduced Neighbor Report serialization and deserialization.
ReducedNeighborReport GetReducedNeighborReport(PhyOpChannelIt channel2_4It, PhyOpChannelIt channel5It, PhyOpChannelIt channel6It)
Get a Reduced Neighbor Report element including the given operating channels.
void DoRun() override
Implementation to actually run this TestCase.
WifiPhyOperatingChannel::ConstIterator PhyOpChannelIt
typedef for const iterator on the set of available channels
Test serialization and deserialization of EHT capabilities IE.
void CheckSerializedByte(const Buffer &buffer, uint32_t position, uint8_t value)
Check that the given buffer contains the given value at the given position.
void DoRun() override
Implementation to actually run this TestCase.
HeCapabilities GetHeCapabilities() const
Generate the HE capabilities IE.
bool m_is2_4Ghz
whether the PHY is operating in 2.4 GHz
void CheckSupportedEhtMcsAndNssSet(const Buffer &buffer, uint8_t maxSupportedMcs)
Check the content of the Supported EHT-MCS And NSS Set subfield.
~WifiEhtCapabilitiesIeTest() override=default
Buffer SerializeIntoBuffer(const EhtCapabilities &ehtCapabilities)
Serialize the EHT capabilities in a buffer.
uint16_t m_channelWidth
Supported channel width by the PHY (in MHz)
EhtCapabilities GetEhtCapabilities(uint16_t maxMpduLength, uint32_t maxAmpduSize, uint8_t maxSupportedMcs) const
Generate the EHT capabilities IE.
void CheckEhtMacCapabilitiesInformation(const Buffer &buffer, uint8_t expectedValueFirstByte)
Check the content of the EHT MAC Capabilities Information subfield.
void CheckEhtPhyCapabilitiesInformation(const Buffer &buffer, uint8_t expectedValueSixthByte)
Check the content of the EHT PHY Capabilities Information subfield.
wifi EHT Information Elements Test Suite
iterator in a Buffer instance
Definition: buffer.h:100
uint8_t ReadU8()
Definition: buffer.h:1027
uint16_t ReadLsbtohU16()
Definition: buffer.cc:1070
void Next()
go forward by one byte
Definition: buffer.h:853
automatically resized byte buffer
Definition: buffer.h:94
uint32_t GetSize() const
Definition: buffer.h:1068
void AddAtStart(uint32_t start)
Definition: buffer.cc:314
Buffer::Iterator Begin() const
Definition: buffer.h:1074
void SetEss()
Set the Extended Service Set (ESS) bit in the capability information field.
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
void SetShortPreamble(bool shortPreamble)
Set the short preamble bit in the capability information field.
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize capability information from the given buffer.
The IEEE 802.11be EHT Capabilities.
void SetPpeThresholds(uint8_t nssPe, uint8_t ruIndexBitmask, const std::vector< std::pair< uint8_t, uint8_t > > &ppeThresholds)
Set the EHT PPE threshold info subfield.
void SetMaxMpduLength(uint16_t length)
Set the maximum MPDU length.
void SetSupportedTxEhtMcsAndNss(EhtMcsAndNssSet::EhtMcsMapType mapType, uint8_t upperMcs, uint8_t maxNss)
Set a subfield of the Supported EHT-MCS And NSS Set.
EhtPhyCapabilities m_phyCapabilities
EHT PHY Capabilities Info subfield.
uint8_t GetHighestSupportedTxMcs(EhtMcsAndNssSet::EhtMcsMapType mapType)
Get the highest supported TX MCS for a given EHT-MCS map type.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum A-MPDU length.
void SetSupportedRxEhtMcsAndNss(EhtMcsAndNssSet::EhtMcsMapType mapType, uint8_t upperMcs, uint8_t maxNss)
Set a subfield of the Supported EHT-MCS And NSS Set.
uint8_t GetHighestSupportedRxMcs(EhtMcsAndNssSet::EhtMcsMapType mapType)
Get the highest supported RX MCS for a given EHT-MCS map type.
EHT Operation Information Element.
Definition: eht-operation.h:66
void SetMaxTxNss(uint8_t maxNss, uint8_t mcsStart, uint8_t mcsEnd)
Set the max Tx NSS for input MCS index range.
void SetMaxRxNss(uint8_t maxNss, uint8_t mcsStart, uint8_t mcsEnd)
Set the max Rx NSS for input MCS index range.
EhtOpParams m_params
EHT Operation Parameters.
std::optional< EhtOpInfo > m_opInfo
EHT Operation Information.
The Extended Capabilities Information Element.
The Extended Supported Rates Information Element.
The IEEE 802.11ax HE Capabilities.
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
Subclass of TestCase class adding the ability to test the serialization and deserialization of a Head...
void TestHeaderSerialization(const T &hdr, Args &&... args)
Serialize the given header in a buffer, then create a new header by deserializing from the buffer and...
The HT Capabilities Information Element.
an EUI-48 address
Definition: mac48-address.h:46
Implement the header for management frames of type association request.
Definition: mgt-headers.h:161
CapabilityInformation & Capabilities()
Definition: mgt-headers.cc:194
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:182
The IEEE 802.11 Non-Inheritance Information Element.
std::set< uint8_t > m_elemIdList
list of unique Element ID values (in increasing order)
bool IsPresent(uint8_t elemId, uint8_t elemIdExt=0) const
std::set< uint8_t > m_elemIdExtList
list of unique Element ID Extension values
The Reduced Neighbor Report element.
std::size_t GetNNbrApInfoFields() const
Get the number of Neighbor AP Information fields.
void SetMldParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t mldId, uint8_t linkId, uint8_t changeSequence)
Set the MLD Parameters subfield of the i-th TBTT Information field of the given Neighbor AP Informati...
void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid)
Set the Short SSID field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid)
Set the BSSID field of the i-th TBTT Information field of the given Neighbor AP Information field.
void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz)
Set the 20 MHz PSD field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
void AddNbrApInfoField()
Add a Neighbor AP Information field.
void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters)
Set the BSS Parameters field of the i-th TBTT Information field of the given Neighbor AP Information ...
void AddTbttInformationField(std::size_t nbrApInfoId)
Add a TBTT Information fields to the TBTT Information Set field of the given Neighbor AP Information ...
void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel &channel)
Set the Operating Class and the Channel Number fields of the given Neighbor AP Information field base...
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
The Supported Rates Information Element.
@ QUICK
Fast test.
Definition: test.h:1065
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1256
The IEEE 802.11ac VHT Capabilities.
uint16_t GetSerializedSize() const
Get the size of the serialized IE including Element ID and length fields (for every element this IE i...
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize entire IE including Element ID and length fields.
Buffer::Iterator DeserializeIfPresent(Buffer::Iterator i)
Deserialize entire IE (which may possibly be fragmented into multiple elements) if it is present.
Class that keeps track of all information about the current PHY operating channel.
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
static ConstIterator FindFirst(uint8_t number, uint16_t frequency, uint16_t width, WifiStandard standard, WifiPhyBand band, ConstIterator start=m_frequencyChannels.begin())
Find the first channel matching the specified parameters.
std::set< FrequencyChannelInfo >::const_iterator ConstIterator
Typedef for a const iterator pointing to a channel in the set of available channels.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
Definition: test.h:956
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:251
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1360
@ WIFI_STANDARD_80211be
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
Definition: wifi-phy-band.h:39
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TidLinkMapDir
TID-to-Link Mapping Control Direction IEEE 802.11be D2.0 Figure 9-1002an.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Struct containing all supported rates.
SupportedRates rates
supported rates
std::optional< ExtendedSupportedRatesIE > extendedRates
supported extended rates
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
Medium Synchronization Delay Information subfield.
uint8_t mediumSyncDuration
Medium Synchronization Duration.
Common Info field of the Basic Multi-Link element.
std::optional< EmlCapabilities > m_emlCapabilities
EML Capabilities.
uint8_t Deserialize(Buffer::Iterator start, uint16_t presence)
Deserialize the Common Info field.
std::optional< MediumSyncDelayInfo > m_mediumSyncDelayInfo
Medium Synchronization Delay Information.
Mac48Address m_mldMacAddress
Subfields.
std::optional< uint8_t > m_bssParamsChangeCount
BSS Parameters Change Count.
std::optional< uint8_t > m_linkIdInfo
Link ID Info.
EHT Operation Information subfield IEEE 802.11be D2.0 Figure 9-1002c.
EHT Operation Parameters subfield IEEE 802.11be D2.0 Figure 9-1002b.
Definition: eht-operation.h:73
uint8_t support320MhzIn6Ghz
Support For 320 MHz In 6 GHz.
uint8_t supportTx1024And4096QamForRuSmallerThan242Tones
Tx 1024-QAM And 4096-QAM < 242-tone RU Support.
uint8_t supportRx1024And4096QamForRuSmallerThan242Tones
Rx 1024-QAM And 4096-QAM < 242-tone RU Support.
static WifiEhtInfoElemsTestSuite g_wifiEhtInfoElemsTestSuite
the test suite
#define IE_EXT_EHT_CAPABILITIES
#define IE_EXTENSION
#define IE_EXT_MULTI_LINK_ELEMENT