diff options
-rw-r--r-- | jjb/apex/apex.yml | 22 | ||||
-rw-r--r-- | jjb/armband/armband-project-jobs.yml (renamed from jjb/armband/armband.yml) | 40 | ||||
-rwxr-xr-x | jjb/armband/build.sh (renamed from jjb/armband/armband-build.sh) | 0 | ||||
-rwxr-xr-x | jjb/armband/upload-artifacts.sh | 86 | ||||
-rw-r--r-- | jjb/bottlenecks/bottlenecks-ci-jobs.yml | 40 | ||||
-rw-r--r-- | jjb/functest/functest-ci-jobs.yml | 31 | ||||
-rw-r--r-- | jjb/opnfv/opnfv-docker.sh | 8 | ||||
-rw-r--r-- | jjb/opnfv/slave-params.yml | 15 | ||||
-rw-r--r-- | jjb/releng-macros.yaml | 23 | ||||
-rw-r--r-- | utils/test/dashboard/js/opnfv_dashboard_tests_conf.js | 4 | ||||
-rw-r--r-- | utils/test/reporting/functest/default.css (renamed from utils/test/reporting/default.css) | 0 | ||||
-rw-r--r-- | utils/test/reporting/functest/img/weather-clear.png (renamed from utils/test/reporting/img/weather-clear.png) | bin | 1560 -> 1560 bytes | |||
-rw-r--r-- | utils/test/reporting/functest/img/weather-few-clouds.png (renamed from utils/test/reporting/img/weather-few-clouds.png) | bin | 1927 -> 1927 bytes | |||
-rw-r--r-- | utils/test/reporting/functest/img/weather-overcast.png (renamed from utils/test/reporting/img/weather-overcast.png) | bin | 1588 -> 1588 bytes | |||
-rw-r--r-- | utils/test/reporting/functest/img/weather-storm.png (renamed from utils/test/reporting/img/weather-storm.png) | bin | 2137 -> 2137 bytes | |||
-rw-r--r-- | utils/test/reporting/functest/index.html (renamed from utils/test/reporting/index.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/functest/reporting-status.py (renamed from utils/test/reporting/reporting-status.py) | 157 | ||||
-rw-r--r-- | utils/test/reporting/functest/reporting-tempest.py (renamed from utils/test/reporting/reporting-tempest.py) | 4 | ||||
-rw-r--r-- | utils/test/reporting/functest/reporting-vims.py (renamed from utils/test/reporting/reporting-vims.py) | 4 | ||||
-rw-r--r-- | utils/test/reporting/functest/template/index-status-tmpl.html (renamed from utils/test/reporting/index-status-tmpl.html) | 12 | ||||
-rw-r--r-- | utils/test/reporting/functest/template/index-tempest-tmpl.html (renamed from utils/test/reporting/index-tempest-tmpl.html) | 0 | ||||
-rw-r--r-- | utils/test/reporting/functest/template/index-vims-tmpl.html (renamed from utils/test/reporting/index-vims-tmpl.html) | 0 | ||||
-rw-r--r-- | utils/test/result_collection_api/dashboard/functest2Dashboard.py | 28 |
23 files changed, 330 insertions, 144 deletions
diff --git a/jjb/apex/apex.yml b/jjb/apex/apex.yml index 91f76b5cf..6dbea1a62 100644 --- a/jjb/apex/apex.yml +++ b/jjb/apex/apex.yml @@ -760,7 +760,7 @@ set -o pipefail # delete everything that is in $WORKSPACE - /bin/rm -rf $WORKSPACE + sudo /bin/rm -rf $WORKSPACE - builder: name: 'apex-upload-artifact' @@ -895,6 +895,26 @@ DEPLOY_CMD="./deploy.sh -c ${WORKSPACE}/build -r ${WORKSPACE}/build/images/" DEPLOY_FILE="${WORKSPACE}/config/deploy/${DEPLOY_SCENARIO}.yaml" NETWORK_FILE="${WORKSPACE}/config/network/network_settings.yaml" + # Make sure python34 is installed + if ! rpm -q python34 > /dev/null; then + sudo yum install -y epel-release + if ! sudo yum install -y python34; then + echo "Failed to install python34" + exit 1 + fi + fi + if ! rpm -q python34-PyYAML > /dev/null; then + sudo yum install -y epel-release + if ! sudo yum install -y python34-PyYAML; then + echo "Failed to install python34-PyYAML" + exit 1 + fi + fi + if [ -z ${PYTHONPATH:-} ]; then + export PYTHONPATH=${WORKSPACE}/lib/python + else + export PYTHONPATH=$PYTHONPATH:${WORKSPACE}/lib/python + fi else RPM_LIST=$RPM_INSTALL_PATH for pkg in common undercloud opendaylight-sfc; do diff --git a/jjb/armband/armband.yml b/jjb/armband/armband-project-jobs.yml index 75c0e7a7b..b40949d27 100644 --- a/jjb/armband/armband.yml +++ b/jjb/armband/armband-project-jobs.yml @@ -9,6 +9,7 @@ jobs: - 'armband-verify-{stream}' + - 'armband-build-daily-{stream}' stream: - master: @@ -72,15 +73,11 @@ max-per-node: 1 parameters: - - project-parameters: + - project-parameter: project: '{project}' - 'arm-build1-defaults' - - choice: - name: FORCE_BUILD - choices: - - 'false' - - 'true' - description: 'Force build even if there are no changes in the armband repo. Default false' + - armband-project-parameter: + gs-pathname: '{gs-pathname}' scm: - git-scm: @@ -89,18 +86,41 @@ branch: '{branch}' triggers: - -pollscm: + - pollscm: cron: '0 H/4 * * *' wrappers: - -timeout: + - timeout: timeout: 360 fail: true builders: - shell: - !include-raw-escape: ./armband-build.sh + !include-raw-escape: ./build.sh + - shell: + !include-raw-escape: ./upload-artifacts.sh publishers: - email: recipients: josep.puigdemont@enea.com armband@enea.com + +######################## +# parameter macros +######################## +- parameter: + name: armband-project-parameter + parameters: + - string: + name: BUILD_DIRECTORY + default: $WORKSPACE/build_output + description: "Directory where the build artifact will be located upon the completion of the build." + - string: + name: GS_URL + default: artifacts.opnfv.org/$PROJECT{gs-pathname} + description: "URL to Google Storage." + - choice: + name: FORCE_BUILD + choices: + - 'false' + - 'true' + description: 'Force build even if there are no changes in the armband repo. Default false' diff --git a/jjb/armband/armband-build.sh b/jjb/armband/build.sh index 81917f6de..81917f6de 100755 --- a/jjb/armband/armband-build.sh +++ b/jjb/armband/build.sh diff --git a/jjb/armband/upload-artifacts.sh b/jjb/armband/upload-artifacts.sh new file mode 100755 index 000000000..f4e84e9d2 --- /dev/null +++ b/jjb/armband/upload-artifacts.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2016 Ericsson AB 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 -o pipefail + +# check if we built something +if [ -f $WORKSPACE/.noupload ]; then + echo "Nothing new to upload. Exiting." + /bin/rm -f $WORKSPACE/.noupload + exit 0 +fi + +# source the opnfv.properties to get ARTIFACT_VERSION +source $WORKSPACE/opnfv.properties + +# storing ISOs for verify & merge jobs will be done once we get the disk array +if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then + # store ISO locally on NFS first + ISOSTORE="/home/jenkins/opnfv/iso_store" + if [[ -d "$ISOSTORE" ]]; then + # remove all but most recent 3 ISOs first to keep iso_mount clean & tidy + cd $ISOSTORE + ls -tp | grep -v '/' | tail -n +4 | xargs -d '\n' /bin/rm -f -- + + # store ISO + echo "Storing latest ISO in local storage" + touch .storing + /bin/cp -f $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \ + $ISOSTORE/opnfv-$OPNFV_ARTIFACT_VERSION.iso + rm .storing + fi +fi + +# log info to console +echo "Uploading armband artifacts. This could take some time..." +echo + +echo "Started at $(date)" +cd $WORKSPACE +# upload artifact and additional files to google storage +gsutil cp $BUILD_DIRECTORY/opnfv-$OPNFV_ARTIFACT_VERSION.iso \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1 +gsutil cp $WORKSPACE/opnfv.properties \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1 +if [[ ! "$JOB_NAME" =~ (verify|merge) ]]; then + gsutil cp $WORKSPACE/opnfv.properties \ + gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1 +elif [[ "$JOB_NAME" =~ "merge" ]]; then + echo "Uploaded Armband Fuel ISO for a merged change" +fi +echo "Ended at $(date)" + +gsutil -m setmeta \ + -h "Content-Type:text/html" \ + -h "Cache-Control:private, max-age=0, no-transform" \ + gs://$GS_URL/latest.properties \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > /dev/null 2>&1 + +gsutil -m setmeta \ + -h "Cache-Control:private, max-age=0, no-transform" \ + gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1 + +# disabled errexit due to gsutil setmeta complaints +# BadRequestException: 400 Invalid argument +# check if we uploaded the file successfully to see if things are fine +gsutil ls gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > /dev/null 2>&1 +if [[ $? -ne 0 ]]; then + echo "Problem while uploading artifact!" + echo "Check log $WORKSPACE/gsutil.iso.log on the machine where this build is done." + exit 1 +fi + +echo "Done!" +echo +echo "--------------------------------------------------------" +echo +echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso" +echo +echo "--------------------------------------------------------" +echo diff --git a/jjb/bottlenecks/bottlenecks-ci-jobs.yml b/jjb/bottlenecks/bottlenecks-ci-jobs.yml index cd1d89a5c..9d881233d 100644 --- a/jjb/bottlenecks/bottlenecks-ci-jobs.yml +++ b/jjb/bottlenecks/bottlenecks-ci-jobs.yml @@ -114,7 +114,6 @@ builders: - 'bottlenecks-env-cleanup' - - 'bottlenecks-fetch-os-creds' - 'bottlenecks-run-suite' publishers: @@ -125,12 +124,6 @@ # builder macros ######################## - builder: - name: bottlenecks-fetch-os-creds - builders: - - shell: - !include-raw ../../utils/fetch_os_creds.sh - -- builder: name: bottlenecks-env-cleanup builders: - shell: | @@ -162,21 +155,36 @@ set -e [[ $GERRIT_REFSPEC_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" - echo "Bottlenecks: ${SUITE_NAME} running now..." - - # pull latest image - docker pull opnfv/bottlenecks:$DOCKER_TAG >$redirect + echo "Bottlenecks: to pull image opnfv/bottlenecks:${DOCKER_TAG}" + docker pull opnfv/bottlenecks:$DOCKER_TAG >${redirect} - # run tests by using docker - opts="--privileged=true --rm" + echo "Bottlenecks: docker start running" + opts="--privileged=true -id" envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \ -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NET=${EXTERNAL_NETWORK} \ -e BOTTLENECKS_BRANCH=${BOTTLENECKS_BRANCH} -e GERRIT_REFSPEC_DEBUG=${GERRIT_REFSPEC_DEBUG} \ -e BOTTLENECKS_DB_TARGET=${BOTTLENECKS_DB_TARGET} -e PACKAGE_URL=${PACKAGE_URL}" + cmd="sudo docker run ${opts} ${envs} opnfv/bottlenecks:${DOCKER_TAG} /bin/bash" + echo "Bottlenecks: docker cmd running ${cmd}" + ${cmd} >${redirect} + + echo "Bottlenecks: obtain docker id" + container_id=$(docker ps | grep "opnfv/bottlenecks:${DOCKER_TAG}" | awk '{print $1}' | head -1) + if [ -z ${container_id} ]; then + echo "Cannot find opnfv/bottlenecks container ID ${container_id}. Please check if it exists." + docker ps -a + exit 1 + fi + + echo "Bottlenecks: to prepare openstack environment" + prepare_env="${REPO_DIR}/ci/prepare_env.sh" + echo "Bottlenecks: docker cmd running: ${prepare_env}" + sudo docker exec ${container_id} ${prepare_env} + + echo "Bottlenecks: to run testsuite ${SUITE_NAME}" run_testsuite="${REPO_DIR}/run_tests.sh -s ${SUITE_NAME}" - cmd="sudo docker run ${opts} ${envs} opnfv/bottlenecks ${run_testsuite}" - echo "Bottlenecks: docker cmd running: ${cmd}" - ${cmd} + echo "Bottlenecks: docker cmd running: ${run_testsuite}" + sudo docker exec ${container_id} ${run_testsuite} #################### # parameter macros diff --git a/jjb/functest/functest-ci-jobs.yml b/jjb/functest/functest-ci-jobs.yml index d691140f4..a0a1326ba 100644 --- a/jjb/functest/functest-ci-jobs.yml +++ b/jjb/functest/functest-ci-jobs.yml @@ -94,6 +94,9 @@ - nokia-pod1: installer: apex <<: *master + - arm-pod1: + installer: fuel + <<: *master #-------------------------------- testsuite: @@ -146,8 +149,6 @@ branch: '{branch}' builders: - - 'functest-cleanup' - - 'set-functest-env' - 'functest-{testsuite}-builder' ######################## @@ -219,11 +220,9 @@ builders: - shell: | #!/bin/bash - set +e - flags="-s" - [[ "$PUSH_RESULTS_TO_DB" == "true" ]] && flags+=" -r" + set -e echo "Functest: run $FUNCTEST_SUITE_NAME" - cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME ${flags}" + cmd="${FUNCTEST_REPO_DIR}/docker/run_tests.sh --test $FUNCTEST_SUITE_NAME" container_id=$(docker ps -a | grep opnfv/functest | awk '{print $1}' | head -1) docker exec $container_id $cmd @@ -244,15 +243,15 @@ builders: - shell: | #!/bin/bash - set +e + set -e [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null" # labconfig is used only for joid labconfig="" if [[ ${INSTALLER_TYPE} == 'apex' ]]; then - if virsh list | grep instack; then + if sudo virsh list | grep instack; then instack_mac=$(sudo virsh domiflist instack | grep default | \ grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") - elif virsh list | grep undercloud; then + elif sudo virsh list | grep undercloud; then instack_mac=$(sudo virsh domiflist undercloud | grep default | \ grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+") else @@ -261,8 +260,12 @@ fi INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'}) sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa" - sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable - sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable + if sudo iptables -C FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then + sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable + fi + if sudo iptables -C FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then + sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable + fi elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then # If production lab then creds may be retrieved dynamically # creds are on the jumphost, always in the same folder @@ -286,7 +289,7 @@ cmd="sudo docker run --privileged=true -id ${envs} ${labconfig} ${sshkey} ${res_volume} opnfv/functest:${DOCKER_TAG} /bin/bash" echo "Functest: Running docker run command: ${cmd}" ${cmd} >${redirect} - docker ps -a + docker ps -a >${redirect} sleep 5 container_id=$(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | awk '{print $1}' | head -1) echo "Container ID=${container_id}" @@ -298,7 +301,7 @@ echo "Starting the container: docker start ${container_id}" docker start ${container_id} sleep 5 - docker ps + docker ps >${redirect} if [ $(docker ps | grep "opnfv/functest:${DOCKER_TAG}" | wc -l) == 0 ]; then echo "The container opnfv/functest with ID=${container_id} has not been properly started. Exiting..." exit 1 @@ -330,7 +333,7 @@ # Remove existing images if exist if [[ ! -z $(docker images | grep opnfv/functest) ]]; then echo "Docker images to remove:" - docker images | head -1 && docker images | grep opnfv/functest + docker images | head -1 && docker images | grep opnfv/functest >${redirect} image_tags=($(docker images | grep opnfv/functest | awk '{print $2}')) for tag in "${image_tags[@]}"; do echo "Removing docker image opnfv/functest:$tag..." diff --git a/jjb/opnfv/opnfv-docker.sh b/jjb/opnfv/opnfv-docker.sh index 8f44268e6..702c0ce52 100644 --- a/jjb/opnfv/opnfv-docker.sh +++ b/jjb/opnfv/opnfv-docker.sh @@ -17,6 +17,14 @@ echo "--------------------------------------------------------" echo +if [[ -n $(ps -ef|grep 'docker build'|grep -v grep) ]]; then + echo "There is already another build process in progress:" + echo $(ps -ef|grep 'docker build'|grep -v grep) + # Abort this job since it will colide and might mess up the current one. + echo "Aborting..." + exit 1 +fi + # Remove previous running containers if exist if [[ -n "$(docker ps -a | grep $DOCKER_REPO_NAME)" ]]; then echo "Removing existing $DOCKER_REPO_NAME containers..." diff --git a/jjb/opnfv/slave-params.yml b/jjb/opnfv/slave-params.yml index 2431ade85..2ca4459dd 100644 --- a/jjb/opnfv/slave-params.yml +++ b/jjb/opnfv/slave-params.yml @@ -597,3 +597,18 @@ name: GIT_BASE default: https://gerrit.opnfv.org/gerrit/$PROJECT description: 'Git URL to use on this Jenkins Slave' + +- parameter: + name: 'arm-pod1-defaults' + parameters: + - node: + name: SLAVE_NAME + description: 'Slave name on Jenkins' + allowed-slaves: + - arm-pod1 + default-slaves: + - arm-pod1 + - string: + name: GIT_BASE + default: https://gerrit.opnfv.org/gerrit/$PROJECT + description: 'Git URL to use on this Jenkins Slave' diff --git a/jjb/releng-macros.yaml b/jjb/releng-macros.yaml index 23d174a26..7fb4d653d 100644 --- a/jjb/releng-macros.yaml +++ b/jjb/releng-macros.yaml @@ -339,11 +339,27 @@ # generate and upload lint log echo "Running flake8 code on $PROJECT ..." - echo -e "Flake8 Violations\n-----------------" >> lint.log - find . \ + # Get number of flake8 violations. If none, this will be an + # empty string: "" + FLAKE_COUNT="$(find . \ -path './releng_flake8' -prune -o \ -type f -name "*.py" -print | \ - xargs flake8 --exit-zero --first >> lint.log + xargs flake8 --exit-zero -qq --count 2>&1)" + + if [ ! -z $FLAKE_COUNT ]; then + echo "Flake8 Violations: $FLAKE_COUNT" >> lint.log + find . \ + -path './releng_flake8' -prune -o \ + -type f -name "*.py" -print | \ + xargs flake8 --exit-zero --first >> violation.log + SHOWN=$(wc -l violation.log | cut -d' ' -f1) + echo -e "First $SHOWN shown\n---" >> lint.log + cat violation.log >> lint.log + sed -r -i '4,$s/^/ /g' lint.log + rm violation.log + else + echo -e "Flake8 Violations: 0" > lint.log + fi deactivate @@ -357,7 +373,6 @@ set -o xtrace export PATH=$PATH:/usr/local/bin/ if [[ -e lint.log ]] ; then - sed -r -i 's/^/ /g' lint.log echo -e "\nposting linting report to gerrit...\n" cat lint.log echo diff --git a/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js b/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js index 6778332eb..4d909c883 100644 --- a/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js +++ b/utils/test/dashboard/js/opnfv_dashboard_tests_conf.js @@ -56,13 +56,13 @@ var opnfv_dashboard_testcases = { var opnfv_dashboard_installers_pods = {};
opnfv_dashboard_installers_pods['apex'] = ['all','intel-pod7','opnfv-jump-1'];
opnfv_dashboard_installers_pods['compass'] = ['all','huawei-us-deploy-bare-1','huawei-us-deploy-vm-1','huawei-us-deploy-vm2','intel-pod8'];
-opnfv_dashboard_installers_pods['fuel'] = ['all','ericsson-pod2','opnfv-jump-2'];
+opnfv_dashboard_installers_pods['fuel'] = ['all','ericsson-pod2','opnfv-jump-2','arm-pod1'];
opnfv_dashboard_installers_pods['joid'] = ['all','intel-pod5','intel-pod6','orange-fr-pod2'];
var opnfv_dashboard_installers_pods_print = {};
opnfv_dashboard_installers_pods_print['apex'] = ['all','intelpod7','opnfvjump1'];
opnfv_dashboard_installers_pods_print['compass'] = ['all','hwusbare1','hwusvm1','hwusvm2','intelpod8'];
-opnfv_dashboard_installers_pods_print['fuel'] = ['all','ericssonpod2','opnfvjump2'];
+opnfv_dashboard_installers_pods_print['fuel'] = ['all','ericssonpod2','opnfvjump2','armpod1'];
opnfv_dashboard_installers_pods_print['joid'] = ['all','intelpod5','intelpod6','orangefrpod2'];
var opnfv_dashboard_file_directory = 'res-test';
diff --git a/utils/test/reporting/default.css b/utils/test/reporting/functest/default.css index 0e330e965..0e330e965 100644 --- a/utils/test/reporting/default.css +++ b/utils/test/reporting/functest/default.css diff --git a/utils/test/reporting/img/weather-clear.png b/utils/test/reporting/functest/img/weather-clear.png Binary files differindex a0d967750..a0d967750 100644 --- a/utils/test/reporting/img/weather-clear.png +++ b/utils/test/reporting/functest/img/weather-clear.png diff --git a/utils/test/reporting/img/weather-few-clouds.png b/utils/test/reporting/functest/img/weather-few-clouds.png Binary files differindex acfa78398..acfa78398 100644 --- a/utils/test/reporting/img/weather-few-clouds.png +++ b/utils/test/reporting/functest/img/weather-few-clouds.png diff --git a/utils/test/reporting/img/weather-overcast.png b/utils/test/reporting/functest/img/weather-overcast.png Binary files differindex 4296246d0..4296246d0 100644 --- a/utils/test/reporting/img/weather-overcast.png +++ b/utils/test/reporting/functest/img/weather-overcast.png diff --git a/utils/test/reporting/img/weather-storm.png b/utils/test/reporting/functest/img/weather-storm.png Binary files differindex 956f0e20f..956f0e20f 100644 --- a/utils/test/reporting/img/weather-storm.png +++ b/utils/test/reporting/functest/img/weather-storm.png diff --git a/utils/test/reporting/index.html b/utils/test/reporting/functest/index.html index af4033567..af4033567 100644 --- a/utils/test/reporting/index.html +++ b/utils/test/reporting/functest/index.html diff --git a/utils/test/reporting/reporting-status.py b/utils/test/reporting/functest/reporting-status.py index e15bac9f7..2eb0f50d5 100644 --- a/utils/test/reporting/reporting-status.py +++ b/utils/test/reporting/functest/reporting-status.py @@ -4,6 +4,7 @@ import jinja2 import os import re import requests +import sys import time import yaml @@ -12,11 +13,12 @@ functest_test_list = ['vPing', 'vPing_userdata', 'Tempest', 'Rally', 'ODL', 'ONOS', 'vIMS'] # functest_test_list = ['vPing'] -# functest_test_list = [] companion_test_list = ['doctor/doctor-notification', 'promise/promise'] # companion_test_list = [] installers = ["apex", "compass", "fuel", "joid"] -# installers = ["apex"] +# installers = ["fuel"] +versions = ["brahmaputra", "master"] +# versions = ["master"] PERIOD = 10 # Correspondance between the name of the test case and the name in the DB @@ -100,7 +102,7 @@ class TestCase(object): self.isRunnable = is_runnable -def getApiResults(case, installer, scenario): +def getApiResults(case, installer, scenario, version): case = case.getName() results = json.dumps([]) # to remove proxy (to be removed at the end for local test only) @@ -109,9 +111,9 @@ def getApiResults(case, installer, scenario): # urllib2.install_opener(opener) # url = "http://127.0.0.1:8000/results?case=" + case + \ # "&period=30&installer=" + installer - url = "http://testresults.opnfv.org/testapi/results?case=" + case + \ - "&period=" + str(PERIOD) + "&installer=" + installer + \ - "&scenario=" + scenario + url = ("http://testresults.opnfv.org/testapi/results?case=" + case + + "&period=" + str(PERIOD) + "&installer=" + installer + + "&scenario=" + scenario + "&version=" + version) request = Request(url) try: @@ -124,11 +126,12 @@ def getApiResults(case, installer, scenario): return results -def getScenarios(case, installer): +def getScenarios(case, installer, version): case = case.getName() url = "http://testresults.opnfv.org/testapi/results?case=" + case + \ - "&period=" + str(PERIOD) + "&installer=" + installer + "&period=" + str(PERIOD) + "&installer=" + installer + \ + "&version=" + version request = Request(url) try: @@ -147,9 +150,9 @@ def getScenarios(case, installer): for r in test_results: # Retrieve all the scenarios per installer - if not r['version'] in scenario_results.keys(): - scenario_results[r['version']] = [] - scenario_results[r['version']].append(r) + if not r['scenario'] in scenario_results.keys(): + scenario_results[r['scenario']] = [] + scenario_results[r['scenario']].append(r) return scenario_results @@ -174,10 +177,10 @@ def getNbtestOk(results): return nb_test_ok -def getResult(testCase, installer, scenario): +def getResult(testCase, installer, scenario, version): # retrieve raw results - results = getApiResults(testCase, installer, scenario) + results = getApiResults(testCase, installer, scenario, version) # let's concentrate on test results only test_results = results['test_results'] @@ -230,77 +233,79 @@ def getResult(testCase, installer, scenario): # ****************************************************************************** # ****************************************************************************** -# as the criteria are all difference, we shall use a common way to indicate -# the criteria -# 100 = 100% = all the test must be OK -# 90 = 90% = all the test must be above 90% of success rate -# TODO harmonize success criteria -# some criteria could be the duration, the success rate, the packet loss,... -# to be done case by case -# TODo create TestCriteria Object - - # init just tempest to get the list of scenarios # as all the scenarios run Tempest tempest = TestCase("Tempest", "functest", -1) # Retrieve the Functest configuration to detect which tests are relevant # according to the installer, scenario -response = requests.get('https://git.opnfv.org/cgit/functest/plain/testcases/config_functest.yaml') +cf = "https://git.opnfv.org/cgit/functest/plain/testcases/config_functest.yaml" +response = requests.get(cf) functest_yaml_config = yaml.load(response.text) print "****************************************" print "* Generating reporting..... *" print "****************************************" -# For all the installers -for installer in installers: - # get scenarios - scenario_results = getScenarios(tempest, installer) - scenario_stats = getScenarioStats(scenario_results) - - items = {} - # For all the scenarios get results - for s, s_result in scenario_results.items(): - testCases = [] - # For each scenario declare the test cases - # Functest cases - for test_case in functest_test_list: - testCases.append(TestCase(test_case, "functest")) - - # project/case - for test_case in companion_test_list: - test_split = test_case.split("/") - test_project = test_split[0] - test_case = test_split[1] - testCases.append(TestCase(test_case, test_project)) - - # Check if test case is runnable according to the installer, scenario - for test_case in testCases: - test_case.checkRunnable(installer, s, functest_yaml_config) - # print "testcase %s is %s" % (test_case.getName(), - # test_case.isRunnable) - - print "--------------------------" - print "%s / %s:" % (installer, s) - for testCase in testCases: - time.sleep(1) - if testCase.isRunnable: - print " Searching results for case %s " % testCase.getName() - result = getResult(testCase, installer, s) - testCase.setCriteria(result) - items[s] = testCases - print "--------------------------" - print "****************************************" - templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) - templateEnv = jinja2.Environment(loader=templateLoader) - - TEMPLATE_FILE = "index-status-tmpl.html" - template = templateEnv.get_template(TEMPLATE_FILE) - - outputText = template.render(scenario_stats=scenario_stats, - items=items, - installer=installer, - period=PERIOD) - - with open("index-status-" + installer + ".html", "wb") as fh: - fh.write(outputText) +# For all the versions +for version in versions: + # For all the installers + for installer in installers: + # get scenarios + scenario_results = getScenarios(tempest, installer, version) + scenario_stats = getScenarioStats(scenario_results) + + items = {} + # For all the scenarios get results + for s, s_result in scenario_results.items(): + testCases = [] + # For each scenario declare the test cases + # Functest cases + for test_case in functest_test_list: + testCases.append(TestCase(test_case, "functest")) + + # project/case + for test_case in companion_test_list: + test_split = test_case.split("/") + test_project = test_split[0] + test_case = test_split[1] + testCases.append(TestCase(test_case, test_project)) + + # Check if test case is runnable / installer, scenario + try: + for test_case in testCases: + test_case.checkRunnable(installer, s, functest_yaml_config) + # print "testcase %s is %s" % (test_case.getName(), + # test_case.isRunnable) + print "--------------------------" + print ("installer %s, version %s, scenario %s:" % + (installer, version, s)) + for testCase in testCases: + time.sleep(1) + if testCase.isRunnable: + print (" Searching results for case %s " % + (testCase.getName())) + result = getResult(testCase, installer, s, version) + testCase.setCriteria(result) + items[s] = testCases + print "--------------------------" + except: + print ("installer %s, version %s, scenario %s" % + (installer, version, s)) + print "No data available , error %s " % (sys.exc_info()[0]) + + print "****************************************" + templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) + templateEnv = jinja2.Environment(loader=templateLoader) + + TEMPLATE_FILE = "./template/index-status-tmpl.html" + template = templateEnv.get_template(TEMPLATE_FILE) + + outputText = template.render(scenario_stats=scenario_stats, + items=items, + installer=installer, + period=PERIOD, + version=version) + + with open("./release/" + version + + "/index-status-" + installer + ".html", "wb") as fh: + fh.write(outputText) diff --git a/utils/test/reporting/reporting-tempest.py b/utils/test/reporting/functest/reporting-tempest.py index 944b42809..563e53010 100644 --- a/utils/test/reporting/reporting-tempest.py +++ b/utils/test/reporting/functest/reporting-tempest.py @@ -88,12 +88,12 @@ for installer in installers: templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) templateEnv = jinja2.Environment(loader=templateLoader) - TEMPLATE_FILE = "index-tempest-tmpl.html" + TEMPLATE_FILE = "./template/index-tempest-tmpl.html" template = templateEnv.get_template(TEMPLATE_FILE) outputText = template.render(scenario_results=scenario_results, items=items, installer=installer) - with open("index-tempest-" + installer + ".html", "wb") as fh: + with open("./release/index-tempest-" + installer + ".html", "wb") as fh: fh.write(outputText) diff --git a/utils/test/reporting/reporting-vims.py b/utils/test/reporting/functest/reporting-vims.py index cf43f3ebc..78ca9f5b3 100644 --- a/utils/test/reporting/reporting-vims.py +++ b/utils/test/reporting/functest/reporting-vims.py @@ -72,12 +72,12 @@ for installer in installers: templateLoader = jinja2.FileSystemLoader(os.path.dirname(os.path.abspath(__file__))) templateEnv = jinja2.Environment( loader=templateLoader ) - TEMPLATE_FILE = "index-vims-tmpl.html" + TEMPLATE_FILE = "./template/index-vims-tmpl.html" template = templateEnv.get_template( TEMPLATE_FILE ) outputText = template.render( scenario_results = scenario_results, step_order = step_order, installer = installer) - with open("index-vims" + installer + ".html", "wb") as fh: + with open("./release/index-vims" + installer + ".html", "wb") as fh: fh.write(outputText) diff --git a/utils/test/reporting/index-status-tmpl.html b/utils/test/reporting/functest/template/index-status-tmpl.html index 0fd470d6f..604f2c8e4 100644 --- a/utils/test/reporting/index-status-tmpl.html +++ b/utils/test/reporting/functest/template/index-status-tmpl.html @@ -18,7 +18,7 @@ <body> <div class="container"> <div class="masthead"> - <h3 class="text-muted">Functest status page</h3> + <h3 class="text-muted">Functest status page ({{version}})</h3> <nav> <ul class="nav nav-justified"> <li class="active"><a href="index.html">Home</a></li> @@ -37,7 +37,7 @@ </div> <div class="scenario-overview"> - <div class="panel-heading"><h4><b>List of last scenarios run over the last {{period}} days </b></h4></div> + <div class="panel-heading"><h4><b>List of last scenarios ({{version}}) run over the last {{period}} days </b></h4></div> <table class="table"> <tr> <th width="80%">Scenario</th> @@ -75,13 +75,13 @@ {% if test.isRunnable is sameas false -%} <td>N.R</td> {% elif test.getCriteria() > 2 -%} - <td><img src="./img/weather-clear.png"></td> + <td><img src="../../img/weather-clear.png"></td> {%- elif test.getCriteria() > 1 -%} - <td><img src="./img/weather-few-clouds.png"></td> + <td><img src="../../img/weather-few-clouds.png"></td> {%- elif test.getCriteria() > 0 -%} - <td><img src="./img/weather-overcast.png"></td> + <td><img src="../../img/weather-overcast.png"></td> {%- else -%} - <td><img src="./img/weather-storm.png"></td> + <td><img src="../../img/weather-storm.png"></td> {%- endif %} {%- endfor %} </tr> diff --git a/utils/test/reporting/index-tempest-tmpl.html b/utils/test/reporting/functest/template/index-tempest-tmpl.html index be0b79734..be0b79734 100644 --- a/utils/test/reporting/index-tempest-tmpl.html +++ b/utils/test/reporting/functest/template/index-tempest-tmpl.html diff --git a/utils/test/reporting/index-vims-tmpl.html b/utils/test/reporting/functest/template/index-vims-tmpl.html index 8858182c1..8858182c1 100644 --- a/utils/test/reporting/index-vims-tmpl.html +++ b/utils/test/reporting/functest/template/index-vims-tmpl.html diff --git a/utils/test/result_collection_api/dashboard/functest2Dashboard.py b/utils/test/result_collection_api/dashboard/functest2Dashboard.py index a2ed3085c..379b93279 100644 --- a/utils/test/result_collection_api/dashboard/functest2Dashboard.py +++ b/utils/test/result_collection_api/dashboard/functest2Dashboard.py @@ -117,12 +117,15 @@ def format_vIMS_for_dashboard(results): # Calculate nb of tests run and nb of tests failed # vIMS_results = get_vIMSresults(vIMS_test) # print vIMS_results - if data_test['result'] == "Passed": - nbTests += 1 - elif data_test['result'] == "Failed": - nbFailures += 1 - elif data_test['result'] == "Skipped": - nbSkipped += 1 + try: + if data_test['result'] == "Passed": + nbTests += 1 + elif data_test['result'] == "Failed": + nbFailures += 1 + elif data_test['result'] == "Skipped": + nbSkipped += 1 + except: + nbTests = 0 new_element.append({'x': data['creation_date'], 'y1': nbTests, @@ -149,10 +152,13 @@ def format_vIMS_for_dashboard(results): nbTestsOK = 0 nbTestsKO = 0 - if data_test['result'] == "Passed": - nbTestsOK += 1 - elif data_test['result'] == "Failed": - nbTestsKO += 1 + try: + if data_test['result'] == "Passed": + nbTestsOK += 1 + elif data_test['result'] == "Failed": + nbTestsKO += 1 + except: + nbTestsOK = 0 nbTests += nbTestsOK + nbTestsKO nbFailures += nbTestsKO @@ -366,7 +372,7 @@ def format_Rally_for_dashboard(results): # ******************************** new_element = [] for data in results: - summary_cursor = len(data) + summary_cursor = len(data['details']) - 1 new_element.append({'x': data['creation_date'], 'y': int(data['details'][summary_cursor]['summary']['duration'])}) |