21 #include "ns3/ipv6-address-generator.h"
22 #include "ns3/simulation-singleton.h"
30 virtual void DoRun (
void);
31 virtual void DoTeardown (
void);
35 :
TestCase (
"Make sure the network number allocator is working on some of network prefixes.")
50 network = Ipv6AddressGenerator::GetNetwork (
Ipv6Prefix (
"FFFF::0"));
52 network = Ipv6AddressGenerator::NextNetwork (
Ipv6Prefix (
"FFFF::0"));
55 Ipv6AddressGenerator::Init (
Ipv6Address (
"0:1::0:0"),
57 network = Ipv6AddressGenerator::GetNetwork (
Ipv6Prefix (
"FFFF:FFFF::0"));
59 network = Ipv6AddressGenerator::NextNetwork (
Ipv6Prefix (
"FFFF:FFFF::0"));
62 Ipv6AddressGenerator::Init (
Ipv6Address (
"0:0:1::0"),
64 network = Ipv6AddressGenerator::GetNetwork (
Ipv6Prefix (
"FFFF:FFFF:FFFF::0"));
66 network = Ipv6AddressGenerator::NextNetwork (
Ipv6Prefix (
"FFFF:FFFF:FFFF::0"));
76 virtual void DoRun (
void);
81 :
TestCase (
"Sanity check on allocation of addresses")
91 address = Ipv6AddressGenerator::GetNetwork (
Ipv6Prefix (64));
93 Ipv6AddressGenerator::NextNetwork (
Ipv6Prefix (64));
94 address = Ipv6AddressGenerator::GetNetwork (
Ipv6Prefix (64));
96 address = Ipv6AddressGenerator::GetAddress (
Ipv6Prefix (64));
98 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (64));
100 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (64));
105 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (16));
107 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (16));
116 Simulator::Destroy ();
124 virtual void DoRun (
void);
129 :
TestCase (
"Make sure Network and address allocation play together.")
137 Simulator::Destroy ();
148 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (16));
150 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (16));
153 network = Ipv6AddressGenerator::NextNetwork (
Ipv6Prefix (
"FFFF::"));
155 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (16));
165 virtual void DoRun (
void);
170 :
TestCase (
"A typical real-world example")
185 Ipv6AddressGenerator::Init (
Ipv6Address (
"2001:0AB8::"),
187 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (48));
189 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (48));
191 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (48));
197 Ipv6AddressGenerator::NextNetwork (
Ipv6Prefix (
"FFFF:FFFF:FFFF::0"));
201 Ipv6AddressGenerator::InitAddress (
Ipv6Address (
"::3"),
206 address = Ipv6AddressGenerator::NextAddress (
Ipv6Prefix (48));
220 :
TestCase (
"Make sure that the address collision logic works.")
228 Simulator::Destroy ();
233 Ipv6AddressGenerator::AddAllocated (
"0::0:5");
234 Ipv6AddressGenerator::AddAllocated (
"0::0:10");
235 Ipv6AddressGenerator::AddAllocated (
"0::0:15");
236 Ipv6AddressGenerator::AddAllocated (
"0::0:20");
238 Ipv6AddressGenerator::AddAllocated (
"0::0:4");
239 Ipv6AddressGenerator::AddAllocated (
"0::0:3");
240 Ipv6AddressGenerator::AddAllocated (
"0::0:2");
241 Ipv6AddressGenerator::AddAllocated (
"0::0:1");
243 Ipv6AddressGenerator::AddAllocated (
"0::0:6");
244 Ipv6AddressGenerator::AddAllocated (
"0::0:7");
245 Ipv6AddressGenerator::AddAllocated (
"0::0:8");
246 Ipv6AddressGenerator::AddAllocated (
"0::0:9");
248 Ipv6AddressGenerator::AddAllocated (
"0::0:11");
249 Ipv6AddressGenerator::AddAllocated (
"0::0:12");
250 Ipv6AddressGenerator::AddAllocated (
"0::0:13");
251 Ipv6AddressGenerator::AddAllocated (
"0::0:14");
253 Ipv6AddressGenerator::AddAllocated (
"0::0:19");
254 Ipv6AddressGenerator::AddAllocated (
"0::0:18");
255 Ipv6AddressGenerator::AddAllocated (
"0::0:17");
256 Ipv6AddressGenerator::AddAllocated (
"0::0:16");
258 Ipv6AddressGenerator::TestMode ();
259 bool added = Ipv6AddressGenerator::AddAllocated (
"0::0:21");
262 added = Ipv6AddressGenerator::AddAllocated (
"0::0:4");
265 added = Ipv6AddressGenerator::AddAllocated (
"0::0:9");
268 added = Ipv6AddressGenerator::AddAllocated (
"0::0:16");
271 added = Ipv6AddressGenerator::AddAllocated (
"0::0:21");
virtual void DoRun(void)
Implementation to actually run this TestCase.
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
AddressAllocator6TestCase()
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ipv6AddressGeneratorTestSuite()
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
NetworkAndAddress6TestCase()
Ipv6AddressGeneratorTestSuite g_ipv6AddressGeneratorTestSuite
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
NetworkNumber6AllocatorTestCase()
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
ExampleAddress6GeneratorTestCase()
Describes an IPv6 address.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
Describes an IPv6 prefix.
void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
AddressCollision6TestCase()