20#include "ns3/icmpv4-l4-protocol.h"
21#include "ns3/icmpv6-l4-protocol.h"
22#include "ns3/internet-stack-helper.h"
23#include "ns3/ipv4-address-helper.h"
24#include "ns3/ipv4-l3-protocol.h"
25#include "ns3/ipv4-routing-helper.h"
26#include "ns3/ipv6-address-helper.h"
27#include "ns3/ipv6-l3-protocol.h"
28#include "ns3/ipv6-routing-helper.h"
29#include "ns3/neighbor-cache-helper.h"
30#include "ns3/simple-channel.h"
31#include "ns3/simple-net-device-helper.h"
32#include "ns3/simple-net-device.h"
33#include "ns3/simulator.h"
34#include "ns3/socket-factory.h"
35#include "ns3/socket.h"
37#include "ns3/udp-l4-protocol.h"
38#include "ns3/udp-socket-factory.h"
108 void DoRun()
override;
123 "The DynamicNeighborCacheTestPopulate checks if neighbor caches are correctly populated "
124 "in global scope and updated when there is an IP address added or removed.")
131 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
135 "Received Packet size is not equal to the Rx buffer size");
181 ipv4Interface->AddAddress(ifaceAddr);
188 ipv6Interface->AddAddress(ifaceAddr);
194 ipv4Interface->RemoveAddress(index);
200 ipv6Interface->RemoveAddress(index);
206 Ptr<Node> tx1Node = CreateObject<Node>();
207 Ptr<Node> tx2Node = CreateObject<Node>();
209 Ptr<Node> snifferNode = CreateObject<Node>();
213 std::ostringstream stringStream1v4;
215 std::ostringstream stringStream1v6;
225 tx1Dev = CreateObject<SimpleNetDevice>();
227 tx1Node->AddDevice(tx1Dev);
233 tx2Dev = CreateObject<SimpleNetDevice>();
235 tx2Node->AddDevice(tx2Dev);
242 rxDev = CreateObject<SimpleNetDevice>();
244 rxNode->AddDevice(rxDev);
251 snifferDev = CreateObject<SimpleNetDevice>();
252 snifferDev->SetAddress(
Mac48Address(
"00:00:00:00:00:04"));
253 snifferNode->AddDevice(snifferDev);
259 tx1Dev->SetChannel(channel);
260 tx2Dev->SetChannel(channel);
261 rxDev->SetChannel(channel);
262 snifferDev->SetChannel(channel);
327 Ptr<Socket> rxSocketv4 = rxSocketFactory->CreateSocket();
328 Ptr<Socket> rxSocketv6 = rxSocketFactory->CreateSocket();
340 Ptr<Socket> snifferSocketv4 = snifferSocketFactory->CreateSocket();
341 Ptr<Socket> snifferSocketv6 = snifferSocketFactory->CreateSocket();
353 Ptr<Socket> tx1Socket = tx1SocketFactory->CreateSocket();
354 tx1Socket->SetAllowBroadcast(
true);
357 Ptr<Socket> tx2Socket = tx2SocketFactory->CreateSocket();
358 tx2Socket->SetAllowBroadcast(
true);
378 "Should receive packet sending to the added IPv4 address.");
381 "Should receive packet sending to the added IPv6 address.");
385 "Should receive only 1 packet from IPv4 interface and only 1 packet from IPv6 interface.");
390 constexpr auto arpCache =
391 "ARP Cache of node 0 at time 0\n"
392 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
393 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
394 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
395 "ARP Cache of node 1 at time 0\n"
396 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
397 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
398 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
399 "ARP Cache of node 2 at time 0\n"
400 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
401 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
402 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
403 "ARP Cache of node 3 at time 0\n"
404 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
405 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
406 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
407 "ARP Cache of node 0 at time 1\n"
408 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
409 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
410 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
411 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
412 "ARP Cache of node 1 at time 1\n"
413 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
414 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
415 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
416 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
417 "ARP Cache of node 2 at time 1\n"
418 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
419 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
420 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
421 "ARP Cache of node 3 at time 1\n"
422 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
423 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
424 "10.0.1.3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
425 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
426 "ARP Cache of node 0 at time 2\n"
427 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
428 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
429 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
430 "ARP Cache of node 1 at time 2\n"
431 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
432 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
433 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
434 "ARP Cache of node 2 at time 2\n"
435 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
436 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
437 "10.0.1.4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
438 "ARP Cache of node 3 at time 2\n"
439 "10.0.1.1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
440 "10.0.1.2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
441 "10.0.1.5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
448 "NDISC Cache of node 0 at time +0s\n"
449 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
450 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
451 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
452 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
453 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
454 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
455 "NDISC Cache of node 1 at time +0s\n"
456 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
457 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
458 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
459 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
460 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
461 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
462 "NDISC Cache of node 2 at time +0s\n"
463 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
464 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
465 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
466 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
467 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
468 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
469 "NDISC Cache of node 3 at time +0s\n"
470 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
471 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
472 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
473 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
474 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
475 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
476 "NDISC Cache of node 0 at time +1s\n"
477 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
478 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
479 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
480 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
481 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
482 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
483 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
484 "NDISC Cache of node 1 at time +1s\n"
485 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
486 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
487 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
488 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
489 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
490 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
491 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
492 "NDISC Cache of node 2 at time +1s\n"
493 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
494 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
495 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
496 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
497 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
498 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
499 "NDISC Cache of node 3 at time +1s\n"
500 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
501 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
502 "2001::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
503 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
504 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
505 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
506 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
507 "NDISC Cache of node 0 at time +2s\n"
508 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
509 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
510 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
511 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
512 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
513 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
514 "NDISC Cache of node 1 at time +2s\n"
515 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
516 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
517 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
518 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
519 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
520 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
521 "NDISC Cache of node 2 at time +2s\n"
522 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
523 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
524 "2001::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
525 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
526 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
527 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
528 "NDISC Cache of node 3 at time +2s\n"
529 "2001::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
530 "2001::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
531 "2001::200:ff:fe00:5 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
532 "fe80::200:ff:fe00:1 dev 1 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
533 "fe80::200:ff:fe00:2 dev 1 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
534 "fe80::200:ff:fe00:3 dev 1 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
550 void DoRun()
override;
559 "The ChannelTest Check if neighbor caches are correctly populated on specific channel.")
583 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
585 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
599 std::ostringstream stringStream1v4;
601 std::ostringstream stringStream1v6;
611 constexpr auto arpCache =
"ARP Cache of node 0 at time 0\n"
612 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
613 "ARP Cache of node 1 at time 0\n"
614 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
615 "ARP Cache of node 2 at time 0\n";
620 "NDISC Cache of node 0 at time +0s\n"
621 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
622 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
623 "NDISC Cache of node 1 at time +0s\n"
624 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
625 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
626 "NDISC Cache of node 2 at time +0s\n";
639 void DoRun()
override;
647 :
TestCase(
"The NetDeviceContainerTest check if neighbor caches are populated correctly on "
648 "specific netDeviceContainer.")
672 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
674 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
688 std::ostringstream stringStream1v4;
690 std::ostringstream stringStream1v6;
700 constexpr auto arpCache =
701 "ARP Cache of node 0 at time 0\n"
702 "ARP Cache of node 1 at time 0\n"
703 "10.1.2.2 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
704 "ARP Cache of node 2 at time 0\n"
705 "10.1.2.1 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
710 "NDISC Cache of node 0 at time +0s\n"
711 "NDISC Cache of node 1 at time +0s\n"
712 "2001:1::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
713 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
714 "NDISC Cache of node 2 at time +0s\n"
715 "2001:1::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
716 "fe80::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
729 void DoRun()
override;
737 :
TestCase(
"The InterfaceContainerTest check if neighbor caches are populated correctly on "
738 "specific interfaceContainer.")
762 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
764 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
779 std::ostringstream stringStream1v4;
781 std::ostringstream stringStream1v6;
791 constexpr auto arpCache =
"ARP Cache of node 0 at time 0\n"
792 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
793 "ARP Cache of node 1 at time 0\n"
794 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
795 "ARP Cache of node 2 at time 0\n";
800 "NDISC Cache of node 0 at time +0s\n"
801 "NDISC Cache of node 1 at time +0s\n"
802 "2001:1::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
803 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
804 "NDISC Cache of node 2 at time +0s\n"
805 "2001:1::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
806 "fe80::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
819 void DoRun()
override;
827 :
TestCase(
"The FlushTest checks that FlushAutoGenerated() will only remove "
828 "STATIC_AUTOGENERATED entries.")
852 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
854 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
869 std::pair<Ptr<Ipv4>,
uint32_t> returnValue = i.
Get(0);
871 uint32_t index = returnValue.second;
879 std::pair<Ptr<Ipv6>,
uint32_t> returnValue2 = icv61.
Get(0);
881 index = returnValue2.second;
891 std::ostringstream stringStream1v4;
893 std::ostringstream stringStream1v6;
902 constexpr auto ArpCache =
"ARP Cache of node 0 at time 0\n"
903 "10.1.1.4 dev 0 lladdr 04-06-00:00:00:00:00:01 PERMANENT\n"
904 "ARP Cache of node 1 at time 0\n"
905 "ARP Cache of node 2 at time 0\n";
910 "NDISC Cache of node 0 at time +0s\n"
911 "2001::200:ff:fe00:4 dev 0 lladdr 04-06-00:00:00:00:00:01 PERMANENT\n"
912 "NDISC Cache of node 1 at time +0s\n"
913 "NDISC Cache of node 2 at time +0s\n";
926 void DoRun()
override;
934 :
TestCase(
"The DuplicateTest checks that populate neighbor caches in overlapped scope does "
935 "not raise an error or generate duplicate entries.")
959 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
961 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
979 std::ostringstream stringStream1v4;
981 std::ostringstream stringStream1v6;
991 "ARP Cache of node 0 at time 0\n"
992 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
993 "ARP Cache of node 1 at time 0\n"
994 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
995 "10.1.2.2 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
996 "ARP Cache of node 2 at time 0\n"
997 "10.1.2.1 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
1002 "NDISC Cache of node 0 at time +0s\n"
1003 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1004 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1005 "NDISC Cache of node 1 at time +0s\n"
1006 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1007 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1008 "2001:1::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
1009 "fe80::200:ff:fe00:4 dev 1 lladdr 04-06-00:00:00:00:00:04 STATIC_AUTOGENERATED\n"
1010 "NDISC Cache of node 2 at time +0s\n"
1011 "2001:1::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n"
1012 "fe80::200:ff:fe00:3 dev 0 lladdr 04-06-00:00:00:00:00:03 STATIC_AUTOGENERATED\n";
1025 void DoRun()
override;
1061 :
TestCase(
"The DynamicPartialTest checks if dynamic neighbor cache update correctly when "
1062 "generating on a non-global scope.")
1069 ipv4Interface->AddAddress(ifaceAddr);
1075 ipv6Interface->AddAddress(ifaceAddr);
1081 ipv4Interface->RemoveAddress(index);
1087 ipv6Interface->RemoveAddress(index);
1110 ipv4.SetBase(
"10.1.1.0",
"255.255.255.252");
1112 ipv4.SetBase(
"10.1.2.0",
"255.255.255.252");
1165 std::ostringstream stringStream1v4;
1167 std::ostringstream stringStream1v6;
1181 constexpr auto ArpCache =
"ARP Cache of node 0 at time 0\n"
1182 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1183 "ARP Cache of node 1 at time 0\n"
1184 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1185 "ARP Cache of node 2 at time 0\n"
1186 "ARP Cache of node 0 at time 1\n"
1187 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1188 "ARP Cache of node 1 at time 1\n"
1189 "10.1.1.1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1190 "ARP Cache of node 2 at time 1\n"
1191 "ARP Cache of node 0 at time 2\n"
1192 "10.1.1.2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1193 "ARP Cache of node 1 at time 2\n"
1194 "ARP Cache of node 2 at time 2\n";
1200 "NDISC Cache of node 0 at time +0s\n"
1201 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1202 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1203 "NDISC Cache of node 1 at time +0s\n"
1204 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1205 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1206 "NDISC Cache of node 2 at time +0s\n"
1207 "NDISC Cache of node 0 at time +1s\n"
1208 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1209 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1210 "NDISC Cache of node 1 at time +1s\n"
1211 "2001::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1212 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1213 "NDISC Cache of node 2 at time +1s\n"
1214 "NDISC Cache of node 0 at time +2s\n"
1215 "2001::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1216 "fe80::200:ff:fe00:2 dev 0 lladdr 04-06-00:00:00:00:00:02 STATIC_AUTOGENERATED\n"
1217 "NDISC Cache of node 1 at time +2s\n"
1218 "fe80::200:ff:fe00:1 dev 0 lladdr 04-06-00:00:00:00:00:01 STATIC_AUTOGENERATED\n"
1219 "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, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
@ UNIT
This test suite implements a Unit Test.
API to create UDP socket instances.
#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...
static NeighborCacheTestSuite g_neighborcacheTestSuite
Static variable for test initialization.