blob: 8571ce0137e68a588d1ecbc39911d9c988bec115 [file] [log] [blame]
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +00001#! /bin/bash
Masayoshi Kobayashic18e3b62013-04-08 19:46:13 +00002if [ 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
5elif [ $# != 1 ]; then
6 echo "$0 hostfile"
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +00007 exit
8fi
9
Masayoshi Kobayashic18e3b62013-04-08 19:46:13 +000010basename=$ONOS_CLUSTER_BASENAME
11NR_NODES=$ONOS_CLUSTER_NR_NODES
12hosts_file=$1
13
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +000014for 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
21done
22cp template/onsdemo_core.py ${basename}1/onsdemo.py
23
Masayoshi Kobayashic18e3b62013-04-08 19:46:13 +000024cat $hosts_file | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +000025for 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
30done
31
32cat 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