diff options
author | 2015-08-14 14:30:41 -0700 | |
---|---|---|
committer | 2015-08-14 14:30:41 -0700 | |
commit | 12b2b2c38e01a00c07c09b924a5b62f8ddc74145 (patch) | |
tree | 37ee93a9c36f6aac8e6b12e5e9111af7c99be30d /QTIP.sh | |
parent | be6d041ae8279f7a8e6de4153217108a7b383637 (diff) |
Added automation script, 2 test cases, Heat template for test case, Project INFO files
Structured existing playbooks into directories, added automations scripts and test cases which
were demonstrated in demo1. Basic Directoy structure also introduced. All hard coded values removed.
JIRA: QTIP-3
Change-Id: Icdceb0f125a5275d3dee7845a403e567d729dc26
Signed-off-by: Nauman Ahad <Nauman_Ahad@dell.com>
Diffstat (limited to 'QTIP.sh')
-rwxr-xr-x | QTIP.sh | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/QTIP.sh b/QTIP.sh new file mode 100755 index 00000000..dcefb29f --- /dev/null +++ b/QTIP.sh @@ -0,0 +1,116 @@ +#! /bin/bash + +#DIR1= $PWD + + + +function Call_Test { + + case "$1" in + dhrystone) + mkdir $PWD/results/dhrystone + ansible-playbook -s $PWD/benchmarks/playbooks/dhrystone.yaml --extra-vars "Dest_dir=$PWD/results" -v + + ;; + + ramspeed) + mkdir $PWD/results/ramspeed + ansible-playbook -s $PWD/benchmarks/playbooks/ramspeedbench.yaml --extra-vars "Dest_dir=$PWD/results" -v + ;; + + cachebench) + mkdir $PWD/results/cachebench + ansible-playbook -s $PWD/benchmarks/playbooks/cachebench.yaml --extra-vars "Dest_dir=$PWD/results" -v + ;; + + whetstone) + mkdir $PWD/results/whetstone + ansible-playbook -s $PWD/benchmarks/playbooks/whetstone.yaml --extra-vars "Dest_dir=$PWD/results" -v + ;; + + *) + echo "Please pass a correct argument to test. use -h for more details" + ;; + esac + +} + +mkdir $PWD/results +case "$1" in + -h) + printf "To run test.sh, 2 arguments are required\n" + printf "First argument: The Test case to run\nOptions:\nFirst: For a comparison between a baremetal machine and a VM\nSecond: For a comparison between two baremetal machines\n\nSecond argument: The Benchmark to run\nOptions:\ndhrystone\nwhetstone\nramspeed\ncachebench\n" + ;; + First) + + echo "Enter the IP of the machine to be teststed for comparison to the VM" + read ipvar + echo "Enter the password of this machine" + read -s passwordvar + expect $PWD/data/ssh_exch.exp $ipvar $passwordvarp + heat stack-create exp2 -f $PWD/Test-cases/SampleHeat.yaml + + VAR1=$( heat stack-show exp2 | grep "stack_status_reason" | awk '{print $6;}') + echo $VAR1 + while [ "$VAR1" != completed ] + do + echo VM is coming up + VAR1=$( heat stack-show exp2 | grep "stack_status_reason" | awk '{print $6;}') + #echo $VAR1 + done + echo VM Created + + if [ "$VAR1" == "completed" ]; then + VAR=$( heat stack-show exp2 | grep "output_value" | awk '{print $4;}'| cut -d '"' -f2) + + echo IP of VM is: + echo $VAR + + sed -i '/demo1/a '$VAR'' /etc/ansible/hosts + sed -i '/demo1/a '$ipvar'' /etc/ansible/hosts + + + + echo Waiting for ping + while ! ping -c1 $VAR &> /dev/null; do + echo Waiting for ping + done + + echo Ping detected + expect $PWD/data/ssh_exch.exp $VAR + Call_Test $2 + + echo cleaning environment + sleep 10 + $PWD/clean.sh + + + fi + + ;; + Second) + echo Second test to be written below + echo "Enter the IP of the first machine to be benchmarked for comparison" + read ipvar + echo "Enter the password of this machine" + read -s passwordvar + expect $PWD/data/ssh_exch.exp $ipvar $passwordvar + sed -i '/demo1/a '$ipvar'' /etc/ansible/hosts + echo "Enter the IP of the second machine to be benchmarked for comparison" + read ipvar + echo "Enter the password of this machine" + read -s passwordvar + expect $PWD/data/ssh_exch.exp $ipvar $passwordvar + sed -i '/demo1/a '$ipvar'' /etc/ansible/hosts + Call_Test $2 + echo cleaning environment + sleep 10 + $PWD/clean.sh + ;; + + *) + echo Incorrect Arguments passed to the script. Run script with -h for more helo + +esac + + |