-# Copyright (c) 2019 Cisco and/or its affiliates.
-# Copyright (c) 2019 PANTHEON.tech and/or its affiliates.
+# Copyright (c) 2020 Cisco and/or its affiliates.
+# Copyright (c) 2020 PANTHEON.tech and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
env_dir="${root_path}/env"
req_path=${2-$CSIT_DIR/requirements.txt}
rm -rf "${env_dir}" || die "Failed to clean previous virtualenv."
- pip3 install --upgrade virtualenv || {
+ pip3 install virtualenv==20.0.20 || {
die "Virtualenv package install failed."
}
- virtualenv --python=$(which python3) "${env_dir}" || {
+ virtualenv --no-download --python=$(which python3) "${env_dir}" || {
die "Virtualenv creation for $(which python3) failed."
}
set +u
source "${env_dir}/bin/activate" || die "Virtualenv activation failed."
set -u
- pip3 install --upgrade -r "${req_path}" || {
+ pip3 install -r "${req_path}" || {
die "Requirements installation failed."
}
# Most CSIT Python scripts assume PYTHONPATH is set and exported.
# Variables set:
# - BASH_FUNCTION_DIR - Path to existing directory this file is located in.
# - CSIT_DIR - Path to existing root of local CSIT git repository.
- # - TOPOLOGIES_DIR - Path to existing directory with available tpologies.
+ # - TOPOLOGIES_DIR - Path to existing directory with available topologies.
+ # - JOB_SPECS_DIR - Path to existing directory with job test specifications.
# - RESOURCES_DIR - Path to existing CSIT subdirectory "resources".
# - TOOLS_DIR - Path to existing resources subdirectory "tools".
# - PYTHON_SCRIPTS_DIR - Path to existing tools subdirectory "scripts".
TOPOLOGIES_DIR=$(readlink -e "${CSIT_DIR}/topologies/available") || {
die "Readlink failed."
}
+ JOB_SPECS_DIR=$(readlink -e "${CSIT_DIR}/docs/job_specs") || {
+ die "Readlink failed."
+ }
RESOURCES_DIR=$(readlink -e "${CSIT_DIR}/resources") || {
die "Readlink failed."
}
*"device"*)
PYBOT_ARGS+=("--suite" "tests.${DUT}.device")
;;
- *"func"*)
- PYBOT_ARGS+=("--suite" "tests.${DUT}.func")
- ;;
*"perf"*)
PYBOT_ARGS+=("--suite" "tests.${DUT}.perf")
;;
cp -r "${CSIT_DIR}/tests" "${GENERATED_DIR}/tests" || die
cmd_line=("find" "${GENERATED_DIR}/tests" "-type" "f")
cmd_line+=("-executable" "-name" "*.py")
- file_list=$("${cmd_line[@]}") || die
+ # We sort the directories, so log output can be compared between runs.
+ file_list=$("${cmd_line[@]}" | sort) || die
for gen in ${file_list}; do
directory="$(dirname "${gen}")" || die
# - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
# Functions called:
# - die - Print to stderr and exit.
- # - ansible_hosts - Perform an action using ansible, see ansible.sh
+ # - ansible_playbook - Perform an action using ansible, see ansible.sh
# Traps registered:
# - EXIT - Calls cancel_all for ${WORKING_TOPOLOGY}.
}
die "Trap attempt failed, unreserve succeeded. Aborting."
}
- # Cleanup check.
+ # Cleanup + calibration checks.
set +e
- ansible_hosts "cleanup"
+ ansible_playbook "cleanup, calibration"
result="$?"
set -e
if [[ "${result}" == "0" ]]; then
# Variables read:
# - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
# - TEST_CODE - String affecting test selection, usually jenkins job name.
+ # - DUT - CSIT test/ subdirectory, set while processing tags.
# - TEST_TAG_STRING - String selecting tags, from gerrit comment.
# Can be unset.
# - TOPOLOGIES_DIR - Path to existing directory with available tpologies.
sed_nics_sub_cmd+=" | sed -e s/ANDvic1227/ANDnic_cisco-vic-1227/"
sed_nics_sub_cmd+=" | sed -e s/ANDvic1385/ANDnic_cisco-vic-1385/"
# Tag file directory shorthand.
- tfd="${BASH_FUNCTION_DIR}"
+ tfd="${JOB_SPECS_DIR}"
case "${TEST_CODE}" in
# Select specific performance tests based on jenkins job type variable.
*"ndrpdr-weekly"* )
- readarray -t test_tag_array < "${tfd}/mlr-weekly.txt" || die
+ readarray -t test_tag_array <<< $(sed 's/ //g' \
+ ${tfd}/mlr_weekly/${DUT}-${NODENESS}-${FLAVOR}.md |
+ eval ${sed_nics_sub_cmd}) || die
;;
*"mrr-daily"* )
readarray -t test_tag_array <<< $(sed 's/ //g' \
- ${tfd}/mrr-daily-${NODENESS}-${FLAVOR}.txt |
+ ${tfd}/mrr_daily/${DUT}-${NODENESS}-${FLAVOR}.md |
eval ${sed_nics_sub_cmd}) || die
;;
*"mrr-weekly"* )
- readarray -t test_tag_array <<< $(${sed_nic_sub_cmd} \
- ${tfd}/mrr-weekly.txt) || die
+ readarray -t test_tag_array <<< $(sed 's/ //g' \
+ ${tfd}/mrr_weekly/${DUT}-${NODENESS}-${FLAVOR}.md |
+ eval ${sed_nics_sub_cmd}) || die
+ ;;
+ *"report-iterative"* )
+ test_sets=(${TEST_TAG_STRING//:/ })
+ # Run only one test set per run
+ report_file=${test_sets[0]}.md
+ readarray -t test_tag_array <<< $(sed 's/ //g' \
+ ${tfd}/report_iterative/${NODENESS}-${FLAVOR}/${report_file} |
+ eval ${sed_nics_sub_cmd}) || die
+ ;;
+ *"report-coverage"* )
+ test_sets=(${TEST_TAG_STRING//:/ })
+ # Run only one test set per run
+ report_file=${test_sets[0]}.md
+ readarray -t test_tag_array <<< $(sed 's/ //g' \
+ ${tfd}/report_coverage/${NODENESS}-${FLAVOR}/${report_file} |
+ eval ${sed_nics_sub_cmd}) || die
;;
* )
if [[ -z "${TEST_TAG_STRING-}" ]]; then
# - EXIT - Failure to untrap is reported, but ignored otherwise.
# Functions called:
# - die - Print to stderr and exit.
- # - ansible_hosts - Perform an action using ansible, see ansible.sh
+ # - ansible_playbook - Perform an action using ansible, see ansible.sh
set -xo pipefail
set +eu # We do not want to exit early in a "teardown" function.
set -eu
warn "Testbed looks unreserved already. Trap removal failed before?"
else
- ansible_hosts "cleanup" || true
+ ansible_playbook "cleanup" || true
python3 "${PYTHON_SCRIPTS_DIR}/topo_reservation.py" -c -t "${wt}" || {
die "${1:-FAILED TO UNRESERVE, FIX MANUALLY.}" 2
}