16#include "ns3/address.h"
17#include "ns3/callback.h"
18#include "ns3/double.h"
19#include "ns3/error-model.h"
20#include "ns3/mac48-address.h"
22#include "ns3/packet.h"
23#include "ns3/pointer.h"
25#include "ns3/rng-seed-manager.h"
26#include "ns3/simple-channel.h"
27#include "ns3/simple-net-device.h"
28#include "ns3/simulator.h"
29#include "ns3/string.h"
37 for (
int i = 0; i < num; i++)
40 device->Send(pkt, addr, 0);
53 queueFactory.
SetTypeId(
"ns3::DropTailQueue<Packet>");
58 input->SetQueue(queueA);
59 output->SetQueue(queueB);
63 input->SetChannel(channel);
65 output->SetChannel(channel);
83 void DoRun()
override;
105 :
TestCase(
"ErrorModel and PhyRxDrop trace for SimpleNetDevice"),
152 em->SetRandomVariable(uv);
154 em->SetAttribute(
"ErrorUnit",
StringValue(
"ERROR_UNIT_PACKET"));
157 output->SetAttribute(
"ReceiveErrorModel",
PointerValue(em));
158 output->TraceConnectWithoutContext(
"PhyRxDrop",
186 void DoRun()
override;
208 :
TestCase(
"ErrorModel and PhyRxDrop trace for SimpleNetDevice"),
255 em->SetRandomVariable(uv);
259 em->AssignStreams(51);
262 output->SetAttribute(
"ReceiveErrorModel",
PointerValue(em));
263 output->TraceConnectWithoutContext(
"PhyRxDrop",
BurstErrorModel unit tests.
bool Receive(Ptr< NetDevice > nd, Ptr< const Packet > p, uint16_t protocol, const Address &addr)
Receive form a NetDevice.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t m_count
The received packets counter.
~BurstErrorModelSimple() override
uint32_t m_drops
The dropped packets counter.
void DropEvent(Ptr< const Packet > p)
Register a Drop.
uint32_t m_drops
The dropped packets counter.
bool Receive(Ptr< NetDevice > nd, Ptr< const Packet > p, uint16_t protocol, const Address &addr)
Receive form a NetDevice.
~ErrorModelSimple() override
uint32_t m_count
The received packets counter.
void DropEvent(Ptr< const Packet > p)
Register a Drop.
void DoRun() override
Implementation to actually run this TestCase.
a polymophic address class
This class can be used to hold variables of floating point type such as 'double' or 'float'.
static Mac48Address Allocate()
Allocate a new Mac48Address.
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
Template class for packet Queues.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
Hold variables of type string.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static ErrorModelTestSuite errorModelTestSuite
Static variable for test initialization.
static void SendPacket(int num, Ptr< NetDevice > device, Address &addr)
static void BuildSimpleTopology(Ptr< Node > a, Ptr< Node > b, Ptr< SimpleNetDevice > input, Ptr< SimpleNetDevice > output, Ptr< SimpleChannel > channel)
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_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal 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.
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...