fix make-mininet.sh to handle dash(-) in hostname
diff --git a/cluster-mgmt/make-mininet.sh b/cluster-mgmt/make-mininet.sh
index 8571ce0..207b89e 100755
--- a/cluster-mgmt/make-mininet.sh
+++ b/cluster-mgmt/make-mininet.sh
@@ -8,6 +8,9 @@
fi
basename=$ONOS_CLUSTER_BASENAME
+## Shell Var can't handle "-" so replace it with "_"
+basename_var=`echo $ONOS_CLUSTER_BASENAME | sed 's/\-/_/g'`
+
NR_NODES=$ONOS_CLUSTER_NR_NODES
hosts_file=$1
@@ -21,14 +24,16 @@
done
cp template/onsdemo_core.py ${basename}1/onsdemo.py
-cat $hosts_file | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
+## Shell var can't handle "-" so replace it with "_"
+cat $hosts_file | sed 's/\-/\_/g' | awk '{printf("%s=%s\n",$2,$1)}' > .tmp
+
for n in `seq 2 $NR_NODES`; do
cat template/tunnel_onsdemo_edge_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\
sed "s/__NWID__/$n/g" |\
- sed "s/__TUNNEL__/TUNNEL\=\(\"1 $n ${basename}1\"\)/g" > ${basename}${n}/tunnel_onsdemo.sh
+ sed "s/__TUNNEL__/TUNNEL\=\(\"1 $n ${basename_var}1\"\)/g" > ${basename}${n}/tunnel_onsdemo.sh
chmod 755 ${basename}${n}/tunnel_onsdemo.sh
done
cat template/tunnel_onsdemo_core_template.sh | awk '{if(NR==2){system("cat .tmp")}else{print $0}}' |\
- sed "s/__basename__/$basename/g" > ${basename}1/tunnel_onsdemo.sh
+ sed "s/__basename__/${basename_var}/g" > ${basename}1/tunnel_onsdemo.sh
chmod 755 ${basename}1/tunnel_onsdemo.sh