blob: 5c7446277eef097e370b139a1cb5f52ead13feac [file] [log] [blame]
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +00001#! /bin/bash
2USERNAME=ubuntu
3CASSANDRA_DIR='/home/ubuntu/apache-cassandra-1.1.4'
4ZK_DIR='/home/ubuntu/zookeeper-3.4.5'
5ZK_LIB='/var/lib/zookeeper'
6CASSANDRA_LIB='/var/lib/cassandra'
7
8SSH_COPY="authorized_keys id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem"
9
10if [ $# == 2 ]; then
11 NR_NODES=$1
12 basename=$2
13else
14 echo "$0 nr_nodes basename"
15 exit
16fi
17
18if [ ! -f ./cluster.txt ]; then
19 echo "Cannot find cluster.txt"
20 exit
21fi
22
23export CLUSTER="./cluster.txt"
24dsh -g $basename 'uname -a'
25
26echo "Stopping Services"
27#dsh -g $basename 'cd ONOS; ./start-onos.sh stop'
28#dsh -g $basename 'cd ONOS; ./stop-cassandra stop'
29#dsh -g $basename '$ZK_DIR/bin/zkServer.sh stop'
30
31# authorized_keys cassandra.yaml hosts id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem onos.properties zoo.cfg
32## SSH Setting
33dsh -g $basename 'mkdir -m 700 .ssh'
34for n in $SSH_COPY; do
35 pcp -g $basename common/$n '.ssh'
36 if [ $n != "id_rsa.pub" ] ; then
37 dsh -g $basename "chmod 600 .ssh/$n"
38 fi
39done
40
41dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/commitlog/*"
42dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/saved_caches/*"
43dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/data/*"
44dsh -g $basename "sudo chown -R $username:$username $CASSANDRA_LIB"
45
46dsh -g $basename "sudo rm -rf $ZK_LIB/version-2*"
47dsh -g $basename "sudo rm -rf $ZK_LIB/myid"
48
49pcp -g $basename common/cassandra.yaml $CASSANDRA_DIR/conf
50pcp -g $basename common/zoo.cfg $ZK_DIR/conf
51pcp -g $basename common/hosts '~'
52
53for n in `seq 1 $NR_NODES`; do
54 pcp -w ${basename}${n} ${basename}${n}/hostname '~'
55 pcp -w ${basename}${n} ${basename}${n}/myid $ZK_DIR/conf
56done
57
58dsh -g $basename 'sudo cp ~/hostname /etc'
59dsh -g $basename 'sudo cp ~/hosts /etc'
60dsh -g $basename "cd $ZK_LIB; sudo ln -s $ZK_DIR/conf/myid"
61
62dsh -g $basename 'sudo hostname `cat /etc/hostname`'
63
64for n in `seq 2 $NR_NODES`; do
65 pcp -w ${basename}${n} ${basename}${n}/onsdemo_edge.py 'ONOS/test-network/mininet'
66 pcp -w ${basename}${n} ${basename}${n}/tunnel_onos_edge.sh 'ONOS/test-network/mininet'
67done
68pcp -w ${basename}1 ${basename}1/tunnel_onos_core.sh 'ONOS/test-network/mininet'
69pcp -w ${basename}1 ${basename}1/onsdemo_core.py 'ONOS/test-network/mininet'