Added ability to form a cluster via REST API.

Change-Id: Ib71f6b4caed1b1c4b9db78596ee35bf5cab05184
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java b/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java
index e567540..c3eb3c1 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterAdminService.java
@@ -17,12 +17,24 @@
 
 import org.onlab.packet.IpAddress;
 
+import java.util.Set;
+
 /**
  * Service for administering the cluster node membership.
  */
 public interface ClusterAdminService {
 
     /**
+     * Forms cluster configuration based on the specified set of node
+     * information.  This method resets and restarts the controller
+     * instance.
+     *
+     * @param nodes    set of nodes that form the cluster
+     * @param ipPrefix IP address prefix, e.g. 10.0.1.*
+     */
+    void formCluster(Set<ControllerNode> nodes, String ipPrefix);
+
+    /**
      * Adds a new controller node to the cluster.
      *
      * @param nodeId  controller node identifier
diff --git a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
index 4229e6a..cdb03b2 100644
--- a/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
+++ b/core/api/src/main/java/org/onosproject/cluster/ClusterStore.java
@@ -15,12 +15,12 @@
  */
 package org.onosproject.cluster;
 
-import java.util.Set;
-
 import org.joda.time.DateTime;
 import org.onlab.packet.IpAddress;
 import org.onosproject.store.Store;
 
+import java.util.Set;
+
 /**
  * Manages inventory of controller cluster nodes; not intended for direct use.
  */
@@ -65,6 +65,16 @@
     DateTime getLastUpdated(NodeId nodeId);
 
     /**
+     * Forms cluster configuration based on the specified set of node
+     * information. Assumes subsequent restart for the new configuration to
+     * take hold.
+     *
+     * @param nodes    set of nodes that form the cluster
+     * @param ipPrefix IP address prefix, e.g. 10.0.1.*
+     */
+    void formCluster(Set<ControllerNode> nodes, String ipPrefix);
+
+    /**
      * Adds a new controller node to the cluster.
      *
      * @param nodeId  controller node identifier
diff --git a/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java b/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java
index 31185dd..7d701d9 100644
--- a/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java
+++ b/core/api/src/main/java/org/onosproject/cluster/DefaultControllerNode.java
@@ -26,7 +26,7 @@
  */
 public class DefaultControllerNode implements ControllerNode {
 
-    private static final int DEFAULT_PORT = 9876;
+    public static final int DEFAULT_PORT = 9876;
 
     private final NodeId id;
     private final IpAddress ip;