17#include "ns3/callback.h"
18#include "ns3/core-module.h"
20#include "ns3/network-server-helper.h"
21#include "ns3/network-server.h"
27using namespace lorawan;
57 void DoRun()
override;
64 :
TestCase(
"Verify that the NetworkServer application can receive"
65 " packets sent in the uplink by devices")
103 nsNode->GetApplication(0)->TraceConnectWithoutContext(
154 void DoRun()
override;
161 :
TestCase(
"Verify that devices requesting an acknowledgment receive"
162 " a reply from the network server.")
212 "RequiredTransmissions",
254 void DoRun()
override;
264 :
TestCase(
"Verify that the NetworkServer application correctly responds to "
265 "LinkCheck requests")
It verifies that devices requesting an acknowledgment receive a reply from the network server.
DownlinkPacketTest()
Default constructor.
~DownlinkPacketTest() override
Destructor.
bool m_receivedPacketAtEd
Set to true if a packet is received by the end device.
void DoRun() override
Implementation to actually run this TestCase.
void ReceivedPacketAtEndDevice(uint8_t requiredTransmissions, bool success, Time time, Ptr< Packet > packet)
Record the exit status of a MAC layer packet retransmission process of an end device.
void SendPacket(Ptr< Node > endDevice, bool requestAck)
Send a packet from the input end device.
It verifies that the NetworkServer application correctly responds to LinkCheck requests.
void DoRun() override
Implementation to actually run this TestCase.
void SendPacket(Ptr< Node > endDevice, bool requestAck)
Send a packet containing a LinkCheckReq MAC command from the input end device.
LinkCheckTest()
Default constructor.
~LinkCheckTest() override
Destructor.
int m_numberOfGatewaysThatReceivedPacket
Stores the number of gateways that received the last packet carrying a LinkCheckReq MAC command.
bool m_receivedPacketAtEd
Set to true if a packet containing a LinkCheckAns MAC command is received by the end device.
void LastKnownGatewayCount(int newValue, int oldValue)
Trace changes in the last known gateway count variable (updated on reception of LinkCheckAns MAC comm...
The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the TestCases...
NetworkServerTestSuite()
Default constructor.
It verifies that the NetworkServer application can receive packets sent in uplink by devices.
UplinkPacketTest()
Default constructor.
void DoRun() override
Implementation to actually run this TestCase.
void ReceivedPacket(Ptr< const Packet > packet)
Callback for tracing ReceivedPacket.
~UplinkPacketTest() override
Destructor.
bool m_receivedPacket
Set to true if a packet is received by the server.
void SendPacket(Ptr< Node > endDevice)
Send a packet from the input end device.
a polymophic address class
keep track of a set of node pointers.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Smart pointer class similar to boost::intrusive_ptr.
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.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time Seconds(double value)
Construct a Time in the indicated unit.
NetworkComponents InitializeNetwork(int nDevices, int nGateways)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
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...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
@ LOG_LEVEL_ALL
Print everything.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
static NetworkServerTestSuite lorawanTestSuite
Stores the main elements of a simulated LoRaWAN network.
Ptr< Node > nsNode
A pointer to the network server Node.
Ptr< LoraChannel > channel
A pointer to the LoraChannel object.
NodeContainer endDevices
Container of the end device nodes.
NodeContainer gateways
Container of the gateway nodes.