blob: e314114818605f81954889b4908ca595e258cf22 [file] [log] [blame]
Masayoshi Kobayashif358ff52013-03-22 00:31:59 +00001#! /bin/bash
2if [ $# == 3 ]; then
3 NR_NODES=$1
4 basename=$2
5 hosts_file=$3
6else
7 echo "$0 nr_hodes basename hostfile"
8 exit
9fi
10
11for 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
18done
19cp template/onsdemo_core.py ${basename}1/onsdemo.py
20
21cat hosts | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
22for 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
27done
28
29cat 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