diff options
Diffstat (limited to 'resources/libraries/bash/function/common.sh')
-rw-r--r-- | resources/libraries/bash/function/common.sh | 146 |
1 files changed, 63 insertions, 83 deletions
diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh index 8a46fc329d..fa00b14ded 100644 --- a/resources/libraries/bash/function/common.sh +++ b/resources/libraries/bash/function/common.sh @@ -17,11 +17,6 @@ set -exuo pipefail # This library defines functions used by multiple entry scripts. # Keep functions ordered alphabetically, please. -# TODO: Add a link to bash style guide. -# TODO: Consider putting every die into a {} block, -# the code might become more readable (but longer). - - function activate_docker_topology () { # Create virtual vpp-device topology. Output of the function is topology @@ -124,15 +119,16 @@ function activate_virtualenv () { env_dir="${root_path}/env" req_path=${2-$CSIT_DIR/requirements.txt} rm -rf "${env_dir}" || die "Failed to clean previous virtualenv." - pip3 install virtualenv==20.15.1 || { - die "Virtualenv package install failed." - } + #pip3 install virtualenv==20.26.3 || { + # die "Virtualenv package install failed." + #} 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 setuptools pip3 install -r "${req_path}" || { die "Requirements installation failed." } @@ -492,10 +488,6 @@ function get_test_code () { NODENESS="2n" FLAVOR="zn2" ;; - *"2n-clx") - NODENESS="2n" - FLAVOR="clx" - ;; *"2n-icx") NODENESS="2n" FLAVOR="icx" @@ -524,25 +516,23 @@ function get_test_code () { NODENESS="3n" FLAVOR="icxd" ;; - *"2n-tx2") - NODENESS="2n" - FLAVOR="tx2" - ;; - *"3n-tsh") - NODENESS="3n" - FLAVOR="tsh" - ;; *"3n-alt") NODENESS="3n" FLAVOR="alt" ;; - *"2n-x-"*) + *"2n-grc") NODENESS="2n" - FLAVOR="${TEST_CODE#*2n-}" + FLAVOR="grc" ;; - *"3n-x-"*) - NODENESS="3n" - FLAVOR="${TEST_CODE#*3n-}" + *"-x-2n"*) + TESTBED="${TEST_CODE#${TEST_CODE%2n*}}" + NODENESS="${TESTBED%-${TEST_CODE#*-x-2n*-}}" + FLAVOR="${TEST_CODE#*-x-2n*-}" + ;; + *"-x-3n"*) + TESTBED="${TEST_CODE#${TEST_CODE%3n*}}" + NODENESS="${TESTBED%-${TEST_CODE#*-x-3n*-}}" + FLAVOR="${TEST_CODE#*-x-3n*-}" ;; esac } @@ -780,7 +770,7 @@ function reserve_and_cleanup_testbed () { } # Cleanup + calibration checks set +e - ansible_playbook "cleanup, calibration" + ansible_playbook "cleanup,calibration" result="$?" set -e if [[ "${result}" == "0" ]]; then @@ -878,6 +868,11 @@ function select_arch_os () { VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_JAMMY" PKG_SUFFIX="deb" ;; + *"LTS (Noble Numbat)"*) + IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU_NOBLE" + VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_NOBLE" + PKG_SUFFIX="deb" + ;; *) die "Unsupported Ubuntu version!" ;; @@ -952,9 +947,6 @@ function select_tags () { *"3n-icxd") default_nic="nic_intel-e823c" ;; - *"3n-tsh") - default_nic="nic_intel-x520-da2" - ;; *"3n-icx" | *"2n-icx") default_nic="nic_intel-e810cq" ;; @@ -967,12 +959,15 @@ function select_tags () { *"2n-spr") default_nic="nic_intel-e810cq" ;; - *"2n-clx" | *"2n-zn2") + *"2n-zn2") default_nic="nic_intel-xxv710" ;; - *"2n-tx2" | *"3n-alt") + *"3n-alt") default_nic="nic_intel-xl710" ;; + *"2n-grc") + default_nic="nic_mellanox-cx7veat" + ;; *"1n-aws" | *"2n-aws" | *"3n-aws") default_nic="nic_amazon-nitro-50g" ;; @@ -982,7 +977,7 @@ function select_tags () { *"1n-c6in" | *"2n-c6in" | *"3n-c6in") default_nic="nic_amazon-nitro-200g" ;; - *"2n-x-"* | *"3n-x-"*) + *"-x-2n"* | *"-x-3n"*) default_nic="nic_intel-e810cq" ;; *) @@ -995,7 +990,6 @@ function select_tags () { awk_nics_sub_cmd+='gsub("xxv710","25ge2p1xxv710");' awk_nics_sub_cmd+='gsub("x710","10ge2p1x710");' awk_nics_sub_cmd+='gsub("xl710","40ge2p1xl710");' - awk_nics_sub_cmd+='gsub("x520-da2","10ge2p1x520");' awk_nics_sub_cmd+='gsub("cx556a","100ge2p1cx556a");' awk_nics_sub_cmd+='gsub("2p1cx7veat","200ge2p1cx7veat");' awk_nics_sub_cmd+='gsub("6p3cx7veat","200ge6p3cx7veat");' @@ -1106,23 +1100,20 @@ function select_tags () { *"1n-alt") test_tag_array+=("!flow") ;; - *"2n-clx") - test_tag_array+=("!ipsechw") - ;; *"2n-icx") test_tag_array+=("!ipsechw") ;; *"2n-spr") ;; - *"2n-tx2") - test_tag_array+=("!ipsechw") - ;; *"2n-zn2") test_tag_array+=("!ipsechw") ;; *"3n-alt") test_tag_array+=("!ipsechw") ;; + *"2n-grc") + test_tag_array+=("!ipsechw") + ;; *"3n-icx") test_tag_array+=("!ipsechw") test_tag_array+=("!3_node_double_link_topoANDnic_intel-xxv710") @@ -1135,10 +1126,6 @@ function select_tags () { ;; *"3nb-spr") ;; - *"3n-tsh") - test_tag_array+=("!drv_avf") - test_tag_array+=("!ipsechw") - ;; *"1n-aws" | *"2n-aws" | *"3n-aws") test_tag_array+=("!ipsechw") ;; @@ -1148,7 +1135,7 @@ function select_tags () { *"1n-c6in" | *"2n-c6in" | *"3n-c6in") test_tag_array+=("!ipsechw") ;; - *"2n-x-"* | *"3n-x-"*) + *"-x-2n"* | *"-x-3n"*) ;; esac @@ -1210,103 +1197,94 @@ function select_topology () { set -exuo pipefail - case_text="${NODENESS}_${FLAVOR}" - case "${case_text}" in - "1n_aws") + case "${TEST_CODE}" in + *"1n-aws") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*1n-aws*.yaml ) TOPOLOGIES_TAGS="1_node_single_link_topo" ;; - "1n_c6in") + *"1n-c6in") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*1n-c6in*.yaml ) TOPOLOGIES_TAGS="1_node_single_link_topo" ;; - "1n_alt" | "1n_spr") + *"1n-alt" | *"1n-spr") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*vpp_device*.template ) TOPOLOGIES_TAGS="2_node_single_link_topo" ;; - "1n_vbox") + *"1n-vbox") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*vpp_device*.template ) TOPOLOGIES_TAGS="2_node_single_link_topo" ;; - "2n_aws") + *"2n-aws") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n-aws*.yaml ) TOPOLOGIES_TAGS="2_node_single_link_topo" ;; - "2n_c7gn") + *"2n-c7gn") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n-c7gn*.yaml ) TOPOLOGIES_TAGS="2_node_single_link_topo" ;; - "2n_c6in") + *"2n-c6in") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n-c6in*.yaml ) TOPOLOGIES_TAGS="2_node_single_link_topo" ;; - "2n_clx") - TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_clx_*.yaml ) - TOPOLOGIES_TAGS="2_node_*_link_topo" - ;; - "2n_icx") + *"2n-icx") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_icx_*.yaml ) TOPOLOGIES_TAGS="2_node_*_link_topo" ;; - "2n_spr") + *"2n-spr") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_spr_*.yaml ) TOPOLOGIES_TAGS="2_node_*_link_topo" ;; - "2n_tx2") - TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_tx2_*.yaml ) - TOPOLOGIES_TAGS="2_node_single_link_topo" - ;; - "2n_zn2") + *"2n-zn2") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_zn2_*.yaml ) TOPOLOGIES_TAGS="2_node_*_link_topo" ;; - "3n_alt") + *"3n-alt") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_alt_*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; - "3n_aws") + *"2n-grc") + TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_grc_*.yaml ) + TOPOLOGIES_TAGS="2_node_single_link_topo" + ;; + *"3n-aws") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n-aws*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; - "3n_c7gn") + *"3n-c7gn") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n-c7gn*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; - "3n_c6in") + *"3n-c6in") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n-c6in*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; - "3n_icx") + *"3n-icx") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_icx_*.yaml ) # Trailing underscore is needed to distinguish from 3n_icxd. TOPOLOGIES_TAGS="3_node_*_link_topo" ;; - "3n_icxd") + *"3n-icxd") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_icxd_*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; - "3n_snr") + *"3n-snr") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_snr_*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; - "3n_tsh") - TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_tsh_*.yaml ) - TOPOLOGIES_TAGS="3_node_single_link_topo" - ;; - "3na_spr") + *"3na-spr") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3na_spr_*.yaml ) TOPOLOGIES_TAGS="3_node_*_link_topo" ;; - "3nb_spr") + *"3nb-spr") TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3nb_spr_*.yaml ) TOPOLOGIES_TAGS="3_node_*_link_topo" ;; - "2n_x"*) - TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*2n_"${FLAVOR}"*.yaml ) + *"-x-2n"*) + TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*_x_"${NODENESS}_${FLAVOR}"*.yaml ) TOPOLOGIES_TAGS="2_node_single_link_topo" ;; - "3n_x"*) - TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*3n_"${FLAVOR}"*.yaml ) + *"-x-3n"*) + TOPOLOGIES=( "${TOPOLOGIES_DIR}"/*_x_"${NODENESS}_${FLAVOR}"*.yaml ) TOPOLOGIES_TAGS="3_node_single_link_topo" ;; *) @@ -1362,9 +1340,11 @@ function set_environment_variables () { # Maciek's workaround for Zen2 with lower amount of cores. export TREX_CORE_COUNT=14 ;; - *"2n-x-"* | *"3n-x-"* ) - export TREX_CORE_COUNT=6 + *"-x-2n"* | *"-x-3n"* ) + export TREX_CORE_COUNT=14 export TREX_PORT_MTU=9000 + # Settings to prevent duration stretching. + export PERF_TRIAL_STL_DELAY=0.12 ;; esac } |