9#include "ns3/icmpv4-l4-protocol.h"
10#include "ns3/icmpv6-l4-protocol.h"
11#include "ns3/internet-stack-helper.h"
12#include "ns3/ipv4-address-helper.h"
13#include "ns3/ipv4-l3-protocol.h"
14#include "ns3/ipv4-routing-helper.h"
15#include "ns3/ipv6-address-helper.h"
16#include "ns3/ipv6-l3-protocol.h"
17#include "ns3/ipv6-routing-helper.h"
18#include "ns3/neighbor-cache-helper.h"
19#include "ns3/simple-channel.h"
20#include "ns3/simple-net-device-helper.h"
21#include "ns3/simple-net-device.h"
22#include "ns3/simulator.h"
23#include "ns3/socket-factory.h"
24#include "ns3/socket.h"
26#include "ns3/udp-l4-protocol.h"
27#include "ns3/udp-socket-factory.h"
97 void DoRun()
override;
112 "The DynamicNeighborCacheTestPopulate checks if neighbor caches are correctly populated "
113 "in global scope and updated when there is an IP address added or removed.")
120 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
124 "Received Packet size is not equal to the Rx buffer size");
170 ipv4Interface->AddAddress(ifaceAddr);
177 ipv6Interface->AddAddress(ifaceAddr);
183 ipv4Interface->RemoveAddress(index);
189 ipv6Interface->RemoveAddress(index);
202 std::ostringstream stringStream1v4;
204 std::ostringstream stringStream1v6;
216 tx1Node->AddDevice(tx1Dev);
224 tx2Node->AddDevice(tx2Dev);
233 rxNode->AddDevice(rxDev);
241 snifferDev->SetAddress(
Mac48Address(
"00:00:00:00:00:04"));
242 snifferNode->AddDevice(snifferDev);
248 tx1Dev->SetChannel(channel);
249 tx2Dev->SetChannel(channel);
250 rxDev->SetChannel(channel);
251 snifferDev->SetChannel(channel);
316 Ptr<Socket> rxSocketv4 = rxSocketFactory->CreateSocket();
317 Ptr<Socket> rxSocketv6 = rxSocketFactory->CreateSocket();
329 Ptr<Socket> snifferSocketv4 = snifferSocketFactory->CreateSocket();
330 Ptr<Socket> snifferSocketv6 = snifferSocketFactory->CreateSocket();
342 Ptr<Socket> tx1Socket = tx1SocketFactory->CreateSocket();
343 tx1Socket->SetAllowBroadcast(
true);
346 Ptr<Socket> tx2Socket = tx2SocketFactory->CreateSocket();
347 tx2Socket->SetAllowBroadcast(
true);
367 "Should receive packet sending to the added IPv4 address.");
370 "Should receive packet sending to the added IPv6 address.");
374 "Should receive only 1 packet from IPv4 interface and only 1 packet from IPv6 interface.");
379 constexpr auto arpCache =
380 "ARP Cache of node 0 at time 0\n"
381 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
382 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
383 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
384 "ARP Cache of node 1 at time 0\n"
385 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
386 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
387 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
388 "ARP Cache of node 2 at time 0\n"
389 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
390 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
391 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
392 "ARP Cache of node 3 at time 0\n"
393 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
394 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
395 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
396 "ARP Cache of node 0 at time 1\n"
397 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
398 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
399 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
400 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
401 "ARP Cache of node 1 at time 1\n"
402 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
403 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
404 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
405 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
406 "ARP Cache of node 2 at time 1\n"
407 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
408 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
409 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
410 "ARP Cache of node 3 at time 1\n"
411 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
412 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
413 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
414 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
415 "ARP Cache of node 0 at time 2\n"
416 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
417 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
418 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
419 "ARP Cache of node 1 at time 2\n"
420 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
421 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
422 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
423 "ARP Cache of node 2 at time 2\n"
424 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
425 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
426 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
427 "ARP Cache of node 3 at time 2\n"
428 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
429 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
430 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
437 "NDISC Cache of node 0 at time +0s\n"
438 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
439 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
440 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
441 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
442 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
443 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
444 "NDISC Cache of node 1 at time +0s\n"
445 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
446 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
447 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
448 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
449 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
450 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
451 "NDISC Cache of node 2 at time +0s\n"
452 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
453 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
454 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
455 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
456 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
457 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
458 "NDISC Cache of node 3 at time +0s\n"
459 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
460 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
461 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
462 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
463 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
464 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
465 "NDISC Cache of node 0 at time +1s\n"
466 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
467 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
468 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
469 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
470 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
471 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
472 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
473 "NDISC Cache of node 1 at time +1s\n"
474 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
475 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
476 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
477 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
478 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
479 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
480 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
481 "NDISC Cache of node 2 at time +1s\n"
482 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
483 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
484 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
485 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
486 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
487 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
488 "NDISC Cache of node 3 at time +1s\n"
489 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
490 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
491 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
492 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
493 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
494 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
495 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
496 "NDISC Cache of node 0 at time +2s\n"
497 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
498 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
499 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
500 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
501 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
502 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
503 "NDISC Cache of node 1 at time +2s\n"
504 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
505 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
506 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
507 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
508 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
509 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
510 "NDISC Cache of node 2 at time +2s\n"
511 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
512 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
513 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
514 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
515 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
516 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
517 "NDISC Cache of node 3 at time +2s\n"
518 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
519 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
520 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
521 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
522 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
523 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
539 void DoRun()
override;
548 "The ChannelTest Check if neighbor caches are correctly populated on specific channel.")
572 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
574 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
588 std::ostringstream stringStream1v4;
590 std::ostringstream stringStream1v6;
600 constexpr auto arpCache =
"ARP Cache of node 0 at time 0\n"
601 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
602 "ARP Cache of node 1 at time 0\n"
603 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
604 "ARP Cache of node 2 at time 0\n";
609 "NDISC Cache of node 0 at time +0s\n"
610 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
611 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
612 "NDISC Cache of node 1 at time +0s\n"
613 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
614 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
615 "NDISC Cache of node 2 at time +0s\n";
628 void DoRun()
override;
636 :
TestCase(
"The NetDeviceContainerTest check if neighbor caches are populated correctly on "
637 "specific netDeviceContainer.")
661 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
663 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
677 std::ostringstream stringStream1v4;
679 std::ostringstream stringStream1v6;
689 constexpr auto arpCache =
690 "ARP Cache of node 0 at time 0\n"
691 "ARP Cache of node 1 at time 0\n"
692 "10.1.2.2 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
693 "ARP Cache of node 2 at time 0\n"
694 "10.1.2.1 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
699 "NDISC Cache of node 0 at time +0s\n"
700 "NDISC Cache of node 1 at time +0s\n"
701 "2001:1::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
702 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
703 "NDISC Cache of node 2 at time +0s\n"
704 "2001:1::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
705 "fe80::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
718 void DoRun()
override;
726 :
TestCase(
"The InterfaceContainerTest check if neighbor caches are populated correctly on "
727 "specific interfaceContainer.")
751 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
753 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
768 std::ostringstream stringStream1v4;
770 std::ostringstream stringStream1v6;
780 constexpr auto arpCache =
"ARP Cache of node 0 at time 0\n"
781 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
782 "ARP Cache of node 1 at time 0\n"
783 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
784 "ARP Cache of node 2 at time 0\n";
789 "NDISC Cache of node 0 at time +0s\n"
790 "NDISC Cache of node 1 at time +0s\n"
791 "2001:1::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
792 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
793 "NDISC Cache of node 2 at time +0s\n"
794 "2001:1::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
795 "fe80::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
808 void DoRun()
override;
816 :
TestCase(
"The FlushTest checks that FlushAutoGenerated() will only remove "
817 "STATIC_AUTOGENERATED entries.")
841 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
843 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
858 std::pair<Ptr<Ipv4>,
uint32_t> returnValue = i.
Get(0);
860 uint32_t index = returnValue.second;
868 std::pair<Ptr<Ipv6>,
uint32_t> returnValue2 = icv61.
Get(0);
870 index = returnValue2.second;
880 std::ostringstream stringStream1v4;
882 std::ostringstream stringStream1v6;
891 constexpr auto ArpCache =
"ARP Cache of node 0 at time 0\n"
892 "10.1.1.4 dev 0 lladdr 04-06-00:00:00:00:00:01 PERMANENT\n"
893 "ARP Cache of node 1 at time 0\n"
894 "ARP Cache of node 2 at time 0\n";
899 "NDISC Cache of node 0 at time +0s\n"
900 "2001::200:ff:fe00:4 dev 0 lladdr 04-06-00:00:00:00:00:01 PERMANENT\n"
901 "NDISC Cache of node 1 at time +0s\n"
902 "NDISC Cache of node 2 at time +0s\n";
915 void DoRun()
override;
923 :
TestCase(
"The DuplicateTest checks that populate neighbor caches in overlapped scope does "
924 "not raise an error or generate duplicate entries.")
948 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
950 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
968 std::ostringstream stringStream1v4;
970 std::ostringstream stringStream1v6;
980 "ARP Cache of node 0 at time 0\n"
981 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
982 "ARP Cache of node 1 at time 0\n"
983 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
984 "10.1.2.2 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
985 "ARP Cache of node 2 at time 0\n"
986 "10.1.2.1 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
991 "NDISC Cache of node 0 at time +0s\n"
992 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
993 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
994 "NDISC Cache of node 1 at time +0s\n"
995 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
996 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
997 "2001:1::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
998 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
999 "NDISC Cache of node 2 at time +0s\n"
1000 "2001:1::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
1001 "fe80::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
1014 void DoRun()
override;
1050 :
TestCase(
"The DynamicPartialTest checks if dynamic neighbor cache update correctly when "
1051 "generating on a non-global scope.")
1058 ipv4Interface->AddAddress(ifaceAddr);
1064 ipv6Interface->AddAddress(ifaceAddr);
1070 ipv4Interface->RemoveAddress(index);
1076 ipv6Interface->RemoveAddress(index);
1099 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
1101 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
1154 std::ostringstream stringStream1v4;
1156 std::ostringstream stringStream1v6;
1170 constexpr auto ArpCache =
"ARP Cache of node 0 at time 0\n"
1171 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1172 "ARP Cache of node 1 at time 0\n"
1173 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1174 "ARP Cache of node 2 at time 0\n"
1175 "ARP Cache of node 0 at time 1\n"
1176 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1177 "ARP Cache of node 1 at time 1\n"
1178 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1179 "ARP Cache of node 2 at time 1\n"
1180 "ARP Cache of node 0 at time 2\n"
1181 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1182 "ARP Cache of node 1 at time 2\n"
1183 "ARP Cache of node 2 at time 2\n";
1189 "NDISC Cache of node 0 at time +0s\n"
1190 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1191 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1192 "NDISC Cache of node 1 at time +0s\n"
1193 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1194 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1195 "NDISC Cache of node 2 at time +0s\n"
1196 "NDISC Cache of node 0 at time +1s\n"
1197 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1198 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1199 "NDISC Cache of node 1 at time +1s\n"
1200 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1201 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1202 "NDISC Cache of node 2 at time +1s\n"
1203 "NDISC Cache of node 0 at time +2s\n"
1204 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1205 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1206 "NDISC Cache of node 1 at time +2s\n"
1207 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1208 "NDISC Cache of node 2 at time +2s\n";
Neighbor cache on Channel Test.
void DoRun() override
Implementation to actually run this TestCase.
NodeContainer m_nodes
Nodes used in the test.
Neighbor Cache on Overlapped Scope Test.
NodeContainer m_nodes
Nodes used in the test.
void DoRun() override
Implementation to actually run this TestCase.
Dynamic Neighbor Cache Test.
std::vector< uint32_t > m_receivedPacketSizes
Received packet sizes.
void ReceivePkt(Ptr< Socket > socket)
Receive data.
void RemoveIpv4Address(Ptr< Ipv4Interface > ipv4Interface, uint32_t index)
Remove an IPv4 address from an IPv4 interface.
DynamicNeighborCacheTest()
void AddIpv4Address(Ptr< Ipv4Interface > ipv4Interface, Ipv4InterfaceAddress ifaceAddr)
Add an IPv4 address to an IPv4 interface.
void AddIpv6Address(Ptr< Ipv6Interface > ipv6Interface, Ipv6InterfaceAddress ifaceAddr)
Add an IPv6 address to an IPv6 interface.
void DoRun() override
Implementation to actually run this TestCase.
void DoSendDatav4(Ptr< Socket > socket, Ipv4Address to)
Send data immediately after being called.
void RemoveIpv6Address(Ptr< Ipv6Interface > ipv6Interface, uint32_t index)
Remove an IPv6 address from an IPv6 interface.
void DoSendDatav6(Ptr< Socket > socket, Ipv6Address to)
Send data immediately after being called.
void SendData(Ptr< Socket > socket, Ipv4Address to)
Schedules the DoSendData () function to send the data.
Ptr< Packet > m_receivedPacket
Received packet.
Dynamic Neighbor Cache on Reduced Scope Test.
void DoRun() override
Implementation to actually run this TestCase.
void AddIpv6Address(Ptr< Ipv6Interface > ipv6Interface, Ipv6InterfaceAddress ifaceAddr)
Add an IPv6 address to an IPv6 interface.
void RemoveIpv4Address(Ptr< Ipv4Interface > ipv4Interface, uint32_t index)
Remove an IPv4 address from an IPv4 interface.
void RemoveIpv6Address(Ptr< Ipv6Interface > ipv6Interface, uint32_t index)
Remove an IPv6 address from an IPv6 interface.
void AddIpv4Address(Ptr< Ipv4Interface > ipv4Interface, Ipv4InterfaceAddress ifaceAddr)
Add an IPv4 address to an IPv4 interface.
NodeContainer m_nodes
Nodes used in the test.
Neighbor Cache Flush Test.
void DoRun() override
Implementation to actually run this TestCase.
NodeContainer m_nodes
Nodes used in the test.
Neighbor Cache on InterfaceContainer Test.
NodeContainer m_nodes
Nodes used in the test.
void DoRun() override
Implementation to actually run this TestCase.
Neighbor Cache on NetDeviceContainer Test.
NodeContainer m_nodes
Nodes used in the test.
void DoRun() override
Implementation to actually run this TestCase.
a polymophic address class
A record that that holds information about an ArpCache entry.
void MarkPermanent()
Changes the state of this entry to Permanent.
void SetMacAddress(Address macAddress)
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
a class to store IPv4 address information on an interface
holds a vector of std::pair of Ptr<Ipv4> and interface index.
std::pair< Ptr< Ipv4 >, uint32_t > Get(uint32_t i) const
Get the std::pair of an Ptr<Ipv4> and interface stored at the location specified by the index.
Implement the IPv4 layer.
a class to represent an Ipv4 address mask
static void PrintNeighborCacheAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of all nodes at a particular time.
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.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
IPv6 address associated with an interface.
Keep track of a set of IPv6 interfaces.
std::pair< Ptr< Ipv6 >, uint32_t > Get(uint32_t i) const
Get the std::pair of an Ptr<Ipv6> and interface stored at the location specified by the index.
IPv6 layer implementation.
Describes an IPv6 prefix.
static void PrintNeighborCacheAllAt(Time printTime, Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S)
prints the neighbor cache of all nodes at a particular time.
A record that holds information about a NdiscCache entry.
void MarkPermanent()
Change the state to this entry to PERMANENT.
void SetMacAddress(Address mac)
Set the MAC address of this entry.
IPv6 Neighbor Discovery cache.
A helper class to populate neighbor cache.
void PopulateNeighborCache()
Populate neighbor ARP and NDISC caches for all devices.
void SetDynamicNeighborCache(bool enable)
Enable/disable dynamic neighbor cache, auto-generated neighbor cache will update by IP addresses chan...
void FlushAutoGenerated() const
Remove entries generated from NeighborCacheHelper from ARP cache and NDISC cache.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
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 GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void RemoveAllByteTags()
Remove all byte tags stored in this packet.
Smart pointer class similar to boost::intrusive_ptr.
build a set of SimpleNetDevice objects
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
API to create UDP socket instances.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#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.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
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...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
static NeighborCacheTestSuite g_neighborcacheTestSuite
Static variable for test initialization.