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 cf1e22d..52883a2 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
@@ -27,6 +27,7 @@
 import org.onosproject.net.host.DefaultHostDescription;
 
 import java.util.Map;
+import java.util.Set;
 
 import static org.onlab.util.Tools.toHex;
 import static org.onosproject.provider.nil.NullProviders.SCHEME;
@@ -96,6 +97,19 @@
         hostProviderService.hostDetected(hostId, description, false);
     }
 
+    /**
+     * Creates a simulated multi-homed host.
+     *
+     * @param hostId   host identifier
+     * @param locations host locations
+     * @param hostIps   host IP addresses
+     */
+    public void createHost(HostId hostId, Set<HostLocation> locations, Set<IpAddress> hostIps) {
+        DefaultHostDescription description =
+                new DefaultHostDescription(hostId.mac(), hostId.vlanId(), locations, hostIps, false);
+        hostProviderService.hostDetected(hostId, description, false);
+    }
+
     @Override
     protected void createDevices() {
     }
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/NullProviders.java b/providers/null/src/main/java/org/onosproject/provider/nil/NullProviders.java
index 1250877..7313f12 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/NullProviders.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/NullProviders.java
@@ -439,8 +439,9 @@
 
         @Override
         public boolean isReachable(DeviceId deviceId) {
-            return topoShape.equals("custom") ||
-                    (simulator != null && simulator.contains(deviceId) &&
+            return simulator != null &&
+                    (simulator.contains(deviceId) || !deviceService.getPorts(deviceId).isEmpty()) &&
+                    (simulator instanceof CustomTopologySimulator ||
                             topologyMutationDriver.isReachable(deviceId));
         }
 
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/TopologySimulator.java b/providers/null/src/main/java/org/onosproject/provider/nil/TopologySimulator.java
index 8152da3..f531ae6 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/TopologySimulator.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/TopologySimulator.java
@@ -177,9 +177,7 @@
      * @param i index of the device id in the list.
      */
     protected void createDevice(int i) {
-        DeviceId id = DeviceId.deviceId(SCHEME + ":" + toHex(i));
-        deviceIds.add(id);
-        createDevice(id, i);
+        createDevice(DeviceId.deviceId(SCHEME + ":" + toHex(i)), i);
     }
 
     /**
@@ -205,6 +203,7 @@
                 new DefaultDeviceDescription(id.uri(), type,
                                              "ON.Lab", "0.1", "0.1", "1234",
                                              new ChassisId(chassisId));
+        deviceIds.add(id);
         deviceProviderService.deviceConnected(id, desc);
         deviceProviderService.updatePorts(id, buildPorts(portCount));
     }
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullDevice.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullDevice.java
index b6c668f..4d081f8 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullDevice.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullDevice.java
@@ -17,7 +17,6 @@
 
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.Device;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.config.NetworkConfigService;
@@ -31,34 +30,32 @@
  */
 @Command(scope = "onos", name = "null-create-device",
         description = "Adds a simulated device to the custom topology simulation")
-public class CreateNullDevice extends AbstractShellCommand {
-    private static final String GEO = "geo";
-    private static final String GRID = "grid";
+public class CreateNullDevice extends CreateNullEntity {
 
     @Argument(index = 0, name = "type", description = "Device type, e.g. switch, roadm",
-            required = true, multiValued = false)
+            required = true)
     String type = null;
 
     @Argument(index = 1, name = "name", description = "Device name",
-            required = true, multiValued = false)
+            required = true)
     String name = null;
 
     @Argument(index = 2, name = "portCount", description = "Port count",
-            required = true, multiValued = false)
+            required = true)
     Integer portCount = null;
 
     @Argument(index = 3, name = "latOrY",
             description = "Geo latitude / Grid y-coord",
-            required = true, multiValued = false)
+            required = false)
     Double latOrY = null;
 
     @Argument(index = 4, name = "longOrX",
             description = "Geo longitude / Grid x-coord",
-            required = true, multiValued = false)
+            required = false)
     Double longOrX = null;
 
     @Argument(index = 5, name = "locType", description = "Location type {geo|grid}",
-            required = false, multiValued = false)
+            required = false)
     String locType = GEO;
 
     @Override
@@ -67,28 +64,15 @@
         NetworkConfigService cfgService = get(NetworkConfigService.class);
 
         TopologySimulator simulator = service.currentSimulator();
