21 #include "ns3/string.h" 23 #include "ns3/pointer.h" 25 #include "ns3/packet-sink.h" 26 #include "ns3/wifi-net-device.h" 27 #include "ns3/wifi-mac.h" 28 #include "ns3/wifi-mac-queue.h" 29 #include "ns3/qos-txop.h" 30 #include "ns3/yans-wifi-helper.h" 31 #include "ns3/mobility-helper.h" 32 #include "ns3/internet-stack-helper.h" 33 #include "ns3/ipv4-address-helper.h" 34 #include "ns3/packet-sink-helper.h" 35 #include "ns3/on-off-helper.h" 36 #include "ns3/traffic-control-helper.h" 37 #include "ns3/traffic-control-layer.h" 38 #include "ns3/llc-snap-header.h" 48 virtual void DoRun (
void);
55 uint16_t m_QueueDiscCount[4];
56 uint16_t m_WifiMacQueueCount[4];
60 :
TestCase (
"User priority to Access Category mapping test. Checks that packets are " 61 "enqueued in the correct child queue disc of the mq root queue disc and " 62 "in the correct wifi MAC queue"),
64 m_expectedQueue (expectedQueue)
66 for (uint8_t i = 0; i < 4; i++)
77 if (item->
GetUint8Value (QueueItem::IP_DSFIELD, val) && val == tos)
90 if (llc.
GetType () == Ipv4L3Protocol::PROT_NUMBER)
111 wifi.SetRemoteStationManager (
"ns3::ArfWifiManager");
116 wifiMac.
SetType (
"ns3::ApWifiMac",
125 wifiMac.
SetType (
"ns3::StaWifiMac",
132 mobility.SetMobilityModel (
"ns3::ConstantPositionMobilityModel");
133 mobility.SetPositionAllocator (
"ns3::GridPositionAllocator",
156 address.SetBase (
"192.168.0.0",
"255.255.255.0");
158 staNodeInterface =
address.Assign (staDev);
159 apNodeInterface =
address.Assign (apDev);
161 uint16_t udpPort = 50000;
182 Simulator::Stop (
Seconds (5.0));
188 root->
GetQueueDiscClass (0)->GetQueueDisc ()->TraceConnectWithoutContext (
"Enqueue",
191 root->
GetQueueDiscClass (1)->GetQueueDisc ()->TraceConnectWithoutContext (
"Enqueue",
194 root->
GetQueueDiscClass (2)->GetQueueDisc ()->TraceConnectWithoutContext (
"Enqueue",
197 root->
GetQueueDiscClass (3)->GetQueueDisc ()->TraceConnectWithoutContext (
"Enqueue",
200 Ptr<WifiMac> apMac = DynamicCast<WifiNetDevice> (apDev.
Get (0))->GetMac ();
222 for (uint32_t i = 0; i < 4; i++)
236 uint32_t totalOctetsThrough =
237 DynamicCast<PacketSink> (sinkApp.
Get (0))->GetTotalRx ();
242 Simulator::Destroy ();
253 :
TestSuite (
"ns3-wifi-ac-mapping", SYSTEM)
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
holds a vector of ns3::Application pointers.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
WifiAcMappingTest(uint8_t tos, uint8_t expectedQueue)
Smart pointer class similar to boost::intrusive_ptr.
AttributeValue implementation for Boolean.
QueueDiscContainer Install(NetDeviceContainer c)
holds a vector of std::pair of Ptr<Ipv4> and interface index.
uint16_t m_QueueDiscCount[4]
Hold variables of type string.
Introspection did not find any typical Config paths.
Make it easy to create and manage PHY objects for the yans model.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
static void PacketEnqueuedInWifiMacQueue(uint8_t tos, uint16_t *count, Ptr< const WifiMacQueueItem > item)
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
helps to create WifiNetDevice objects
ClassIdList AddQueueDiscClasses(uint16_t handle, uint16_t count, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add the given number of queue disc classes (of the given type and with the gi...
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
Ptr< YansWifiChannel > Create(void) const
Class for representing data rates.
void SetChannel(Ptr< YansWifiChannel > channel)
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Hold an unsigned integer type.
#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.
holds a vector of ns3::NetDevice pointers
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Build a set of QueueDisc objects.
static void PacketEnqueuedInQueueDisc(uint8_t tos, uint16_t *count, Ptr< const QueueDiscItem > item)
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
Ptr< QueueDiscClass > GetQueueDiscClass(std::size_t i) const
Get the i-th queue disc class.
HandleList AddChildQueueDiscs(uint16_t handle, const ClassIdList &classes, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to attach a child queue disc (of the given type and with the given attributes) t...
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
std::vector< uint16_t > ClassIdList
Container type for Class IDs.
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
keep track of a set of node pointers.
Hold objects of type Ptr<T>.
std::size_t GetNQueueDiscClasses(void) const
Get the number of queue disc classes.
uint16_t SetRootQueueDisc(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to set a root queue disc of the given type and with the given attributes...
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
manage and create wifi channel objects for the yans model.
create MAC layers for a ns3::WifiNetDevice.
virtual bool GetUint8Value(Uint8Values field, uint8_t &value) const
Retrieve the value of a given field from the packet, if present.
The IEEE 802.11 SSID Information Element.
virtual void SetType(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue(), std::string n8="", const AttributeValue &v8=EmptyAttributeValue(), std::string n9="", const AttributeValue &v9=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue())
Helper class used to assign positions and mobility models to nodes.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
static WifiAcMappingTestSuite wifiAcMappingTestSuite
Time Seconds(double value)
Construct a Time in the indicated unit.
AttributeValue implementation for Ssid.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
uint16_t m_WifiMacQueueCount[4]
virtual void DoRun(void)
Implementation to actually run this TestCase.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
#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...
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.