Add golang installation
[bottlenecks.git] / utils / infra_setup / heat_template / vstf_heat_template / vstf_test.sh
index 5f5aa36..94e42e2 100644 (file)
@@ -1,12 +1,17 @@
 #!/bin/bash
+##############################################################################
+# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
 set -x
 
 VM_MANAGER_USER="root"
 VM_MANAGER_PASSWD="root"
-STACK_NAME="vstf"
-#load func
-source ./ssh.sh
-source ./scp.sh
+STACK_NAME="bottlenecks_vstf_stack"
 
 function fn_parser_ipaddress(){
     #parser and get output ipaddress
@@ -33,16 +38,17 @@ function fn_vstf_test_config(){
     echo "tester_testing_ip = ${tester_testing_ip}"
     echo "target_testing_ip = ${target_testing_ip}"
     #setting testting ipaddress
-    local cmd='vstfadm settings ${tester_testing_ip} ${target_testing_ip}'
+    local cmd="vstfadm settings ${tester_testing_ip} ${target_testing_ip}"
     echo "$cmd"
-    #run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${cmd}"
+    ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip}
+    sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}"
 
     return 0
 }
 
 function fn_testing_scenario(){
     local head_cmd="vstfadm perf-test "
-    local test_length_list="64"
+    local test_length_list="64 128 256 512 1024"
     local test_scenario_list="Tu-1 Tu-3"
     local test_tool="netperf"
     local protocol="udp"
@@ -51,7 +57,10 @@ function fn_testing_scenario(){
     do
         local cmd="${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}-result.txt"
         echo ${cmd}
-        run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}"
+
+        ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip}
+        sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}"
+        sleep 10        
     done
     return 0
 }
@@ -62,16 +71,22 @@ function fn_result(){
     rm -rf ./result/*
     for scene in ${test_scenario_list}
     do
-        remote_scp_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "/root/${scene}-result.txt" "./result/${scene}" "file"
+        sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "cat /root/${scene}-result.txt"
+        sshpass -p root scp -o StrictHostKeyChecking=no root@${manager_control_public_ip}:/root/${scene}-result.txt "./result/${scene}"
     done
     return 0
 }
 
+function fn_upload(){
+    python vstf_collector.py --config dashboard.json --dir result
+}
+
 function main(){
     fn_parser_ipaddress
     fn_vstf_test_config
-    #fn_testing_scenario
-    #fn_result
+    fn_testing_scenario
+    fn_result
+    fn_upload
     return 0
 }