-        if (!(simulator instanceof CustomTopologySimulator)) {
-            error("Custom topology simulator is not active.");
-            return;
-        }
-
-        if (!(GEO.equals(locType) || GRID.equals(locType))) {
-            error("locType must be 'geo' or 'grid'.");
+        if (!validateSimulator(simulator) || !validateLocType(locType)) {
             return;
         }
 
         CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
         DeviceId deviceId = sim.nextDeviceId();
         BasicDeviceConfig cfg = cfgService.addConfig(deviceId, BasicDeviceConfig.class);
-        cfg.name(name)
-                .locType(locType);
-
-        if (GEO.equals(locType)) {
-            cfg.latitude(latOrY).longitude(longOrX);
-        } else {
-            cfg.gridX(longOrX).gridY(latOrY);
-        }
-        cfg.apply();
+        cfg.name(name);
+        setUiCoordinates(cfg, locType, latOrY, longOrX);
 
         sim.createDevice(deviceId, name, Device.Type.valueOf(type.toUpperCase()), portCount);
     }
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullEntity.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullEntity.java
new file mode 100644
index 0000000..ed68dfc
--- /dev/null
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullEntity.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2018-present Open Networking Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.provider.nil.cli;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.primitives.Longs;
+import org.onosproject.cli.AbstractShellCommand;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.DeviceId;
+import org.onosproject.net.config.basics.BasicElementConfig;
+import org.onosproject.net.edge.EdgePortService;
+import org.onosproject.net.host.HostService;
+import org.onosproject.provider.nil.CustomTopologySimulator;
+import org.onosproject.provider.nil.TopologySimulator;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * Base command for adding simulated entities to the custom topology simulation.
+ */
+public abstract class CreateNullEntity extends AbstractShellCommand {
+    protected static final String GEO = "geo";
+    protected static final String GRID = "grid";
+
+    /**
+     * Validates that the simulator is custom.
+     *
+     * @param simulator topology simulator
+     * @return true if valid
+     */
+    protected boolean validateSimulator(TopologySimulator simulator) {
+        if (!(simulator instanceof CustomTopologySimulator)) {
+            error("Custom topology simulator is not active.");
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Validates that the location type is valid.
+     *
+     * @param locType location type
+     * @return true if valid
+     */
+    protected boolean validateLocType(String locType) {
+        if (!(GEO.equals(locType) || GRID.equals(locType))) {
+            error("locType must be 'geo' or 'grid'.");
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Sets the UI location coordinates appropriately.
+     *
+     * @param cfg     element config
+     * @param locType location type
+     * @param latOrY  latitude or Y grid
+     * @param longOrX longitude or X grid
+     */
+    protected void setUiCoordinates(BasicElementConfig cfg,
+                                    String locType, Double latOrY, Double longOrX) {
+        if (latOrY != null && longOrX != null) {
+            cfg.locType(locType);
+            if (GEO.equals(locType)) {
+                cfg.latitude(latOrY).longitude(longOrX);
+            } else {
+                cfg.gridX(longOrX).gridY(latOrY);
+            }
+        }
+        cfg.apply();
+    }
+
+    /**
+     * Finds an available connect point among edge ports of the specified device.
+     *
+     * @param deviceId   device identifier
+     * @param otherPoint optional other point to be excluded from search
+     * @return connect point available for link or host attachment
+     */
+    protected ConnectPoint findAvailablePort(DeviceId deviceId, ConnectPoint otherPoint) {
+        EdgePortService eps = get(EdgePortService.class);
+        HostService hs = get(HostService.class);
+
+        List<ConnectPoint> points = ImmutableList
+                .sortedCopyOf((l, r) -> Longs.compare(l.port().toLong(), r.port().toLong()),
+                              eps.getEdgePoints(deviceId));
+        return points.stream()
+                .filter(p -> !Objects.equals(p, otherPoint) && hs.getConnectedHosts(p).isEmpty())
+                .findFirst().orElse(null);
+    }
+}
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullHost.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullHost.java
index 5197e79..e1eb5dd 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullHost.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullHost.java
@@ -16,54 +16,51 @@
 
 package org.onosproject.provider.nil.cli;
 
+import com.google.common.collect.ImmutableSet;
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.onlab.packet.IpAddress;
-import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.DeviceId;
 import org.onosproject.net.HostId;
 import org.onosproject.net.HostLocation;
 import org.onosproject.net.config.NetworkConfigService;
 import org.onosproject.net.config.basics.BasicHostConfig;
-import org.onosproject.net.edge.EdgePortService;
-import org.onosproject.net.host.HostService;
 import org.onosproject.provider.nil.CustomTopologySimulator;
 import org.onosproject.provider.nil.NullProviders;
 import org.onosproject.provider.nil.TopologySimulator;
 
-import java.util.HashSet;
-import java.util.Iterator;
+import java.util.Set;
+
+import static java.util.Objects.requireNonNull;
 
 /**
  * Adds a simulated end-station host to the custom topology simulation.
  */
 @Command(scope = "onos", name = "null-create-host",
         description = "Adds a simulated end-station host to the custom topology simulation")
-public class CreateNullHost extends AbstractShellCommand {
-    private static final String GEO = "geo";
-    private static final String GRID = "grid";
+public class CreateNullHost extends CreateNullEntity {
 
-    @Argument(index = 0, name = "deviceName", description = "Name of device where host is attached",
-            required = true, multiValued = false)
-    String deviceName = null;
+    @Argument(index = 0, name = "deviceNames", description = "Name of device where host is attached; comma-separated",
+            required = true)
+    String deviceNames = null;
 
-    @Argument(index = 1, name = "hostIp", description = "Host IP address",
-            required = true, multiValued = false)
-    String hostIp = null;
+    @Argument(index = 1, name = "hostIps", description = "Host IP addresses; comma-separated",
+            required = true)
+    String hostIps = null;
 
     @Argument(index = 2, name = "latOrY",
             description = "Geo latitude / Grid y-coord",
-            required = true, multiValued = false)
+            required = false)
     Double latOrY = null;
 
     @Argument(index = 3, name = "longOrX",
             description = "Geo longitude / Grid x-coord",
-            required = true, multiValued = false)
+            required = false)
     Double longOrX = null;
 
     @Argument(index = 4, name = "locType", description = "Location type {geo|grid}",
-            required = false, multiValued = false)
+            required = false)
     String locType = GEO;
 
     @Override
@@ -72,48 +69,43 @@
         NetworkConfigService cfgService = get(NetworkConfigService.class);
 
         TopologySimulator simulator = service.currentSimulator();
-        if (!(simulator instanceof CustomTopologySimulator)) {
-            error("Custom topology simulator is not active.");
-            return;
-        }
-
-        if (!(GEO.equals(locType) || GRID.equals(locType))) {
-            error("locType must be 'geo' or 'grid'.");
+        if (!validateSimulator(simulator) || !validateLocType(locType)) {
             return;
         }
 
         CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
-        DeviceId deviceId = sim.deviceId(deviceName);
         HostId id = sim.nextHostId();
-        HostLocation location = findAvailablePort(deviceId);
+        Set<HostLocation> locations = getLocations(sim, deviceNames);
+        Set<IpAddress> ips = getIps(hostIps);
+
         BasicHostConfig cfg = cfgService.addConfig(id, BasicHostConfig.class);
+        setUiCoordinates(cfg, locType, latOrY, longOrX);
 
-        cfg.locType(locType);
-        cfg.setLocations(new HashSet<HostLocation>() {{ add(location); }});
+        sim.createHost(id, locations, ips);
+    }
 
-        if (GEO.equals(locType)) {
-            cfg.latitude(latOrY).longitude(longOrX);
-        } else {
-            cfg.gridX(longOrX).gridY(latOrY);
+    private Set<IpAddress> getIps(String hostIps) {
+        ImmutableSet.Builder<IpAddress> ips = ImmutableSet.builder();
+        String[] csv = hostIps.split(",");
+        for (String s : csv) {
+            ips.add(IpAddress.valueOf(s));
         }
-        cfg.apply();
+        return ips.build();
+    }
 
-        sim.createHost(id, location, IpAddress.valueOf(hostIp));
+    private Set<HostLocation> getLocations(CustomTopologySimulator sim, String deviceNames) {
+        ImmutableSet.Builder<HostLocation> locations = ImmutableSet.builder();
+        String[] csv = deviceNames.split(",");
+        for (String s : csv) {
+            locations.add(requireNonNull(findAvailablePort(sim.deviceId(s))));
+        }
+        return locations.build();
     }
 
     // Finds an available connect point among edge ports of the specified device
     private HostLocation findAvailablePort(DeviceId deviceId) {
-        EdgePortService eps = get(EdgePortService.class);
-        HostService hs = get(HostService.class);
-        Iterator<ConnectPoint> points = eps.getEdgePoints(deviceId).iterator();
-
-        while (points.hasNext()) {
-            ConnectPoint point = points.next();
-            if (hs.getConnectedHosts(point).isEmpty()) {
-                return new HostLocation(point, System.currentTimeMillis());
-            }
-        }
-        return null;
+        ConnectPoint point = findAvailablePort(deviceId, null);
+        return point == null ? null : new HostLocation(point, System.currentTimeMillis());
     }
 
 }
diff --git a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullLink.java b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullLink.java
index 1b609cf..72e1781 100644
--- a/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullLink.java
+++ b/providers/null/src/main/java/org/onosproject/provider/nil/cli/CreateNullLink.java
@@ -19,40 +19,32 @@
 import org.apache.karaf.shell.commands.Argument;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
-import org.onosproject.cli.AbstractShellCommand;
 import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
 import org.onosproject.net.Link;
-import org.onosproject.net.edge.EdgePortService;
-import org.onosproject.net.host.HostService;
 import org.onosproject.provider.nil.CustomTopologySimulator;
 import org.onosproject.provider.nil.NullProviders;
 import org.onosproject.provider.nil.TopologySimulator;
 
-import java.util.Iterator;
-import java.util.Objects;
-
 /**
  * Adds a simulated link to the custom topology simulation.
  */
 @Command(scope = "onos", name = "null-create-link",
         description = "Adds a simulated link to the custom topology simulation")
-public class CreateNullLink extends AbstractShellCommand {
+public class CreateNullLink extends CreateNullEntity {
 
     @Argument(index = 0, name = "type", description = "Link type, e.g. direct, indirect, optical",
-            required = true, multiValued = false)
+            required = true)
     String type = null;
 
     @Argument(index = 1, name = "src", description = "Source device name",
-            required = true, multiValued = false)
+            required = true)
     String src = null;
 
     @Argument(index = 2, name = "dst", description = "Destination device name",
-            required = true, multiValued = false)
+            required = true)
     String dst = null;
 
-    @Option(name = "-u", aliases = "--unidirectional", description = "Unidirectional link only",
-            required = false, multiValued = false)
+    @Option(name = "-u", aliases = "--unidirectional", description = "Unidirectional link only")
     private boolean unidirectional = false;
 
     @Override
@@ -71,19 +63,4 @@
         sim.createLink(one, two, Link.Type.valueOf(type.toUpperCase()), !unidirectional);
     }
 
-    // Finds an available connect point among edge ports of the specified device
-    private ConnectPoint findAvailablePort(DeviceId deviceId, ConnectPoint otherPoint) {
-        EdgePortService eps = get(EdgePortService.class);
-        HostService hs = get(HostService.class);
-        Iterator<ConnectPoint> points = eps.getEdgePoints(deviceId).iterator();
-
-        while (points.hasNext()) {
-            ConnectPoint point = points.next();
-            if (!Objects.equals(point, otherPoint) && hs.getConnectedHosts(point).isEmpty()) {
-                return point;
-            }
-        }
-        return null;
-    }
-
 }
