Remove unsupported onos-form-cluster scripts
Change-Id: Idb9dcf8efd8f9dc83bc2d0b8afee80fbe573fba1
diff --git a/tools/package/bin/onos-form-cluster b/tools/package/bin/onos-form-cluster
deleted file mode 100755
index 4e3645c..0000000
--- a/tools/package/bin/onos-form-cluster
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-
-#
-# Copyright 2015-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.
-#
-
-# -----------------------------------------------------------------------------
-# Forms ONOS cluster using REST API of each separate instance.
-# -----------------------------------------------------------------------------
-function usage() {
- echo "usage: $(basename $0)[-x] [-P port] [-u user] [-p password] [-s partitionSize] ip1 ip2..." && exit 1
-}
-
-ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos'
-ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks'
-ONOS_WEB_PORT=${ONOS_WEB_PORT:-8181} # REST API port defaults to '8181'
-
-port=${ONOS_WEB_PORT}
-user=${ONOS_WEB_USER}
-password=${ONOS_WEB_PASS}
-
-# Scan arguments for user/password or other options...
-while getopts P:u:p:s: o; do
- case "$o" in
- P) port=$OPTARG;;
- u) user=$OPTARG;;
- p) password=$OPTARG;;
- s) partitionsize=$OPTARG;;
- *) usage;;
- esac
-done
-
-let OPC=$OPTIND-1
-shift $OPC
-
-[ $# -lt 2 ] && usage
-
-ip=$1
-shift
-nodes=$*
-
-ipPrefix=${ip%.*}
-
-aux=/tmp/${ipPrefix}.cluster.json
-trap "rm -f $aux" EXIT
-
-echo "{ \"nodes\": [ { \"ip\": \"$ip\" }" > $aux
-for node in $nodes; do
- echo ", { \"ip\": \"$node\" }" >> $aux
-done
-echo "], \"ipPrefix\": \"$ipPrefix.*\"" >> $aux
-if ! [ -z ${partitionsize} ]; then
- echo ", \"partitionSize\": $partitionsize" >> $aux
-fi
-echo " }" >> $aux
-
-for node in $ip $nodes; do
- echo "Forming cluster on $node..."
- curl --fail -sSL --user $user:$password -X POST \
- http://$node:$port/onos/v1/cluster/configuration -d @$aux
-done
diff --git a/tools/test/bin/onos-form-cluster b/tools/test/bin/onos-form-cluster
deleted file mode 100755
index a9f6a5b..0000000
--- a/tools/test/bin/onos-form-cluster
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# Forms ONOS cluster using REST API.
-# -----------------------------------------------------------------------------
-
-[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
-. $ONOS_ROOT/tools/build/envDefaults
-
-# Scan arguments for user/password or other options...
-while getopts u:p:s: o; do
- case "$o" in
- u) user=$OPTARG;;
- p) password=$OPTARG;;
- s) partitionsize=$OPTARG;;
- esac
-done
-ONOS_WEB_USER=${ONOS_WEB_USER:-onos} # ONOS WEB User defaults to 'onos'
-ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks} # ONOS WEB Password defaults to 'rocks'
-user=${user:-$ONOS_WEB_USER}
-password=${password:-$ONOS_WEB_PASS}
-let OPC=$OPTIND-1
-shift $OPC
-
-node=${1:-$OCI}
-
-if [ $node = "cell" ]; then
- nodes=${ONOS_INSTANCES}
- node=${OCI}
-else
- nodes="$@"
-fi
-
-if ! [ -z ${partitionsize} ]; then
- partitionarg="-s ${partitionsize}"
-else
- partitionarg=
-fi
-
-set -x
-
-ssh $ONOS_USER@$node $ONOS_INSTALL_DIR/bin/onos-form-cluster -u $user -p $partitionarg $password $nodes
diff --git a/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
index 664f0eb..47570c9 100644
--- a/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
+++ b/web/api/src/main/java/org/onosproject/rest/resources/ClusterWebResource.java
@@ -15,30 +15,19 @@
*/
package org.onosproject.rest.resources;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.onosproject.cluster.ClusterAdminService;
-import org.onosproject.cluster.ClusterService;
-import org.onosproject.cluster.ControllerNode;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.codec.JsonCodec;
-import org.onosproject.rest.AbstractWebResource;
-
import javax.ws.rs.GET;
-import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.HashSet;
-import java.util.List;
+
+import org.onosproject.cluster.ClusterService;
+import org.onosproject.cluster.ControllerNode;
+import org.onosproject.cluster.NodeId;
+import org.onosproject.rest.AbstractWebResource;
import static org.onlab.util.Tools.nullIsNotFound;
-import static org.onlab.util.Tools.readTreeFromStream;
/**
* Manage cluster of ONOS instances.
@@ -78,35 +67,4 @@
NODE_NOT_FOUND);
return ok(codec(ControllerNode.class).encode(node, this)).build();
}
-
- /**
- * Forms cluster of ONOS instances.
- * Forms ONOS cluster using the uploaded JSON definition.
- *
- * @param config cluster definition
- * @return 200 OK
- * @throws IOException to signify bad request
- * @onos.rsModel ClusterPost
- */
- @POST
- @Path("configuration")
- @Produces(MediaType.APPLICATION_JSON)
- public Response formCluster(InputStream config) throws IOException {
- JsonCodec<ControllerNode> codec = codec(ControllerNode.class);
- ObjectNode root = readTreeFromStream(mapper(), config);
-
- List<ControllerNode> nodes = codec.decode((ArrayNode) root.path("nodes"), this);
- JsonNode partitionSizeNode = root.get("partitionSize");
- if (partitionSizeNode != null) {
- int partitionSize = partitionSizeNode.asInt();
- if (partitionSize == 0) {
- return Response.notAcceptable(null).build();
- }
- get(ClusterAdminService.class).formCluster(new HashSet<>(nodes), partitionSize);
- } else {
- get(ClusterAdminService.class).formCluster(new HashSet<>(nodes));
- }
-
- return Response.ok().build();
- }
}