Code changes to ensure ONOS has each IP address attached to only one host at a time
Change-Id: I1b4de39175d5bfd5ddf04c9087f4f3beff264594
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 bd5d68f..1eb014f 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
@@ -21,9 +21,11 @@
import org.junit.Before;
import org.junit.Test;
import org.onlab.junit.TestTools;
+import org.onlab.osgi.ComponentContextAdapter;
import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
+import org.onosproject.cfg.ComponentConfigAdapter;
import org.onosproject.common.event.impl.TestEventDispatcher;
import org.onosproject.event.Event;
import org.onosproject.net.DeviceId;
@@ -43,6 +45,8 @@
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.trivial.SimpleHostStore;
+import java.util.Dictionary;
+import java.util.Hashtable;
import java.util.List;
import java.util.Set;
@@ -94,6 +98,16 @@
protected TestHostProvider provider;
protected HostProviderService providerService;
+ private static final ComponentContextAdapter REMOVE_DUPS =
+ new ComponentContextAdapter() {
+ @Override
+ public Dictionary getProperties() {
+ Hashtable<String, String> props = new Hashtable<>();
+ props.put("allowDuplicateIps", "true");
+ return props;
+ }
+ };
+
@Before
public void setUp() {
mgr = new HostManager();
@@ -101,8 +115,8 @@
injectEventDispatcher(mgr, new TestEventDispatcher());
registry = mgr;
mgr.networkConfigService = new TestNetworkConfigService();
- mgr.activate();
-
+ mgr.cfgService = new ComponentConfigAdapter();
+ mgr.activate(REMOVE_DUPS);
mgr.addListener(listener);
provider = new TestHostProvider();