11#include "ns3/arp-header.h"
12#include "ns3/arp-l3-protocol.h"
13#include "ns3/config.h"
14#include "ns3/frame-exchange-manager.h"
15#include "ns3/icmpv6-header.h"
16#include "ns3/internet-stack-helper.h"
17#include "ns3/ipv4-address-helper.h"
18#include "ns3/ipv6-address-helper.h"
19#include "ns3/ipv6-header.h"
20#include "ns3/ipv6-l3-protocol.h"
21#include "ns3/llc-snap-header.h"
22#include "ns3/mobility-helper.h"
23#include "ns3/pointer.h"
24#include "ns3/qos-txop.h"
25#include "ns3/rng-seed-manager.h"
27#include "ns3/string.h"
29#include "ns3/udp-client-server-helper.h"
30#include "ns3/wifi-mac-queue.h"
31#include "ns3/wifi-mac.h"
32#include "ns3/wifi-net-device.h"
108 double txPowerW)
override;
109 void DoRun()
override;
174 std::string(
"Check UDP packet transmission between MLDs ") +
175 " (ID: " +
std::to_string(params.id) +
176 ", #AP_links: " +
std::to_string(params.apChannels.size()) +
177 ", #STA_1_links: " +
std::to_string(params.firstStaChannels.size()) +
178 ", #STA_2_links: " +
std::to_string(params.secondStaChannels.size()) +
179 ", Traffic pattern: " +
std::to_string(static_cast<uint8_t>(params.trafficPattern)) +
182 ", A-MSDU aggregation: " +
std::to_string(params.amsduAggr) +
183 ", IP version: " +
std::to_string(params.ipVersion) +
")",
185 BaseParams{params.firstStaChannels, params.apChannels, {}}),
186 m_2ndStaChannels(
params.secondStaChannels),
187 m_trafficPattern(
params.trafficPattern),
188 m_assocType(
params.assocType),
189 m_amsduAggr(
params.amsduAggr),
190 m_ipVersion(
params.ipVersion)
193 "Unsupported IP version " << +m_ipVersion);
203 int64_t streamNumber = 30;
211 wifi.SetRemoteStationManager(
"ns3::ConstantRateWifiManager",
229 mac.SetType(
"ns3::StaWifiMac",
235 NetDeviceContainer staDevices = wifi.Install(staPhyHelper1, mac, wifiStaNodes.Get(0));
237 mac.SetType(
"ns3::StaWifiMac",
243 staDevices.Add(wifi.Install(staPhyHelper2, mac, wifiStaNodes.Get(1)));
245 mac.SetType(
"ns3::ApWifiMac",
264 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
265 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
266 mobility.SetPositionAllocator(positionAlloc);
268 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
269 mobility.Install(wifiApNode);
270 mobility.Install(wifiStaNodes);
280 for (uint8_t phyId = 0; phyId <
m_apMac->GetDevice()->GetNPhys(); phyId++)
283 "/NodeList/0/DeviceList/*/$ns3::WifiNetDevice/Phys/" + std::to_string(phyId) +
289 for (uint8_t phyId = 0; phyId <
m_staMacs[i]->GetDevice()->GetNPhys(); phyId++)
292 "/NodeList/" + std::to_string(i + 1) +
"/DeviceList/*/$ns3::WifiNetDevice/Phys/" +
293 std::to_string(phyId) +
"/PhyTxPsduBegin",
301 stack.Install(allNodes);
302 streamNumber += stack.AssignStreams(allNodes, streamNumber);
307 address.SetBase(
"10.1.0.0",
"255.255.255.0");
327 auto serverApps = serverHelper.
Install(allNodes);
328 serverApps.Start(
Seconds(0.0));
349 m_apMac->TraceConnectWithoutContext(
"AssociatedSta",
385 auto clientApp = clientHelper.
Install(srcMac->GetDevice()->GetNode());
399 auto psdu = psduMap.begin()->second;
402 if (!psdu->GetHeader(0).IsQosData() || !psdu->GetHeader(0).HasData())
410 std::list<Ptr<const Packet>> packets;
412 if (mpdu->GetHeader().IsQosAmsdu())
416 packets.push_back(msdu.first);
421 packets.push_back(mpdu->GetPacket());
424 for (
auto pkt : packets)
427 auto packet = pkt->Copy();
428 packet->RemoveHeader(llc);
433 packet->RemoveHeader(arp);
452 packet->RemoveHeader(ipv6);
460 packet->PeekHeader(icmpv6);
465 packet->RemoveHeader(ns);
470 packet->CopyData(&type,
sizeof(type));
473 "Unexpected Neighbor Solicitation option");
476 packet->RemoveHeader(lla);
482 packet->RemoveHeader(na);
486 "Missing Neighbor Advertisement option");
489 packet->CopyData(&type,
sizeof(type));
492 "Unexpected Neighbor Advertisement option");
495 packet->RemoveHeader(lla);
514 !srcMac->GetLinkIdByAddress(sender) && sender != srcMac->GetAddress())
531 ?
m_staMacs[0]->GetFrameExchangeManager(linkId)->GetAddress()
538 expectedSrc =
m_apMac->GetAddress();
548 "Unexpected source HW address");
551 "Unexpected destination HW address");
566 if (!srcMac->GetLinkIdByAddress(sender) && sender != srcMac->GetAddress())
575 ? srcMac->GetFrameExchangeManager(linkId)->GetAddress()
576 : srcMac->GetAddress();
582 "Unexpected source HW address");
597 !srcMac->GetLinkIdByAddress(sender) && sender != srcMac->GetAddress())
612 ?
m_staMacs[0]->GetFrameExchangeManager(linkId)->GetAddress()
618 expectedSrc =
m_apMac->GetAddress();
628 "Unexpected source link-layer address");
645 if (!srcMac->GetLinkIdByAddress(sender) && sender != srcMac->GetAddress())
656 ? srcMac->GetFrameExchangeManager(linkId)->GetAddress()
657 : srcMac->GetAddress();
663 "Unexpected target link-layer address");
675 "Unexpected number of received packets");
677 std::size_t expectedNOrigRequest{0};
678 std::size_t expectedNFwdRequest{0};
685 expectedNOrigRequest = 1;
686 expectedNFwdRequest =
m_apMac->GetNLinks();
690 expectedNOrigRequest =
m_apMac->GetNLinks();
691 expectedNFwdRequest = 0;
697 std::size_t expectedNOrigReply{0};
698 std::size_t expectedNFwdReply{0};
704 expectedNOrigReply = 1;
705 expectedNFwdReply = 0;
711 std::min<std::size_t>(
m_apMac->GetNLinks(),
m_staMacs[0]->GetSetupLinkIds().size());
712 expectedNFwdReply = 0;
717 expectedNOrigReply = expectedNFwdReply =
m_staMacs[1]->GetSetupLinkIds().size();
726 expectedNOrigRequest + expectedNFwdRequest,
727 "Unexpected number of transmitted ARP Request frames");
729 expectedNOrigRequest,
730 "Unexpected number of checked ARP Request frames");
732 expectedNOrigReply + expectedNFwdReply,
733 "Unexpected number of transmitted ARP Reply frames");
736 "Unexpected number of checked ARP Reply frames");
741 expectedNOrigRequest + expectedNFwdRequest,
742 "Unexpected number of transmitted Neighbor Solicitation frames");
744 expectedNOrigRequest,
745 "Unexpected number of checked Neighbor Solicitation frames");
747 expectedNOrigReply + expectedNFwdReply,
748 "Unexpected number of transmitted Neighbor Advertisement frames");
751 "Unexpected number of checked Neighbor Advertisement frames");
772 std::size_t inputId{};
773 std::vector<WifiMloUdpTest::InputParams> testVectors;
774 using ParamsTuple = std::array<std::vector<std::string>, 3>;
776 for (
const auto& channels :
779 {{
"{3, 40, BAND_6GHZ, 0}"},
780 {
"{46, 40, BAND_5GHZ, 1}",
"{5, 40, BAND_2_4GHZ, 0}",
"{3, 40, BAND_6GHZ, 0}"},
781 {
"{3, 40, BAND_6GHZ, 0}"}}},
784 {{
"{3, 40, BAND_6GHZ, 0}"},
785 {
"{46, 40, BAND_5GHZ, 1}",
"{5, 40, BAND_2_4GHZ, 0}",
"{3, 40, BAND_6GHZ, 0}"},
786 {
"{46, 40, BAND_5GHZ, 1}",
"{3, 40, BAND_6GHZ, 0}"}}},
789 {{
"{46, 40, BAND_5GHZ, 1}",
"{5, 40, BAND_2_4GHZ, 0}",
"{3, 40, BAND_6GHZ, 0}"},
790 {
"{3, 40, BAND_6GHZ, 0}"},
791 {
"{46, 40, BAND_5GHZ, 1}",
"{5, 40, BAND_2_4GHZ, 0}"}}},
794 {{
"{46, 40, BAND_5GHZ, 1}",
"{3, 40, BAND_6GHZ, 0}",
"{5, 40, BAND_2_4GHZ, 0}"},
795 {
"{46, 40, BAND_5GHZ, 1}",
"{3, 40, BAND_6GHZ, 0}",
"{5, 40, BAND_2_4GHZ, 0}"},
796 {
"{3, 40, BAND_6GHZ, 0}",
"{5, 40, BAND_2_4GHZ, 0}"}}}})
802 for (
const auto amsduAggr : {
false,
true})
806 for (
const uint8_t ipVersion : {4, 6})
808 testVectors.emplace_back(
810 .apChannels = channels[0],
811 .firstStaChannels = channels[1],
812 .secondStaChannels = channels[2],
813 .trafficPattern = trafficPattern,
814 .assocType = assocType,
815 .amsduAggr = amsduAggr,
816 .ipVersion = ipVersion});
823 for (
const auto& testVector : testVectors)
virtual void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a FEM passes PSDUs to the PHY.
void SetSsid(uint16_t aid, Mac48Address)
Set the SSID on the next station that needs to start the association procedure.
std::vector< Ptr< StaWifiMac > > m_staMacs
STA wifi MACs.
const std::vector< std::string > m_staChannels
strings specifying channels for STA
uint16_t m_startAid
first AID to allocate to stations
void SetChannels(SpectrumWifiPhyHelper &helper, const std::vector< std::string > &channels, const ChannelMap &channelMap)
Reset the given PHY helper, use the given strings to set the ChannelSettings attribute of the PHY obj...
const std::vector< std::string > m_apChannels
strings specifying channels for AP
std::map< FrequencyRange, Ptr< MultiModelSpectrumChannel > > ChannelMap
PHY band-indexed map of spectrum channels.
uint8_t m_nStations
number of stations to create
Time m_duration
simulation duration
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
Ptr< ApWifiMac > m_apMac
AP wifi MAC.
MultiLinkOperationsTestBase(const std::string &name, uint8_t nStations, const BaseParams &baseParams)
Constructor.
Test UDP packet transmission between MLDs and SLDs.
Ipv6InterfaceContainer m_staInterfaces6
IPv6 interfaces for non-AP MLDs.
uint8_t m_ipVersion
IP version to use, either 4 or 6.
Ipv6InterfaceContainer m_apInterface6
IPv6 interface for AP MLD.
WifiMloUdpTest(const InputParams ¶ms)
Constructor.
const uint16_t m_udpPort
UDP port for application servers.
WifiAssocType m_assocType
association type
std::size_t m_nNa
counts how many Neighbor Advertisements are sent
void CheckArpRequestHwAddresses(const ArpHeader &arp, Mac48Address sender, uint8_t linkId)
Check source and destination hardware addresses in ARP request frames.
std::size_t m_nArpRequest
counts how many ARP Requests are transmitted
WifiTrafficPattern m_trafficPattern
the pattern of traffic to generate
std::size_t m_nCheckedNs
counts how many Neighbor Solicitations are checked
void CheckArpReplyHwAddresses(const ArpHeader &arp, Mac48Address sender, uint8_t linkId)
Check source and destination hardware addresses in ARP reply frames.
std::size_t m_nCheckedNa
counts how many Neighbor Advertisements are checked
void CheckNaHwAddress(Address targetLinkLayerAddress, Mac48Address sender, uint8_t linkId)
Check target link-layer address in Neighbor Advertisement frames.
std::size_t m_nCheckedArpReply
counts how many ARP Replies are checked
void CheckNsHwAddress(Address sourceLinkLayerAddress, Mac48Address sender, uint8_t linkId)
Check source link-layer address in Neighbor Solicitation frames.
const std::vector< std::string > m_2ndStaChannels
string specifying channels for second STA
Ipv4InterfaceContainer m_staInterfaces
IPv4 interfaces for non-AP MLDs.
std::size_t m_nNs
counts how many Neighbor Solicitations are transmitted
void DoSetup() override
Implementation to do any local setup required for this TestCase.
const std::size_t m_nPackets
number of application packets to generate
std::size_t m_nArpReply
counts how many ARP Replies are transmitted
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< UdpServer > m_sink
server app on the receiving node
Ipv4InterfaceContainer m_apInterface
IPv4 interface for AP MLD.
void StartTraffic() override
Start the generation of traffic (needs to be overridden).
bool m_amsduAggr
whether A-MSDU aggregation is enabled
std::size_t m_nCheckedArpRequest
counts how many ARP Requests are checked
Multi-Link Operations with UDP traffic Test Suite.
a polymophic address class
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
ApplicationContainer Install(NodeContainer c)
Install an application on each node of the input container configured with all the attributes set wit...
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
static const uint16_t PROT_NUMBER
ARP protocol number (0x0806).
Hold variables of type enum.
ICMPv6 Neighbor Advertisement header.
ICMPv6 Neighbor Solicitation header.
ICMPv6 link-layer address option.
Address GetAddress() const
Get the hardware address.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Helper class to auto-assign global IPv6 unicast addresses.
Describes an IPv6 address.
bool IsAny() const
If the IPv6 address is the "Any" address.
Keep track of a set of IPv6 interfaces.
static constexpr uint16_t PROT_NUMBER
The protocol number for IPv6 (0x86DD).
Describes an IPv6 prefix.
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address GetBroadcast()
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
static NodeContainer GetGlobal()
Create a NodeContainer that contains a list of all nodes created through NodeContainer::Create() and ...
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static 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.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
Create a client application which sends UDP packets carrying a 32bit sequence number and a 64 bit tim...
Create a server application which waits for input UDP packets and uses the information carried into t...
Hold an unsigned integer type.
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
create MAC layers for a ns3::WifiNetDevice.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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...
void SetDefault(std::string name, const AttributeValue &value)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiAssocType
Type of association performed by this device (provided that it is supported by the standard configure...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ
Identifier for the frequency range covering the wifi spectrum in the 6 GHz band.
U * PeekPointer(const Ptr< U > &p)
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
Ptr< T1 > StaticCast(const Ptr< T2 > &p)
Cast a Ptr.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Configuration parameters common to all subclasses.
static WifiMloUdpTestSuite g_wifiMloUdpTestSuite
the test suite