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