+function select_vpp_device_tags () {
+
+ # Variables read:
+ # - TEST_CODE - String affecting test selection, usually jenkins job name.
+ # - TEST_TAG_STRING - String selecting tags, from gerrit comment.
+ # Can be unset.
+ # Variables set:
+ # - TAGS - Array of processed tag boolean expressions.
+
+ set -exuo pipefail
+
+ case "${TEST_CODE}" in
+ # Select specific device tests based on jenkins job type variable.
+ * )
+ if [[ -z "${TEST_TAG_STRING-}" ]]; then
+ # If nothing is specified, we will run pre-selected tests by
+ # following tags. Items of array will be concatenated by OR
+ # in Robot Framework.
+ test_tag_array=()
+ else
+ # If trigger contains tags, split them into array.
+ test_tag_array=(${TEST_TAG_STRING//:/ })
+ fi
+ SELECTION_MODE="--include"
+ ;;
+ esac
+
+ # Blacklisting certain tags per topology.
+ #
+ # Reasons for blacklisting:
+ # - avf - AVF is not possible to run on enic driver of VirtualBox.
+ # - vhost - VirtualBox does not support nesting virtualization on Intel CPU.
+ case "${TEST_CODE}" in
+ *"1n-vbox"*)
+ test_tag_array+=("!avf")
+ test_tag_array+=("!vhost")
+ ;;
+ *)
+ ;;
+ esac
+
+ TAGS=()
+
+ # We will prefix with devicetest to prevent running other tests
+ # (e.g. Functional).
+ prefix="devicetestAND"
+ if [[ "${TEST_CODE}" == "vpp-"* ]]; then
+ # Automatic prefixing for VPP jobs to limit testing.
+ prefix="${prefix}"
+ fi
+ for tag in "${test_tag_array[@]}"; do
+ if [[ ${tag} == "!"* ]]; then
+ # Exclude tags are not prefixed.
+ TAGS+=("${tag}")
+ else
+ TAGS+=("${prefix}${tag}")
+ fi
+ done
+}
+
+
+function set_environment_variables () {
+
+ # Depending on testbed topology, overwrite defaults set in the
+ # resources/libraries/python/Constants.py file
+ #
+ # Variables read:
+ # - TEST_CODE - String affecting test selection, usually jenkins job name.
+ # Variables set:
+ # See specific cases
+
+ set -exuo pipefail
+
+ case "${TEST_CODE}" in
+ *"2n-aws"* | *"3n-aws"*)
+ # T-Rex 2.88 workaround for ENA NICs
+ export TREX_RX_DESCRIPTORS_COUNT=1024
+ export TREX_EXTRA_CMDLINE="--mbuf-factor 19"
+ # Settings to prevent duration stretching
+ export PERF_TRIAL_STL_DELAY=0.1
+ ;;
+ esac
+}
+
+