Masayoshi Kobayashi | f358ff5 | 2013-03-22 00:31:59 +0000 | [diff] [blame] | 1 | #! /bin/bash |
Masayoshi Kobayashi | c18e3b6 | 2013-04-08 19:46:13 +0000 | [diff] [blame] | 2 | if [ x$ONOS_CLUSTER_BASENAME == "x" -o x$ONOS_CLUSTER_NR_NODES == "x" ]; then |
| 3 | echo "set environment variable ONOS_CLUSTER_BASENAME and ONOS_CLUSTER_NR_NODES" |
| 4 | exit |
| 5 | elif [ $# != 1 ]; then |
| 6 | echo "$0 hostfile" |
Masayoshi Kobayashi | f358ff5 | 2013-03-22 00:31:59 +0000 | [diff] [blame] | 7 | exit |
| 8 | fi |
| 9 | |
Masayoshi Kobayashi | c18e3b6 | 2013-04-08 19:46:13 +0000 | [diff] [blame] | 10 | basename=$ONOS_CLUSTER_BASENAME |
| 11 | NR_NODES=$ONOS_CLUSTER_NR_NODES |
| 12 | hosts_file=$1 |
| 13 | |
Masayoshi Kobayashi | f358ff5 | 2013-03-22 00:31:59 +0000 | [diff] [blame] | 14 | for n in `seq 2 $NR_NODES`; do |
| 15 | if [ $n == 2 ]; then |
| 16 | nrsw=50 |
| 17 | else |
| 18 | nrsw=25 |
| 19 | fi |
| 20 | cat template/onsdemo_edge_template.py | sed "s/__NWID__/$n/g" | sed "s/__NRSW__/${nrsw}/g" > ${basename}${n}/onsdemo.py |
| 21 | done |
| 22 | cp template/onsdemo_core.py ${basename}1/onsdemo.py |
| 23 | |
Masayoshi Kobayashi | c18e3b6 | 2013-04-08 19:46:13 +0000 | [diff] [blame] | 24 | cat $hosts_file | awk '{printf("%s=%s\n",$2,$1)}' > .tmp |
Masayoshi Kobayashi | f358ff5 | 2013-03-22 00:31:59 +0000 | [diff] [blame] | 25 | for n in `seq 2 $NR_NODES`; do |
| 26 | cat template/tunnel_onsdemo_edge_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\ |
| 27 | sed "s/__NWID__/$n/g" |\ |
| 28 | sed "s/__TUNNEL__/TUNNEL\=\(\"1 $n ${basename}1\"\)/g" > ${basename}${n}/tunnel_onsdemo.sh |
| 29 | chmod 755 ${basename}${n}/tunnel_onsdemo.sh |
| 30 | done |
| 31 | |
| 32 | cat template/tunnel_onsdemo_core_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\ |
| 33 | sed "s/__basename__/$basename/g" > ${basename}1/tunnel_onsdemo.sh |
| 34 | chmod 755 ${basename}1/tunnel_onsdemo.sh |