|
|
| 94 |
Ipv4InterfaceAddress output = interface->GetAddress (2); |
94 |
Ipv4InterfaceAddress output = interface->GetAddress (2); |
| 95 |
NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output, |
95 |
NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output, |
| 96 |
"The addresses should be identical"); |
96 |
"The addresses should be identical"); |
|
|
97 |
|
| 98 |
/* Test Ipv4Interface()::RemoveAddress(address) */ |
| 99 |
output = interface->RemoveAddress (Ipv4Address ("250.0.0.1")); |
| 100 |
NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output, |
| 101 |
"Wrong Interface Address Removed??"); |
| 102 |
num = interface->GetNAddresses (); |
| 103 |
NS_TEST_ASSERT_MSG_EQ (num, 2, "Should find 2 interfaces??"); |
| 104 |
|
| 105 |
/* Remove a non-existent Address */ |
| 106 |
output = interface->RemoveAddress (Ipv4Address ("253.123.9.81")); |
| 107 |
NS_TEST_ASSERT_MSG_EQ (Ipv4InterfaceAddress (), output, |
| 108 |
"Removed non-existent address??"); |
| 109 |
num = interface->GetNAddresses (); |
| 110 |
NS_TEST_ASSERT_MSG_EQ (num, 2, "Should find 2 interfaces??"); |
| 111 |
|
| 112 |
/* Remove a Loopback Address */ |
| 113 |
output = interface->RemoveAddress (Ipv4Address::GetLoopback ()); |
| 114 |
NS_TEST_ASSERT_MSG_EQ (Ipv4InterfaceAddress (), output, |
| 115 |
"Able to remove loopback address??"); |
| 116 |
num = interface->GetNAddresses (); |
| 117 |
NS_TEST_ASSERT_MSG_EQ (num, 2, "Should find 2 interfaces??"); |
| 118 |
|
| 119 |
/* Test Ipv4Address::RemoveAddress(i, addresss) */ |
| 120 |
bool result = ipv4->RemoveAddress (index, Ipv4Address |
| 121 |
("192.168.0.2")); |
| 122 |
NS_TEST_ASSERT_MSG_EQ (true, result, "Unable to remove Address??"); |
| 123 |
num = interface->GetNAddresses (); |
| 124 |
NS_TEST_ASSERT_MSG_EQ (num, 1, "Should find 1 interfaces??"); |
| 125 |
|
| 126 |
/* Remove a non-existent Address */ |
| 127 |
result = ipv4->RemoveAddress (index, Ipv4Address ("189.0.0.1")); |
| 128 |
NS_TEST_ASSERT_MSG_EQ (false, result, |
| 129 |
"Removed non-existent address??"); |
| 130 |
num = interface->GetNAddresses (); |
| 131 |
NS_TEST_ASSERT_MSG_EQ (num, 1, "Should find 1 interfaces??"); |
| 132 |
|
| 133 |
/* Remove a loopback Address */ |
| 134 |
result = ipv4->RemoveAddress (index, Ipv4Address::GetLoopback ()); |
| 135 |
NS_TEST_ASSERT_MSG_EQ (false, result, |
| 136 |
"Able to remove loopback address??"); |
| 137 |
num = interface->GetNAddresses (); |
| 138 |
NS_TEST_ASSERT_MSG_EQ (num, 1, "Should find 1 interfaces??"); |
| 139 |
|
| 97 |
Simulator::Destroy (); |
140 |
Simulator::Destroy (); |
| 98 |
} |
141 |
} |
| 99 |
|
142 |
|
|
|
143 |
|
| 100 |
static class IPv4L3ProtocolTestSuite : public TestSuite |
144 |
static class IPv4L3ProtocolTestSuite : public TestSuite |
| 101 |
{ |
145 |
{ |
| 102 |
public: |
146 |
public: |