diff options
author | Nauman Ahad <Nauman_Ahad@dell.com> | 2015-08-18 07:07:04 -0700 |
---|---|---|
committer | Nauman Ahad <Nauman_Ahad@dell.com> | 2015-08-18 07:07:04 -0700 |
commit | 123ab6c7e1d0fd6e0a6880814ab731b140539e91 (patch) | |
tree | e31cd51efffc9bfa56303057af21b6edbaf57000 | |
parent | 12b2b2c38e01a00c07c09b924a5b62f8ddc74145 (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>
-rwxr-xr-x | QTIP.sh | 67 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | Test-cases/Bare_vs_Bare/Config.yaml | 4 | ||||
-rw-r--r-- | Test-cases/Bare_vs_VM/Config.yaml | 2 | ||||
-rw-r--r-- | Test-cases/Bare_vs_VM/SampleHeat.yaml | 93 | ||||
-rwxr-xr-x | clean.sh | 2 |
6 files changed, 148 insertions, 24 deletions
@@ -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 @@ -37,7 +37,11 @@ Requirments: 2. Python 2.7 +Configuring Test Cases: +Test cases can be found within the Test-cases directory. +For each Test case, a Config.yaml file contains the details for the machines upon which the benchmarks would run. +Edit the IP and the Password fields within the files for the machines on which the benchmark is to run. A robust framework that would allow to include more tests would be included within the future diff --git a/Test-cases/Bare_vs_Bare/Config.yaml b/Test-cases/Bare_vs_Bare/Config.yaml new file mode 100644 index 00000000..6612cbdc --- /dev/null +++ b/Test-cases/Bare_vs_Bare/Config.yaml @@ -0,0 +1,4 @@ +Machine_1_IP: 172.18.0.17 +Machine_1_Password: Op3nStack +Machine_2_IP: 172.18.0.16 +Machine_2_Password: Op3nStack diff --git a/Test-cases/Bare_vs_VM/Config.yaml b/Test-cases/Bare_vs_VM/Config.yaml new file mode 100644 index 00000000..e410a632 --- /dev/null +++ b/Test-cases/Bare_vs_VM/Config.yaml @@ -0,0 +1,2 @@ +Machine_1_IP: 172.18.0.17 +Machine_1_Password: Op3nStack diff --git a/Test-cases/Bare_vs_VM/SampleHeat.yaml b/Test-cases/Bare_vs_VM/SampleHeat.yaml new file mode 100644 index 00000000..6ee76ac0 --- /dev/null +++ b/Test-cases/Bare_vs_VM/SampleHeat.yaml @@ -0,0 +1,93 @@ + heat_template_version: 2014-10-16 + + description: Test10 + + parameters: + + public_network: + type: string + label: Public Network name or ID + description: Public network with floating IPs + default: "provider_network" + + private_net_name: + type: string + default: "private_network" + + availability_zone: + type: string + description: The Availability Zone to launch the instance. + default: compute1 + + resources: + + private_network: + type: OS::Neutron::Net + + + private_subnet: + type: OS::Neutron::Subnet + properties: + network_id: { get_resource: private_network } + cidr: 10.10.17.0/24 + dns_nameservers: + - 8.8.8.8 + + router_1: + type: OS::Neutron::Router + properties: + external_gateway_info: + network: { get_param: public_network } + + router_interface: + type: OS::Neutron::RouterInterface + properties: + router_id: { get_resource: router_1 } + subnet: { get_resource: private_subnet } + + public_port: + type: OS::Neutron::Port + properties: + network: { get_resource: private_network } + security_groups: [{ get_resource: demo1_security_Group }] + + floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network: { get_param: public_network } + + floating_ip_assoc: + type: OS::Neutron::FloatingIPAssociation + properties: + floatingip_id: { get_resource: floating_ip } + port_id: { get_resource: public_port } + + demo1_security_Group: + type: OS::Neutron::SecurityGroup + properties: + name: demo1_security_Group + rules: + - protocol: tcp + port_range_min: 22 + port_range_max: 22 + - protocol: icmp + + my_instance: + type: OS::Nova::Server + properties: + image: QTIP_CentOS7 + flavor: m1.large + availability_zone: { get_param: availability_zone } + networks: + - port: { get_resource: public_port } + + + + outputs: + instance_ip: + description: IP address of the instance + value: { get_attr: [floating_ip, floating_ip_address] } + + + + @@ -1,6 +1,6 @@ #! /bin/bash echo cleaning Ip -sed -i -e '/demo1/{n;N;N;N;N;N;d}' /etc/ansible/hosts +sed -i -e '/demo1/{n;N;d;}' /etc/ansible/hosts neutron floatingip-delete $(neutron floatingip-list| grep "17" | awk '{print $2;}') heat stack-delete exp2 |