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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
18 */
19
20#include <ns3/constant-position-mobility-model.h>
21#include <ns3/core-module.h>
22#include <ns3/log.h>
23#include <ns3/lr-wpan-module.h>
24#include <ns3/packet.h>
25#include <ns3/propagation-delay-model.h>
26#include <ns3/propagation-loss-model.h>
27#include <ns3/simulator.h>
28#include <ns3/single-model-spectrum-channel.h>
29
30#include <iostream>
31
32using namespace ns3;
33
34NS_LOG_COMPONENT_DEFINE("lr-wpan-mac-test");
35
43{
44 public:
47
48 private:
67 void StateChangeNotificationDev0(std::string context,
68 Time now,
69 LrWpanPhyEnumeration oldState,
70 LrWpanPhyEnumeration newState);
78 void StateChangeNotificationDev2(std::string context,
79 Time now,
80 LrWpanPhyEnumeration oldState,
81 LrWpanPhyEnumeration newState);
82
83 void DoRun() override;
84
86};
87
89 : TestCase("Test PHY going to TRX_OFF state after CSMA failure")
90{
91}
92
94{
95}
96
97void
99{
100 NS_LOG_DEBUG("Received packet of size " << p->GetSize());
101}
102
103void
105{
106 if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_SUCCESS)
107 {
108 NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Success");
109 }
110 else if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_CHANNEL_ACCESS_FAILURE)
111 {
112 NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Channel Access Failure");
113 }
114}
115
116void
118 Time now,
119 LrWpanPhyEnumeration oldState,
120 LrWpanPhyEnumeration newState)
121{
123 << context << "PHY state change at " << now.As(Time::S) << " from "
124 << LrWpanHelper::LrWpanPhyEnumerationPrinter(oldState) << " to "
126
127 m_dev0State = newState;
128}
129
130void
132 Time now,
133 LrWpanPhyEnumeration oldState,
134 LrWpanPhyEnumeration newState)
135{
137 << context << "PHY state change at " << now.As(Time::S) << " from "
138 << LrWpanHelper::LrWpanPhyEnumerationPrinter(oldState) << " to "
140}
141
142void
144{
145 // [00:01] [00:02] [00:03]
146 // Node 0------>Node1<------Node2 (interferer)
147 //
148 // Test Setup:
149 //
150 // Start the test with a transmission from node 2 to node 1,
151 // soon after, node 0 will attempt to transmit a packet to node 1 as well but
152 // it will fail because node 2 is still transmitting.
153 //
154 // The test confirms that the PHY in node 0 goes to TRX_OFF
155 // after its CSMA failure because its MAC has been previously
156 // set with flag RxOnWhenIdle (false). To ensure that node 0 CSMA
157 // do not attempt to do multiple backoffs delays in its CSMA,
158 // macMinBE and MacMaxCSMABackoffs has been set to 0.
159
161
163 LogComponentEnable("LrWpanCsmaCa", LOG_LEVEL_DEBUG);
164 LogComponentEnable("lr-wpan-mac-test", LOG_LEVEL_DEBUG);
165
166 // Create 3 nodes, and a NetDevice for each one
167 Ptr<Node> n0 = CreateObject<Node>();
168 Ptr<Node> n1 = CreateObject<Node>();
169 Ptr<Node> interferenceNode = CreateObject<Node>();
170
171 Ptr<LrWpanNetDevice> dev0 = CreateObject<LrWpanNetDevice>();
172 Ptr<LrWpanNetDevice> dev1 = CreateObject<LrWpanNetDevice>();
173 Ptr<LrWpanNetDevice> dev2 = CreateObject<LrWpanNetDevice>();
174
175 dev0->SetAddress(Mac16Address("00:01"));
176 dev1->SetAddress(Mac16Address("00:02"));
177 dev2->SetAddress(Mac16Address("00:03"));
178
179 // Each device must be attached to the same channel
180 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
182 CreateObject<LogDistancePropagationLossModel>();
184 CreateObject<ConstantSpeedPropagationDelayModel>();
185 channel->AddPropagationLossModel(propModel);
186 channel->SetPropagationDelayModel(delayModel);
187
188 dev0->SetChannel(channel);
189 dev1->SetChannel(channel);
190 dev2->SetChannel(channel);
191
192 // To complete configuration, a LrWpanNetDevice must be added to a node
193 n0->AddDevice(dev0);
194 n1->AddDevice(dev1);
195 interferenceNode->AddDevice(dev2);
196
197 // Trace state changes in the phy
198 dev0->GetPhy()->TraceConnect(
199 "TrxState",
200 std::string("[address 00:01]"),
202 dev2->GetPhy()->TraceConnect(
203 "TrxState",
204 std::string("[address 00:03]"),
206
207 Ptr<ConstantPositionMobilityModel> sender0Mobility =
208 CreateObject<ConstantPositionMobilityModel>();
209 sender0Mobility->SetPosition(Vector(0, 0, 0));
210 dev0->GetPhy()->SetMobility(sender0Mobility);
211 Ptr<ConstantPositionMobilityModel> sender1Mobility =
212 CreateObject<ConstantPositionMobilityModel>();
213
214 sender1Mobility->SetPosition(Vector(0, 1, 0));
215 dev1->GetPhy()->SetMobility(sender1Mobility);
216
217 Ptr<ConstantPositionMobilityModel> sender3Mobility =
218 CreateObject<ConstantPositionMobilityModel>();
219
220 sender3Mobility->SetPosition(Vector(0, 2, 0));
221 dev2->GetPhy()->SetMobility(sender3Mobility);
222
225 dev0->GetMac()->SetMcpsDataConfirmCallback(cb0);
226
229 dev0->GetMac()->SetMcpsDataIndicationCallback(cb1);
230
233 dev1->GetMac()->SetMcpsDataConfirmCallback(cb2);
234
237 dev1->GetMac()->SetMcpsDataIndicationCallback(cb3);
238
239 dev0->GetMac()->SetRxOnWhenIdle(false);
240 dev1->GetMac()->SetRxOnWhenIdle(false);
241
242 // set CSMA min beacon exponent (BE) to 0 to make all backoff delays == to 0 secs.
243 dev0->GetCsmaCa()->SetMacMinBE(0);
244 dev2->GetCsmaCa()->SetMacMinBE(0);
245
246 // Only try once to do a backoff period before giving up.
247 dev0->GetCsmaCa()->SetMacMaxCSMABackoffs(0);
248 dev2->GetCsmaCa()->SetMacMaxCSMABackoffs(0);
249
250 // The below should trigger two callbacks when end-to-end data is working
251 // 1) DataConfirm callback is called
252 // 2) DataIndication callback is called with value of 50
253 Ptr<Packet> p0 = Create<Packet>(50); // 50 bytes of dummy data
255 params.m_dstPanId = 0;
256
257 params.m_srcAddrMode = SHORT_ADDR;
258 params.m_dstAddrMode = SHORT_ADDR;
259 params.m_dstAddr = Mac16Address("00:02");
260
261 params.m_msduHandle = 0;
262
263 // Send the packet that will be rejected due to channel access failure
265 Seconds(0.00033),
267 dev0->GetMac(),
268 params,
269 p0);
270
271 // Send interference packet
272 Ptr<Packet> p2 = Create<Packet>(60); // 60 bytes of dummy data
273 params.m_dstAddr = Mac16Address("00:02");
274
276 Seconds(0.0),
278 dev2->GetMac(),
279 params,
280 p2);
281
282 NS_LOG_DEBUG("----------- Start of TestRxOffWhenIdleAfterCsmaFailure -------------------");
284
286 LrWpanPhyEnumeration::IEEE_802_15_4_PHY_TRX_OFF,
287 "Error, dev0 [00:01] PHY should be in TRX_OFF after CSMA failure");
288
290}
291
299{
300 public:
303
304 private:
317
318 void DoRun() override;
319
320 std::vector<PanDescriptor> m_panDescriptorList;
324};
325
327 : TestCase("Test the reception of PAN descriptors while performing an active scan")
328{
329}
330
332{
333}
334
335void
337{
338 if (params.m_status == MLMESCAN_SUCCESS)
339 {
340 m_panDescriptorList = params.m_panDescList;
341 }
342}
343
344void
346{
347 g_beaconPayloadSize = params.m_sdu->GetSize();
348}
349
350void
352{
353 /*
354 * [00:01] [00:02] [00:03]
355 * PAN Coordinator 1 (PAN: 5) End Device PAN Coordinator 2 (PAN: 7)
356 *
357 * |--------100 m----------------|----------106 m -----------------------|
358 * Channel 12 (Active Scan channels 11-14) Channel 14
359 *
360 * Test Setup:
361 *
362 * At the beginning of the simulation, PAN coordinators are set to
363 * non-beacon enabled mode and wait for any beacon requests.
364 *
365 * During the simulation, the end device do an Active scan (i.e. send beacon request commands to
366 * the scanned channels). On reception of such commands, coordinators reply with a single beacon
367 * which contains a PAN descriptor. The test makes sure that the PAN descriptors are received (2
368 * PAN descriptors) and because both PAN coordinators are set to a different distance from the
369 * end device, their LQI values should be below 255 but above 0. Likewise, Coordinator 2 LQI
370 * value should be less than Coordinator 1 LQI value. The exact expected value of LQI is not
371 * tested, this is dependable on the LQI implementation.
372 */
373
374 // Create 2 PAN coordinator nodes, and 1 end device
375 Ptr<Node> coord1 = CreateObject<Node>();
376 Ptr<Node> endNode = CreateObject<Node>();
377 Ptr<Node> coord2 = CreateObject<Node>();
378
379 Ptr<LrWpanNetDevice> coord1NetDevice = CreateObject<LrWpanNetDevice>();
380 Ptr<LrWpanNetDevice> endNodeNetDevice = CreateObject<LrWpanNetDevice>();
381 Ptr<LrWpanNetDevice> coord2NetDevice = CreateObject<LrWpanNetDevice>();
382
383 coord1NetDevice->SetAddress(Mac16Address("00:01"));
384 endNodeNetDevice->SetAddress(Mac16Address("00:02"));
385 coord2NetDevice->SetAddress(Mac16Address("00:03"));
386
387 // Configure Spectrum channel
388 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
390 CreateObject<LogDistancePropagationLossModel>();
392 CreateObject<ConstantSpeedPropagationDelayModel>();
393 channel->AddPropagationLossModel(propModel);
394 channel->SetPropagationDelayModel(delayModel);
395
396 coord1NetDevice->SetChannel(channel);
397 endNodeNetDevice->SetChannel(channel);
398 coord2NetDevice->SetChannel(channel);
399
400 coord1->AddDevice(coord1NetDevice);
401 endNode->AddDevice(endNodeNetDevice);
402 coord2->AddDevice(coord2NetDevice);
403
404 // Mobility
406 CreateObject<ConstantPositionMobilityModel>();
407 coord1Mobility->SetPosition(Vector(0, 0, 0));
408 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
409
410 Ptr<ConstantPositionMobilityModel> endNodeMobility =
411 CreateObject<ConstantPositionMobilityModel>();
412 endNodeMobility->SetPosition(Vector(100, 0, 0));
413 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
414
416 CreateObject<ConstantPositionMobilityModel>();
417 coord2Mobility->SetPosition(Vector(206, 0, 0));
418 coord2NetDevice->GetPhy()->SetMobility(coord2Mobility);
419
420 // MAC layer Callbacks hooks
423 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb0);
424
427 endNodeNetDevice->GetMac()->SetMlmeBeaconNotifyIndicationCallback(cb1);
428
430 // ACTIVE SCAN //
432
433 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode but answer to beacon
434 // requests.
436 params.m_panCoor = true;
437 params.m_PanId = 5;
438 params.m_bcnOrd = 15;
439 params.m_sfrmOrd = 15;
440 params.m_logCh = 12;
442 Seconds(2.0),
444 coord1NetDevice->GetMac(),
445 params);
446
447 // PAN coordinator N2 (PAN 7) is set to channel 14 in non-beacon mode but answer to beacon
448 // requests. The second coordinator includes a beacon payload of 25 bytes using the
449 // MLME-SET.request primitive.
450 Ptr<LrWpanMacPibAttributes> pibAttribute = Create<LrWpanMacPibAttributes>();
451 pibAttribute->macBeaconPayload = Create<Packet>(25);
452 coord2NetDevice->GetMac()->MlmeSetRequest(LrWpanMacPibAttributeIdentifier::macBeaconPayload,
453 pibAttribute);
454
456 params2.m_panCoor = true;
457 params2.m_PanId = 7;
458 params2.m_bcnOrd = 15;
459 params2.m_sfrmOrd = 15;
460 params2.m_logCh = 14;
462 Seconds(2.0),
464 coord2NetDevice->GetMac(),
465 params2);
466
467 // End device N1 broadcast a single BEACON REQUEST for each channel (11, 12, 13, and 14).
468 // If a coordinator is present and in range, it will respond with a beacon broadcast.
469 // Scan Channels are represented by bits 0-26 (27 LSB)
470 // ch 14 ch 11
471 // | |
472 // 0x7800 = 0000000000000000111100000000000
473 MlmeScanRequestParams scanParams;
474 scanParams.m_chPage = 0;
475 scanParams.m_scanChannels = 0x7800;
476 scanParams.m_scanDuration = 14;
477 scanParams.m_scanType = MLMESCAN_ACTIVE;
479 Seconds(3.0),
481 endNodeNetDevice->GetMac(),
482 scanParams);
483
485 NS_LOG_DEBUG("----------- Start of TestActiveScanPanDescriptors -------------------");
487
489 2,
490 "Error, Beacons not received or PAN descriptors not found");
491
492 if (m_panDescriptorList.size() == 2)
493 {
495 255,
496 "Error, Coordinator 1 (PAN 5) LQI value should be less than 255.");
498 255,
499 "Error, Coordinator 2 (PAN 7) LQI value should be less than 255.");
501 0,
502 "Error, Coordinator 1 (PAN 5) LQI value should be greater than 0.");
504 0,
505 "Error, Coordinator 2 (PAN 7) LQI value should be greater than 0.");
506
508 m_panDescriptorList[0].m_linkQuality,
509 "Error, Coordinator 2 (PAN 7) LQI value should"
510 " be less than Coordinator 1 (PAN 5).");
511
513 25,
514 "Error, Beacon Payload not received or incorrect size (25 bytes)");
515 }
516
518}
519
527{
528 public:
530 ~TestOrphanScan() override;
531
532 private:
539
547
548 void DoRun() override;
549
553};
554
556 : TestCase("Test an orphan scan and the reception of the commands involved")
557{
558 m_orphanScanSuccess = false;
559}
560
562{
563}
564
565void
567{
568 if (params.m_status == MLMESCAN_SUCCESS)
569 {
570 m_orphanScanSuccess = true;
571 }
572}
573
574void
576{
577 // The steps taken by the coordinator on the event of an orphan indication
578 // are meant to be implemented by the next higher layer and are out of the scope of the
579 // standard. In this test, we assume that coordinator 2 already has
580 // the endDevice [00:00:00:00:00:00:00:03] registered and therefore reply to this device
581 // a with a coordidinator realignment command.
582
583 if (params.m_orphanAddr == Mac64Address("00:00:00:00:00:00:00:02"))
584 {
585 MlmeOrphanResponseParams respParams;
586 respParams.m_assocMember = true;
587 respParams.m_orphanAddr = params.m_orphanAddr;
588 respParams.m_shortAddr = Mac16Address("00:02");
589
592 respParams);
593 }
594}
595
596void
598{
599 // Create 2 PAN coordinator nodes, and 1 end device
600 Ptr<Node> coord1 = CreateObject<Node>();
601 Ptr<Node> endNode = CreateObject<Node>();
602
603 coord1NetDevice = CreateObject<LrWpanNetDevice>();
604 endNodeNetDevice = CreateObject<LrWpanNetDevice>();
605
606 // PAN Coordinators configurations require to set both, the EUI-64 (extended address)
607 // and to assign their own short address.
608 coord1NetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01"));
609 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:01"));
610
611 // Other devices must have only its EUI-64 and later on, their short address is
612 // potentially assigned by the coordinator.
613 endNodeNetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02"));
614
615 // Configure Spectrum channel
616 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
618 CreateObject<LogDistancePropagationLossModel>();
620 CreateObject<ConstantSpeedPropagationDelayModel>();
621 channel->AddPropagationLossModel(propModel);
622 channel->SetPropagationDelayModel(delayModel);
623
624 coord1NetDevice->SetChannel(channel);
626
627 coord1->AddDevice(coord1NetDevice);
628 endNode->AddDevice(endNodeNetDevice);
629
630 // Mobility
632 CreateObject<ConstantPositionMobilityModel>();
633 coord1Mobility->SetPosition(Vector(0, 0, 0));
634 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
635
636 Ptr<ConstantPositionMobilityModel> endNodeMobility =
637 CreateObject<ConstantPositionMobilityModel>();
638 endNodeMobility->SetPosition(Vector(100, 0, 0));
639 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
640
641 // MAC layer Callbacks hooks
644 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb1);
645
648 coord1NetDevice->GetMac()->SetMlmeOrphanIndicationCallback(cb2);
650 // ORPHAN SCAN //
652
653 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode
654 // but answer to beacon request and orphan notification commands.
656 params.m_panCoor = true;
657 params.m_PanId = 5;
658 params.m_bcnOrd = 15;
659 params.m_sfrmOrd = 15;
660 params.m_logCh = 12;
662 Seconds(2.0),
665 params);
666
667 // End device N1 is set to scan 4 channels looking for the presence of a coordinator.
668 // On each channel, a single orphan notification command is sent and a response is
669 // waited for a maximum time of macResponseWaitTime. If a reply is received from a
670 // coordinator within this time (coordinator realignment command), the programmed scans on
671 // other channels is suspended.
672 // Scan Channels are represented by bits 0-26 (27 LSB)
673 // ch 14 ch 11
674 // | |
675 // 0x7800 = 0000000000000000111100000000000
676 MlmeScanRequestParams scanParams;
677 scanParams.m_chPage = 0;
678 scanParams.m_scanChannels = 0x7800;
679 scanParams.m_scanType = MLMESCAN_ORPHAN;
681 Seconds(3.0),
684 scanParams);
685
687 NS_LOG_DEBUG("----------- Start of TestOrphanScan -------------------");
689
691 true,
692 "Error, no coordinator realignment commands"
693 " received during orphan scan");
695 {
696 NS_TEST_EXPECT_MSG_EQ(endNodeNetDevice->GetMac()->GetShortAddress(),
697 Mac16Address("00:02"),
698 "Error, end device did not receive short address"
699 " during orphan scan");
700 }
701
703}
704
712{
713 public:
715};
716
718 : TestSuite("lr-wpan-mac-test", UNIT)
719{
723}
724
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)
LrWpanPhyEnumeration m_dev0State
Stores the PHY state of device 0 [00:01].
void StateChangeNotificationDev2(std::string context, Time now, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState)
Function called when a the PHY state changes in Dev2 [00:03].
void DoRun() override
Implementation to actually run this TestCase.
void StateChangeNotificationDev0(std::string context, Time now, LrWpanPhyEnumeration oldState, LrWpanPhyEnumeration newState)
Function called when a the PHY state changes in Dev0 [00:01].
void DataIndication(McpsDataIndicationParams params, Ptr< Packet > p)
Function called when a Data indication is invoked.
static std::string LrWpanPhyEnumerationPrinter(LrWpanPhyEnumeration e)
Transform the LrWpanPhyEnumeration enumeration into a printable string.
void MlmeStartRequest(MlmeStartRequestParams params)
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
Definition: lr-wpan-mac.cc:549
void MlmeScanRequest(MlmeScanRequestParams params)
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
Definition: lr-wpan-mac.cc:588
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p)
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
Definition: lr-wpan-mac.cc:349
void MlmeOrphanResponse(MlmeOrphanResponseParams params)
IEEE 802.15.4-2011, section 6.2.7.2 MLME-ORPHAN.response Primitive used to initiatte a response to an...
Definition: lr-wpan-mac.cc:785
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Ptr< LrWpanMac > GetMac() const
Get the MAC used by this NetDevice.
Ptr< LrWpanPhy > GetPhy() const
Get the PHY used by this NetDevice.
This class can contain 16 bit addresses.
Definition: mac16-address.h:44
an EUI-64 address
Definition: mac64-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:140
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:587
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static void Run()
Run the simulation.
Definition: simulator.cc:176
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:606
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:184
encapsulates test code
Definition: test.h:1060
@ QUICK
Fast test.
Definition: test.h:1065
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1256
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:417
@ S
second
Definition: nstime.h:116
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Definition: lr-wpan-phy.h:109
@ MLMESCAN_ORPHAN
Definition: lr-wpan-mac.h:184
@ MLMESCAN_ACTIVE
Definition: lr-wpan-mac.h:182
@ MLMESCAN_SUCCESS
Definition: lr-wpan-mac.h:234
@ SHORT_ADDR
Definition: lr-wpan-mac.h:156
#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:709
#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:251
#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:874
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
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:302
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:702
LogLevel
Logging severity classes and levels.
Definition: log.h:94
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition: log.h:118
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition: log.h:119
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition: log.h:113
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:320
MCPS-DATA.confirm params.
Definition: lr-wpan-mac.h:418
MCPS-DATA.indication params.
Definition: lr-wpan-mac.h:430
MCPS-DATA.request params.
Definition: lr-wpan-mac.h:402
MLME-BEACON-NOTIFY.indication params.
Definition: lr-wpan-mac.h:609
MLME-ORPHAN.indication params.
Definition: lr-wpan-mac.h:659
MLME-ORPHAN.response params.
Definition: lr-wpan-mac.h:669
Mac16Address m_shortAddr
The short address allocated.
Definition: lr-wpan-mac.h:671
Mac64Address m_orphanAddr
The address of the orphaned device.
Definition: lr-wpan-mac.h:670
bool m_assocMember
T = allocated with this coord | F = otherwise.
Definition: lr-wpan-mac.h:672
MLME-SCAN.confirm params.
Definition: lr-wpan-mac.h:544
MLME-SCAN.request params.
Definition: lr-wpan-mac.h:525
uint32_t m_scanChannels
The channel numbers to be scanned.
Definition: lr-wpan-mac.h:528
uint32_t m_chPage
The channel page on which to perform scan.
Definition: lr-wpan-mac.h:535
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
Definition: lr-wpan-mac.h:531
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
Definition: lr-wpan-mac.h:526
MLME-START.request params.
Definition: lr-wpan-mac.h:475
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
Definition: lr-wpan-mac.h:477
bool m_panCoor
On true this device will become coordinator.
Definition: lr-wpan-mac.h:486
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
Definition: lr-wpan-mac.h:483
uint16_t m_PanId
Pan Identifier used by the device.
Definition: lr-wpan-mac.h:476
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
Definition: lr-wpan-mac.h:485