|
|
| 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 |
output = interface->RemoveAddress (Ipv4Address ("250.0.0.1")); |
| 99 |
NS_TEST_ASSERT_MSG_EQ (ifaceAddr4, output, |
| 100 |
"The addresses should be identical"); |
| 101 |
num = interface->GetNAddresses (); |
| 102 |
NS_TEST_ASSERT_MSG_EQ (num, 2, "Should find 2 interfaces??"); |
| 103 |
|
| 104 |
output = interface->RemoveAddress (Ipv4Address ("253.123.9.81")); |
| 105 |
NS_TEST_ASSERT_MSG_EQ (Ipv4InterfaceAddress (), output, |
| 106 |
"The addresses should be identical"); |
| 107 |
num = interface->GetNAddresses (); |
| 108 |
NS_TEST_ASSERT_MSG_EQ (num, 2, "Should find 2 interfaces??"); |
| 109 |
|
| 110 |
bool removalSuccess = ipv4->RemoveAddress (index, Ipv4Address |
| 111 |
("192.168.0.2")); |
| 112 |
NS_TEST_ASSERT_MSG_EQ (true, removalSuccess, |
| 113 |
"The addresses was not removed"); |
| 114 |
num = interface->GetNAddresses (); |
| 115 |
NS_TEST_ASSERT_MSG_EQ (num, 1, "Should find 1 interfaces??"); |
| 116 |
removalSuccess = ipv4->RemoveAddress (index, Ipv4Address ("127.0.0.1")); |
| 117 |
NS_TEST_ASSERT_MSG_EQ (false, removalSuccess, |
| 118 |
"Shouldn't removed loopback address"); |
| 119 |
output = interface->RemoveAddress (Ipv4Address ("127.0.0.1")); |
| 120 |
NS_TEST_ASSERT_MSG_EQ (Ipv4InterfaceAddress (), output, |
| 121 |
"The addresses should be identical"); |
| 122 |
|
| 123 |
removalSuccess = ipv4->RemoveAddress (index, Ipv4Address ("189.0.0.1")); |
| 124 |
NS_TEST_ASSERT_MSG_EQ (false, removalSuccess, |
| 125 |
"Non-existent IP Address removed"); |
| 97 |
Simulator::Destroy (); |
126 |
Simulator::Destroy (); |
| 98 |
} |
127 |
} |
| 99 |
|
128 |
|
|
|
129 |
|
| 100 |
static class IPv4L3ProtocolTestSuite : public TestSuite |
130 |
static class IPv4L3ProtocolTestSuite : public TestSuite |
| 101 |
{ |
131 |
{ |
| 102 |
public: |
132 |
public: |