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 == LrWpanMacStatus::SUCCESS)
107 {
108 NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Success");
109 }
110 else if (params.m_status == LrWpanMacStatus::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:
311
318
319 void DoRun() override;
320
321 std::vector<PanDescriptor> m_panDescriptorList;
325};
326
328 : TestCase("Test the reception of PAN descriptors while performing an active scan")
329{
330}
331
333{
334}
335
336void
338{
339 if (params.m_status == LrWpanMacStatus::SUCCESS)
340 {
341 m_panDescriptorList = params.m_panDescList;
342 }
343}
344
345void
347{
348 g_beaconPayloadSize = params.m_sdu->GetSize();
349}
350
351void
353{
354 /*
355 * [00:01] [00:02] [00:03]
356 * PAN Coordinator 1 (PAN: 5) End Device PAN Coordinator 2 (PAN: 7)
357 *
358 * |--------100 m----------------|----------106 m -----------------------|
359 * Channel 12 (Active Scan channels 11-14) Channel 14
360 *
361 * Test Setup:
362 *
363 * At the beginning of the simulation, PAN coordinators are set to
364 * non-beacon enabled mode and wait for any beacon requests.
365 *
366 * During the simulation, the end device do an Active scan (i.e. send beacon request commands to
367 * the scanned channels). On reception of such commands, coordinators reply with a single beacon
368 * which contains a PAN descriptor. The test makes sure that the PAN descriptors are received (2
369 * PAN descriptors) and because both PAN coordinators are set to a different distance from the
370 * end device, their LQI values should be below 255 but above 0. Likewise, Coordinator 2 LQI
371 * value should be less than Coordinator 1 LQI value. The exact expected value of LQI is not
372 * tested, this is dependable on the LQI implementation.
373 */
374
375 // Create 2 PAN coordinator nodes, and 1 end device
376 Ptr<Node> coord1 = CreateObject<Node>();
377 Ptr<Node> endNode = CreateObject<Node>();
378 Ptr<Node> coord2 = CreateObject<Node>();
379
380 Ptr<LrWpanNetDevice> coord1NetDevice = CreateObject<LrWpanNetDevice>();
381 Ptr<LrWpanNetDevice> endNodeNetDevice = CreateObject<LrWpanNetDevice>();
382 Ptr<LrWpanNetDevice> coord2NetDevice = CreateObject<LrWpanNetDevice>();
383
384 // PAN coordinators typically have a short address = 00:00 (e.g. Zigbee networks)
385 coord1NetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:CA:FE");
386 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:00"));
387
388 coord2NetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:BE:BE");
389 coord2NetDevice->GetMac()->SetShortAddress(Mac16Address("00:00"));
390
391 // An end device currently not associated (short address = ff:ff)
392 endNodeNetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:00:03");
393 endNodeNetDevice->GetMac()->SetShortAddress(Mac16Address("ff:ff"));
394
395 // Configure Spectrum channel
396 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
398 CreateObject<LogDistancePropagationLossModel>();
400 CreateObject<ConstantSpeedPropagationDelayModel>();
401 channel->AddPropagationLossModel(propModel);
402 channel->SetPropagationDelayModel(delayModel);
403
404 coord1NetDevice->SetChannel(channel);
405 endNodeNetDevice->SetChannel(channel);
406 coord2NetDevice->SetChannel(channel);
407
408 coord1->AddDevice(coord1NetDevice);
409 endNode->AddDevice(endNodeNetDevice);
410 coord2->AddDevice(coord2NetDevice);
411
412 // Mobility
414 CreateObject<ConstantPositionMobilityModel>();
415 coord1Mobility->SetPosition(Vector(0, 0, 0));
416 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
417
418 Ptr<ConstantPositionMobilityModel> endNodeMobility =
419 CreateObject<ConstantPositionMobilityModel>();
420 endNodeMobility->SetPosition(Vector(100, 0, 0));
421 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
422
424 CreateObject<ConstantPositionMobilityModel>();
425 coord2Mobility->SetPosition(Vector(206, 0, 0));
426 coord2NetDevice->GetPhy()->SetMobility(coord2Mobility);
427
428 // MAC layer Callbacks hooks
431 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb0);
432
435 endNodeNetDevice->GetMac()->SetMlmeBeaconNotifyIndicationCallback(cb1);
436
438 // ACTIVE SCAN //
440
441 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode but answer to beacon
442 // requests.
444 params.m_panCoor = true;
445 params.m_PanId = 5;
446 params.m_bcnOrd = 15;
447 params.m_sfrmOrd = 15;
448 params.m_logCh = 12;
450 Seconds(2.0),
452 coord1NetDevice->GetMac(),
453 params);
454
455 // PAN coordinator N2 (PAN 7) is set to channel 14 in non-beacon mode but answer to beacon
456 // requests. The second coordinator includes a beacon payload of 25 bytes using the
457 // MLME-SET.request primitive.
458 Ptr<LrWpanMacPibAttributes> pibAttribute = Create<LrWpanMacPibAttributes>();
459 pibAttribute->macBeaconPayload = Create<Packet>(25);
460 coord2NetDevice->GetMac()->MlmeSetRequest(LrWpanMacPibAttributeIdentifier::macBeaconPayload,
461 pibAttribute);
462
464 params2.m_panCoor = true;
465 params2.m_PanId = 7;
466 params2.m_bcnOrd = 15;
467 params2.m_sfrmOrd = 15;
468 params2.m_logCh = 14;
470 Seconds(2.0),
472 coord2NetDevice->GetMac(),
473 params2);
474
475 // End device N1 broadcast a single BEACON REQUEST for each channel (11, 12, 13, and 14).
476 // If a coordinator is present and in range, it will respond with a beacon broadcast.
477 // Scan Channels are represented by bits 0-26 (27 LSB)
478 // ch 14 ch 11
479 // | |
480 // 0x7800 = 0000000000000000111100000000000
481 MlmeScanRequestParams scanParams;
482 scanParams.m_chPage = 0;
483 scanParams.m_scanChannels = 0x7800;
484 scanParams.m_scanDuration = 14;
485 scanParams.m_scanType = MLMESCAN_ACTIVE;
487 Seconds(3.0),
489 endNodeNetDevice->GetMac(),
490 scanParams);
491
493 NS_LOG_DEBUG("----------- Start of TestActiveScanPanDescriptors -------------------");
495
497 2,
498 "Error, Beacons not received or PAN descriptors not found");
499
500 if (m_panDescriptorList.size() == 2)
501 {
503 255,
504 "Error, Coordinator 1 (PAN 5) LQI value should be less than 255.");
506 255,
507 "Error, Coordinator 2 (PAN 7) LQI value should be less than 255.");
509 0,
510 "Error, Coordinator 1 (PAN 5) LQI value should be greater than 0.");
512 0,
513 "Error, Coordinator 2 (PAN 7) LQI value should be greater than 0.");
514
516 m_panDescriptorList[0].m_linkQuality,
517 "Error, Coordinator 2 (PAN 7) LQI value should"
518 " be less than Coordinator 1 (PAN 5).");
519
521 25,
522 "Error, Beacon Payload not received or incorrect size (25 bytes)");
523 }
524
526}
527
535{
536 public:
538 ~TestOrphanScan() override;
539
540 private:
547
555
556 void DoRun() override;
557
561};
562
564 : TestCase("Test an orphan scan and the reception of the commands involved")
565{
566 m_orphanScanSuccess = false;
567}
568
570{
571}
572
573void
575{
576 if (params.m_status == LrWpanMacStatus::SUCCESS)
577 {
578 m_orphanScanSuccess = true;
579 }
580}
581
582void
584{
585 // The steps taken by the coordinator on the event of an orphan indication
586 // are meant to be implemented by the next higher layer and are out of the scope of the
587 // standard. In this test, we assume that coordinator 2 already has
588 // the endDevice [00:00:00:00:00:00:00:03] registered and therefore reply to this device
589 // a with a coordidinator realignment command.
590
591 if (params.m_orphanAddr == Mac64Address("00:00:00:00:00:00:00:02"))
592 {
593 MlmeOrphanResponseParams respParams;
594 respParams.m_assocMember = true;
595 respParams.m_orphanAddr = params.m_orphanAddr;
596 respParams.m_shortAddr = Mac16Address("00:02");
597
600 respParams);
601 }
602}
603
604void
606{
607 // Create 2 PAN coordinator nodes, and 1 end device
608 Ptr<Node> coord1 = CreateObject<Node>();
609 Ptr<Node> endNode = CreateObject<Node>();
610
611 coord1NetDevice = CreateObject<LrWpanNetDevice>();
612 endNodeNetDevice = CreateObject<LrWpanNetDevice>();
613
614 // PAN Coordinators configurations require to set both, the EUI-64 (extended address)
615 // and to assign their own short address.
616 coord1NetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01"));
617 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:01"));
618
619 // Other devices must have only its EUI-64 and later on, their short address is
620 // potentially assigned by the coordinator.
621 endNodeNetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02"));
622
623 // Configure Spectrum channel
624 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
626 CreateObject<LogDistancePropagationLossModel>();
628 CreateObject<ConstantSpeedPropagationDelayModel>();
629 channel->AddPropagationLossModel(propModel);
630 channel->SetPropagationDelayModel(delayModel);
631
632 coord1NetDevice->SetChannel(channel);
634
635 coord1->AddDevice(coord1NetDevice);
636 endNode->AddDevice(endNodeNetDevice);
637
638 // Mobility
640 CreateObject<ConstantPositionMobilityModel>();
641 coord1Mobility->SetPosition(Vector(0, 0, 0));
642 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
643
644 Ptr<ConstantPositionMobilityModel> endNodeMobility =
645 CreateObject<ConstantPositionMobilityModel>();
646 endNodeMobility->SetPosition(Vector(100, 0, 0));
647 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
648
649 // MAC layer Callbacks hooks
652 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb1);
653
656 coord1NetDevice->GetMac()->SetMlmeOrphanIndicationCallback(cb2);
658 // ORPHAN SCAN //
660
661 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode
662 // but answer to beacon request and orphan notification commands.
664 params.m_panCoor = true;
665 params.m_PanId = 5;
666 params.m_bcnOrd = 15;
667 params.m_sfrmOrd = 15;
668 params.m_logCh = 12;
670 Seconds(2.0),
673 params);
674
675 // End device N1 is set to scan 4 channels looking for the presence of a coordinator.
676 // On each channel, a single orphan notification command is sent and a response is
677 // waited for a maximum time of macResponseWaitTime. If a reply is received from a
678 // coordinator within this time (coordinator realignment command), the programmed scans on
679 // other channels is suspended.
680 // Scan Channels are represented by bits 0-26 (27 LSB)
681 // ch 14 ch 11
682 // | |
683 // 0x7800 = 0000000000000000111100000000000
684 MlmeScanRequestParams scanParams;
685 scanParams.m_chPage = 0;
686 scanParams.m_scanChannels = 0x7800;
687 scanParams.m_scanType = MLMESCAN_ORPHAN;
689 Seconds(3.0),
692 scanParams);
693
695 NS_LOG_DEBUG("----------- Start of TestOrphanScan -------------------");
697
699 true,
700 "Error, no coordinator realignment commands"
701 " received during orphan scan");
703 {
704 NS_TEST_EXPECT_MSG_EQ(endNodeNetDevice->GetMac()->GetShortAddress(),
705 Mac16Address("00:02"),
706 "Error, end device did not receive short address"
707 " during orphan scan");
708 }
709
711}
712
720{
721 public:
723};
724
726 : TestSuite("lr-wpan-mac-test", Type::UNIT)
727{
728 AddTestCase(new TestRxOffWhenIdleAfterCsmaFailure, TestCase::Duration::QUICK);
729 AddTestCase(new TestActiveScanPanDescriptors, TestCase::Duration::QUICK);
730 AddTestCase(new TestOrphanScan, TestCase::Duration::QUICK);
731}
732
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 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.
Definition: lr-wpan-mac.cc:384
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...
Definition: lr-wpan-mac.cc:623
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...
Definition: lr-wpan-mac.cc:584
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...
Definition: lr-wpan-mac.cc:803
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:77
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:588
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static void Run()
Run the simulation.
Definition: simulator.cc:178
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:605
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
encapsulates test code
Definition: test.h:1061
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:301
A suite of tests to run.
Definition: test.h:1268
Type
Type of test.
Definition: test.h:1275
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:415
@ 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:111
@ MLMESCAN_ORPHAN
@ MLMESCAN_ACTIVE
@ SHORT_ADDR
#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:710
#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:252
#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:875
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
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:704
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.
MCPS-DATA.indication params.
MCPS-DATA.request params.
MLME-BEACON-NOTIFY.indication params.
MLME-ORPHAN.indication params.
MLME-ORPHAN.response params.
Mac16Address m_shortAddr
The short address allocated.
Mac64Address m_orphanAddr
The address of the orphaned device.
bool m_assocMember
T = allocated with this coord | F = otherwise.
MLME-SCAN.confirm params.
MLME-SCAN.request params.
uint32_t m_scanChannels
The channel numbers to be scanned.
uint32_t m_chPage
The channel page on which to perform scan.
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
MLME-START.request params.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
bool m_panCoor
On true this device will become coordinator.
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
uint16_t m_PanId
Pan Identifier used by the device.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.