Allow host provider to remove a learnt host provided by others
Before, a host provider is allowed to remove
O learnt hosts provided by itself
O configured hosts provided by itself
X learnt hosts provided by other
X configured hosts provided by other
After, a host provider is allowed to remove
O learnt hosts provided by itself
O configured hosts provided by itself
O learnt hosts provided by other
X configured hosts provided by other
Also, fix tests in HostManagerTest
Change-Id: Ibce4567017a74cdec1dd77bd82de5b9de2559b5f
diff --git a/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java b/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java
index ba27dcb..f2beda1 100644
--- a/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/host/impl/HostManagerTest.java
@@ -259,7 +259,8 @@
}
/**
- * Providers should only be able to remove a host provided by itself.
+ * Providers should only be able to remove a host that is provided by itself,
+ * or a host that is not configured.
*/
@Test
public void hostVanishedWithMultipleProviders() {
@@ -267,16 +268,15 @@
configured(HID2, MAC2, VLAN2, LOC2, IP2);
providerService2.hostVanished(HID1);
- assertNotNull("host should not be removed", mgr.getHost(HID1));
+ assertNull("Should be able to remove learnt host", mgr.getHost(HID1));
providerService.hostVanished(HID2);
- assertNotNull("host should not be removed", mgr.getHost(HID2));
-
- providerService.hostVanished(HID1);
- assertNull("host should be removed", mgr.getHost(HID1));
+ assertNotNull("Should not be able to remove configured host since the provider is different",
+ mgr.getHost(HID2));
providerService2.hostVanished(HID2);
- assertNull("host should be removed", mgr.getHost(HID2));
+ assertNull("Should be able to remove configured host when provider is the same",
+ mgr.getHost(HID2));
}
private void validateHosts(