|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/simulator.h"
24 #include "ns3/boolean.h"
25 #include "ns3/inet6-socket-address.h"
27 #include "ns3/simple-net-device.h"
29 #include "ns3/ipv6-interface.h"
30 #include "ns3/ipv6-l3-protocol.h"
31 #include "ns3/icmpv6-l4-protocol.h"
47 virtual void DoRun ();
51 TestCase (
"Verify the IPv6 layer 3 protocol")
79 interface->SetDevice (device);
80 interface->SetNode (node);
86 interface2->SetDevice (device2);
87 interface2->SetNode (node);
96 "Should be link local??");
99 "interface has always a link-local address");
103 interface->AddAddress (ifaceAddr1);
106 interface->AddAddress (ifaceAddr2);
110 interface2->AddAddress (ifaceAddr3);
112 uint32_t num = interface->GetNAddresses ();
115 num = interface2->GetNAddresses ();
118 interface->RemoveAddress (2);
119 num = interface->GetNAddresses ();
124 "Should be the interface address 1?");
137 output = interface->RemoveAddress (
Ipv6Address (
"2001:1234:5678:9000::1"));
139 num = interface->GetNAddresses ();
143 output = interface->RemoveAddress (
Ipv6Address (
"2001:1234:5678:9000::1"));
145 "Removed non-existent address??");
146 num = interface->GetNAddresses ();
150 output = interface->RemoveAddress (Ipv6Address::GetLoopback ());
152 "Able to remove loopback address??");
153 num = interface->GetNAddresses ();
159 (
"2001:ffff:5678:9001::2"));
161 num = interface2->GetNAddresses ();
166 (
"2001:ffff:5678:9001::2"));
168 num = interface2->GetNAddresses ();
172 result = ipv6->
RemoveAddress (index, Ipv6Address::GetLoopback ());
174 num = interface2->GetNAddresses ();
177 Simulator::Destroy ();
The IPv6 representation of a network interface.
IPv6 address associated with an interface.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
AttributeValue implementation for Boolean.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ipv6Address GetAddress() const
Get the IPv6 address.
static IPv6L3ProtocolTestSuite g_ipv6protocolTestSuite
Static variable for test initialization.
Describes an IPv6 address.
int32_t GetInterfaceForAddress(Ipv6Address addr) const
Get interface index which has specified IPv6 address.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
uint32_t AddIpv6Interface(Ptr< Ipv6Interface > interface)
Add an IPv6 interface to the stack.
bool RemoveAddress(uint32_t interfaceIndex, uint32_t addressIndex)
Remove an address from an interface.
bool IsLinkLocal() const
If the IPv6 address is a link-local address (fe80::/64).
int32_t GetInterfaceForPrefix(Ipv6Address addr, Ipv6Prefix mask) const
Get interface index which match specified address/prefix.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
virtual void Insert(Ptr< IpL4Protocol > protocol)
Add a L4 protocol.
IPv6L3ProtocolTestSuite()
#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.
@ UNIT
This test suite implements a Unit Test.
virtual void DoRun()
Implementation to actually run this TestCase.
virtual ~Ipv6L3ProtocolTestCase()
Describes an IPv6 prefix.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.