24 #include "ns3/nqos-wifi-mac-helper.h"
25 #include "ns3/yans-wifi-helper.h"
26 #include "ns3/internet-stack-helper.h"
27 #include "ns3/ipv4-address-helper.h"
28 #include "ns3/packet-sink-helper.h"
29 #include "ns3/on-off-helper.h"
30 #include "ns3/mobility-helper.h"
31 #include "ns3/wifi-net-device.h"
32 #include "ns3/adhoc-wifi-mac.h"
33 #include "ns3/propagation-delay-model.h"
34 #include "ns3/propagation-loss-model.h"
35 #include "ns3/yans-error-rate-model.h"
36 #include "ns3/constant-position-mobility-model.h"
38 #include "ns3/pointer.h"
39 #include "ns3/rng-seed-manager.h"
40 #include "ns3/config.h"
41 #include "ns3/boolean.h"
42 #include "ns3/string.h"
51 int64_t currentStream = stream;
84 virtual void DoRun (
void);
120 phy->SetErrorRateModel (error);
121 phy->SetChannel (channel);
122 phy->SetDevice (dev);
128 mac->SetAddress (Mac48Address::Allocate ());
131 dev->SetRemoteStationManager (manager);
146 CreateOne (Vector (0.0, 0.0, 0.0), channel);
147 CreateOne (Vector (5.0, 0.0, 0.0), channel);
148 CreateOne (Vector (5.0, 0.0, 0.0), channel);
150 Simulator::Stop (
Seconds (10.0));
153 Simulator::Destroy ();
226 virtual void DoRun (
void);
240 :
TestCase (
"InterferenceHelperSequence")
269 phy->SetErrorRateModel (error);
270 phy->SetChannel (channel);
271 phy->SetDevice (dev);
272 phy->SetMobility (mobility);
278 mac->SetAddress (Mac48Address::Allocate ());
281 dev->SetRemoteStationManager (manager);
305 propLoss->SetDefaultLoss (999);
307 Simulator::Schedule (
Seconds (1.0),
309 DynamicCast<WifiNetDevice> (senderB->
GetDevice (0)));
311 Simulator::Schedule (
Seconds (1.0000001),
313 DynamicCast<WifiNetDevice> (rxOnly->
GetDevice (0)));
315 Simulator::Schedule (
Seconds (5.0),
317 DynamicCast<WifiNetDevice> (senderA->
GetDevice (0)));
319 Simulator::Schedule (
Seconds (7.0),
321 DynamicCast<WifiNetDevice> (senderB->
GetDevice (0)));
323 Simulator::Stop (
Seconds (100.0));
326 Simulator::Destroy ();
367 virtual void DoRun (
void);
385 :
TestCase (
"Test case for Bug 555")
420 RngSeedManager::SetSeed (1);
421 RngSeedManager::SetRun (17);
433 Ptr<Node> txNode = CreateObject<Node> ();
446 txPhy->SetErrorRateModel (txError);
447 txPhy->SetChannel (channel);
448 txPhy->SetDevice (txDev);
449 txPhy->SetMobility (txMobility);
456 txMac->SetAddress (Mac48Address::Allocate ());
457 txDev->SetMac (txMac);
458 txDev->SetPhy (txPhy);
469 Simulator::Stop (
Seconds (2.0));
471 Simulator::Destroy ();
477 uint32_t expectedWait1 = 1408 + (0 * 9) + 16 + 18;
503 virtual void DoRun (
void);
513 :
TestCase (
"Test case for Bug 730"),
558 mac.
SetType (
"ns3::StaWifiMac",
563 staDevices = wifi.
Install (phy, mac, wifiStaNode);
570 apDevices = wifi.
Install (phy, mac, wifiApNode);
575 positionAlloc->
Add (Vector (0.0, 0.0, 0.0));
576 positionAlloc->
Add (Vector (1.0, 0.0, 0.0));
581 mobility.
Install (wifiStaNode);
588 address.
SetBase (
"10.1.1.0",
"255.255.255.0");
590 StaInterface = address.
Assign (staDevices);
592 ApInterface = address.
Assign (apDevices);
614 Simulator::Schedule (
Seconds (10.0),
Config::Set,
"/NodeList/0/DeviceList/0/RemoteStationManager/FragmentationThreshold",
StringValue (
"800"));
616 Simulator::Stop (
Seconds (55));
618 Simulator::Destroy ();
621 NS_TEST_ASSERT_MSG_EQ (result,
true,
"packet reception unexpectedly stopped after adapting fragmentation threshold!");
holds a vector of ns3::Application pointers.
void NotifyPhyTxBegin(Ptr< const Packet > p)
Simulation virtual time values and global simulation resolution.
virtual ~Bug730TestCase()
Smart pointer class similar to boost::intrusive_ptr.
AttributeValue implementation for Boolean.
void Receive(std::string context, Ptr< const Packet > p, const Address &adr)
holds a vector of std::pair of Ptr and interface index.
Ptr< YansWifiChannel > Create(void) const
void SetRemoteStationManager(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())
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Hold variables of type string.
Make it easy to create and manage PHY objects for the yans model.
void Set(std::string path, const AttributeValue &value)
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
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())
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
void SetPropagationLossModel(Ptr< PropagationLossModel > loss)
void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
void ConfigureStandard(enum WifiPhyStandard standard)
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
aggregate IP/TCP/UDP functionality to existing Nodes.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
bool QosUtilsIsOldPacket(uint16_t startingSeq, uint16_t seqNumber)
This function checks if packet with sequence number seqNumber is an "old" packet. ...
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Make sure that when changing the fragmentation threshold during the simulation, the TCP transmission ...
helps to create WifiNetDevice objects
InterferenceHelperSequenceTest()
A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
a polymophic address class
Keep track of the current position and velocity of an object.
void SetChannel(Ptr< YansWifiChannel > channel)
Ptr< WifiPhy > GetPhy(void) const
Ptr< Node > CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
This queue contains packets for a particular access class.
void SendOnePacket(Ptr< WifiNetDevice > dev)
void Install(Ptr< Node > node) const
"Layout" a single node according to the current position allocator type.
Time m_secondTransmissionTime
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
base class for all MAC-level wifi objects.
Hold an unsigned integer type.
Time m_firstTransmissionTime
#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.
QosUtilsIsOldPacketTest()
holds a vector of ns3::NetDevice pointers
virtual void SetStandard(enum WifiPhyStandard standard)
calculate a propagation delay.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
virtual void DoRun(void)
Implementation to actually run this TestCase.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
hold a list of per-remote-station state.
create non QoS-enabled MAC layers for a ns3::WifiNetDevice.
void Connect(std::string path, const CallbackBase &cb)
void SwitchCh(Ptr< WifiNetDevice > dev)
virtual void DoRun(void)
Implementation to actually run this TestCase.
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Hold objects of type Ptr.
static WifiTestSuite g_wifiTestSuite
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
void SetMobilityModel(std::string type, 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())
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
manage and create wifi channel objects for the yans model.
ObjectFactory m_propDelay
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
void SendOnePacket(Ptr< LrWpanPhy > sender, Ptr< LrWpanPhy > receiver)
virtual void SetChannelNumber(uint16_t id)=0
Set channel number.
void SetPosition(const Vector &position)
The IEEE 802.11 SSID Information Element.
ObjectFactory m_propDelay
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Helper class used to assign positions and mobility models to nodes.
virtual Address GetBroadcast(void) const
unsigned int m_numSentPackets
Instantiate subclasses of ns3::Object.
AttributeValue implementation for Address.
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
static void AssignWifiRandomStreams(Ptr< WifiMac > mac, int64_t stream)
Ptr< Node > Get(uint32_t i) const
Get the Ptr stored in this container at a given index.
ObjectFactory m_propDelay
Time Seconds(double value)
Construct a Time in the indicated unit.
AttributeValue implementation for Ssid.
void SetDefault(std::string name, const AttributeValue &value)
void Add(Vector v)
Add a position to the list of positions.
void SendOnePacket(Ptr< WifiNetDevice > dev)
ApplicationContainer Install(NodeContainer c) const
Install an ns3::PacketSinkApplication on each node of the input container configured with all the att...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SendOnePacket(Ptr< WifiNetDevice > dev)
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Now(void)
create an ns3::Time instance which contains the current simulation time.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
void SetPositionAllocator(Ptr< PositionAllocator > allocator)
Set the position allocator which will be used to allocate the initial position of every node initiali...
handle packet fragmentation and retransmissions.
virtual void DoRun(void)
Implementation to actually run this TestCase.
ApplicationContainer Install(NodeContainer c) const
Install an ns3::OnOffApplication on each node of the input container configured with all the attribut...
void SetAttribute(std::string name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
void CreateOne(Vector pos, Ptr< YansWifiChannel > channel)
Make sure that when multiple broadcast packets are queued on the same device in a short succession no...
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
virtual void DoRun(void)
Implementation to actually run this TestCase.