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
154 LogComponentEnable("LrWpanCsmaCa", LOG_LEVEL_DEBUG);
155 LogComponentEnable("lr-wpan-mac-test", LOG_LEVEL_DEBUG);
156
157 // Create 3 nodes, and a NetDevice for each one
160 Ptr<Node> interferenceNode = CreateObject<Node>();
161
165
166 dev0->SetAddress(Mac16Address("00:01"));
167 dev1->SetAddress(Mac16Address("00:02"));
168 dev2->SetAddress(Mac16Address("00:03"));
169
170 // Each device must be attached to the same channel
176 channel->AddPropagationLossModel(propModel);
177 channel->SetPropagationDelayModel(delayModel);
178
179 dev0->SetChannel(channel);
180 dev1->SetChannel(channel);
181 dev2->SetChannel(channel);
182
183 // To complete configuration, a LrWpanNetDevice must be added to a node
184 n0->AddDevice(dev0);
185 n1->AddDevice(dev1);
186 interferenceNode->AddDevice(dev2);
187
188 // Trace state changes in the phy
189 dev0->GetPhy()->TraceConnect(
190 "TrxState",
191 std::string("[address 00:01]"),
193 dev2->GetPhy()->TraceConnect(
194 "TrxState",
195 std::string("[address 00:03]"),
197
198 Ptr<ConstantPositionMobilityModel> sender0Mobility =
200 sender0Mobility->SetPosition(Vector(0, 0, 0));
201 dev0->GetPhy()->SetMobility(sender0Mobility);
202 Ptr<ConstantPositionMobilityModel> sender1Mobility =
204
205 sender1Mobility->SetPosition(Vector(0, 1, 0));
206 dev1->GetPhy()->SetMobility(sender1Mobility);
207
208 Ptr<ConstantPositionMobilityModel> sender3Mobility =
210
211 sender3Mobility->SetPosition(Vector(0, 2, 0));
212 dev2->GetPhy()->SetMobility(sender3Mobility);
213
216 dev0->GetMac()->SetMcpsDataConfirmCallback(cb0);
217
220 dev0->GetMac()->SetMcpsDataIndicationCallback(cb1);
221
224 dev1->GetMac()->SetMcpsDataConfirmCallback(cb2);
225
228 dev1->GetMac()->SetMcpsDataIndicationCallback(cb3);
229
230 dev0->GetMac()->SetRxOnWhenIdle(false);
231 dev1->GetMac()->SetRxOnWhenIdle(false);
232
233 // set CSMA min beacon exponent (BE) to 0 to make all backoff delays == to 0 secs.
234 dev0->GetCsmaCa()->SetMacMinBE(0);
235 dev2->GetCsmaCa()->SetMacMinBE(0);
236
237 // Only try once to do a backoff period before giving up.
238 dev0->GetCsmaCa()->SetMacMaxCSMABackoffs(0);
239 dev2->GetCsmaCa()->SetMacMaxCSMABackoffs(0);
240
241 // The below should trigger two callbacks when end-to-end data is working
242 // 1) DataConfirm callback is called
243 // 2) DataIndication callback is called with value of 50
244 Ptr<Packet> p0 = Create<Packet>(50); // 50 bytes of dummy data
246 params.m_dstPanId = 0;
247
248 params.m_srcAddrMode = SHORT_ADDR;
249 params.m_dstAddrMode = SHORT_ADDR;
250 params.m_dstAddr = Mac16Address("00:02");
251
252 params.m_msduHandle = 0;
253
254 // Send the packet that will be rejected due to channel access failure
255 Simulator::ScheduleWithContext(dev0->GetNode()->GetId(),
256 Seconds(0.00033),
258 dev0->GetMac(),
259 params,
260 p0);
261
262 // Send interference packet
263 Ptr<Packet> p2 = Create<Packet>(60); // 60 bytes of dummy data
264 params.m_dstAddr = Mac16Address("00:02");
265
266 Simulator::ScheduleWithContext(dev2->GetNode()->GetId(),
267 Seconds(0),
269 dev2->GetMac(),
270 params,
271 p2);
272
273 NS_LOG_DEBUG("----------- Start of TestRxOffWhenIdleAfterCsmaFailure -------------------");
275
278 "Error, dev0 [00:01] PHY should be in TRX_OFF after CSMA failure");
279
281}
282
283/**
284 * @ingroup lr-wpan-test
285 * @ingroup tests
286 *
287 * @brief Test MAC Active Scan PAN descriptor reception and check some of its values.
288 */
290{
291 public:
294
295 private:
296 /**
297 * Function called in response to a MAC scan request.
298 *
299 * @param params MLME scan confirm parameters
300 */
302
303 /**
304 * Function used to notify the reception of a beacon with payload.
305 *
306 * @param params The MLME-BEACON-NOTIFY.indication parameters
307 */
309
310 void DoRun() override;
311
312 std::vector<PanDescriptor> m_panDescriptorList; //!< The list of PAN descriptors
313 //!< accumulated during the scan.
314 uint32_t g_beaconPayloadSize; //!< The size of the beacon payload received
315 //!< from a coordinator.
316};
317
319 : TestCase("Test the reception of PAN descriptors while performing an active scan")
320{
321}
322
326
327void
329{
330 if (params.m_status == MacStatus::SUCCESS)
331 {
332 m_panDescriptorList = params.m_panDescList;
333 }
334}
335
336void
341
342void
344{
345 /*
346 * [00:01] [00:02] [00:03]
347 * PAN Coordinator 1 (PAN: 5) End Device PAN Coordinator 2 (PAN: 7)
348 *
349 * |--------90 m----------------|----------188 m -----------------------|
350 * Channel 12 (Active Scan channels 11-14) Channel 14
351 *
352 * Test Setup:
353 *
354 * At the beginning of the simulation, PAN coordinators are set to
355 * non-beacon enabled mode and wait for any beacon requests.
356 *
357 * During the simulation, the end device do an Active scan (i.e. send beacon request commands to
358 * the scanned channels). On reception of such commands, coordinators reply with a single beacon
359 * which contains a PAN descriptor. The test makes sure that the PAN descriptors are received (2
360 * PAN descriptors) and because both PAN coordinators are set to a different distance from the
361 * end device, their LQI values should be below 255 but above 0. Likewise, Coordinator 2 LQI
362 * value should be less than Coordinator 1 LQI value. The exact expected value of LQI is not
363 * tested, this is dependable on the LQI implementation.
364 */
365
366 // Create 2 PAN coordinator nodes, and 1 end device
367 Ptr<Node> coord1 = CreateObject<Node>();
368 Ptr<Node> endNode = CreateObject<Node>();
369 Ptr<Node> coord2 = CreateObject<Node>();
370
374
375 // PAN coordinators typically have a short address = 00:00 (e.g. Zigbee networks)
376 coord1NetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:CA:FE");
377 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:00"));
378
379 coord2NetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:BE:BE");
380 coord2NetDevice->GetMac()->SetShortAddress(Mac16Address("00:00"));
381
382 // An end device currently not associated (short address = ff:ff)
383 endNodeNetDevice->GetMac()->SetExtendedAddress("00:00:00:00:00:00:00:03");
384 endNodeNetDevice->GetMac()->SetShortAddress(Mac16Address("ff:ff"));
385
386 // Configure Spectrum channel
392 channel->AddPropagationLossModel(propModel);
393 channel->SetPropagationDelayModel(delayModel);
394
395 coord1NetDevice->SetChannel(channel);
396 endNodeNetDevice->SetChannel(channel);
397 coord2NetDevice->SetChannel(channel);
398
399 coord1->AddDevice(coord1NetDevice);
400 endNode->AddDevice(endNodeNetDevice);
401 coord2->AddDevice(coord2NetDevice);
402
403 // Mobility
406 coord1Mobility->SetPosition(Vector(0, 0, 0));
407 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
408
409 Ptr<ConstantPositionMobilityModel> endNodeMobility =
411 endNodeMobility->SetPosition(Vector(90, 0, 0));
412 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
413
416 coord2Mobility->SetPosition(Vector(188, 0, 0));
417 coord2NetDevice->GetPhy()->SetMobility(coord2Mobility);
418
419 // MAC layer Callbacks hooks
422 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb0);
423
426 endNodeNetDevice->GetMac()->SetMlmeBeaconNotifyIndicationCallback(cb1);
427
428 /////////////////
429 // ACTIVE SCAN //
430 /////////////////
431
432 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode but answer to beacon
433 // requests.
435 params.m_panCoor = true;
436 params.m_PanId = 5;
437 params.m_bcnOrd = 15;
438 params.m_sfrmOrd = 15;
439 params.m_logCh = 12;
440 Simulator::ScheduleWithContext(coord1NetDevice->GetNode()->GetId(),
441 Seconds(2),
443 coord1NetDevice->GetMac(),
444 params);
445
446 // PAN coordinator N2 (PAN 7) is set to channel 14 in non-beacon mode but answer to beacon
447 // requests. The second coordinator includes a beacon payload of 2 bytes using the
448 // MLME-SET.request primitive.
450 std::vector<uint8_t> payload;
451 payload.emplace_back(1);
452 payload.emplace_back(2);
453 pibAttribute->macBeaconPayload = payload;
454 coord2NetDevice->GetMac()->MlmeSetRequest(MacPibAttributeIdentifier::macBeaconPayload,
455 pibAttribute);
456
458 params2.m_panCoor = true;
459 params2.m_PanId = 7;
460 params2.m_bcnOrd = 15;
461 params2.m_sfrmOrd = 15;
462 params2.m_logCh = 14;
463 Simulator::ScheduleWithContext(coord2NetDevice->GetNode()->GetId(),
464 Seconds(2),
466 coord2NetDevice->GetMac(),
467 params2);
468
469 // End device N1 broadcast a single BEACON REQUEST for each channel (11, 12, 13, and 14).
470 // If a coordinator is present and in range, it will respond with a beacon broadcast.
471 // Scan Channels are represented by bits 0-26 (27 LSB)
472 // ch 14 ch 11
473 // | |
474 // 0x7800 = 0000000000000000111100000000000
475 MlmeScanRequestParams scanParams;
476 scanParams.m_chPage = 0;
477 scanParams.m_scanChannels = 0x7800;
478 scanParams.m_scanDuration = 14;
479 scanParams.m_scanType = MLMESCAN_ACTIVE;
480 Simulator::ScheduleWithContext(endNodeNetDevice->GetNode()->GetId(),
481 Seconds(3),
483 endNodeNetDevice->GetMac(),
484 scanParams);
485
487 NS_LOG_DEBUG("----------- Start of TestActiveScanPanDescriptors -------------------");
489
491 2,
492 "Error, Beacons not received or PAN descriptors not found");
493
494 if (m_panDescriptorList.size() == 2)
495 {
497 255,
498 "Error, Coordinator 1 (PAN 5) LQI value should be less than 255.");
500 255,
501 "Error, Coordinator 2 (PAN 7) LQI value should be less than 255.");
503 0,
504 "Error, Coordinator 1 (PAN 5) LQI value should be greater than 0.");
506 0,
507 "Error, Coordinator 2 (PAN 7) LQI value should be greater than 0.");
508
510 m_panDescriptorList[0].m_linkQuality,
511 "Error, Coordinator 2 (PAN 7) LQI value should"
512 " be less than Coordinator 1 (PAN 5).");
513
515 2,
516 "Error, Beacon Payload not received or incorrect size (2 bytes)");
517 }
518
520}
521
522/**
523 * @ingroup lr-wpan-test
524 * @ingroup tests
525 *
526 * @brief Test MAC Orphan Scan Coordinator Realignment command reception and its values.
527 */
529{
530 public:
532 ~TestOrphanScan() override;
533
534 private:
535 /**
536 * Function called in response to a MAC scan request.
537 *
538 * @param params MLME scan confirm parameters
539 */
541
542 /**
543 * Function called as a result of receiving an orphan notification command
544 * on the coordinator
545 *
546 * @param params MLME orphan indication parameters
547 */
549
550 void DoRun() override;
551
552 Ptr<LrWpanNetDevice> coord1NetDevice; //!< The LrWpanNetDevice of coordinator 1
553 Ptr<LrWpanNetDevice> endNodeNetDevice; //!< The LrWpanNetDevice of the end device
554 bool m_orphanScanSuccess; //!< Indicates a successful orphan scan
555};
556
558 : TestCase("Test an orphan scan and the reception of the commands involved")
559{
560 m_orphanScanSuccess = false;
561}
562
566
567void
569{
570 if (params.m_status == MacStatus::SUCCESS)
571 {
572 m_orphanScanSuccess = true;
573 }
574}
575
576void
578{
579 // The steps taken by the coordinator on the event of an orphan indication
580 // are meant to be implemented by the next higher layer and are out of the scope of the
581 // standard. In this test, we assume that coordinator 2 already has
582 // the endDevice [00:00:00:00:00:00:00:03] registered and therefore reply to this device
583 // a with a coordidinator realignment command.
584
585 if (params.m_orphanAddr == Mac64Address("00:00:00:00:00:00:00:02"))
586 {
587 MlmeOrphanResponseParams respParams;
588 respParams.m_assocMember = true;
589 respParams.m_orphanAddr = params.m_orphanAddr;
590 respParams.m_shortAddr = Mac16Address("00:02");
591
593 coord1NetDevice->GetMac(),
594 respParams);
595 }
596}
597
598void
600{
601 // Create 2 PAN coordinator nodes, and 1 end device
602 Ptr<Node> coord1 = CreateObject<Node>();
603 Ptr<Node> endNode = CreateObject<Node>();
604
607
608 // PAN Coordinators configurations require to set both, the EUI-64 (extended address)
609 // and to assign their own short address.
610 coord1NetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:01"));
611 coord1NetDevice->GetMac()->SetShortAddress(Mac16Address("00:01"));
612
613 // Other devices must have only its EUI-64 and later on, their short address is
614 // potentially assigned by the coordinator.
615 endNodeNetDevice->GetMac()->SetExtendedAddress(Mac64Address("00:00:00:00:00:00:00:02"));
616
617 // Configure Spectrum channel
623 channel->AddPropagationLossModel(propModel);
624 channel->SetPropagationDelayModel(delayModel);
625
626 coord1NetDevice->SetChannel(channel);
627 endNodeNetDevice->SetChannel(channel);
628
629 coord1->AddDevice(coord1NetDevice);
630 endNode->AddDevice(endNodeNetDevice);
631
632 // Mobility
635 coord1Mobility->SetPosition(Vector(0, 0, 0));
636 coord1NetDevice->GetPhy()->SetMobility(coord1Mobility);
637
638 Ptr<ConstantPositionMobilityModel> endNodeMobility =
640 endNodeMobility->SetPosition(Vector(95, 0, 0));
641 endNodeNetDevice->GetPhy()->SetMobility(endNodeMobility);
642
643 // MAC layer Callbacks hooks
646 endNodeNetDevice->GetMac()->SetMlmeScanConfirmCallback(cb1);
647
650 coord1NetDevice->GetMac()->SetMlmeOrphanIndicationCallback(cb2);
651 /////////////////
652 // ORPHAN SCAN //
653 /////////////////
654
655 // PAN coordinator N0 (PAN 5) is set to channel 12 in non-beacon mode
656 // but answer to beacon request and orphan notification commands.
658 params.m_panCoor = true;
659 params.m_PanId = 5;
660 params.m_bcnOrd = 15;
661 params.m_sfrmOrd = 15;
662 params.m_logCh = 12;
664 Seconds(2),
666 coord1NetDevice->GetMac(),
667 params);
668
669 // End device N1 is set to scan 4 channels looking for the presence of a coordinator.
670 // On each channel, a single orphan notification command is sent and a response is
671 // waited for a maximum time of macResponseWaitTime. If a reply is received from a
672 // coordinator within this time (coordinator realignment command), the programmed scans on
673 // other channels is suspended.
674 // Scan Channels are represented by bits 0-26 (27 LSB)
675 // ch 14 ch 11
676 // | |
677 // 0x7800 = 0000000000000000111100000000000
678 MlmeScanRequestParams scanParams;
679 scanParams.m_chPage = 0;
680 scanParams.m_scanChannels = 0x7800;
681 scanParams.m_scanType = MLMESCAN_ORPHAN;
683 Seconds(3),
685 endNodeNetDevice->GetMac(),
686 scanParams);
687
689 NS_LOG_DEBUG("----------- Start of TestOrphanScan -------------------");
691
693 true,
694 "Error, no coordinator realignment commands"
695 " received during orphan scan");
697 {
698 NS_TEST_EXPECT_MSG_EQ(endNodeNetDevice->GetMac()->GetShortAddress(),
699 Mac16Address("00:02"),
700 "Error, end device did not receive short address"
701 " during orphan scan");
702 }
703
705}
706
707/**
708 * @ingroup lr-wpan-test
709 * @ingroup tests
710 *
711 * @brief LrWpan MAC TestSuite
712 */
714{
715 public:
717};
718
726
727static 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.
Definition ptr.h:70
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:597
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition simulator.h:614
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
@ QUICK
Fast test.
Definition test.h:1057
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
Type
Type of test.
Definition test.h:1271
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Definition test.cc:494
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition time.cc:408
@ S
second
Definition nstime.h:106
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.
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:690
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:194
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:260
Callback< void, McpsDataIndicationParams, Ptr< Packet > > McpsDataIndicationCallback
This callback is called after a Mcps has successfully received a frame and wants to deliver it to the...
Callback< void, MlmeScanConfirmParams > MlmeScanConfirmCallback
This callback is called after a MlmeScanRequest has been called from the higher layer.
Callback< void, MlmeOrphanIndicationParams > MlmeOrphanIndicationCallback
This callback is called by the MLME and issued to its next higher layer following the reception of a ...
PhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Callback< void, MlmeBeaconNotifyIndicationParams > MlmeBeaconNotifyIndicationCallback
This callback is called after a Mlme has successfully received a beacon frame and wants to deliver it...
Callback< void, McpsDataConfirmParams > McpsDataConfirmCallback
This callback is called after a McpsDataRequest has been called from the higher layer.
@ macBeaconPayload
The contents of the beacon payload.
@ IEEE_802_15_4_PHY_TRX_OFF
@ CHANNEL_ACCESS_FAILURE
A Tx could not take place due to activity in the CH.
@ SUCCESS
The operation was completed successfully.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:454
#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:698
#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:240
#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:863
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1273
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:279
LogLevel
Logging severity classes and levels.
Definition log.h:86
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition log.h:110
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition log.h:111
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
Definition log.h:105
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
Definition log.h:112
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition log.cc:297
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.