aboutsummaryrefslogtreecommitdiffstats
path: root/QTIP.sh
diff options
context:
space:
mode:
authorNauman Ahad <Nauman_Ahad@dell.com>2015-08-18 07:07:04 -0700
committerNauman Ahad <Nauman_Ahad@dell.com>2015-08-18 07:07:04 -0700
commit123ab6c7e1d0fd6e0a6880814ab731b140539e91 (patch)
treee31cd51efffc9bfa56303057af21b6edbaf57000 /QTIP.sh
parent12b2b2c38e01a00c07c09b924a5b62f8ddc74145 (diff)
Added full automation to scripts
Introduced Config.yaml file for each test case. User can modify these to enter the details for the machines on which to run benchmarks. This also leads to automation. JIRA: QTIP-6 Change-Id: Ifecab13968148cbd9d8f352309be77b8ca2d30f2 Signed-off-by: Nauman Ahad <Nauman_Ahad@dell.com>
Diffstat (limited to 'QTIP.sh')
-rwxr-xr-xQTIP.sh67
1 files changed, 44 insertions, 23 deletions
diff --git a/QTIP.sh b/QTIP.sh
index dcefb29f..2a313420 100755
--- a/QTIP.sh
+++ b/QTIP.sh
@@ -1,6 +1,6 @@
#! /bin/bash
-#DIR1= $PWD
+WDIR=$PWD
@@ -35,6 +35,26 @@ function Call_Test {
}
+function Fetch_VM_Image {
+
+ mkdir $PWD/Temp_Image
+
+ file="$PWD/Temp_Image/Cent7Modified.qcow2"
+ if [ -f "$file" ]
+ then
+ echo "Image already downdloaded"
+ else
+ echo "Fetching QTIP_VM Image"
+ cd $PWD/Temp_Image && wget https://www.dropbox.com/s/3uswrydrvhxw3qm/Cent7Modified.qcow2
+ echo "Uploading image to glance"
+ glance image-create --name "QTIP_CentOS" --is-public true --disk-format qcow2 \
+ --container-format bare \
+ --file $PWD/Temp_Image/Cent7Modified.qcow2
+
+
+ fi
+ cd $WDIR
+}
mkdir $PWD/results
case "$1" in
-h)
@@ -43,22 +63,25 @@ case "$1" in
;;
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
+ Fetch_VM_Image
+
+ ipvar=$(cat $PWD/Test-cases/Bare_vs_VM/Config.yaml | grep "Machine_1_IP" | awk '{print$2;}')
+
- VAR1=$( heat stack-show exp2 | grep "stack_status_reason" | awk '{print $6;}')
- echo $VAR1
- while [ "$VAR1" != completed ]
+ passwordvar=$(cat $PWD/Test-cases/Bare_vs_VM/Config.yaml | grep "Machine_1_Password" | awk '{print$2;}')
+
+ expect $PWD/data/ssh_exch.exp $ipvar $passwordvar
+ heat stack-create exp2 -f $PWD/Test-cases/Bare_vs_VM/SampleHeat.yaml
+ sleep 3
+ 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
+ echo VM Created
if [ "$VAR1" == "completed" ]; then
VAR=$( heat stack-show exp2 | grep "output_value" | awk '{print $4;}'| cut -d '"' -f2)
@@ -87,19 +110,17 @@ case "$1" in
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
+
+ ipvar=$(cat $PWD/Test-cases/Bare_vs_Bare/Config.yaml | grep "Machine_1_IP" | awk '{print$2;}')
+ echo $ipvar
+ passwordvar=$(cat $PWD/Test-cases/Bare_vs_Bare/Config.yaml | grep "Machine_1_IP_Password" | awk '{print$2;}')
+ echo $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
+ ipvar=$(cat $PWD/Test-cases/Bare_vs_Bare/Config.yaml | grep "Machine_2_IP" | awk '{print$2;}')
+ passwordvar=$(cat $PWD/Test-cases/Bare_vs_Bare/Config.yaml | grep "Machine_2_IP_Password" | awk '{print$2;}')
expect $PWD/data/ssh_exch.exp $ipvar $passwordvar
sed -i '/demo1/a '$ipvar'' /etc/ansible/hosts
Call_Test $2
@@ -109,8 +130,8 @@ case "$1" in
;;
*)
- echo Incorrect Arguments passed to the script. Run script with -h for more helo
-
+ echo Incorrect Arguments passed to the script. Run script with -h for more help
+ ;;
esac