Adding ability to add simulated hosts to the null provider.
Change-Id: Iaf96caf904e2e8a724064be39211087bf681dad0
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java b/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java
index 016b187..a075199 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/CustomTopologySimulator.java
@@ -17,11 +17,14 @@
package org.onosproject.provider.nil;
import com.google.common.collect.Maps;
+import org.onlab.packet.IpAddress;
import org.onlab.packet.MacAddress;
import org.onlab.packet.VlanId;
import org.onosproject.net.Device;
import org.onosproject.net.DeviceId;
import org.onosproject.net.HostId;
+import org.onosproject.net.HostLocation;
+import org.onosproject.net.host.DefaultHostDescription;
import java.util.Map;
@@ -80,6 +83,19 @@
nameToId.put(name, id);
}
+ /**
+ * Creates a simulated host.
+ *
+ * @param hostId host identifier
+ * @param location host location
+ * @param hostIp host IP address
+ */
+ public void createHost(HostId hostId, HostLocation location, IpAddress hostIp) {
+ DefaultHostDescription description =
+ new DefaultHostDescription(hostId.mac(), hostId.vlanId(), location, hostIp);
+ hostProviderService.hostDetected(hostId, description, false);
+ }
+
@Override
protected void createDevices() {
}