Fixing null provider custom topo simulator

- properly deal with device mastership
- allow creation of multi-homed hosts
- made UI location parameters optional
- added a simulated fabric script

Change-Id: I8558cc06aa4c323fab898b02fba9659b202c5392
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;
-    }
-
 }