9#include "ns3/internet-stack-helper.h"
10#include "ns3/ipv4-address-helper.h"
11#include "ns3/llc-snap-header.h"
12#include "ns3/mobility-helper.h"
13#include "ns3/on-off-helper.h"
14#include "ns3/packet-sink-helper.h"
15#include "ns3/packet-sink.h"
16#include "ns3/pointer.h"
17#include "ns3/qos-txop.h"
19#include "ns3/string.h"
21#include "ns3/traffic-control-helper.h"
22#include "ns3/traffic-control-layer.h"
23#include "ns3/wifi-mac-queue.h"
24#include "ns3/wifi-mac.h"
25#include "ns3/wifi-net-device.h"
26#include "ns3/yans-wifi-helper.h"
48 void DoRun()
override;
80 :
TestCase(
"User priority to Access Category mapping test. Checks that packets are "
81 "enqueued in the correct child queue disc of the mq root queue disc and "
82 "in the correct wifi MAC queue"),
84 m_expectedQueue(expectedQueue)
86 for (uint8_t i = 0; i < 4; i++)
112 packet->RemoveHeader(llc);
117 packet->PeekHeader(iph);
134 Ssid ssid =
Ssid(
"wifi-ac-mapping");
151 mobility.SetMobilityModel(
"ns3::ConstantPositionMobilityModel");
152 mobility.SetPositionAllocator(
"ns3::GridPositionAllocator",
165 mobility.Install(sta);
166 mobility.Install(ap);
182 address.SetBase(
"192.168.0.0",
"255.255.255.0");
185 staNodeInterface = address.Assign(staDev);
186 apNodeInterface = address.Assign(apDev);
188 uint16_t udpPort = 50000;
199 onoff.SetConstantRate(
DataRate(
"5kbps"), 500);
215 "The root queue disc should have 4 classes");
222 root->GetQueueDiscClass(0)->GetQueueDisc()->TraceConnectWithoutContext(
226 root->GetQueueDiscClass(1)->GetQueueDisc()->TraceConnectWithoutContext(
232 root->GetQueueDiscClass(2)->GetQueueDisc()->TraceConnectWithoutContext(
238 root->GetQueueDiscClass(3)->GetQueueDisc()->TraceConnectWithoutContext(
252 apMac->GetAttribute(
"BE_Txop", ptr);
259 apMac->GetAttribute(
"BK_Txop", ptr);
266 apMac->GetAttribute(
"VI_Txop", ptr);
273 apMac->GetAttribute(
"VO_Txop", ptr);
288 "There is no packet in the expected queue disc " << i);
291 "There is no packet in the expected Wifi MAC queue " << i);
297 "Unexpectedly, there is a packet in queue disc " << i);
300 "Unexpectedly, there is a packet in Wifi MAC queue " << i);
Test for User priority to Access Category mapping.
static void PacketEnqueuedInWifiMacQueue(uint8_t tos, uint16_t *count, Ptr< const WifiMpdu > item)
Function called whenever a packet is enqueued in a Wi-Fi MAC queue.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_WifiMacQueueCount[4]
packet counter per Wi-Fi MAC queue
WifiAcMappingTest(uint8_t tos, uint8_t expectedQueue)
Constructor for WifiAcMappingTest.
uint8_t m_tos
type of service
static void PacketEnqueuedInQueueDisc(uint8_t tos, uint16_t *count, Ptr< const QueueDiscItem > item)
Function called whenever a packet is enqueued in a queue disc.
uint16_t m_expectedQueue
expected queue disc index
uint16_t m_QueueDiscCount[4]
packet counter per queue disc
Access category mapping Test Suite.
holds a vector of ns3::Application pointers.
void Start(Time start) const
Start all of the Applications in this container at the start time given as a parameter.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void Stop(Time stop) const
Arrange for all of the Applications in this container to Stop() at the 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...
Class for representing data rates.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
static Ipv4Address GetAny()
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
static const uint16_t PROT_NUMBER
Protocol number (0x0800)
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
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.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes.
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).
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.
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.
Build a set of QueueDisc objects.
QueueDiscContainer Install(NetDeviceContainer c)
uint16_t SetRootQueueDisc(const std::string &type, Args &&... args)
Helper function used to set a root queue disc of the given type and with the given attributes.
std::vector< uint16_t > ClassIdList
Container type for Class IDs.
ClassIdList AddQueueDiscClasses(uint16_t handle, uint16_t count, const std::string &type, Args &&... args)
Helper function used to add the given number of queue disc classes (of the given type and with the gi...
HandleList AddChildQueueDiscs(uint16_t handle, const ClassIdList &classes, const std::string &type, Args &&... args)
Helper function used to attach a child queue disc (of the given type and with the given attributes) t...
The Traffic Control layer aims at introducing an equivalent of the Linux Traffic Control infrastructu...
Hold an unsigned integer type.
helps to create WifiNetDevice objects
create MAC layers for a ns3::WifiNetDevice.
void SetType(std::string type, Args &&... args)
manage and create wifi channel objects for the YANS model.
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Ptr< YansWifiChannel > Create() const
Make it easy to create and manage PHY objects for the YANS model.
void SetChannel(Ptr< YansWifiChannel > channel)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
static WifiAcMappingTestSuite wifiAcMappingTestSuite