From 9038727dee2e67f8facd75f8b498ca20a1e066c9 Mon Sep 17 00:00:00 2001 From: yuyang Date: Mon, 6 Feb 2017 16:21:36 +0800 Subject: [PATCH] Add POSCA jenkins job support 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 --- run_posca.sh | 54 ++++++++++++++++++++++ run_tests.sh | 25 ++++------ .../posca_factor_system_bandwidth.yaml | 6 +-- .../posca_factor_system_bandwidth.py | 5 +- utils/infra_setup/runner/yardstick.py | 3 +- 5 files changed, 70 insertions(+), 23 deletions(-) create mode 100644 run_posca.sh diff --git a/run_posca.sh b/run_posca.sh new file mode 100644 index 00000000..b47a220a --- /dev/null +++ b/run_posca.sh @@ -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 diff --git a/run_tests.sh b/run_tests.sh index c03b1988..0892f921 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -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 } diff --git a/testsuites/posca/testcase_cfg/posca_factor_system_bandwidth.yaml b/testsuites/posca/testcase_cfg/posca_factor_system_bandwidth.yaml index 217bff3e..e7238d2c 100755 --- a/testsuites/posca/testcase_cfg/posca_factor_system_bandwidth.yaml +++ b/testsuites/posca/testcase_cfg/posca_factor_system_bandwidth.yaml @@ -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: diff --git a/testsuites/posca/testcase_script/posca_factor_system_bandwidth.py b/testsuites/posca/testcase_script/posca_factor_system_bandwidth.py index aebfa962..54e2970b 100644 --- a/testsuites/posca/testcase_script/posca_factor_system_bandwidth.py +++ b/testsuites/posca/testcase_script/posca_factor_system_bandwidth.py @@ -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 diff --git a/utils/infra_setup/runner/yardstick.py b/utils/infra_setup/runner/yardstick.py index 7c8cd255..104cdfae 100644 --- a/utils/infra_setup/runner/yardstick.py +++ b/utils/infra_setup/runner/yardstick.py @@ -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") - -- 2.16.6