diff --git a/tools/test/topos/cfab-null b/tools/test/topos/cfab-null
new file mode 100755
index 0000000..8993d2e
--- /dev/null
+++ b/tools/test/topos/cfab-null
@@ -0,0 +1,85 @@
+#!/bin/bash
+# -----------------------------------------------------------------------------
+# Creates a spine-leaf fabric with large number of hosts using null providers
+# -----------------------------------------------------------------------------
+
+# config
+node=${1:-$OCI}
+
+# Create the script of ONOS commands first and then execute it all at once.
+export CMDS="/tmp/fab-onos.cmds"
+rm $CMDS
+
+function sim {
+    echo "$@" >> $CMDS
+}
+
+sim "wipe-out please"
+
+spinePorts=48
+leafPorts=64
+accessPorts=1024
+
+# Create spines
+for spine in {1..2}; do
+    sim "null-create-device switch Spine-${spine} ${spinePorts}"
+done
+
+# Create 2 leaf pairs with dual links to the spines and a link between the pair
+for pair in A B; do
+    sim "null-create-device switch Leaf-${pair}1 ${leafPorts}"
+    sim "null-create-device switch Leaf-${pair}2 ${leafPorts}"
+    sim "null-create-link direct Leaf-${pair}1 Leaf-${pair}2"
+
+    for spine in {1..2}; do
+        for link in {1..2}; do
+            sim "null-create-link direct Spine-${spine} Leaf-${pair}1"
+            sim "null-create-link direct Spine-${spine} Leaf-${pair}2"
+        done
+    done
+
+    # Create hosts for each leaf group; multi-homed to each leaf in the pair
+    [ $pair = A ] && pn=1 || pn=2
+    for host in {1..10}; do
+        sim "null-create-host Leaf-${pair}1,Leaf-${pair}2 10.${pn}.1.${host}"
+    done
+done
+
+# Create 8 single leafs with dual links to the spines
+for access in {1..8}; do
+    sim "null-create-device switch Access-${access} ${accessPorts}"
+
+    for spine in {1..2}; do
+        for link in {1..2}; do
+            sim "null-create-link direct Spine-${spine} Access-${access}"
+        done
+    done
+
+    # Create hosts for each single leaf
+    for host in {1..25}; do
+        sim "null-create-host Access-${access} 10.0.${access}.${host}"
+    done
+done
+
+
+
+# make sure null providers are activated
+onos ${node} app activate org.onosproject.null
+
+sleep 2
+
+# start custom simulation..
+onos ${node} null-simulation start custom
+
+# Generate the recipe using the following:
+# 2 spines, can potentially be few more
+# 12 leaves in total
+#     2 leaf pair
+#     8 non-paired
+# Host per leaf up to 1K
+
+sleep 5
+
+# Add devices, links, and hosts
+cat $CMDS | onos ${node}
+
