9#include "ns3/core-module.h"
10#include "ns3/internet-module.h"
11#include "ns3/internet-stack-helper.h"
12#include "ns3/simple-net-device-helper.h"
13#include "ns3/simple-net-device.h"
14#include "ns3/sixlowpan-module.h"
15#include "ns3/sixlowpan-nd-protocol.h"
34 :
TestCase(
"2 6LNs with different ROVR attempt to register the same address")
65 lnNdProtocol->TraceConnectWithoutContext(
70 Address lnMac = simpleNetDevices.
Get(1)->GetAddress();
71 Address lbrMac = simpleNetDevices.
Get(0)->GetAddress();
77 std::vector<uint8_t> conflictingRovr(16, 0);
80 constexpr uint16_t regLifetimeMinutes = 5;
98 "Should have received at least one NA packet");
105 bool hasEaro =
false;
113 "NA EARO status should be DUPLICATE_ADDRESS");
144static SixLowPanNdRovrTestSuite
a polymophic address class
ICMPv6 Neighbor Advertisement header.
ICMPv6 link-layer address option.
ICMPv6 Extended Address Registration Option header RFC 8505.
uint8_t GetStatus() const
Get the status field.
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...
Describes an IPv6 address.
static Ipv6Address MakeAutoconfiguredLinkLocalAddress(Address mac)
Make the autoconfigured link-local IPv6 address from a Mac address.
Describes an IPv6 prefix.
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.
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 Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Setup a sixlowpan stack to be used as a shim between IPv6 and a generic NetDevice.
Ipv6InterfaceContainer InstallSixLowPanNdNode(NetDeviceContainer c)
Install the SixLoWPAN-ND stack, associate it with a NetDevice, and set it as a 6LN.
NetDeviceContainer Install(NetDeviceContainer c)
Install the SixLoWPAN stack on top of an existing NetDevice.
void SetAdvertisedPrefix(const Ptr< NetDevice > nd, Ipv6Prefix prefix)
Add a new prefix to be advertised by 6LoWPAN-ND.
Ipv6InterfaceContainer InstallSixLowPanNdBorderRouter(NetDeviceContainer c, Ipv6Address baseAddr)
Install the SixLoWPAN-ND stack, associate it with a NetDevice, and set it as a 6LBR.
An optimization of the ND protocol for 6LoWPANs.
void SendSixLowPanNsWithEaro(Ipv6Address addrToRegister, Ipv6Address dst, Address dstMac, uint16_t time, const std::vector< uint8_t > &rovr, Ptr< NetDevice > sixDevice)
Send a NS for 6LoWPAN ND (+ EARO, SLLAO).
static bool ParseAndValidateNaEaroPacket(Ptr< Packet > p, Icmpv6NA &naHdr, Icmpv6OptionLinkLayerAddress &tlla, Icmpv6OptionSixLowPanExtendedAddressRegistration &earo, bool &hasEaro)
Parses NA packet and populates params, returning true if packet is valid.
@ DUPLICATE_ADDRESS
Duplicate Address.
Test successful registration of varying numbers of 6LNs with 1 6LBR.
std::vector< Ptr< Packet > > m_naPacketsReceived
Container for NA packets received during test.
void DoRun() override
Implementation to actually run this TestCase.
void NaRxSink(Ptr< Packet > pkt)
Callback sink for NA packet reception trace events.
SixLowPanNdRovrTestSuite()
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
@ UNIT
This test suite implements a Unit Test.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
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...
#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.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static SixLowPanNdRovrTestSuite g_sixlowpanndrovrTestSuite
Static variable for test initialization.