Add POSCA jenkins job support 97/28097/5
authoryuyang <Gabriel.yuyang@huawei.com>
Mon, 6 Feb 2017 08:21:36 +0000 (16:21 +0800)
committeryuyang <Gabriel.yuyang@huawei.com>
Thu, 9 Feb 2017 08:35:44 +0000 (16:35 +0800)
JIRA: BOTTLENECK-128

This patch is to make the POSCA testsuite could be built
automatically for OPNFV CI job.

Change-Id: I21d7fd553ce3591aea3391a33fe0a7b8579b57d4
Signed-off-by: yuyang <Gabriel.yuyang@huawei.com>
run_posca.sh [new file with mode: 0644]
run_tests.sh
testsuites/posca/testcase_cfg/posca_factor_system_bandwidth.yaml
testsuites/posca/testcase_script/posca_factor_system_bandwidth.py
utils/infra_setup/runner/yardstick.py

diff --git a/run_posca.sh b/run_posca.sh
new file mode 100644 (file)
index 0000000..b47a220
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2017 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
+##############################################################################
+
+pip install -U /home/opnfv/bottlenecks
+
+function check_testcase(){
+
+    check_suite="$1"
+    SUITE_PREFIX="/home/opnfv/bottlenecks/testsuites/posca/testcase_cfg"
+
+    TEST_CASE=$2
+
+    #find all the test case yaml files first
+    find $SUITE_PREFIX -name "*yaml" > /tmp/all_testcases.yaml
+    all_testcases_insuite=`cat /tmp/all_testcases.yaml | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}'`
+    all_testcases=(${all_testcases_insuite})
+
+    if [ "${TEST_CASE}" != "" ]; then
+       testcase_exec=(${TEST_CASE// /})
+       for i in "${testcase_exec[@]}"; do
+           if [[ " ${all_testcases[*]} " != *" $i "* ]]; then
+               error "unknown test case: $i. available test cases are: ${all_test_cases[@]}"
+           fi
+       done
+       info "tests to execute: ${TEST_CASE}."
+    else
+       error "lack of testcase name"
+    fi
+}
+
+SUITE_PREFIX="/home/opnfv/bottlenecks/testsuites/posca/testcase_cfg"
+source /home/opnfv/bottlenecks/common.sh
+test_file="/home/opnfv/bottlenecks/testsuites/posca/testsuite_story/posca_factor_test"
+if [[ -f $test_file ]]; then
+    testcases=($(cat $test_file))
+else
+    error "no posca test suite file "
+fi
+
+for i in "${testcases[@]}"; do
+    #check if the testcase is legal or not
+    check_testcase -posca $i
+    #adjust config parameters
+    #run test case
+    file=${SUITE_PREFIX}/${i}.yaml
+    python /home/opnfv/bottlenecks/testsuites/posca/run_posca.py
+done
index c03b198..0892f92 100755 (executable)
@@ -71,7 +71,7 @@ function run_test(){
 
     case $test_suite in
         "rubbos")
-            info "Running rubbos test suite"
+            info "Running rubbos test suite\n"
             test_file="/home/opnfv/bottlenecks/testsuites/rubbos/testsuite_story/rubbos_story1"
             if [[ -f $test_file ]]; then
                 testcases=($(cat $test_file))
@@ -107,22 +107,15 @@ function run_test(){
             done
         ;;
         "posca")
+            info "Composing up dockers"
+            docker-compose -f /home/opnfv/bottlenecks/docker/bottleneck-compose/docker-compose.yml up -d
+            info "Pulling tutum/influxdb for yardstick"
+            docker pull tutum/influxdb:0.13
+            info "Copying testing scripts to docker"
+            docker cp /home/opnfv/bottlenecks/run_posca.sh bottleneckcompose_bottlenecks_1:/home/opnfv/bottlenecks
+            sleep 5
             info "Running posca test suite"
-            test_file="/home/opnfv/bottlenecks/testsuites/posca/testsuite_story/posca_factor_test"
-            if [[ -f $test_file ]]; then
-                testcases=($(cat $test_file))
-            else
-                error "no posca test suite file "
-            fi
-
-            for i in "${testcases[@]}"; do
-                #check if the testcase is legal or not
-                check_testcase -posca $i
-                #adjust config parameters
-                #run test case
-                file=${BASEDIR}/testsuites/posca/testcase_cfg/${i}.yaml
-                python /home/opnfv/bottlenecks/testsuites/posca/run_posca.py -c ${i}
-            done
+            docker exec bottleneckcompose_bottlenecks_1 bash /home/opnfv/bottlenecks/run_posca.sh
         ;;
     esac
 }
index 217bff3..e7238d2 100755 (executable)
@@ -1,9 +1,9 @@
 test_config:
   tool: netperf
   protocol: tcp
-  test_time: 60
-  tx_pkt_sizes: 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072
-  rx_pkt_sizes: 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072
+  test_time: 20
+  tx_pkt_sizes: 64, 256, 1024, 4096, 8192, 16384, 32768, 65536
+  rx_pkt_sizes: 64, 256, 1024, 4096, 8192, 16384, 32768, 65536
   cpu_load: 0.9
   latency: 100000
 runner_config:
index aebfa96..54e2970 100644 (file)
@@ -33,8 +33,8 @@ test_dict = {
 }
 
 
-def env_pre():
-    Runner.Create_Incluxdb()
+def env_pre(con_dic):
+    Runner.Create_Incluxdb(con_dic['runner_config'])
 
 
 def do_test(test_config, con_dic):
@@ -64,6 +64,7 @@ def run(con_dic):
     if con_dic["runner_config"]["yardstick_test_ip"] is None:
         con_dic["runner_config"]["yardstick_test_ip"] =\
             conf_parser.ip_parser("yardstick_test_ip")
+    env_pre(con_dic)
     for test_x in data["tx_pkt_sizes"]:
         data_max["throughput"] = 1
         bandwidth_tmp = 1
index 7c8cd25..104cdfa 100644 (file)
@@ -33,7 +33,7 @@ def Get_Reply(test_config, task_id, time_test=1):
     if reply_data["status"] == 1:
         return(reply_data["result"])
     if reply_data["status"] == 0:
-        if time_test == 10:
+        if time_test == 100:
             LOG.info("yardstick time out")
             sys.exit()
         time.sleep(10)
@@ -77,4 +77,3 @@ def find_condition(con_dic):
     requests.post(
         base_url, headers=headers)
     LOG.info("check for creating InfluxDB")
-