10#include "ns3/constant-position-mobility-model.h"
11#include "ns3/core-module.h"
13#include "ns3/lr-wpan-module.h"
14#include "ns3/packet.h"
15#include "ns3/propagation-delay-model.h"
16#include "ns3/propagation-loss-model.h"
17#include "ns3/rng-seed-manager.h"
18#include "ns3/simulator.h"
19#include "ns3/single-model-spectrum-channel.h"
20#include "ns3/zigbee-module.h"
79 void DoRun()
override;
85 :
TestCase(
"Zigbee: APS layer data test")
108 if (params.m_status == NwkStatus::SUCCESS)
124 NS_ABORT_MSG(
"Unable to discover networks | status: " << params.m_status);
147 dataReqParams.
m_dstAddrMode = ApsDstAddressMode::DST_ADDR16_DST_ENDPOINT_PRESENT;
148 dataReqParams.
m_dstAddr16 = stackDst->GetNwk()->GetNetworkAddress();
181 dev0->GetMac()->SetExtendedAddress(
"00:00:00:00:00:00:CA:FE");
182 dev1->GetMac()->SetExtendedAddress(
"00:00:00:00:00:00:00:01");
183 dev2->GetMac()->SetExtendedAddress(
"00:00:00:00:00:00:00:02");
192 channel->AddPropagationLossModel(propModel);
193 channel->SetPropagationDelayModel(delayModel);
195 dev0->SetChannel(channel);
196 dev1->SetChannel(channel);
197 dev2->SetChannel(channel);
209 zstack0->GetNwk()->AssignStreams(0);
210 zstack1->GetNwk()->AssignStreams(10);
211 zstack2->GetNwk()->AssignStreams(20);
216 dev0Mobility->SetPosition(Vector(0, 0, 0));
217 dev0->GetPhy()->SetMobility(dev0Mobility);
220 dev1Mobility->SetPosition(Vector(50, 0, 0));
221 dev1->GetPhy()->SetMobility(dev1Mobility);
224 dev2Mobility->SetPosition(Vector(0, 50, 0));
225 dev2->GetPhy()->SetMobility(dev2Mobility);
228 zstack1->GetAps()->SetApsdeDataIndicationCallback(
231 zstack2->GetAps()->SetApsdeDataIndicationCallback(
237 zstack1->GetNwk()->SetNlmeNetworkDiscoveryConfirmCallback(
239 zstack2->GetNwk()->SetNlmeNetworkDiscoveryConfirmCallback(
289 "The dev 1 was unable to join the network");
293 "The dev 1 was unable to join the network");
296 zstack1->GetNwk()->GetNetworkAddress(),
297 "Error, devices 0 and 1 have the same 16 bit MAC address");
300 zstack2->GetNwk()->GetNetworkAddress(),
301 "Error, devices 1 and 2 have the same 16 bit MAC address");
307 "Packet was not received in the correct destination endpoint");
Zigbee RREQ transmission retries test case.
uint16_t m_dstEndpoint
The destination endpoint.
static void NwkNetworkDiscoveryConfirm(ZigbeeApsDataTestCase *testcase, Ptr< ZigbeeStack > stack, NlmeNetworkDiscoveryConfirmParams params)
Callback for NLME-NETWORK-DISCOVERY.confirm This callback is called when a network discovery has been...
void DoRun() override
Implementation to actually run this TestCase.
~ZigbeeApsDataTestCase() override
static void SendDataUcstDst(Ptr< ZigbeeStack > stackSrc, Ptr< ZigbeeStack > stackDst)
Send data to a unicast destination.
static void ApsDataIndication(ZigbeeApsDataTestCase *testcase, Ptr< ZigbeeStack > stack, ApsdeDataIndicationParams params, Ptr< Packet > asdu)
Callback for APSDE-DATA.indication This callback is called when a data packet is received by the APS ...
Zigbee APS Data TestSuite.
helps to manage and create IEEE 802.15.4 NetDevice objects
NetDeviceContainer Install(NodeContainer c)
Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes.
This class can contain 16 bit addresses.
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.
Smart pointer class similar to boost::intrusive_ptr.
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 ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static void Run()
Run the simulation.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Setup a Zigbee stack to be used with LrWpanNetDevice.
zigbee::ZigbeeStackContainer Install(NetDeviceContainer c)
Install the Zigbee stack on top of an existing LrWpanNetDevice.
Network layer to device interface.
void ApsdeDataRequest(ApsdeDataRequestParams params, Ptr< Packet > asdu)
Zigbee Specification r22.1.0, Section 2.2.4.1.1 APSDE-DATA.request Request the transmission of data t...
Helper class used to craft the transmission options bitmap used by the APSDE-DATA....
uint8_t GetTxOptions() const
Get the complete bitmap containing the Tx options.
void NlmeNetworkDiscoveryRequest(NlmeNetworkDiscoveryRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.3 NLME-NETWORK-DISCOVERY.request Allows the next higher l...
void NlmeJoinRequest(NlmeJoinRequestParams params)
Zigbee Specification r22.1.0, section 3.2.2.13 NLME-JOIN.request This primitive allows the next highe...
void NlmeNetworkFormationRequest(NlmeNetworkFormationRequestParams params)
Zigbee Specification r22.1.0, Section 3.2.2.5 and 3.6.1.1 NLME-NETWORK-FORMATION.request Request the ...
Holds a vector of ns3::ZigbeeStack pointers.
Ptr< ZigbeeStack > Get(uint32_t i) const
Get a stack element from the container.
Zigbee protocol stack to device interface.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#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.
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_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report 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.
Zigbee Specification r22.1.0, Section 2.2.4.1.3 APSDE-DATA.indications params.
Zigbee Specification r22.1.0, Section 2.2.4.1.1 APSDE-DATA.request params.
uint16_t m_profileId
The application profile ID.
uint16_t m_clusterId
The application cluster ID.
Mac16Address m_dstAddr16
The destination 16-bit address.
uint8_t m_txOptions
Transmission options.
uint8_t m_srcEndPoint
The source endpoint.
bool m_useAlias
Indicates if alias is used in this transmission.
ApsDstAddressMode m_dstAddrMode
Destination address mode.
uint8_t m_dstEndPoint
The destination endpoint.
uint8_t channelPageCount
The number of the channel page structures contained in the channel list structure.
std::vector< uint32_t > channelsField
The set of channels for a given page.
NLME-JOIN.request params.
JoiningMethod m_rejoinNetwork
This parameter controls the method of joining the network.
uint8_t m_capabilityInfo
The operating capabilities of the device being directly joined (Bit map).
uint64_t m_extendedPanId
The 64 bit PAN identifier of the the network to join.
NLME-NETWORK-DISCOVERY.confirm params.
NLME-NETWORK-DISCOVERY.request params.
uint8_t m_scanDuration
A value used to calculate the length of time to spend.
ChannelList m_scanChannelList
The list of all channel pages and the associated channels that shall be scanned.
static ZigbeeApsDataTestSuite zigbeeApsDataTestSuite
Static variable for test initialization.