9#include "ns3/ap-wifi-mac.h"
10#include "ns3/attribute-container.h"
11#include "ns3/boolean.h"
12#include "ns3/config.h"
13#include "ns3/ctrl-headers.h"
14#include "ns3/double.h"
15#include "ns3/frame-exchange-manager.h"
16#include "ns3/mac-rx-middle.h"
17#include "ns3/mobility-helper.h"
18#include "ns3/multi-model-spectrum-channel.h"
19#include "ns3/originator-block-ack-agreement.h"
20#include "ns3/packet-socket-client.h"
21#include "ns3/packet-socket-helper.h"
22#include "ns3/packet-socket-server.h"
23#include "ns3/packet.h"
24#include "ns3/pointer.h"
25#include "ns3/qos-txop.h"
26#include "ns3/qos-utils.h"
27#include "ns3/recipient-block-ack-agreement.h"
28#include "ns3/spectrum-wifi-helper.h"
29#include "ns3/string.h"
31#include "ns3/wifi-default-ack-manager.h"
32#include "ns3/wifi-mac-header.h"
33#include "ns3/wifi-mac-queue.h"
34#include "ns3/wifi-mpdu.h"
35#include "ns3/wifi-net-device.h"
36#include "ns3/wifi-phy.h"
37#include "ns3/yans-wifi-helper.h"
89 void DoRun()
override;
94 :
TestCase(
"Check correct order of buffering when startSequence < endSeq")
110 std::list<uint16_t> m_buffer;
111 std::list<uint16_t>::iterator i;
112 std::list<uint16_t>::iterator j;
113 m_buffer.push_back(0);
114 m_buffer.push_back(16);
115 m_buffer.push_back(56000);
117 uint16_t endSeq = 4000;
119 uint16_t receivedSeq = 4001 * 16;
122 for (i = m_buffer.begin(); i != m_buffer.end(); i++)
130 m_buffer.insert(i, receivedSeq);
132 receivedSeq = 3999 * 16;
135 for (i = m_buffer.begin(); i != m_buffer.end(); i++)
143 m_buffer.insert(i, receivedSeq);
145 for (i = m_buffer.begin(), j =
m_expectedBuffer.begin(); i != m_buffer.end(); i++, j++)
187 void DoRun()
override;
192 :
TestCase(
"Check correct order of buffering when startSequence > endSeq")
209 std::list<uint16_t> m_buffer;
210 std::list<uint16_t>::iterator i;
211 std::list<uint16_t>::iterator j;
212 m_buffer.push_back(256);
213 m_buffer.push_back(64000);
214 m_buffer.push_back(16);
216 uint16_t endSeq = 10;
218 uint16_t receivedSeq = 15 * 16;
221 for (i = m_buffer.begin(); i != m_buffer.end(); i++)
229 m_buffer.insert(i, receivedSeq);
231 receivedSeq = 15 * 16 + 1;
234 for (i = m_buffer.begin(); i != m_buffer.end(); i++)
242 m_buffer.insert(i, receivedSeq);
244 receivedSeq = 4050 * 16;
247 for (i = m_buffer.begin(); i != m_buffer.end(); i++)
255 m_buffer.insert(i, receivedSeq);
257 for (i = m_buffer.begin(), j =
m_expectedBuffer.begin(); i != m_buffer.end(); i++, j++)
275 void DoRun()
override;
279 :
TestCase(
"Check the correctness of the originator block ack window")
286 uint16_t winSize = 16;
287 uint16_t startingSeq = 4090;
297 for (uint16_t i = 0; i < winSize; i++)
301 "Not all flags are cleared after initialization");
308 uint16_t seqNumber = startingSeq;
309 mpdu->GetHeader().SetSequenceNumber(seqNumber);
334 "Incorrect starting sequence after 5 acknowledgments");
335 for (uint16_t i = 0; i < winSize; i++)
339 "Not all flags are cleared after 5 acknowledgments");
366 "Incorrect starting sequence after 1 unacknowledged MPDU");
369 "Incorrect flag after 1 unacknowledged MPDU");
372 "Incorrect flag after 1 unacknowledged MPDU");
375 "Incorrect flag after 1 unacknowledged MPDU");
378 "Incorrect flag after 1 unacknowledged MPDU");
381 "Incorrect flag after 1 unacknowledged MPDU");
382 for (uint16_t i = 5; i < winSize; i++)
386 "Incorrect flag after 1 unacknowledged MPDU");
391 mpdu->GetHeader().SetSequenceNumber(startingSeq);
404 "Incorrect starting sequence after acknowledgment of missing MPDU");
405 for (uint16_t i = 0; i < winSize; i++)
409 "Not all flags are cleared after acknowledgment of missing MPDU");
415 mpdu->GetHeader().SetSequenceNumber(seqNumber);
428 mpdu->GetHeader().SetSequenceNumber(seqNumber);
446 "Incorrect starting sequence after 3 unacknowledged MPDUs");
449 "Incorrect flag after 3 unacknowledged MPDUs");
452 "Incorrect flag after 3 unacknowledged MPDUs");
455 "Incorrect flag after 3 unacknowledged MPDUs");
458 "Incorrect flag after 3 unacknowledged MPDUs");
461 "Incorrect flag after 3 unacknowledged MPDUs");
464 "Incorrect flag after 3 unacknowledged MPDUs");
467 "Incorrect flag after 3 unacknowledged MPDUs");
470 "Incorrect flag after 3 unacknowledged MPDUs");
473 "Incorrect flag after 3 unacknowledged MPDUs");
476 "Incorrect flag after 3 unacknowledged MPDUs");
479 "Incorrect flag after 3 unacknowledged MPDUs");
482 "Incorrect flag after 3 unacknowledged MPDUs");
483 for (uint16_t i = 12; i < winSize; i++)
487 "Incorrect flag after 3 unacknowledged MPDUs");
493 mpdu->GetHeader().SetSequenceNumber(seqNumber);
507 "Incorrect starting sequence after transmitting an MPDU beyond the current window");
510 "Incorrect flag after transmitting an MPDU beyond the current window");
513 "Incorrect flag after transmitting an MPDU beyond the current window");
516 "Incorrect flag after transmitting an MPDU beyond the current window");
519 "Incorrect flag after transmitting an MPDU beyond the current window");
522 "Incorrect flag after transmitting an MPDU beyond the current window");
525 "Incorrect flag after transmitting an MPDU beyond the current window");
528 "Incorrect flag after transmitting an MPDU beyond the current window");
531 "Incorrect flag after transmitting an MPDU beyond the current window");
534 "Incorrect flag after transmitting an MPDU beyond the current window");
537 "Incorrect flag after transmitting an MPDU beyond the current window");
538 for (uint16_t i = 10; i < winSize; i++)
543 "Incorrect flag after transmitting an MPDU beyond the current window");
549 mpdu->GetHeader().SetSequenceNumber(seqNumber);
563 "Incorrect starting sequence after transmitting another MPDU beyond the current window");
567 "Incorrect flag after transmitting another MPDU beyond the current window");
571 "Incorrect flag after transmitting another MPDU beyond the current window");
575 "Incorrect flag after transmitting another MPDU beyond the current window");
579 "Incorrect flag after transmitting another MPDU beyond the current window");
583 "Incorrect flag after transmitting another MPDU beyond the current window");
584 for (uint16_t i = 5; i < winSize; i++)
589 "Incorrect flag after transmitting another MPDU beyond the current window");
595 mpdu->GetHeader().SetSequenceNumber(seqNumber);
608 "Incorrect starting sequence after discarding an MPDU");
609 for (uint16_t i = 0; i < winSize; i++)
613 "Incorrect flag after discarding an MPDU");
618 for (uint16_t i = 1; i < winSize; i++)
633 "Incorrect starting sequence after acknowledging all but the first MPDU");
636 "Incorrect flag after acknowledging all but the first MPDU");
637 for (uint16_t i = 1; i < winSize; i++)
641 "Incorrect flag after acknowledging all but the first MPDU");
658 "Incorrect starting sequence after acknowledging the first MPDU");
659 for (uint16_t i = 0; i < winSize; i++)
663 "Incorrect flag after acknowledging the first MPDU");
679 void DoRun()
override;
684 :
TestCase(
"Check the correctness of block ack compressed bitmap")
696 for (uint16_t i = 179; i < 220; i++)
700 for (uint16_t i = 225; i <= 242; i++)
725 "error in compressed bitmap");
732 for (uint16_t i = 4090; i != 10; i = (i + 1) % 4096)
736 for (uint16_t i = 22; i < 25; i++)
780 void DoRun()
override;
796 :
TestCase(
"Test case for Block Ack recipient reordering buffer operations"),
839 "The MPDU forwarded up is not the expected one");
891 "The MPDU forwarded up is not the expected one");
896 "The MPDU forwarded up is not the expected one");
899 "The MPDU forwarded up is not the expected one");
904 "The MPDU forwarded up is not the expected one");
909 "The MPDU forwarded up is not the expected one");
914 "The MPDU forwarded up is not the expected one");
932 "The MPDU forwarded up is not the expected one");
974 "The MPDU forwarded up is not the expected one");
979 "The MPDU forwarded up is not the expected one");
984 "The MPDU forwarded up is not the expected one");
1003 void DoRun()
override;
1007 :
TestCase(
"Check the correctness of Multi-STA block ack")
1021 uint16_t aid1 = 100;
1022 bool ackType1 =
true;
1025 blockAck.SetAid11(aid1, 0);
1026 blockAck.SetAckType(ackType1, 0);
1027 blockAck.SetTidInfo(tid1, 0);
1030 uint16_t aid2 = 200;
1031 bool ackType2 =
false;
1033 uint16_t startSeq2 = 1000;
1035 blockAck.SetAid11(aid2, 1);
1036 blockAck.SetAckType(ackType2, 1);
1037 blockAck.SetTidInfo(tid2, 1);
1038 blockAck.SetStartingSequence(startSeq2, 1);
1040 for (uint16_t i = startSeq2; i < startSeq2 + 8; i += 2)
1042 blockAck.SetReceivedPacket(i, 1);
1045 for (uint16_t i = startSeq2 + 9; i < startSeq2 + 16; i += 2)
1047 blockAck.SetReceivedPacket(i, 1);
1051 for (uint16_t i = startSeq2 + 24; i < startSeq2 + 32; i++)
1053 blockAck.SetReceivedPacket(i, 1);
1057 uint16_t aid3 = 300;
1058 bool ackType3 =
false;
1060 uint16_t startSeq3 = 2000;
1062 blockAck.SetAid11(aid3, 2);
1063 blockAck.SetAckType(ackType3, 2);
1064 blockAck.SetTidInfo(tid3, 2);
1065 blockAck.SetStartingSequence(startSeq3, 2);
1067 for (uint16_t i = startSeq3; i < startSeq3 + 8; i += 2)
1069 blockAck.SetReceivedPacket(i, 2);
1072 for (uint16_t i = startSeq3 + 9; i < startSeq3 + 16; i += 2)
1074 blockAck.SetReceivedPacket(i, 2);
1078 for (uint16_t i = startSeq3 + 24; i < startSeq3 + 32; i++)
1080 blockAck.SetReceivedPacket(i, 2);
1083 for (uint16_t i = startSeq3 + 32; i < startSeq3 + 36; i++)
1085 blockAck.SetReceivedPacket(i, 2);
1088 for (uint16_t i = startSeq3 + 44; i < startSeq3 + 48; i++)
1090 blockAck.SetReceivedPacket(i, 2);
1094 for (uint16_t i = startSeq3 + 56; i < startSeq3 + 64; i++)
1096 blockAck.SetReceivedPacket(i, 2);
1100 uint16_t aid4 = 400;
1101 bool ackType4 =
false;
1103 uint16_t startSeq4 = 3000;
1105 blockAck.SetAid11(aid4, 3);
1106 blockAck.SetAckType(ackType4, 3);
1107 blockAck.SetTidInfo(tid4, 3);
1108 blockAck.SetStartingSequence(startSeq4, 3);
1110 for (uint16_t i = startSeq4; i < startSeq4 + 8; i += 2)
1112 blockAck.SetReceivedPacket(i, 3);
1115 for (uint16_t i = startSeq4 + 9; i < startSeq4 + 16; i += 2)
1117 blockAck.SetReceivedPacket(i, 3);
1121 for (uint16_t i = startSeq4 + 24; i < startSeq4 + 32; i++)
1123 blockAck.SetReceivedPacket(i, 3);
1126 for (uint16_t i = startSeq4 + 32; i < startSeq4 + 36; i++)
1128 blockAck.SetReceivedPacket(i, 3);
1131 for (uint16_t i = startSeq4 + 44; i < startSeq4 + 48; i++)
1133 blockAck.SetReceivedPacket(i, 3);
1137 for (uint16_t i = startSeq4 + 56; i < startSeq4 + 64; i++)
1139 blockAck.SetReceivedPacket(i, 3);
1143 for (uint16_t i = startSeq4 + 72; i < startSeq4 + 80; i++)
1145 blockAck.SetReceivedPacket(i, 3);
1149 for (uint16_t i = startSeq4 + 88; i < startSeq4 + 96; i++)
1151 blockAck.SetReceivedPacket(i, 3);
1155 for (uint16_t i = startSeq4 + 104; i < startSeq4 + 112; i++)
1157 blockAck.SetReceivedPacket(i, 3);
1161 for (uint16_t i = startSeq4 + 120; i < startSeq4 + 128; i++)
1163 blockAck.SetReceivedPacket(i, 3);
1167 uint16_t aid5 = 500;
1168 bool ackType5 =
false;
1170 uint16_t startSeq5 = 4000;
1172 blockAck.SetAid11(aid5, 4);
1173 blockAck.SetAckType(ackType5, 4);
1174 blockAck.SetTidInfo(tid5, 4);
1175 blockAck.SetStartingSequence(startSeq5, 4);
1177 for (
int i = startSeq5; i < startSeq5 + 8; i += 2)
1179 blockAck.SetReceivedPacket(i, 4);
1182 for (
int i = startSeq5 + 9; i < startSeq5 + 16; i += 2)
1184 blockAck.SetReceivedPacket(i, 4);
1188 for (
int i = startSeq5 + 24; i < startSeq5 + 32; i++)
1190 blockAck.SetReceivedPacket(i, 4);
1193 for (
int i = startSeq5 + 32; i < startSeq5 + 36; i++)
1195 blockAck.SetReceivedPacket(i, 4);
1198 for (
int i = startSeq5 + 44; i < startSeq5 + 48; i++)
1200 blockAck.SetReceivedPacket(i, 4);
1204 for (
int i = startSeq5 + 56; i < startSeq5 + 64; i++)
1206 blockAck.SetReceivedPacket(i, 4);
1210 for (
int i = startSeq5 + 72; i < startSeq5 + 80; i++)
1212 blockAck.SetReceivedPacket(i, 4);
1216 for (
int i = startSeq5 + 88; i < startSeq5 + 96; i++)
1218 blockAck.SetReceivedPacket(i, 4);
1222 for (
int i = (startSeq5 + 104) % 4096; i < (startSeq5 + 112) % 4096; i++)
1224 blockAck.SetReceivedPacket(i, 4);
1228 for (
int i = (startSeq5 + 120) % 4096; i < (startSeq5 + 128) % 4096; i++)
1230 blockAck.SetReceivedPacket(i, 4);
1234 for (
int i = (startSeq5 + 136) % 4096; i < (startSeq5 + 144) % 4096; i++)
1236 blockAck.SetReceivedPacket(i, 4);
1240 for (
int i = (startSeq5 + 152) % 4096; i < (startSeq5 + 160) % 4096; i++)
1242 blockAck.SetReceivedPacket(i, 4);
1246 for (
int i = (startSeq5 + 168) % 4096; i < (startSeq5 + 176) % 4096; i++)
1248 blockAck.SetReceivedPacket(i, 4);
1252 for (
int i = (startSeq5 + 184) % 4096; i < (startSeq5 + 192) % 4096; i++)
1254 blockAck.SetReceivedPacket(i, 4);
1258 for (
int i = (startSeq5 + 200) % 4096; i < (startSeq5 + 208) % 4096; i++)
1260 blockAck.SetReceivedPacket(i, 4);
1264 for (
int i = (startSeq5 + 216) % 4096; i < (startSeq5 + 224) % 4096; i++)
1266 blockAck.SetReceivedPacket(i, 4);
1270 for (
int i = (startSeq5 + 232) % 4096; i < (startSeq5 + 240) % 4096; i++)
1272 blockAck.SetReceivedPacket(i, 4);
1276 for (
int i = (startSeq5 + 248) % 4096; i < (startSeq5 + 256) % 4096; i++)
1278 blockAck.SetReceivedPacket(i, 4);
1282 uint16_t aid6 = 2045;
1283 bool ackType6 =
true;
1287 blockAck.SetAid11(aid6, 5);
1288 blockAck.SetAckType(ackType6, 5);
1289 blockAck.SetTidInfo(tid6, 5);
1290 blockAck.SetUnassociatedStaAddress(address6, 5);
1294 packet->AddHeader(blockAck);
1298 packet->RemoveHeader(blockAckCopy);
1305 "Different block ack variant");
1317 "Different AID for the first Per AID TID Info subfield");
1320 "Different Ack Type for the first Per AID TID Info subfield");
1323 "Different TID for the first Per AID TID Info subfield");
1328 "Different AID for the second Per AID TID Info subfield");
1331 "Different Ack Type for the second Per AID TID Info subfield");
1334 "Different TID for the second Per AID TID Info subfield");
1338 "Different starting sequence number for the second Per AID TID Info subfield");
1340 auto& bitmap2 = blockAckCopy.
GetBitmap(1);
1343 "Different bitmap length for the second Per AID TID Info subfield");
1347 "Error in the 1st byte of the bitmap for the second Per AID TID Info subfield");
1351 "Error in the 2nd byte of the bitmap for the second Per AID TID Info subfield");
1355 "Error in the 3rd byte of the bitmap for the second Per AID TID Info subfield");
1359 "Error in the 4th byte of the bitmap for the second Per AID TID Info subfield");
1364 "Different AID for the third Per AID TID Info subfield");
1367 "Different Ack Type for the third Per AID TID Info subfield");
1370 "Different TID for the third Per AID TID Info subfield");
1374 "Different starting sequence number for the third Per AID TID Info subfield");
1376 auto& bitmap3 = blockAckCopy.
GetBitmap(2);
1379 "Different bitmap length for the third Per AID TID Info subfield");
1383 "Error in the 1st byte of the bitmap for the third Per AID TID Info subfield");
1387 "Error in the 2nd byte of the bitmap for the third Per AID TID Info subfield");
1391 "Error in the 3rd byte of the bitmap for the third Per AID TID Info subfield");
1395 "Error in the 4th byte of the bitmap for the third Per AID TID Info subfield");
1399 "Error in the 5th byte of the bitmap for the third Per AID TID Info subfield");
1403 "Error in the 6th byte of the bitmap for the third Per AID TID Info subfield");
1407 "Error in the 7th byte of the bitmap for the third Per AID TID Info subfield");
1411 "Error in the 8th byte of the bitmap for the third Per AID TID Info subfield");
1416 "Different AID for the fourth Per AID TID Info subfield");
1419 "Different Ack Type for the fourth Per AID TID Info subfield");
1422 "Different TID for the fourth Per AID TID Info subfield");
1426 "Different starting sequence number for the fourth Per AID TID Info subfield");
1428 auto& bitmap4 = blockAckCopy.
GetBitmap(3);
1431 "Different bitmap length for the fourth Per AID TID Info subfield");
1435 "Error in the 1st byte of the bitmap for the fourth Per AID TID Info subfield");
1439 "Error in the 2nd byte of the bitmap for the fourth Per AID TID Info subfield");
1443 "Error in the 3rd byte of the bitmap for the fourth Per AID TID Info subfield");
1447 "Error in the 4th byte of the bitmap for the fourth Per AID TID Info subfield");
1451 "Error in the 5th byte of the bitmap for the fourth Per AID TID Info subfield");
1455 "Error in the 6th byte of the bitmap for the fourth Per AID TID Info subfield");
1459 "Error in the 7th byte of the bitmap for the fourth Per AID TID Info subfield");
1463 "Error in the 8th byte of the bitmap for the fourth Per AID TID Info subfield");
1467 "Error in the 9th byte of the bitmap for the fourth Per AID TID Info subfield");
1471 "Error in the 10th byte of the bitmap for the fourth Per AID TID Info subfield");
1475 "Error in the 11th byte of the bitmap for the fourth Per AID TID Info subfield");
1479 "Error in the 12th byte of the bitmap for the fourth Per AID TID Info subfield");
1483 "Error in the 13th byte of the bitmap for the fourth Per AID TID Info subfield");
1487 "Error in the 14th byte of the bitmap for the fourth Per AID TID Info subfield");
1491 "Error in the 15th byte of the bitmap for the fourth Per AID TID Info subfield");
1495 "Error in the 16th byte of the bitmap for the fourth Per AID TID Info subfield");
1500 "Different AID for the fifth Per AID TID Info subfield");
1503 "Different Ack Type for the fifth Per AID TID Info subfield");
1506 "Different TID for the fifth Per AID TID Info subfield");
1510 "Different starting sequence number for the fifth Per AID TID Info subfield");
1512 auto& bitmap5 = blockAckCopy.
GetBitmap(4);
1515 "Different bitmap length for the fifth Per AID TID Info subfield");
1519 "Error in the 1st byte of the bitmap for the fifth Per AID TID Info subfield");
1523 "Error in the 2nd byte of the bitmap for the fifth Per AID TID Info subfield");
1527 "Error in the 3rd byte of the bitmap for the fifth Per AID TID Info subfield");
1531 "Error in the 4th byte of the bitmap for the fifth Per AID TID Info subfield");
1535 "Error in the 5th byte of the bitmap for the fifth Per AID TID Info subfield");
1539 "Error in the 6th byte of the bitmap for the fifth Per AID TID Info subfield");
1543 "Error in the 7th byte of the bitmap for the fifth Per AID TID Info subfield");
1547 "Error in the 8th byte of the bitmap for the fifth Per AID TID Info subfield");
1551 "Error in the 9th byte of the bitmap for the fifth Per AID TID Info subfield");
1555 "Error in the 10th byte of the bitmap for the fifth Per AID TID Info subfield");
1559 "Error in the 11th byte of the bitmap for the fifth Per AID TID Info subfield");
1563 "Error in the 12th byte of the bitmap for the fifth Per AID TID Info subfield");
1567 "Error in the 13th byte of the bitmap for the fifth Per AID TID Info subfield");
1571 "Error in the 14th byte of the bitmap for the fifth Per AID TID Info subfield");
1575 "Error in the 15th byte of the bitmap for the fifth Per AID TID Info subfield");
1579 "Error in the 16th byte of the bitmap for the fifth Per AID TID Info subfield");
1583 "Error in the 17th byte of the bitmap for the fifth Per AID TID Info subfield");
1587 "Error in the 18th byte of the bitmap for the fifth Per AID TID Info subfield");
1591 "Error in the 19th byte of the bitmap for the fifth Per AID TID Info subfield");
1595 "Error in the 20th byte of the bitmap for the fifth Per AID TID Info subfield");
1599 "Error in the 21th byte of the bitmap for the fifth Per AID TID Info subfield");
1603 "Error in the 22th byte of the bitmap for the fifth Per AID TID Info subfield");
1607 "Error in the 23th byte of the bitmap for the fifth Per AID TID Info subfield");
1611 "Error in the 24th byte of the bitmap for the fifth Per AID TID Info subfield");
1615 "Error in the 25th byte of the bitmap for the fifth Per AID TID Info subfield");
1619 "Error in the 26th byte of the bitmap for the fifth Per AID TID Info subfield");
1623 "Error in the 27th byte of the bitmap for the fifth Per AID TID Info subfield");
1627 "Error in the 28th byte of the bitmap for the fifth Per AID TID Info subfield");
1631 "Error in the 29th byte of the bitmap for the fifth Per AID TID Info subfield");
1635 "Error in the 30th byte of the bitmap for the fifth Per AID TID Info subfield");
1639 "Error in the 31th byte of the bitmap for the fifth Per AID TID Info subfield");
1643 "Error in the 32th byte of the bitmap for the fifth Per AID TID Info subfield");
1648 "Different AID for the sixth Per AID TID Info subfield");
1651 "Different Ack Type for the sixth Per AID TID Info subfield");
1654 "Different TID for the sixth Per AID TID Info subfield");
1658 "Different starting sequence number for the sixth Per AID TID Info subfield");
1730 void DoRun()
override;
1769 if (duration >
m_max)
1776 :
TestCase(
"Test case for Block Ack Policy with aggregation disabled"),
1795 if (p->GetSize() == 1400)
1828 "Unexpected QoS ack policy");
1834 "Unexpected QoS ack policy");
1865 wifiApNode.Create(1);
1869 phy.SetChannel(channel.Create());
1874 wifi.SetRemoteStationManager(
"ns3::IdealWifiManager");
1878 mac.SetType(
"ns3::StaWifiMac",
1886 "BE_BlockAckThreshold",
1892 staDevices = wifi.Install(phy, mac, wifiStaNode);
1894 mac.SetType(
"ns3::ApWifiMac",
1913 apDevices = wifi.Install(phy, mac, wifiApNode);
1918 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
1919 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
1920 mobility.SetPositionAllocator(positionAlloc);
1922 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
1923 mobility.Install(wifiApNode);
1924 mobility.Install(wifiStaNode);
1930 sta_device->GetMac()->SetAttribute(
"BE_MaxAmpduSize",
UintegerValue(0));
1936 sta_device->GetMac()->GetAttribute(
"BE_Txop", ptr);
1937 ptr.
Get<
QosTxop>()->TraceConnectWithoutContext(
1949 packetSocket.
Install(wifiStaNode);
1950 packetSocket.
Install(wifiApNode);
1958 client1->SetRemote(socket);
1960 client1->SetStartTime(
Seconds(1));
1961 client1->SetStopTime(
Seconds(3.0));
1971 client2->SetRemote(socket);
1973 client2->SetStartTime(
Seconds(1.5));
1974 client2->SetStopTime(
Seconds(3.0));
1977 server->SetLocal(socket);
1978 wifiApNode.Get(0)->AddApplication(server);
1979 server->SetStartTime(
Seconds(0.0));
1980 server->SetStopTime(
Seconds(4.0));
1982 Config::Connect(
"/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
2006 "The maximum TXOP duration is too short!");
2048 void DoRun()
override;
2060 :
TestCase(
"Test case for originator Block Ack window stalled"),
2061 m_nLinks(mld ? 2 : 1)
2070 for (
const auto& [aid, psdu] : psduMap)
2072 std::stringstream ss;
2073 ss <<
" #MPDUs " << psdu->GetNMpdus();
2076 ss <<
"\n" << *mpdu;
2079 if (
const auto& hdr = (*psdu->begin())->GetHeader(); hdr.IsQosData())
2082 uint16_t startSeqN{0};
2083 std::size_t count{0};
2104 "Unexpected number of MPDUs in A-MPDU #" <<
m_qosCount);
2110 "Unexpected SeqN in A-MPDU #" <<
m_qosCount);
2113 "Unexpected SeqN in A-MPDU #" <<
m_qosCount);
2122 auto mpduIt = psdu->begin();
2123 std::list<uint64_t> uids;
2124 ss <<
"\nCORRUPTED";
2125 for (std::size_t i = 0; i < 5; ++i, ++mpduIt)
2127 uids.push_back((*mpduIt)->GetPacket()->GetUid());
2128 ss <<
" " << (*mpduIt)->GetHeader().GetSequenceNumber();
2133 else if (hdr.IsBlockAck())
2151 phy.Set(0,
"ChannelSettings",
StringValue(
"{36, 0, BAND_5GHZ, 0}"));
2154 phy.Set(1,
"ChannelSettings",
StringValue(
"{100, 0, BAND_5GHZ, 0}"));
2156 phy.SetChannel(channel);
2160 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
2168 mac.SetType(
"ns3::StaWifiMac",
"MpduBufferSize",
UintegerValue(64));
2170 auto staDevices = wifi.Install(phy, mac, wifiStaNode);
2172 mac.SetType(
"ns3::ApWifiMac");
2174 auto apDevices = wifi.Install(phy, mac, wifiApNode);
2177 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2178 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2181 mobility.SetPositionAllocator(positionAlloc);
2182 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
2183 mobility.Install(wifiApNode);
2184 mobility.Install(wifiStaNode);
2190 "/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phys/*/PhyTxPsduBegin",
2195 apDevice->GetPhy(0)->SetPostReceptionErrorModel(
m_errorModel);
2198 apDevice->GetPhy(1)->SetPostReceptionErrorModel(
m_errorModel);
2208 packetSocket.
Install(wifiStaNode);
2209 packetSocket.
Install(wifiApNode);
2215 client->SetRemote(socket);
2217 client->SetStartTime(
Seconds(0.5));
2218 client->SetStopTime(
Seconds(3.0));
2221 server->SetLocal(socket);
2222 wifiApNode.Get(0)->AddApplication(server);
2223 server->SetStartTime(
Seconds(0.0));
2224 server->SetStopTime(
Seconds(4.0));
2238 "Expected no packet in STA queue");
static BlockAckTestSuite g_blockAckTestSuite
the test suite
Test for Block Ack Policy with aggregation disabled.
uint16_t m_nBa
received BlockAck frames
uint16_t m_txTotal
transmitted data packets
void L7Receive(std::string context, Ptr< const Packet > p, const Address &adr)
Function to trace packets received by the server application.
BlockAckAggregationDisabledTest(bool txop)
Constructor.
~BlockAckAggregationDisabledTest() override
uint16_t m_nBar
transmitted BlockAckReq frames
void Receive(std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand rxPowersW)
Callback invoked when PHY receives a packet.
void Transmit(std::string context, Ptr< const Packet > p, double power)
Callback invoked when PHY transmits a packet.
uint16_t m_txSinceBar
packets transmitted since the agreement was established or the last block ack was received
uint32_t m_received
received packets
void DoRun() override
Implementation to actually run this TestCase.
bool m_txop
true for non-null TXOP limit
Test for recipient reordering buffer operations.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_ssn
the Starting Sequence Number used to initialize WinStartB
BlockAckRecipientBufferTest(uint16_t ssn)
Constructor.
std::list< Ptr< const WifiMpdu > > m_fwup
list of MPDUs that have been forwarded up
void ForwardUp(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Keep track of MPDUs received on the given link that are forwarded up.
~BlockAckRecipientBufferTest() override
Test for Block Ack Policy with non-null BA threshold and TX window blocked.
std::size_t m_baCount
counter for transmitted BlockAck frames
const std::size_t m_nPkts
number of generated packets
const uint8_t m_nLinks
number of links
Ptr< WifiNetDevice > m_staDevice
station WifiNetDevice
std::size_t m_qosCount
counter for transmitted QoS data frames
Ptr< ListErrorModel > m_errorModel
error rate model to corrupt packets
void DoRun() override
Implementation to actually run this TestCase.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
OrigBlockAckWindowStalled(bool mld)
const double m_baThreshold
BA threshold used by ack manager.
void Transmit(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a FEM passes PSDUs to the PHY.
Test for the originator block ack window.
void DoRun() override
Implementation to actually run this TestCase.
OriginatorBlockAckWindowTest()
std::list< uint16_t > m_expectedBuffer
expected test buffer
void DoRun() override
Implementation to actually run this TestCase.
~PacketBufferingCaseA() override
std::list< uint16_t > m_expectedBuffer
expected test buffer
~PacketBufferingCaseB() override
void DoRun() override
Implementation to actually run this TestCase.
a polymophic address class
A container for one type of attribute.
void SetStartingSequence(uint16_t seq)
Set starting sequence number.
void SetBufferSize(uint16_t bufferSize)
Set buffer size.
std::size_t GetWinSize() const
Get the window size.
uint16_t GetWinStart() const
Get the current winStart value.
uint16_t GetWinEnd() const
Get the current winEnd value.
std::vector< bool >::reference At(std::size_t distance)
Get a reference to the element in the window having the given distance from the current winStart.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
void SetList(const std::list< uint64_t > &packetlist)
static Mac48Address Allocate()
Allocate a new Mac48Address.
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Maintains the state and information about transmitted MPDUs with Ack Policy set to Block Ack for an o...
void NotifyDiscardedMpdu(Ptr< const WifiMpdu > mpdu)
Advance the transmit window beyond the MPDU that has been reported to be discarded.
uint16_t GetStartingSequence() const override
Return the starting sequence number of the transmit window, if a transmit window has been initialized...
BlockAckWindow m_txWindow
originator's transmit window
void NotifyTransmittedMpdu(Ptr< const WifiMpdu > mpdu)
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet...
void NotifyAckedMpdu(Ptr< const WifiMpdu > mpdu)
Record that the given MPDU has been acknowledged and advance the transmit window if possible.
void InitTxWindow()
Initialize the originator's transmit window by setting its size and starting sequence number equal to...
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Handles the packet queue and stores DCF/EDCA access parameters (one Txop per AC).
Maintains the scoreboard and the receive reordering buffer used by a recipient of a Block Ack agreeme...
void NotifyReceivedBar(uint16_t startingSequenceNumber)
Update both the scoreboard and the receive reordering buffer upon reception of a Block Ack Request.
void NotifyReceivedMpdu(Ptr< const WifiMpdu > mpdu)
Update both the scoreboard and the receive reordering buffer upon reception of the given MPDU.
void SetMacRxMiddle(const Ptr< MacRxMiddle > rxMiddle)
Set the MAC RX Middle to use.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
Hold variables of type string.
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.
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Make it easy to create and manage PHY objects for the YANS model.
void SetDefault(std::string name, const AttributeValue &value)
void Connect(std::string path, const CallbackBase &cb)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to limit and report if not.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
#define NS_TEST_EXPECT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
uint32_t QosUtilsMapSeqControlToUniqueInteger(uint16_t seqControl, uint16_t endSequence)
Next function is useful to correctly sort buffered packets under block ack.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
std::map< WifiSpectrumBandInfo, Watt_u > RxPowerWattPerChannelBand
A map of the received power for each band.
static constexpr uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
Keeps the maximum duration among all TXOPs.
Time m_max
max TXOP duration
void Trace(Time startTime, Time duration, uint8_t linkId)
Callback for the TxopTrace trace.
The different BlockAck variants.
Variant m_variant
Block Ack variant.
std::vector< uint8_t > m_bitmapLen
Length (bytes) of included bitmaps.