A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lr-wpan-mac-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Tokushima University, Japan
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
7 */
8
9#include <ns3/constant-position-mobility-model.h>
10#include <ns3/core-module.h>
11#include <ns3/log.h>
12#include <ns3/lr-wpan-module.h>
13#include <ns3/packet.h>
14#include <ns3/propagation-delay-model.h>
15#include <ns3/propagation-loss-model.h>
16#include <ns3/simulator.h>
17#include <ns3/single-model-spectrum-channel.h>
18
19#include <iostream>
20
21using namespace ns3;
22using namespace ns3::lrwpan;
23
24NS_LOG_COMPONENT_DEFINE("lr-wpan-mac-test");
25
26/**
27 * \ingroup lr-wpan-test
28 * \ingroup tests
29 *
30 * \brief Test PHY going to TRX_OFF after CSMA failure (MAC->RxOnWhenIdle(false))
31 */
33{
34 public:
37
38 private:
39 /**
40 * Function called when a Data indication is invoked
41 * \param params MCPS data indication parameters
42 * \param p packet
43 */
45 /**
46 * Function called when a Data confirm is invoked (After Tx Attempt)
47 * \param params MCPS data confirm parameters
48 */
50 /**
51 * Function called when a the PHY state changes in Dev0 [00:01]
52 * \param context context
53 * \param now time at which the function is called
54 * \param oldState old PHY state
55 * \param newState new PHY state
56 */
57 void StateChangeNotificationDev0(std::string context,
58 Time now,
59 PhyEnumeration oldState,
60 PhyEnumeration newState);
61 /**
62 * Function called when a the PHY state changes in Dev2 [00:03]
63 * \param context context
64 * \param now time at which the function is called
65 * \param oldState old PHY state
66 * \param newState new PHY state
67 */
68 void StateChangeNotificationDev2(std::string context,
69 Time now,
70 PhyEnumeration oldState,
71 PhyEnumeration newState);
72
73 void DoRun() override;
74
75 PhyEnumeration m_dev0State; //!< Stores the PHY state of device 0 [00:01]
76};
77
79 : TestCase("Test PHY going to TRX_OFF state after CSMA failure")
80{
81}
82
86
87void
89{
90 NS_LOG_DEBUG("Received packet of size " << p->GetSize());
91}
92
93void
95{
96 if (params.m_status == MacStatus::SUCCESS)
97 {
98 NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Success");
99 }
100 else if (params.m_status == MacStatus::CHANNEL_ACCESS_FAILURE)
101 {
102 NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Channel Access Failure");
103 }
104}
105
106void
108 Time now,
109 PhyEnumeration oldState,
110 PhyEnumeration newState)
111{
113 << context << "PHY state change at " << now.As(Time::S) << " from "
114 << LrWpanHelper::LrWpanPhyEnumerationPrinter(oldState) << " to "
116
117 m_dev0State = newState;
118}
119
120void
122 Time now,
123 PhyEnumeration oldState,
124 PhyEnumeration newState)
125{
127 << context << "PHY state change at " << now.As(Time::S) << " from "
128 << LrWpanHelper::LrWpanPhyEnumerationPrinter(oldState) << " to "
130}
131
132void
134{
135 // [00:01] [00:02] [00:03]
136 // Node 0------>Node1<------Node2 (interferer)
137 //
138 // Test Setup:
139 //
140 // Start the test with a transmission from node 2 to node 1,
141 // soon after, node 0 will attempt to transmit a packet to node 1 as well but
142 // it will fail because node 2 is still transmitting.
143 //
144 // The test confirms that the PHY in node 0 goes to TRX_OFF
145 // after its CSMA failure because its MAC has been previously
146 // set with flag RxOnWhenIdle (false). To ensure that node 0 CSMA
147 // do not attempt to do multiple backoffs delays in its CSMA,
148 // macMinBE and MacMaxCSMABackoffs has been set to 0.
149
151
153 LogComponentEnable("LrWpanCsmaCa", LOG_LEVEL_DEBUG);
154 LogComponentEnable("lr-wpan-mac-test", LOG_LEVEL_DEBUG);
155
156 // Create 3 nodes, and a NetDevice for each one
159 Ptr<Node> interferenceNode = CreateObject<Node>();
160
164
165 dev0->SetAddress(Mac16Address("00:01"));
166 dev1->SetAddress(Mac16Address("00:02"));
167 dev2->SetAddress(Mac16Address("00:03"));
168
169 // Each device must be attached to the same channel
175 channel->AddPropagationLossModel(propModel);
176 channel->SetPropagationDelayModel(delayModel);
177
178 dev0->SetChannel(channel);
179 dev1->SetChannel(channel);
180 dev2->SetChannel(channel);
181
182 // To complete configuration, a LrWpanNetDevice must be added to a node
183 n0->AddDevice(dev0);
184 n1->AddDevice(dev1);
185 interferenceNode->AddDevice(dev2);
186
187 // Trace state changes in the phy
188 dev0->GetPhy()->TraceConnect(
189 "TrxState",
190 std::string("[address 00:01]"),
192 dev2->GetPhy()->TraceConnect(
193 "TrxState",
194 std::string("[address 00:03]"),
196
197 Ptr<ConstantPositionMobilityModel> sender0Mobility =
199 sender0Mobility->SetPosition(Vector(0, 0, 0));
200 dev0->GetPhy()->SetMobility(sender0Mobility);
201 Ptr<ConstantPositionMobilityModel> sender1Mobility =
203
204 sender1Mobility->SetPosition(Vector(0, 1, 0));
205 dev1->GetPhy()->SetMobility(sender1Mobility);
206
207 Ptr<ConstantPositionMobilityModel> sender3Mobility =
209
210 sender3Mobility->SetPosition(Vector(0, 2, 0));
211 dev2->GetPhy()->SetMobility(sender3Mobility);
212
215 dev0->GetMac()->SetMcpsDataConfirmCallback(cb0);
216
219 dev0->GetMac()->SetMcpsDataIndicationCallback(cb1);
220
223 dev1->GetMac()->SetMcpsDataConfirmCallback(cb2);
224
227 dev1->GetMac()->SetMcpsDataIndicationCallback(cb3);
228
229 dev0->GetMac()->SetRxOnWhenIdle(false);
230 dev1->GetMac()->SetRxOnWhenIdle(false);
231
232 // set CSMA min beacon exponent (BE) to 0 to make all backoff delays == to 0 secs.
233 dev0->GetCsmaCa()->SetMacMinBE(0);
234 dev2->GetCsmaCa()->SetMacMinBE(0);
235
236 // Only try once to do a backoff period before giving up.
237 dev0->GetCsmaCa()->SetMacMaxCSMABackoffs(0);
238 dev2->GetCsmaCa()->SetMacMaxCSMABackoffs(0);
239
240 // The below should trigger two callbacks when end-to-end data is working
241 // 1) DataConfirm callback is called
242 // 2) DataIndication callback is called with value of 50
243 Ptr<Packet> p0 = Create<Packet>(50); // 50 bytes of dummy data
245 params.m_dstPanId = 0;
246
247 params.m_srcAddrMode = SHORT_ADDR;
248 params.m_dstAddrMode = SHORT_ADDR;
249 params.m_dstAddr = Mac16Address("00:02");
250
251 params.m_msduHandle = 0;
252
253 // Send the packet that will be rejected due to channel access failure
255 Seconds(0.00033),
257 dev0->GetMac(),
258 params,
259 p0);
260
261 // Send interference packet
262 Ptr<Packet> p2 = Create<Packet>(60); // 60 bytes of dummy data
263 params.m_dstAddr = Mac16Address("00:02");
264
266 Seconds(0.0),
268 dev2->GetMac(),
269 params,
270 p2);
271
272 NS_LOG_DEBUG("----------- Start of TestRxOffWhenIdleAfterCsmaFailure -------------------");
274
276 PhyEnumeration::IEEE_802_15_4_PHY_TRX_OFF,
277 "Error, dev0 [00:01] PHY should be in TRX_OFF after CSMA failure");
278
280}
281
282/**
283 * \ingroup lr-wpan-test
284 * \ingroup tests
285 *
286 * \brief Test MAC Active Scan PAN descriptor reception and check some of its values.
287 */
289{
290 public:
293
294 private:
295 /**
296 * Function called in response to a MAC scan request.
297 *
298 * \param params MLME scan confirm parameters
299 */
301
302 /**
303 * Function used to notify the reception of a beacon with payload.
304 *
305 * \param params The MLME-BEACON-NOTIFY.indication parameters
306 */
308
309 void DoRun() override;
310
311 std::vector<PanDescriptor> m_panDescriptorList; //!< The list of PAN descriptors
312 //!< accumulated during the scan.
313 uint32_t g_beaconPayloadSize; //!< The size of the beacon payload received
314 //!< from a coordinator.
315};
316
318 : TestCase("Test the reception of PAN descriptors while performing an active scan")
319{
320}
321
325
326void
328{
329 if (params.m_status == MacStatus::SUCCESS)
330 {
331 m_panDescriptorList = params.m_panDescList;
332 }
333}
334
335void
340
341void
343{
344 /*
345 * [00:01] [00:02] [00:03]
346 * PAN Coordinator 1 (PAN: 5) End Device PAN Coordinator 2 (PAN: 7)
347 *
348 * |--------100 m----------------|----------106 m -----------------------|
349 * Channel 12 (Active Scan channels 11-14) Channel 14
350 *
351 * Test Setup:
352 *
353 * At the beginning of the simulation, PAN coordinators are set to
354 * non-beacon enabled mode and wait for any beacon requests.
355 *
356 * During the simulation, the end device do an Active scan (i.e. send beacon request commands to
357 * the scanned channels). On reception of such commands, coordinators reply with a single beacon
358 * which contains a PAN descriptor. The test makes sure that the PAN descriptors are received (2
359 * PAN descriptors) and because both PAN coordinators are set to a different distance from the
360 * end device, their LQI values should be below 255 but above 0. Likewise, Coordinator 2 LQI
361 * value should be less than Coordinator 1 LQI value. The exact expected value of LQI is not
362 * tested, this is dependable on the LQI implementation.
363 */
364
365 // Create 2 PAN coordinator nodes, and 1 end device
366 Ptr<Node> coord1 = CreateObject<Node>();
367 Ptr<Node> endNode = CreateObject<Node>();
368 Ptr<Node> coord2 = CreateObject<Node>();
369
373
374 // PAN coordinators typically have a short address = 00:00 (e.g. Zigbee networks)
375 coord1NetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:CA:FE");
376 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:00"));
377
378 coord2NetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:BE:BE");
379 coord2NetDevice->GetMac()->SetShortAddress(Mac16Address("00:00"));
380
381 // An end device currently not associated (short address = ff:ff)
382 endNodeNetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:00:03");
383 endNodeNetDevice->GetMac()->SetShortAddress(Mac16Address("ff:ff"));
384
385 // Configure Spectrum channel
391 channel->AddPropagationLossModel(propModel);
392 channel->SetPropagationDelayModel(delayModel);
393
394 coord1NetDevice->SetChannel(channel);
395 endNodeNetDevice->SetChannel(channel);
396 coord2NetDevice->SetChannel(channel);
397
398 coord1->AddDevice(coord1NetDevice);
399 endNode->AddDevice(endNodeNetDevice);
400 coord2->AddDevice(coord2NetDevice);
401
402 // Mobility
405 coord1Mobility->SetPosition(Vector(0, 0, 0));
406 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
407
408 Ptr<ConstantPositionMobilityModel> endNodeMobility =
410 endNodeMobility->SetPosition(Vector(100, 0, 0));
411 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
412
415 coord2Mobility->SetPosition(Vector(206, 0, 0));
416 coord2NetDevice->GetPhy()->SetMobility(coord2Mobility);
417
418 // MAC layer Callbacks hooks
421 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb0);
422
425 endNodeNetDevice->GetMac()->SetMlmeBeaconNotifyIndicationCallback(cb1);
426
427 /////////////////
428 // ACTIVE SCAN //
429 /////////////////
430
431 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode but answer to beacon
432 // requests.
434 params.m_panCoor = true;
435 params.m_PanId = 5;
436 params.m_bcnOrd = 15;
437 params.m_sfrmOrd = 15;
438 params.m_logCh = 12;
440 Seconds(2.0),
442 coord1NetDevice->GetMac(),
443 params);
444
445 // PAN coordinator N2 (PAN 7) is set to channel 14 in non-beacon mode but answer to beacon
446 // requests. The second coordinator includes a beacon payload of 2 bytes using the
447 // MLME-SET.request primitive.
449 std::vector<uint8_t> payload;
450 payload.emplace_back(1);
451 payload.emplace_back(2);
452 pibAttribute->macBeaconPayload = payload;
453 coord2NetDevice->GetMac()->MlmeSetRequest(MacPibAttributeIdentifier::macBeaconPayload,
454 pibAttribute);
455
457 params2.m_panCoor = true;
458 params2.m_PanId = 7;
459 params2.m_bcnOrd = 15;
460 params2.m_sfrmOrd = 15;
461 params2.m_logCh = 14;
463 Seconds(2.0),
465 coord2NetDevice->GetMac(),
466 params2);
467
468 // End device N1 broadcast a single BEACON REQUEST for each channel (11, 12, 13, and 14).
469 // If a coordinator is present and in range, it will respond with a beacon broadcast.
470 // Scan Channels are represented by bits 0-26 (27 LSB)
471 // ch 14 ch 11
472 // | |
473 // 0x7800 = 0000000000000000111100000000000
474 MlmeScanRequestParams scanParams;
475 scanParams.m_chPage = 0;
476 scanParams.m_scanChannels = 0x7800;
477 scanParams.m_scanDuration = 14;
478 scanParams.m_scanType = MLMESCAN_ACTIVE;
480 Seconds(3.0),
482 endNodeNetDevice->GetMac(),
483 scanParams);
484
486 NS_LOG_DEBUG("----------- Start of TestActiveScanPanDescriptors -------------------");
488
490 2,
491 "Error, Beacons not received or PAN descriptors not found");
492
493 if (m_panDescriptorList.size() == 2)
494 {
496 255,
497 "Error, Coordinator 1 (PAN 5) LQI value should be less than 255.");
499 255,
500 "Error, Coordinator 2 (PAN 7) LQI value should be less than 255.");
502 0,
503 "Error, Coordinator 1 (PAN 5) LQI value should be greater than 0.");
505 0,
506 "Error, Coordinator 2 (PAN 7) LQI value should be greater than 0.");
507
509 m_panDescriptorList[0].m_linkQuality,
510 "Error, Coordinator 2 (PAN 7) LQI value should"
511 " be less than Coordinator 1 (PAN 5).");
512
514 2,
515 "Error, Beacon Payload not received or incorrect size (2 bytes)");
516 }
517
519}
520
521/**
522 * \ingroup lr-wpan-test
523 * \ingroup tests
524 *
525 * \brief Test MAC Orphan Scan Coordinator Realignment command reception and its values.
526 */
528{
529 public:
531 ~TestOrphanScan() override;
532
533 private:
534 /**
535 * Function called in response to a MAC scan request.
536 *
537 * \param params MLME scan confirm parameters
538 */
540
541 /**
542 * Function called as a result of receiving an orphan notification command
543 * on the coordinator
544 *
545 * \param params MLME orphan indication parameters
546 */
548
549 void DoRun() override;
550
551 Ptr<LrWpanNetDevice> coord1NetDevice; //!< The LrWpanNetDevice of coordinator 1
552 Ptr<LrWpanNetDevice> endNodeNetDevice; //!< The LrWpanNetDevice of the end device
553 bool m_orphanScanSuccess; //!< Indicates a successful orphan scan
554};
555
557 : TestCase("Test an orphan scan and the reception of the commands involved")
558{
559 m_orphanScanSuccess = false;
560}
561
565
566void
568{
569 if (params.m_status == MacStatus::SUCCESS)
570 {
571 m_orphanScanSuccess = true;
572 }
573}
574
575void
577{
578 // The steps taken by the coordinator on the event of an orphan indication
579 // are meant to be implemented by the next higher layer and are out of the scope of the
580 // standard. In this test, we assume that coordinator 2 already has
581 // the endDevice [00:00:00:00:00:00:00:03] registered and therefore reply to this device
582 // a with a coordidinator realignment command.
583
584 if (params.m_orphanAddr == Mac64Address("00:00:00:00:00:00:00:02"))
585 {
586 MlmeOrphanResponseParams respParams;
587 respParams.m_assocMember = true;
588 respParams.m_orphanAddr = params.m_orphanAddr;
589 respParams.m_shortAddr = Mac16Address("00:02");
590
592 coord1NetDevice->GetMac(),
593 respParams);
594 }
595}
596
597void
599{
600 // Create 2 PAN coordinator nodes, and 1 end device
601 Ptr<Node> coord1 = CreateObject<Node>();
602 Ptr<Node> endNode = CreateObject<Node>();
603
606
607 // PAN Coordinators configurations require to set both, the EUI-64 (extended address)
608 // and to assign their own short address.
609 coord1NetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01"));
610 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:01"));
611
612 // Other devices must have only its EUI-64 and later on, their short address is
613 // potentially assigned by the coordinator.
614 endNodeNetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02"));
615
616 // Configure Spectrum channel
622 channel->AddPropagationLossModel(propModel);
623 channel->SetPropagationDelayModel(delayModel);
624
625 coord1NetDevice->SetChannel(channel);
626 endNodeNetDevice->SetChannel(channel);
627
628 coord1->AddDevice(coord1NetDevice);
629 endNode->AddDevice(endNodeNetDevice);
630
631 // Mobility
634 coord1Mobility->SetPosition(Vector(0, 0, 0));
635 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
636
637 Ptr<ConstantPositionMobilityModel> endNodeMobility =
639 endNodeMobility->SetPosition(Vector(100, 0, 0));
640 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
641
642 // MAC layer Callbacks hooks
645 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb1);
646
649 coord1NetDevice->GetMac()->SetMlmeOrphanIndicationCallback(cb2);
650 /////////////////
651 // ORPHAN SCAN //
652 /////////////////
653
654 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode
655 // but answer to beacon request and orphan notification commands.
657 params.m_panCoor = true;
658 params.m_PanId = 5;
659 params.m_bcnOrd = 15;
660 params.m_sfrmOrd = 15;
661 params.m_logCh = 12;
663 Seconds(2.0),
665 coord1NetDevice->GetMac(),
666 params);
667
668 // End device N1 is set to scan 4 channels looking for the presence of a coordinator.
669 // On each channel, a single orphan notification command is sent and a response is
670 // waited for a maximum time of macResponseWaitTime. If a reply is received from a
671 // coordinator within this time (coordinator realignment command), the programmed scans on
672 // other channels is suspended.
673 // Scan Channels are represented by bits 0-26 (27 LSB)
674 // ch 14 ch 11
675 // | |
676 // 0x7800 = 0000000000000000111100000000000
677 MlmeScanRequestParams scanParams;
678 scanParams.m_chPage = 0;
679 scanParams.m_scanChannels = 0x7800;
680 scanParams.m_scanType = MLMESCAN_ORPHAN;
682 Seconds(3.0),
684 endNodeNetDevice->GetMac(),
685 scanParams);
686
688 NS_LOG_DEBUG("----------- Start of TestOrphanScan -------------------");
690
692 true,
693 "Error, no coordinator realignment commands"
694 " received during orphan scan");
696 {
697 NS_TEST_EXPECT_MSG_EQ(endNodeNetDevice->GetMac()->GetShortAddress(),
698 Mac16Address("00:02"),
699 "Error, end device did not receive short address"
700 " during orphan scan");
701 }
702
704}
705
706/**
707 * \ingroup lr-wpan-test
708 * \ingroup tests
709 *
710 * \brief LrWpan MAC TestSuite
711 */
713{
714 public:
716};
717
719 : TestSuite("lr-wpan-mac-test", Type::UNIT)
720{
721 AddTestCase(new TestRxOffWhenIdleAfterCsmaFailure, TestCase::Duration::QUICK);
722 AddTestCase(new TestActiveScanPanDescriptors, TestCase::Duration::QUICK);
723 AddTestCase(new TestOrphanScan, TestCase::Duration::QUICK);
724}
725
726static LrWpanMacTestSuite g_lrWpanMacTestSuite; //!< Static variable for test initialization
LrWpan MAC TestSuite.
Test MAC Active Scan PAN descriptor reception and check some of its values.
void ScanConfirm(MlmeScanConfirmParams params)
Function called in response to a MAC scan request.
uint32_t g_beaconPayloadSize
The size of the beacon payload received from a coordinator.
void BeaconNotifyIndication(MlmeBeaconNotifyIndicationParams params)
Function used to notify the reception of a beacon with payload.
std::vector< PanDescriptor > m_panDescriptorList
The list of PAN descriptors accumulated during the scan.
void DoRun() override
Implementation to actually run this TestCase.
Test MAC Orphan Scan Coordinator Realignment command reception and its values.
void DoRun() override
Implementation to actually run this TestCase.
void ScanConfirm(MlmeScanConfirmParams params)
Function called in response to a MAC scan request.
void OrphanIndicationCoord(MlmeOrphanIndicationParams params)
Function called as a result of receiving an orphan notification command on the coordinator.
~TestOrphanScan() override
Ptr< LrWpanNetDevice > coord1NetDevice
The LrWpanNetDevice of coordinator 1.
Ptr< LrWpanNetDevice > endNodeNetDevice
The LrWpanNetDevice of the end device.
bool m_orphanScanSuccess
Indicates a successful orphan scan.
Test PHY going to TRX_OFF after CSMA failure (MAC->RxOnWhenIdle(false))
void DataConfirm(McpsDataConfirmParams params)
Function called when a Data confirm is invoked (After Tx Attempt)
void StateChangeNotificationDev0(std::string context, Time now, PhyEnumeration oldState, PhyEnumeration newState)
Function called when a the PHY state changes in Dev0 [00:01].
PhyEnumeration m_dev0State
Stores the PHY state of device 0 [00:01].
void StateChangeNotificationDev2(std::string context, Time now, PhyEnumeration oldState, PhyEnumeration newState)
Function called when a the PHY state changes in Dev2 [00:03].
void DoRun() override
Implementation to actually run this TestCase.
void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when a Data indication is invoked.
static std::string LrWpanPhyEnumerationPrinter(lrwpan::PhyEnumeration e)
Transform the LrWpanPhyEnumeration enumeration into a printable string.
This class can contain 16 bit addresses.
an EUI-64 address
Smart pointer class similar to boost::intrusive_ptr.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:577
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:594
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:404
@ S
second
Definition nstime.h:105
void MlmeStartRequest(MlmeStartRequestParams params) override
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
void MlmeOrphanResponse(MlmeOrphanResponseParams params) override
IEEE 802.15.4-2011, section 6.2.7.2 MLME-ORPHAN.response Primitive used to initiatte a response to an...
void MlmeScanRequest(MlmeScanRequestParams params) override
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p) override
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
PhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#define NS_TEST_ASSERT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report and abort if not.
Definition test.h:699
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:241
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Definition test.h:864
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
static LrWpanMacTestSuite g_lrWpanMacTestSuite
Static variable for test initialization.
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.
Definition log.cc:291
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...
Definition callback.h:684
LogLevel
Logging severity classes and levels.
Definition log.h:83
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition log.h:107
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition log.h:108
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition log.h:102
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition log.cc:309
MLME-BEACON-NOTIFY.indication params.
MLME-ORPHAN.indication params.
bool m_assocMember
T = allocated with this coord | F = otherwise.
Mac64Address m_orphanAddr
The address of the orphaned device.
Mac16Address m_shortAddr
The short address allocated.
MlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
uint32_t m_scanChannels
The channel numbers to be scanned.
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
uint32_t m_chPage
The channel page on which to perform scan.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
bool m_panCoor
On true this device will become coordinator.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
uint16_t m_PanId
Pan Identifier used by the device.