A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ping-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Chandrakant Jena
3 * Copyright (c) 2022 Universita' di Firenze, Italy
4 * Copyright (c) 2022 Tom Henderson
5 *
6 * SPDX-License-Identifier: GPL-2.0-only
7 *
8 * Authors: Chandrakant Jena <chandrakant.barcelona@gmail.com>
9 * Tommaso Pecorella <tommaso.pecorella@unifi.it>
10 * Tom Henderson <tomh@tomh.org>
11 */
12
13// This test suite performs regression tests on the ns-3 Ping application.
14//
15// A simple topology is used:
16//
17// Node 0 Node 1
18// +----SimpleChannel---+
19//
20// - the SimpleChannel implements a one-way delay of 10 ms
21// - each node has a SimpleNetDevice with a DataRate of 1 Gb/s
22// - a ReceiveErrorModel can be configured to force packet drops
23//
24// The following are described in more detail below, inline with the test cases.
25// Most tests listed below will test both IPv4 and IPv6 operation.
26//
27// 1. Unlimited pings, no losses, StopApplication () with no packets in flight
28// 2. Unlimited pings, no losses, StopApplication () with 1 packet in flight
29// 3. Test for operation of count attribute and exit time after all pings were received
30// 4. Test the operation of the interval attribute
31// 5. Test for behavior of pinging an unreachable host when the
32// network does not send an ICMP unreachable message.
33// 6. Test pinging to IPv4 broadcast address and IPv6 all nodes multicast address
34// 7. Test behavior of first reply lost in a count-limited configuration
35// 8. Test behavior of second reply lost in a count-limited configuration
36// 9. Test behavior of last reply lost in a count-limited configuration.
37
38#include "ns3/boolean.h"
39#include "ns3/data-rate.h"
40#include "ns3/error-model.h"
41#include "ns3/internet-stack-helper.h"
42#include "ns3/ipv4-address-helper.h"
43#include "ns3/ipv4-interface-container.h"
44#include "ns3/ipv6-address-helper.h"
45#include "ns3/ipv6-interface-container.h"
46#include "ns3/log.h"
47#include "ns3/neighbor-cache-helper.h"
48#include "ns3/node-container.h"
49#include "ns3/nstime.h"
50#include "ns3/ping.h"
51#include "ns3/simple-net-device-helper.h"
52#include "ns3/simple-net-device.h"
53#include "ns3/simulator.h"
54#include "ns3/test.h"
55#include "ns3/uinteger.h"
56
57#include <list>
58
59using namespace ns3;
60
61NS_LOG_COMPONENT_DEFINE("PingTestSuite");
62
63constexpr bool USEIPV6_FALSE = false;
64constexpr bool USEIPV6_TRUE = true;
65
66/**
67 * @ingroup ping
68 * @defgroup ping-test ping tests
69 */
70
71/**
72 * @ingroup ping-test
73 * @ingroup tests
74 *
75 * @brief ping basic tests
76 */
77class PingTestCase : public TestCase
78{
79 public:
80 /**
81 * Constructor.
82 * @param name TestCase name.
83 * @param useIpv6 Use IPv6.
84 */
85 PingTestCase(std::string name, bool useIpv6);
86
87 /**
88 * Set the Simulation stop time.
89 * @param stopTime The simulation stop time.
90 */
92
93 /**
94 * Set the destination address (either IPv4 or IPv6).
95 * @param address The destination address.
96 */
97 void SetDestinationAddress(Address address);
98
99 /**
100 * Set the PING start time.
101 * @param startTime Ping start time.
102 */
103 void SetStartTime(Time startTime)
104 {
105 m_startTime = startTime;
106 }
107
108 /**
109 * Set the PING stop time.
110 * @param stopTime Ping stop time.
111 */
113 {
115 }
116
117 /**
118 * Set the number of pings to send.
119 * @param count Number of pings to send.
120 */
121 void SetCount(uint32_t count)
122 {
123 m_countAttribute = count;
124 }
125
126 /**
127 * Set the size of pings.
128 * @param size Size of pings.
129 */
130 void SetSize(uint32_t size)
131 {
132 m_sizeAttribute = size;
133 }
134
135 /**
136 * Set the interval of pings.
137 * @param interval Interval of pings.
138 */
139 void SetInterval(Time interval)
140 {
141 m_interpacketInterval = interval;
142 }
143
144 /**
145 * Set the packet drop list on the Ping node's interface
146 * @param dropList packet drop list
147 */
148 void SetDropList(const std::list<uint32_t>& dropList)
149 {
150 m_dropList = dropList;
151 }
152
153 /**
154 * Enable the check on Tx pings counted in Tx trace source.
155 * @param expectedTx Expected Tx.
156 */
157 void CheckTraceTx(uint32_t expectedTx);
158
159 /**
160 * Enable the check on Rtt event count in Rtt trace source.
161 * @param expectedRtt Expected Rtt.
162 */
163 void CheckTraceRtt(uint32_t expectedRtt);
164
165 /**
166 * Enable the check on Tx pings.
167 * @param expectedReportTx Expected Tx.
168 */
169 void CheckReportTransmitted(uint32_t expectedReportTx);
170
171 /**
172 * Enable the check on Rx pings.
173 * @param expectedReportRx Expected Rx.
174 */
175 void CheckReportReceived(uint32_t expectedReportRx);
176
177 /**
178 * Enable the check on Lost pings.
179 * @param expectedReportLoss Expected Lost.
180 */
181 void CheckReportLoss(uint16_t expectedReportLoss);
182
183 /**
184 * Enable the check on average RTT.
185 * @param expectedTime Expected RTT.
186 */
187 void CheckReportTime(Time expectedTime);
188
189 private:
190 void DoSetup() override;
191 void DoTeardown() override;
192 void DoRun() override;
193
194 /**
195 * Trace TX events.
196 * @param seq Sequence number.
197 * @param p Tx packet.
198 */
199 void TxTraceSink(uint16_t seq, Ptr<Packet> p);
200
201 /**
202 * Trace RTT events.
203 * @param seq Sequence number.
204 * @param rttSample RTT sample.
205 */
206 void RttTraceSink(uint16_t seq, Time rttSample);
207
208 /**
209 * Trace Drop events.
210 * @param seq Sequence number.
211 * @param reason Drop reason.
212 */
213 void DropTraceSink(uint16_t seq, Ping::DropReason reason);
214
215 /**
216 * Trace Report generation events.
217 * @param report The report sample.
218 */
219 void ReportTraceSink(const Ping::PingReport& report);
220
221 Address m_destination{Ipv4Address("10.0.0.2")}; //!< Destination address
222 uint32_t m_mtu{1500}; //!< Link MTU
223 uint32_t m_countAttribute{0}; //!< Number of pings to send
224 uint32_t m_sizeAttribute{56}; //!< Size of pings
225 // The following are for setting expected counts for traced events
226 uint32_t m_expectedTraceTx{0}; //!< Expected Tx trace sink calls
227 uint32_t m_expectedTraceRtt{0}; //!< Expected Rtt trace sink calls
228 // The following are counters for traced events
229 uint32_t m_countTraceTx{0}; //!< Tx trace counter
230 uint32_t m_countTraceRtt{0}; //!< Rtt trace counter
231 // The following indicate whether trace counters should be checked
232 bool m_checkTraceTx{false}; //!< Set to true to check the Tx number
233 bool m_checkTraceRtt{false}; //!< Set to true to check the Rtt number
234 // The following are for reported values in the final report
235 uint32_t m_expectedReportTx{0}; //!< Expected reported Tx
236 uint32_t m_expectedReportRx{0}; //!< Expected reported Rx
237 uint16_t m_expectedReportLoss{0}; //!< Expected reported Loss
238 Time m_expectedReportTime; //!< Expected reported time
239 // The following indicate whether report quantities should be checked
240 bool m_checkReportTransmitted{false}; //!< Set to true to check the Tx number
241 bool m_checkReportReceived{false}; //!< Set to true to check the Rx number
242 bool m_checkReportLoss{false}; //!< Set to true to check the Loss number
243 bool m_checkReportTime{false}; //!< Set to true to check the Time
244
245 Time m_startTime{Seconds(1)}; //!< Start time
246 Time m_stopTime{Seconds(5)}; //!< Stop time
247 Time m_simulatorStopTime{Seconds(6)}; //!< Simulator stop time
248 bool m_useIpv6{false}; //!< Use IPv6 (true) or IPv4 (false)
249 Time m_interpacketInterval{Seconds(1)}; //!< Time between pings
250 Time m_lastTx; //!< Last ping Tx time
251 std::list<uint32_t> m_dropList; //!< Drop first reply (true)
252
253 NodeContainer m_nodes; //!< The simulation nodes
254 Ipv4InterfaceContainer m_ipv4Interfaces; //!< The IPv4 interfaces
255 Ipv6InterfaceContainer m_ipv6Interfaces; //!< The IPv6 interfaces
256 NetDeviceContainer m_devices; //!< The NetDevices
257};
258
259PingTestCase::PingTestCase(std::string name, bool useIpv6)
260 : TestCase(name),
261 m_useIpv6(useIpv6)
262{
263}
264
265void
267{
268 NS_LOG_FUNCTION(this);
269 m_nodes.Create(2);
270 SimpleNetDeviceHelper deviceHelper;
271 deviceHelper.SetChannel("ns3::SimpleChannel", "Delay", TimeValue(MilliSeconds(10)));
272 deviceHelper.SetDeviceAttribute("DataRate", DataRateValue(DataRate("1Gbps")));
273 deviceHelper.SetNetDevicePointToPointMode(true);
274 m_devices = deviceHelper.Install(m_nodes);
275 // MTU is not an attribute, so set it directly
277 device0->SetMtu(m_mtu);
279 device1->SetMtu(m_mtu);
280
281 InternetStackHelper internetHelper;
282 if (!m_useIpv6)
283 {
284 internetHelper.SetIpv6StackInstall(false);
285 }
286 else
287 {
288 internetHelper.SetIpv4StackInstall(false);
289 }
290 internetHelper.Install(m_nodes);
291
292 if (!m_useIpv6)
293 {
294 Ipv4AddressHelper ipv4AddrHelper;
295 ipv4AddrHelper.SetBase("10.0.0.0", "255.255.255.0");
296 m_ipv4Interfaces = ipv4AddrHelper.Assign(m_devices);
297 }
298 else
299 {
300 // This is to disable DAD, to simplify the drop testcase.
301 m_nodes.Get(0)->GetObject<Icmpv6L4Protocol>()->SetAttribute("DAD", BooleanValue(false));
302 m_nodes.Get(1)->GetObject<Icmpv6L4Protocol>()->SetAttribute("DAD", BooleanValue(false));
303
304 Ipv6AddressHelper ipv6AddrHelper;
305 ipv6AddrHelper.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
306 m_ipv6Interfaces = ipv6AddrHelper.Assign(m_devices);
307
308 // This is a dirty trick to disable RS/RA, to simplify the drop testcase.
309 // Forwarding interfaces do not send RS.
310 m_nodes.Get(0)->GetObject<Ipv6L3Protocol>()->SetForwarding(1, true);
311 m_nodes.Get(1)->GetObject<Ipv6L3Protocol>()->SetForwarding(1, true);
312 }
313}
314
315void
320
321void
323{
325 m_expectedReportTx = expectedReportTx;
326}
327
328void
330{
332 m_expectedReportRx = expectedReportRx;
333}
334
335void
336PingTestCase::CheckReportLoss(uint16_t expectedReportLoss)
337{
338 m_checkReportLoss = true;
339 m_expectedReportLoss = expectedReportLoss;
340}
341
342void
344{
345 m_checkReportTime = true;
346 m_expectedReportTime = expectedTime;
347}
348
349void
350PingTestCase::RttTraceSink(uint16_t seq, Time rttSample)
351{
352 NS_LOG_FUNCTION(this << seq << rttSample.As(Time::MS));
354 if (m_sizeAttribute == 56)
355 {
356 if (!m_useIpv6)
357 {
358 // Each ping should be received with RTT of 20.0013 ms in this configuration
359 // Check that each ping is within 20.0012 ms <= rttSample <= 20.0014 ms
361 rttSample.GetSeconds() * 1000,
362 20.0013,
363 0.0001,
364 "Rtt sample not within 0.0001 ms of expected value of 20.0013 ms");
365 }
366 else
367 {
368 // Each ping should be received with RTT of 20.0017 ms in this configuration
369 // Check that each ping is within 20.0016 ms <= rttSample <= 20.0018 ms
371 rttSample.GetSeconds() * 1000,
372 20.0017,
373 0.0001,
374 "Rtt sample not within 0.0001 ms of expected value of 20.0017 ms");
375 }
376 }
377}
378
379void
381{
382 NS_LOG_FUNCTION(this << seq << p);
384 if (m_lastTx.IsZero())
385 {
387 }
388 else
389 {
392 "configured interval didn't match the observed interval");
394 }
395}
396
397void
399{
400 NS_LOG_FUNCTION(this << static_cast<uint16_t>(reason));
401 if (reason == Ping::DropReason::DROP_TIMEOUT)
402 {
403 NS_LOG_DEBUG("Drop due to timeout " << seq);
404 }
405 else if (reason == Ping::DROP_HOST_UNREACHABLE)
406 {
407 NS_LOG_DEBUG("Destination host is unreachable " << seq);
408 }
409 else if (reason == Ping::DROP_NET_UNREACHABLE)
410 {
411 NS_LOG_DEBUG("Destination network not reachable " << seq);
412 }
413}
414
415void
417{
418 NS_LOG_FUNCTION(this << report.m_transmitted << report.m_received << report.m_loss
419 << report.m_rttMin << report.m_rttMax);
421 {
424 "Report transmit count does not equal expected");
425 }
427 {
430 "Report receive count does not equal expected");
431 }
433 {
436 "Report lost count does not equal expected");
437 }
439 {
440 NS_TEST_ASSERT_MSG_EQ_TOL(Simulator::Now().GetMicroSeconds(),
442 1, // tolerance of 1 us
443 "Report application not stopped at expected time");
444 }
445 NS_TEST_ASSERT_MSG_GT_OR_EQ(report.m_rttMin, 0, "minimum rtt should be greater than 0");
446 NS_TEST_ASSERT_MSG_GT_OR_EQ(report.m_rttMax, 0, "maximum rtt should be greater than 0");
447}
448
449void
451{
452 m_checkTraceTx = true;
453 m_expectedTraceTx = expectedTx;
454}
455
456void
458{
459 m_checkTraceRtt = true;
460 m_expectedTraceRtt = expectedRtt;
461}
462
463void
468
469void
474
475void
477{
478 NS_LOG_FUNCTION(this);
480
481 if (m_useIpv6)
482 {
484 if (dst.IsLinkLocal() || dst.IsLinkLocalMulticast())
485 {
486 NS_LOG_LOGIC("Setting local interface address to "
488 ping->SetAttribute("InterfaceAddress", AddressValue(m_ipv6Interfaces.GetAddress(0, 0)));
489 }
490 else
491 {
492 NS_LOG_LOGIC("Setting local interface address to "
494 ping->SetAttribute("InterfaceAddress", AddressValue(m_ipv6Interfaces.GetAddress(0, 1)));
495 }
496 NS_LOG_LOGIC("Setting destination address to " << Ipv6Address::ConvertFrom(m_destination));
497 ping->SetAttribute("Destination", AddressValue(m_destination));
498 }
499 else
500 {
501 NS_LOG_LOGIC("Setting destination address to " << Ipv4Address::ConvertFrom(m_destination));
502 ping->SetAttribute("InterfaceAddress", AddressValue(m_ipv4Interfaces.GetAddress(0)));
503 ping->SetAttribute("Destination", AddressValue(m_destination));
504 }
505
506 if (!m_dropList.empty())
507 {
508 NS_LOG_LOGIC("Setting drop list to list of size " << m_dropList.size());
511 netDev->SetReceiveErrorModel(errorModel);
512 errorModel->SetList(m_dropList);
513 }
514
515 ping->SetAttribute("Count", UintegerValue(m_countAttribute));
516 ping->SetAttribute("Size", UintegerValue(m_sizeAttribute));
517 ping->SetAttribute("Interval", TimeValue(m_interpacketInterval));
518 ping->SetStartTime(m_startTime);
519 ping->SetStopTime(m_stopTime);
520 m_nodes.Get(0)->AddApplication(ping);
521 ping->TraceConnectWithoutContext("Tx", MakeCallback(&PingTestCase::TxTraceSink, this));
522 ping->TraceConnectWithoutContext("Rtt", MakeCallback(&PingTestCase::RttTraceSink, this));
523 ping->TraceConnectWithoutContext("Drop", MakeCallback(&PingTestCase::DropTraceSink, this));
524 ping->TraceConnectWithoutContext("Report", MakeCallback(&PingTestCase::ReportTraceSink, this));
525
526 NeighborCacheHelper neighborCacheHelper;
527 neighborCacheHelper.PopulateNeighborCache();
528
531
532 if (m_checkTraceTx)
533 {
536 "Traced Tx events do not equal expected");
537 }
538 if (m_checkTraceRtt)
539 {
542 "Traced Rtt events do not equal expected");
543 }
544}
545
546/**
547 * @ingroup ping-test
548 * @ingroup tests
549 *
550 * @brief ping TestSuite
551 */
553{
554 public:
556};
557
559 : TestSuite("ping", Type::UNIT)
560{
561 // 1. Unlimited pings, no losses, StopApplication () with no packets in flight
562 // Configuration: Ping::Count = 0, Ping::Interval = 1s, Ping start
563 // time = 1s, Ping stop time = 5.5s
564 // Expected behavior: Pings are sent at times 1, 2, 3, 4, 5 sec. The
565 // number sent equals number received, which equals 5.
566 // How validated: PingReport trace is checked for number of packets
567 // transmitted and received (5), and number of drops (0).
568 auto testcase1v4 = new PingTestCase(
569 "1. Unlimited pings, no losses, StopApplication () with no packets in flight IPv4",
571 testcase1v4->SetStartTime(Seconds(1));
572 testcase1v4->SetStopTime(Seconds(5.5));
573 testcase1v4->SetCount(0);
574 testcase1v4->CheckReportTransmitted(5);
575 testcase1v4->CheckReportReceived(5);
576 testcase1v4->CheckTraceTx(5);
577 testcase1v4->SetDestinationAddress(Ipv4Address("10.0.0.2"));
578 AddTestCase(testcase1v4, TestCase::Duration::QUICK);
579
580 auto testcase1v6 = new PingTestCase(
581 "1. Unlimited pings, no losses, StopApplication () with no packets in flight IPv6",
583 testcase1v6->SetStartTime(Seconds(1));
584 testcase1v6->SetStopTime(Seconds(5.5));
585 testcase1v6->SetCount(0);
586 testcase1v6->CheckReportTransmitted(5);
587 testcase1v6->CheckReportReceived(5);
588 testcase1v6->CheckTraceTx(5);
589 testcase1v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
590 AddTestCase(testcase1v6, TestCase::Duration::QUICK);
591
592 // 2. Unlimited pings, no losses, StopApplication () with 1 packet in flight
593 // Configuration: Ping::Count = 0, Ping::Interval = 1s, Ping start time =
594 // 1s, Ping stop time = 1.0001s
595 // Expected behavior: The application is stopped immediately after the
596 // only ping is sent, and this ping will be reported
597 // to be lost
598 // How validated: PingReport trace is checked for number of packets
599 // transmitted (1) and received (0), and number of drops (0)
600 auto testcase2v4 = new PingTestCase(
601 "2. Unlimited pings, no losses, StopApplication () with 1 packet in flight IPv4",
603 testcase2v4->SetStartTime(Seconds(1));
604 testcase2v4->SetStopTime(Seconds(1.0001));
605 testcase2v4->SetSimulatorStopTime(Seconds(5));
606 testcase2v4->CheckReportTransmitted(1);
607 testcase2v4->CheckReportReceived(0);
608 testcase1v4->SetDestinationAddress(Ipv4Address("10.0.0.2"));
609 AddTestCase(testcase2v4, TestCase::Duration::QUICK);
610
611 auto testcase2v6 = new PingTestCase(
612 "2. Unlimited pings, no losses, StopApplication () with 1 packet in flight IPv6",
614 testcase2v6->SetStartTime(Seconds(1));
615 testcase2v6->SetStopTime(Seconds(1.0001));
616 testcase2v6->SetSimulatorStopTime(Seconds(5));
617 testcase2v6->CheckReportTransmitted(1);
618 testcase2v6->CheckReportReceived(0);
619 testcase2v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
620 AddTestCase(testcase2v6, TestCase::Duration::QUICK);
621
622 // 3. Test for operation of count attribute and the resulting StopApplication time after all
623 // pings were received. Limited pings, no losses, StopApplication () with no packet in flight
624 // Configuration: Ping::Count = 2, Ping::Interval = 1s, Ping start time =
625 // 1s, Ping stop time = 5s
626 // Expected behavior: Pings are sent at 1 second intervals. The
627 // number sent (2) is equal to number received (2).
628 // After receiving all pings, despite configuring
629 // the StopApplication time to 5 seconds, the
630 // application will immediately stop and generate
631 // the report (at 2020001 us)
632 // How validated: PingReport trace is checked for number of packets
633 // transmitted (2) and received (2),number of drops (0),
634 // Report time will be MicroSeconds (2020001).
635 uint32_t count = 2;
636 uint32_t expectedTx = 2;
637 auto testcase3v4 = new PingTestCase("3. Test for operation of count attribute and exit "
638 "time after all pings were received, IPv4",
640 testcase3v4->SetStartTime(Seconds(1));
641 testcase3v4->SetStopTime(Seconds(5));
642 testcase3v4->SetCount(count);
643 testcase3v4->SetSimulatorStopTime(Seconds(6));
644 testcase3v4->CheckReportTransmitted(2);
645 testcase3v4->CheckReportReceived(2);
646 testcase3v4->CheckReportTime(MicroSeconds(2020001));
647 testcase3v4->CheckTraceTx(expectedTx);
648 testcase3v4->SetDestinationAddress(Ipv4Address("10.0.0.2"));
649 AddTestCase(testcase3v4, TestCase::Duration::QUICK);
650
651 auto testcase3v6 = new PingTestCase("3. Test for operation of count attribute and exit "
652 "time after all pings were received, IPv6",
654 testcase3v6->SetStartTime(Seconds(1));
655 testcase3v6->SetStopTime(Seconds(5));
656 testcase3v6->SetCount(count);
657 testcase3v6->SetSimulatorStopTime(Seconds(6));
658 testcase3v6->CheckReportTransmitted(2);
659 testcase3v6->CheckReportReceived(2);
660 testcase3v6->CheckReportTime(MicroSeconds(2020001));
661 testcase3v6->CheckTraceTx(expectedTx);
662 testcase3v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
663 AddTestCase(testcase3v6, TestCase::Duration::QUICK);
664
665 // 4. Test for the operation of interval attribute for IPv4
666 // Unlimited pings, no losses, StopApplication () with no packet in flight
667 // Configuration: Ping::Count = 0, Ping::Interval = 3s, Ping start
668 // time = 1s, Ping stop time = 6s
669 // Expected behavior: Pings are sent at the interval of 3 sec.
670 // 1st packet is sent at 1sec and 2nd packet at 4sec.
671 // The number sent (2) is equal to number received (2)
672 // How validated: PingReport trace is checked for number of packets
673 // transmitted (2) and received (2), and number of drops (0)
674 Time interval = Seconds(3);
675 auto testcase4v4 =
676 new PingTestCase("4. Test for the operation of interval attribute for IPv4", USEIPV6_FALSE);
677 testcase4v4->SetStartTime(Seconds(1));
678 testcase4v4->SetStopTime(Seconds(5));
679 testcase4v4->SetInterval(interval);
680 testcase4v4->SetSimulatorStopTime(Seconds(6));
681 testcase4v4->CheckReportTransmitted(2);
682 testcase4v4->CheckReportReceived(2);
683 testcase4v4->SetDestinationAddress(Ipv4Address("10.0.0.2"));
684 AddTestCase(testcase4v4, TestCase::Duration::QUICK);
685
686 auto testcase4v6 =
687 new PingTestCase("4. Test for the operation of interval attribute for IPv6", USEIPV6_TRUE);
688 testcase4v6->SetStartTime(Seconds(1));
689 testcase4v6->SetStopTime(Seconds(5));
690 testcase4v6->SetInterval(interval);
691 testcase4v6->SetSimulatorStopTime(Seconds(6));
692 testcase4v6->CheckReportTransmitted(2);
693 testcase4v6->CheckReportReceived(2);
694 testcase4v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
695 AddTestCase(testcase4v6, TestCase::Duration::QUICK);
696
697 // 5. Test for behavior of pinging an unreachable host when the
698 // network does not send an ICMP unreachable message.
699 // Unlimited pings, StopApplication () with no packet in flight
700 // Configuration: Ping::Count = 0, Ping start time = 1s
701 // Ping stop time = 5.5s. Ping to unknown destination.
702 // Expected behavior: By default, the timeout value is 1 second. Ping
703 // sends first packet at time 1 second, and does not
704 // receive a response. At the timeout (simulation time
705 // 2 seconds), ping should print out that there was
706 // a timeout, and the drop trace should be fired.
707 // At stop time, there should be three drops recorded
708 // of type DROP_TIMEOUT, and not four,
709 // because the packet sent at time 5 seconds has not
710 // had enough time elapsed to timeout.
711 // How validated: PingReport trace is checked for number of packets
712 // transmitted (5) and received (0).
713 // The packet loss rate should be checked to be 100 percent
714 auto testcase5v4 =
715 new PingTestCase("5. Test for behavior of ping to unreachable IPv4 address", USEIPV6_FALSE);
716 testcase5v4->SetStartTime(Seconds(1));
717 testcase5v4->SetStopTime(Seconds(5.5));
718 testcase5v4->SetDestinationAddress(Ipv4Address("1.2.3.4"));
719 testcase5v4->CheckReportTransmitted(5);
720 testcase5v4->CheckReportReceived(0);
721 testcase5v4->CheckReportLoss(100);
722 AddTestCase(testcase5v4, TestCase::Duration::QUICK);
723
724 auto testcase5v6 =
725 new PingTestCase("5. Test for behavior of ping to unreachable IPv6 address", USEIPV6_TRUE);
726 testcase5v6->SetStartTime(Seconds(1));
727 testcase5v6->SetStopTime(Seconds(5.5));
728 testcase5v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:3"));
729 testcase5v6->CheckReportTransmitted(5);
730 testcase5v6->CheckReportReceived(0);
731 testcase5v6->CheckReportLoss(100);
732 AddTestCase(testcase5v6, TestCase::Duration::QUICK);
733
734 // 6. Test for behavior of pinging an broadcast (or multicast) address.
735 // Limited pings, no losses, StopApplication () with no packet in flight
736 // Configuration: Ping::Count = 2, Ping::Interval = 1s, Ping start time =
737 // 1s, Ping stop time = 5s
738 // Expected behavior: Pings are sent at 1 second intervals. The
739 // number sent (2) is equal to number received (2).
740 // After receiving all pings, despite configuring
741 // the StopApplication time to 5 seconds, the
742 // application will immediately stop and generate
743 // the report (at 2020001 us)
744 // How validated: PingReport trace is checked for number of packets
745 // transmitted (2) and received (2),number of drops (0),
746 // Report time will be MicroSeconds (2020001).
747 auto testcase6v4 =
748 new PingTestCase("6. Test for behavior of ping to broadcast IPv4 address", USEIPV6_FALSE);
749 testcase6v4->SetStartTime(Seconds(1));
750 testcase6v4->SetStopTime(Seconds(5.5));
751 testcase6v4->SetDestinationAddress(Ipv4Address::GetBroadcast());
752 testcase6v4->CheckReportTransmitted(5);
753 testcase6v4->CheckReportReceived(5);
754 testcase6v4->CheckReportLoss(0);
755 AddTestCase(testcase6v4, TestCase::Duration::QUICK);
756
757 auto testcase6v6 =
758 new PingTestCase("6. Test for behavior of ping to all-nodes multicast IPv6 address",
760 testcase6v6->SetStartTime(Seconds(1));
761 testcase6v6->SetStopTime(Seconds(5.5));
762 testcase6v6->SetDestinationAddress(Ipv6Address::GetAllNodesMulticast());
763 testcase6v6->CheckReportTransmitted(5);
764 testcase6v6->CheckReportReceived(5);
765 testcase6v6->CheckReportLoss(0);
766 AddTestCase(testcase6v6, TestCase::Duration::QUICK);
767
768 // 7. Test behavior of first reply lost in a count-limited configuration.
769 // Limited pings, no losses, StopApplication () with no packet in flight
770 // Configuration: Ping::Count = 3, Ping::Interval = 1s, Ping start time =
771 // 1s, Ping stop time = 5s. Loss of first reply is forced.
772 // Expected behavior: Pings are sent at 1 second intervals at times
773 // 1s, 2s, 3s. The ping Tx trace will record 3 sends,
774 // but the RTT trace will record 2 receptions.
775 // The application will stop after the third send
776 // after waiting for 2*RttMax (40 ms).
777 // How validated: PingReport trace is checked for number of packets
778 // transmitted (3) and received (2), loss percentage (33).
779 // Ping Tx trace (3) and Rtt trace (2) are also checked.
780 // Report time will be MicroSeconds (3040000).
781 auto testcase7v4 = new PingTestCase(
782 "7. Test behavior of first reply lost in a count-limited configuration, IPv4",
784 std::list<uint32_t> dropList{0};
785 testcase7v4->SetDropList(dropList);
786 testcase7v4->SetStartTime(Seconds(1));
787 testcase7v4->SetCount(3);
788 testcase7v4->SetStopTime(Seconds(5));
789 testcase7v4->CheckTraceTx(3);
790 testcase7v4->CheckTraceRtt(2);
791 testcase7v4->CheckReportTransmitted(3);
792 testcase7v4->CheckReportReceived(2);
793 testcase7v4->CheckReportLoss(33); // 33%
794 testcase7v4->CheckReportTime(MicroSeconds(3040000));
795 AddTestCase(testcase7v4, TestCase::Duration::QUICK);
796
797 auto testcase7v6 = new PingTestCase(
798 "7. Test behavior of first reply lost in a count-limited configuration, IPv6",
800 testcase7v6->SetDropList(dropList);
801 testcase7v6->SetStartTime(Seconds(1));
802 testcase7v6->SetCount(3);
803 testcase7v6->SetStopTime(Seconds(5));
804 testcase7v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
805 testcase7v6->CheckTraceTx(3);
806 testcase7v6->CheckTraceRtt(2);
807 testcase7v6->CheckReportTransmitted(3);
808 testcase7v6->CheckReportReceived(2);
809 testcase7v6->CheckReportLoss(33); // 33%
810 testcase7v6->CheckReportTime(MicroSeconds(3040000));
811 AddTestCase(testcase7v6, TestCase::Duration::QUICK);
812
813 // 8. Test behavior of second reply lost in a count-limited configuration.
814 // Limited pings, no losses, StopApplication () with no packet in flight
815 // Configuration: Ping::Count = 3, Ping::Interval = 1s, Ping start time =
816 // 1s, Ping stop time = 5s. Loss of second reply is forced.
817 // Expected behavior: Pings are sent at 1 second intervals at times
818 // 1s, 2s, 3s. The ping Tx trace will record 3 sends,
819 // but the RTT trace will record 2 receptions.
820 // The application will stop after the third send
821 // after waiting for 2*RttMax (40 ms).
822 // How validated: PingReport trace is checked for number of packets
823 // transmitted (3) and received (2), loss percentage (33).
824 // Ping Tx trace (3) and Rtt trace (2) are also checked.
825 // Report time will be MicroSeconds (3040000).
826 auto testcase8v4 = new PingTestCase(
827 "8. Test behavior of second reply lost in a count-limited configuration, IPv4",
829 std::list<uint32_t> dropList2{1};
830 testcase8v4->SetDropList(dropList2);
831 testcase8v4->SetStartTime(Seconds(1));
832 testcase8v4->SetCount(3);
833 testcase8v4->SetStopTime(Seconds(5));
834 testcase8v4->CheckTraceTx(3);
835 testcase8v4->CheckTraceRtt(2);
836 testcase8v4->CheckReportTransmitted(3);
837 testcase8v4->CheckReportReceived(2);
838 testcase8v4->CheckReportLoss(33); // 33%
839 testcase8v4->CheckReportTime(MicroSeconds(3040000));
840 AddTestCase(testcase8v4, TestCase::Duration::QUICK);
841
842 auto testcase8v6 = new PingTestCase(
843 "8. Test behavior of second reply lost in a count-limited configuration, IPv6",
845 testcase8v6->SetDropList(dropList2);
846 testcase8v6->SetStartTime(Seconds(1));
847 testcase8v6->SetCount(3);
848 testcase8v6->SetStopTime(Seconds(5));
849 testcase8v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
850 testcase8v6->CheckTraceTx(3);
851 testcase8v6->CheckTraceRtt(2);
852 testcase8v6->CheckReportTransmitted(3);
853 testcase8v6->CheckReportReceived(2);
854 testcase8v6->CheckReportLoss(33); // 33%
855 testcase8v6->CheckReportTime(MicroSeconds(3040000));
856 AddTestCase(testcase8v6, TestCase::Duration::QUICK);
857
858 // 9. Test behavior of last reply lost in a count-limited configuration.
859 // Limited pings, no losses, StopApplication () with no packet in flight
860 // Configuration: Ping::Count = 3, Ping::Interval = 1s, Ping start time =
861 // 1s, Ping stop time = 5s. Loss of last reply is forced.
862 // Expected behavior: Pings are sent at 1 second intervals at times
863 // 1s, 2s, 3s. The ping Tx trace will record 3 sends,
864 // but the RTT trace will record 2 receptions.
865 // The application will stop after the third send
866 // after waiting for 2*RttMax (40 ms).
867 // How validated: PingReport trace is checked for number of packets
868 // transmitted (3) and received (2), loss percentage (33).
869 // Ping Tx trace (3) and Rtt trace (2) are also checked.
870 // Report time will be MicroSeconds (3040000).
871 auto testcase9v4 = new PingTestCase(
872 "9. Test behavior of last reply lost in a count-limited configuration, IPv4",
874 std::list<uint32_t> dropList3{2};
875 testcase9v4->SetDropList(dropList3);
876 testcase9v4->SetStartTime(Seconds(1));
877 testcase9v4->SetCount(3);
878 testcase9v4->SetStopTime(Seconds(5));
879 testcase9v4->CheckTraceTx(3);
880 testcase9v4->CheckTraceRtt(2);
881 testcase9v4->CheckReportTransmitted(3);
882 testcase9v4->CheckReportReceived(2);
883 testcase9v4->CheckReportLoss(33); // 33%
884 testcase9v4->CheckReportTime(MicroSeconds(3040000));
885 AddTestCase(testcase9v4, TestCase::Duration::QUICK);
886
887 auto testcase9v6 = new PingTestCase(
888 "9. Test behavior of last reply lost in a count-limited configuration, IPv6",
890 testcase9v6->SetDropList(dropList3);
891 testcase9v6->SetStartTime(Seconds(1));
892 testcase9v6->SetCount(3);
893 testcase9v6->SetStopTime(Seconds(5));
894 testcase9v6->SetDestinationAddress(Ipv6Address("2001:1::200:ff:fe00:2"));
895 testcase9v6->CheckTraceTx(3);
896 testcase9v6->CheckTraceRtt(2);
897 testcase9v6->CheckReportTransmitted(3);
898 testcase9v6->CheckReportReceived(2);
899 testcase9v6->CheckReportLoss(33); // 33%
900 testcase9v6->CheckReportTime(MicroSeconds(3040000));
901 AddTestCase(testcase9v6, TestCase::Duration::QUICK);
902
903#ifdef NOTYET
904 //
905 // 10. Test for behavior of pinging on a link that causes IPv4 fragmentation
906 // Configuration: Ping::Count = 1, Ping start time = 1s
907 // Ping stop time = 2.5s. Ping to Node 1
908 // Ping size set to 2000 bytes.
909 // Expected behavior: At shortly after time 1 seconds, Ping should
910 // successfully exit by recording the successful
911 // exchange of one echo request and reply.
912 // How validated: PingReport trace is checked for number of packets
913 // transmitted (5) and received (0).
914 // PingReport time is checked for an explicit time
915 // (1.020028s) corresponding to 2000 bytes
916 // The packet loss rate should be checked to be 100 percent
917 PingTestCase* testcase10v4 = new PingTestCase("10. Test for IPv4 fragmentation", USEIPV6_FALSE);
918 testcase10v4->SetStartTime(Seconds(1));
919 testcase10v4->SetStopTime(Seconds(2.5));
920 testcase10v4->SetCount(1);
921 testcase10v4->SetSize(2000);
922 testcase10v4->CheckReportTransmitted(1);
923 testcase10v4->CheckReportReceived(1);
924 testcase10v4->CheckReportTime(MicroSeconds(1020028));
925 AddTestCase(testcase10v4, TestCase::Duration::QUICK);
926#endif
927}
928
929static PingTestSuite pingTestSuite; //!< Static variable for test initialization
ping basic tests
Definition ping-test.cc:78
Time m_interpacketInterval
Time between pings.
Definition ping-test.cc:249
bool m_checkReportTime
Set to true to check the Time.
Definition ping-test.cc:243
Time m_simulatorStopTime
Simulator stop time.
Definition ping-test.cc:247
void RttTraceSink(uint16_t seq, Time rttSample)
Trace RTT events.
Definition ping-test.cc:350
uint32_t m_sizeAttribute
Size of pings.
Definition ping-test.cc:224
uint16_t m_expectedReportLoss
Expected reported Loss.
Definition ping-test.cc:237
uint32_t m_countTraceRtt
Rtt trace counter.
Definition ping-test.cc:230
uint32_t m_expectedReportTx
Expected reported Tx.
Definition ping-test.cc:235
void SetStartTime(Time startTime)
Set the PING start time.
Definition ping-test.cc:103
void SetStopTime(Time stopTime)
Set the PING stop time.
Definition ping-test.cc:112
PingTestCase(std::string name, bool useIpv6)
Constructor.
Definition ping-test.cc:259
uint32_t m_expectedTraceRtt
Expected Rtt trace sink calls.
Definition ping-test.cc:227
void CheckReportTime(Time expectedTime)
Enable the check on average RTT.
Definition ping-test.cc:343
void SetSimulatorStopTime(Time stopTime)
Set the Simulation stop time.
Definition ping-test.cc:464
bool m_checkTraceTx
Set to true to check the Tx number.
Definition ping-test.cc:232
void TxTraceSink(uint16_t seq, Ptr< Packet > p)
Trace TX events.
Definition ping-test.cc:380
Ipv6InterfaceContainer m_ipv6Interfaces
The IPv6 interfaces.
Definition ping-test.cc:255
uint32_t m_countTraceTx
Tx trace counter.
Definition ping-test.cc:229
Time m_lastTx
Last ping Tx time.
Definition ping-test.cc:250
void SetCount(uint32_t count)
Set the number of pings to send.
Definition ping-test.cc:121
bool m_checkReportTransmitted
Set to true to check the Tx number.
Definition ping-test.cc:240
uint32_t m_mtu
Link MTU.
Definition ping-test.cc:222
Time m_expectedReportTime
Expected reported time.
Definition ping-test.cc:238
void CheckReportTransmitted(uint32_t expectedReportTx)
Enable the check on Tx pings.
Definition ping-test.cc:322
NodeContainer m_nodes
The simulation nodes.
Definition ping-test.cc:253
bool m_checkReportLoss
Set to true to check the Loss number.
Definition ping-test.cc:242
bool m_useIpv6
Use IPv6 (true) or IPv4 (false)
Definition ping-test.cc:248
void ReportTraceSink(const Ping::PingReport &report)
Trace Report generation events.
Definition ping-test.cc:416
void CheckReportLoss(uint16_t expectedReportLoss)
Enable the check on Lost pings.
Definition ping-test.cc:336
bool m_checkReportReceived
Set to true to check the Rx number.
Definition ping-test.cc:241
void DoRun() override
Implementation to actually run this TestCase.
Definition ping-test.cc:476
Address m_destination
Destination address.
Definition ping-test.cc:221
Time m_stopTime
Stop time.
Definition ping-test.cc:246
void CheckTraceRtt(uint32_t expectedRtt)
Enable the check on Rtt event count in Rtt trace source.
Definition ping-test.cc:457
uint32_t m_expectedTraceTx
Expected Tx trace sink calls.
Definition ping-test.cc:226
bool m_checkTraceRtt
Set to true to check the Rtt number.
Definition ping-test.cc:233
void SetInterval(Time interval)
Set the interval of pings.
Definition ping-test.cc:139
void CheckReportReceived(uint32_t expectedReportRx)
Enable the check on Rx pings.
Definition ping-test.cc:329
void DropTraceSink(uint16_t seq, Ping::DropReason reason)
Trace Drop events.
Definition ping-test.cc:398
NetDeviceContainer m_devices
The NetDevices.
Definition ping-test.cc:256
Ipv4InterfaceContainer m_ipv4Interfaces
The IPv4 interfaces.
Definition ping-test.cc:254
uint32_t m_expectedReportRx
Expected reported Rx.
Definition ping-test.cc:236
Time m_startTime
Start time.
Definition ping-test.cc:245
void SetDestinationAddress(Address address)
Set the destination address (either IPv4 or IPv6).
Definition ping-test.cc:470
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Definition ping-test.cc:266
std::list< uint32_t > m_dropList
Drop first reply (true)
Definition ping-test.cc:251
uint32_t m_countAttribute
Number of pings to send.
Definition ping-test.cc:223
void SetSize(uint32_t size)
Set the size of pings.
Definition ping-test.cc:130
void DoTeardown() override
Implementation to do any local setup required for this TestCase.
Definition ping-test.cc:316
void SetDropList(const std::list< uint32_t > &dropList)
Set the packet drop list on the Ping node's interface.
Definition ping-test.cc:148
void CheckTraceTx(uint32_t expectedTx)
Enable the check on Tx pings counted in Tx trace source.
Definition ping-test.cc:450
ping TestSuite
Definition ping-test.cc:553
a polymophic address class
Definition address.h:90
AttributeValue implementation for Address.
Definition address.h:275
AttributeValue implementation for Boolean.
Definition boolean.h:26
Class for representing data rates.
Definition data-rate.h:78
AttributeValue implementation for DataRate.
Definition data-rate.h:285
An implementation of the ICMPv6 protocol.
aggregate IP/TCP/UDP functionality to existing Nodes.
void SetIpv4StackInstall(bool enable)
Enable/disable IPv4 stack install.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void SetIpv6StackInstall(bool enable)
Enable/disable IPv6 stack install.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Ipv4 addresses are stored in host order in this class.
static Ipv4Address ConvertFrom(const Address &address)
static Ipv4Address GetBroadcast()
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Describes an IPv6 address.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
static Ipv6Address GetAllNodesMulticast()
Get the "all nodes multicast" address.
bool IsLinkLocalMulticast() const
If the IPv6 address is link-local multicast (ff02::/16).
static Ipv6Address ConvertFrom(const Address &address)
Convert the Address object into an Ipv6Address ones.
Keep track of a set of IPv6 interfaces.
Ipv6Address GetAddress(uint32_t i, uint32_t j) const
Get the address for the specified index.
IPv6 layer implementation.
Describes an IPv6 prefix.
A helper class to populate neighbor cache.
void PopulateNeighborCache()
Populate neighbor ARP and NDISC caches for all devices.
holds a vector of ns3::NetDevice pointers
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition node.cc:153
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition object.h:511
DropReason
Reason why a ping was dropped.
Definition ping.h:69
@ DROP_NET_UNREACHABLE
Received ICMP Destination Network Unreachable.
Definition ping.h:72
@ DROP_HOST_UNREACHABLE
Received ICMP Destination Host Unreachable.
Definition ping.h:71
Smart pointer class similar to boost::intrusive_ptr.
build a set of SimpleNetDevice objects
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
void SetChannel(std::string type, Ts &&... args)
Each net device must have a channel to pass packets through.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
static void Run()
Run the simulation.
Definition simulator.cc:167
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
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:392
@ MS
millisecond
Definition nstime.h:106
bool IsZero() const
Exactly equivalent to t == 0.
Definition nstime.h:304
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition nstime.h:402
AttributeValue implementation for Time.
Definition nstime.h:1431
Hold an unsigned integer type.
Definition uinteger.h:34
Time stopTime
#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
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition test.h:134
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition test.h:327
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
Definition test.h:905
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1368
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1344
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1356
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:580
static PingTestSuite pingTestSuite
Static variable for test initialization.
Definition ping-test.cc:929
constexpr bool USEIPV6_TRUE
Definition ping-test.cc:64
constexpr bool USEIPV6_FALSE
Definition ping-test.cc:63
A ping report provides all of the data that is typically output to the terminal when the application ...
Definition ping.h:81
uint16_t m_loss
Percentage of lost packets (decimal value 0-100)
Definition ping.h:84
uint32_t m_received
Number of echo replies received.
Definition ping.h:83
double m_rttMin
rtt min value
Definition ping.h:86
uint32_t m_transmitted
Number of echo requests sent.
Definition ping.h:82
double m_rttMax
rtt max value
Definition ping.h:88