blob: 27213d97ad91ba205014930c1f9771677ebc5222 [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
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +000018dsh -g $basename 'uname -a'
19
20echo "Stopping Services"
21#dsh -g $basename 'cd ONOS; ./start-onos.sh stop'
22#dsh -g $basename 'cd ONOS; ./stop-cassandra stop'
23#dsh -g $basename '$ZK_DIR/bin/zkServer.sh stop'
24
25# authorized_keys cassandra.yaml hosts id_rsa id_rsa.pub known_hosts onlab-gui.pem onlabkey.pem onos.properties zoo.cfg
26## SSH Setting
27dsh -g $basename 'mkdir -m 700 .ssh'
28for n in $SSH_COPY; do
29 pcp -g $basename common/$n '.ssh'
30 if [ $n != "id_rsa.pub" ] ; then
31 dsh -g $basename "chmod 600 .ssh/$n"
32 fi
33done
34
35dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/commitlog/*"
36dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/saved_caches/*"
37dsh -g $basename "sudo rm -rf $CASSANDRA_LIB/data/*"
38dsh -g $basename "sudo chown -R $username:$username $CASSANDRA_LIB"
39
40dsh -g $basename "sudo rm -rf $ZK_LIB/version-2*"
41dsh -g $basename "sudo rm -rf $ZK_LIB/myid"
42
43pcp -g $basename common/cassandra.yaml $CASSANDRA_DIR/conf
44pcp -g $basename common/zoo.cfg $ZK_DIR/conf
45pcp -g $basename common/hosts '~'
46
47for n in `seq 1 $NR_NODES`; do
48 pcp -w ${basename}${n} ${basename}${n}/hostname '~'
49 pcp -w ${basename}${n} ${basename}${n}/myid $ZK_DIR/conf
50done
51
52dsh -g $basename 'sudo cp ~/hostname /etc'
53dsh -g $basename 'sudo cp ~/hosts /etc'
54dsh -g $basename "cd $ZK_LIB; sudo ln -s $ZK_DIR/conf/myid"
55
56dsh -g $basename 'sudo hostname `cat /etc/hostname`'
57
58for n in `seq 2 $NR_NODES`; do
59 pcp -w ${basename}${n} ${basename}${n}/onsdemo_edge.py 'ONOS/test-network/mininet'
60 pcp -w ${basename}${n} ${basename}${n}/tunnel_onos_edge.sh 'ONOS/test-network/mininet'
61done
62pcp -w ${basename}1 ${basename}1/tunnel_onos_core.sh 'ONOS/test-network/mininet'
63pcp -w ${basename}1 ${basename}1/onsdemo_core.py 'ONOS/test-network/mininet'