view mrb/update_all_vm.sh @ 0:9e5a3c884de6

Initial import of the virtual testbed.
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 17 Jun 2010 11:00:32 +0900
parents
children 7b569c198c7c
line wrap: on
line source

#!/bin/bash 

echo ""

# The root of the testbed, which provides internet access
MGR="__mgr.testbed.aaa"
# Root of each testbed which isolates the VMs from the other testbeds
MGRS=""
# The list of all VMs
VMS=""

for testb in "$@"; do
 case "$testb" in
   simple)
	# The simple testbed
	MGRS="$MGRS simple-simplemgr.testbed.aaa"
	VMS="$VMS simple-cli.simple.testbed.aaa"
	VMS="$VMS simple-serv.simple.testbed.aaa"
	;;

   rt)
	# The routing testbed
	MGRS="$MGRS rt-rtmgr.testbed.aaa"
	VMS="$VMS rt-nas.a.rt.testbed.aaa rt-proxy.a.rt.testbed.aaa"
	VMS="$VMS rt-proxy.b.rt.testbed.aaa rt-serv.b.rt.testbed.aaa"
	;;
	
   rtsup)
	# The routing testbed
	VMS="$VMS rt-relay.a.rt.testbed.aaa"
#	VMS="$VMS rt-relay.b.rt.testbed.aaa"
	VMS="$VMS rt-proxy.c.rt.testbed.aaa rt-relay.c.rt.testbed.aaa"
	;;
	
   eap)
	# The EAP testbed
	MGRS="$MGRS eap-eapmgr.testbed.aaa"
	VMS="$VMS supauth.eap.testbed.aaa gw.eap.testbed.aaa"
	VMS="$VMS backend.eap.testbed.aaa opendiam.eap.testbed.aaa"
	;;
	
   *)
   	echo "Unknown testbed subset $testb"
	;;
 esac
done

if [ -z "$VMS" ]; 
then echo "Please specify a VM subset such as: rt, rtsup, simple, ...";
exit 1;
fi

# OK let's start the VMS now.
echo "Starting all VMs"

# The keyboard scancodes for "aptitude update && aptitude dist-upgrade -y &&"
UPDATE_SC="1e 9e 19 99 14 94 17 97 14 94 16 96 20 a0 12 92 39 b9"
UPDATE_SC="$UPDATE_SC 16 96 19 99 20 a0 1e 9e 14 12 92 39 b9"
UPDATE_SC="$UPDATE_SC 1c 9c"
UPGRADE_SC="1e 9e 19 99 14 94 17 97 14 94 16 96 20 a0 12 92 39 b9"
UPGRADE_SC="$UPGRADE_SC 20 a0 17 97 1f 9f 14 94 0c 8c 16 96 19 99 22 a2 13 93 1e 9e 20 a0 12 92 39 b9 0c 8c 15 95 39 b9"
UPGRADE_SC="$UPGRADE_SC 2a 07 87 07 87 aa 39 b9"

start_and_update() {
	./vm_start.sh "$1"
	VBoxManage controlvm "$1" keyboardputscancode $UPDATE_SC >/dev/null 
}

upgrade_and_stop() {
	VBoxManage controlvm "$1" keyboardputscancode $UPGRADE_SC >/dev/null &
	./vm_stop.sh "$1" nochgcns waitterm
}	

# Start the VMs by hierarchical order
start_and_update "$MGR"
for VM in $MGRS; do
	start_and_update "$VM" &
	sleep 15
done
wait
for VM in $VMS; do
	start_and_update "$VM" &
	sleep 15
done
wait

# upgrade and stop in reverse order
for VM in $VMS; do
	upgrade_and_stop "$VM" &
done
wait
for VM in $MGRS; do
	upgrade_and_stop "$VM" &
done
wait
upgrade_and_stop "$MGR"

#All done!
exit 0
"Welcome to our mercurial repository"