aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash')
-rw-r--r--resources/libraries/bash/function/ansible.sh24
-rw-r--r--resources/libraries/bash/function/common.sh132
-rw-r--r--resources/libraries/bash/function/device.sh4
-rw-r--r--resources/libraries/bash/function/gather.sh136
-rw-r--r--resources/libraries/bash/function/gather_dpdk.sh66
-rw-r--r--resources/libraries/bash/function/gather_trex.sh30
-rw-r--r--resources/libraries/bash/function/gather_vpp.sh80
-rw-r--r--resources/libraries/bash/function/hugo.sh24
8 files changed, 267 insertions, 229 deletions
diff --git a/resources/libraries/bash/function/ansible.sh b/resources/libraries/bash/function/ansible.sh
index 6cf4d16f43..587c59cba7 100644
--- a/resources/libraries/bash/function/ansible.sh
+++ b/resources/libraries/bash/function/ansible.sh
@@ -27,11 +27,17 @@ function ansible_adhoc () {
set -exuo pipefail
- case "$FLAVOR" in
- "aws" | "c6in" | "c6gn" | "c7gn")
+ case "${TEST_CODE}" in
+ *"1n-aws" | *"2n-aws" | *"3n-aws")
INVENTORY_PATH="cloud_inventory"
;;
- "x-"*)
+ *"2n-c7gn" | *"3n-c7gn")
+ INVENTORY_PATH="cloud_inventory"
+ ;;
+ *"1n-c6in" | *"2n-c6in" | *"3n-c6in")
+ INVENTORY_PATH="cloud_inventory"
+ ;;
+ *"-x-2n"* | *"-x-3n"*)
INVENTORY_PATH="external_inventory"
;;
*)
@@ -72,11 +78,17 @@ function ansible_playbook () {
set -exuo pipefail
- case "$FLAVOR" in
- "aws" | "c6in" | "c6gn" | "c7gn")
+ case "${TEST_CODE}" in
+ *"1n-aws" | *"2n-aws" | *"3n-aws")
+ INVENTORY_PATH="cloud_inventory"
+ ;;
+ *"2n-c7gn" | *"3n-c7gn")
+ INVENTORY_PATH="cloud_inventory"
+ ;;
+ *"1n-c6in" | *"2n-c6in" | *"3n-c6in")
INVENTORY_PATH="cloud_inventory"
;;
- "x-"*)
+ *"-x-2n"* | *"-x-3n"*)
INVENTORY_PATH="external_inventory"
;;
*)
diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh
index 4f104dbfd3..9fd208b465 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,9 +119,9 @@ 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."
}
@@ -492,10 +487,6 @@ function get_test_code () {
NODENESS="2n"
FLAVOR="zn2"
;;
- *"2n-clx")
- NODENESS="2n"
- FLAVOR="clx"
- ;;
*"2n-icx")
NODENESS="2n"
FLAVOR="icx"
@@ -524,25 +515,19 @@ 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-"*)
- NODENESS="2n"
- FLAVOR="${TEST_CODE#*2n-}"
+ *"-x-2n"*)
+ TESTBED="${TEST_CODE#${TEST_CODE%2n*}}"
+ NODENESS="${TESTBED%-${TEST_CODE#*-x-2n*-}}"
+ FLAVOR="${TEST_CODE#*-x-2n*-}"
;;
- *"3n-x-"*)
- NODENESS="3n"
- FLAVOR="${TEST_CODE#*3n-}"
+ *"-x-3n"*)
+ TESTBED="${TEST_CODE#${TEST_CODE%3n*}}"
+ NODENESS="${TESTBED%-${TEST_CODE#*-x-3n*-}}"
+ FLAVOR="${TEST_CODE#*-x-3n*-}"
;;
esac
}
@@ -878,6 +863,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 +942,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,10 +954,10 @@ 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"
;;
*"1n-aws" | *"2n-aws" | *"3n-aws")
@@ -982,7 +969,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 +982,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,17 +1092,11 @@ 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")
;;
@@ -1135,10 +1115,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 +1124,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 +1186,90 @@ 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")
+ *"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,8 +1325,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=2
+ *"-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
}
diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh
index a0ba5a67a9..7a6f5aaa13 100644
--- a/resources/libraries/bash/function/device.sh
+++ b/resources/libraries/bash/function/device.sh
@@ -332,8 +332,8 @@ function get_available_interfaces () {
# Add Intel Corporation E810 Virtual Function to the
# whitelist.
pci_id="0x154c\|0x1889"
- tg_netdev=(enp42s0 ens5)
- dut1_netdev=(enp61s0 ens7)
+ tg_netdev=(ens2 ens5)
+ dut1_netdev=(ens4 ens7)
ports_per_nic=2
;;
"1n_vbox")
diff --git a/resources/libraries/bash/function/gather.sh b/resources/libraries/bash/function/gather.sh
index e432777e32..a5820a5a61 100644
--- a/resources/libraries/bash/function/gather.sh
+++ b/resources/libraries/bash/function/gather.sh
@@ -1,5 +1,5 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
-# Copyright (c) 2023 PANTHEON.tech and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2024 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:
@@ -19,14 +19,12 @@ set -exuo pipefail
# Keep functions ordered alphabetically, please.
-# TODO: Add a link to bash style guide.
-
-
function gather_build () {
# Variables read:
# - TEST_CODE - String affecting test selection, usually jenkins job name.
# - DOWNLOAD_DIR - Path to directory robot takes the build to test from.
+ # - BASH_FUNCTION_DIR = Path to Bash script directory.
# Variables set:
# - DUT - CSIT test/ subdirectory containing suites to execute.
# Directories updated:
@@ -38,27 +36,23 @@ function gather_build () {
# Multiple other side effects are possible,
# see functions called from here for their current description.
- # TODO: Separate DUT-from-TEST_CODE from gather-for-DUT,
- # when the first one becomes relevant for per_patch.
-
set -exuo pipefail
pushd "${DOWNLOAD_DIR}" || die "Pushd failed."
case "${TEST_CODE}" in
- *"hc2vpp"*)
- DUT="hc2vpp"
- # FIXME: Avoid failing on empty ${DOWNLOAD_DIR}.
- ;;
*"vpp"*)
DUT="vpp"
+ source "${BASH_FUNCTION_DIR}/gather_${DUT}.sh" || die "Source fail."
gather_vpp || die "The function should have died on error."
;;
*"dpdk"*)
DUT="dpdk"
+ source "${BASH_FUNCTION_DIR}/gather_${DUT}.sh" || die "Source fail."
gather_dpdk || die "The function should have died on error."
;;
*"trex"*)
DUT="trex"
+ source "${BASH_FUNCTION_DIR}/gather_${DUT}.sh" || die "Source fail."
gather_trex || die "The function should have died on error."
;;
*)
@@ -67,121 +61,3 @@ function gather_build () {
esac
popd || die "Popd failed."
}
-
-
-function gather_dpdk () {
-
- # Ensure latest DPDK archive is downloaded.
- #
- # Variables read:
- # - TEST_CODE - The test selection string from environment or argument.
- # Hardcoded:
- # - dpdk archive name to download if TEST_CODE is not time based.
- # Directories updated:
- # - ./ - Assumed ${DOWNLOAD_DIR}, dpdk-*.tar.xz is downloaded if not there.
- # Functions called:
- # - die - Print to stderr and exit, defined in common.sh
-
- set -exuo pipefail
-
- dpdk_repo="https://fast.dpdk.org/rel"
- # Use downloaded packages with specific version
- if [[ "${TEST_CODE}" == *"daily"* ]] || \
- [[ "${TEST_CODE}" == *"weekly"* ]] || \
- [[ "${TEST_CODE}" == *"timed"* ]];
- then
- echo "Downloading latest DPDK packages from repo..."
- # URL is not in quotes, calling command from variable keeps them.
- wget_command=("wget" "--no-check-certificate" "--compression=auto")
- wget_command+=("-nv" "-O" "-")
- wget_command+=("${dpdk_repo}")
- dpdk_stable_ver="$("${wget_command[@]}" | grep -v "2015"\
- | grep -Eo 'dpdk-[^\"]+xz' | tail -1)" || {
- die "Composite piped command failed."
- }
- else
- echo "Downloading DPDK package of specific version from repo ..."
- # Downloading DPDK version based on what VPP is using. Currently
- # it is not easy way to detect from VPP version automatically.
- dpdk_stable_ver="$(< "${CSIT_DIR}/DPDK_VPP_VER")".tar.xz || {
- die "Failed to read DPDK VPP version!"
- }
- fi
- # TODO: Use "wget -N" instead checking for file presence?
- if [[ ! -f "${dpdk_stable_ver}" ]]; then
- wget -nv --no-check-certificate "${dpdk_repo}/${dpdk_stable_ver}" || {
- die "Failed to get DPDK package from: ${dpdk_repo}"
- }
- fi
-}
-
-function gather_trex () {
-
- # This function is required to bypass download dir check.
- # Currently it creates empty file in download dir.
- # TODO: Add required packages
-
- set -exuo pipefail
-
- touch trex-download-to-be-added.txt
-}
-
-function gather_vpp () {
-
- # Variables read:
- # - BASH_FUNCTION_DIR - Bash directory with functions.
- # - TEST_CODE - The test selection string from environment or argument.
- # - DOWNLOAD_DIR - Path to directory robot takes the build to test from.
- # - CSIT_DIR - Path to existing root of local CSIT git repository.
- # Variables set:
- # - VPP_VERSION - VPP stable version under test.
- # Files read:
- # - ${CSIT_DIR}/DPDK_STABLE_VER - DPDK version to use
- # by csit-vpp not-timed jobs.
- # - ${CSIT_DIR}/${VPP_VER_FILE} - Ubuntu VPP version to use.
- # - ../*vpp*.deb|rpm - Relative to ${DOWNLOAD_DIR},
- # copied for vpp-csit jobs.
- # Directories updated:
- # - ${DOWNLOAD_DIR}, vpp-*.deb files are copied here for vpp-csit jobs.
- # - ./ - Assumed ${DOWNLOAD_DIR}, *vpp*.deb|rpm files
- # are downloaded here for csit-vpp.
- # Functions called:
- # - die - Print to stderr and exit, defined in common_functions.sh
- # Bash scripts executed:
- # - ${CSIT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh
- # - Should download and extract requested files to ./.
-
- set -exuo pipefail
-
- case "${TEST_CODE}" in
- "csit-"*)
- # Use downloaded packages with specific version.
- if [[ "${TEST_CODE}" == *"daily"* ]] || \
- { [[ "${TEST_CODE}" == *"weekly"* ]] && \
- [[ "${TEST_CODE}" != *"device"* ]]; } || \
- [[ "${TEST_CODE}" == *"semiweekly"* ]] || \
- [[ "${TEST_CODE}" == *"hourly"* ]];
- then
- warn "Downloading latest VPP packages from Packagecloud."
- else
- warn "Downloading stable VPP packages from Packagecloud."
- VPP_VERSION="$(<"${CSIT_DIR}/${VPP_VER_FILE}")" || {
- die "Read VPP stable version failed."
- }
- fi
- source "${BASH_FUNCTION_DIR}/artifacts.sh" || die "Source failed."
- download_artifacts || die
- ;;
- "vpp-csit-"*)
- # Shorten line.
- pkgs="${PKG_SUFFIX}"
- # Use locally built packages.
- mv "${DOWNLOAD_DIR}"/../*vpp*."${pkgs}" "${DOWNLOAD_DIR}"/ || {
- die "Move command failed."
- }
- ;;
- *)
- die "Unable to identify job type from: ${TEST_CODE}"
- ;;
- esac
-}
diff --git a/resources/libraries/bash/function/gather_dpdk.sh b/resources/libraries/bash/function/gather_dpdk.sh
new file mode 100644
index 0000000000..da3fa930e6
--- /dev/null
+++ b/resources/libraries/bash/function/gather_dpdk.sh
@@ -0,0 +1,66 @@
+# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2024 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:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
+
+# This library defines functions used mainly by "bootstrap" entry scripts.
+# Generally, the functions assume "common.sh" library has been sourced already.
+
+# Keep functions ordered alphabetically, please.
+
+function gather_dpdk () {
+
+ # Ensure latest DPDK archive is downloaded.
+ #
+ # Variables read:
+ # - TEST_CODE - The test selection string from environment or argument.
+ # Hardcoded:
+ # - dpdk archive name to download if TEST_CODE is not time based.
+ # Directories updated:
+ # - ./ - Assumed ${DOWNLOAD_DIR}, dpdk-*.tar.xz is downloaded if not there.
+ # Functions called:
+ # - die - Print to stderr and exit, defined in common.sh
+
+ set -exuo pipefail
+
+ dpdk_repo="https://fast.dpdk.org/rel"
+ # Use downloaded packages with specific version
+ if [[ "${TEST_CODE}" == *"daily"* ]] || \
+ [[ "${TEST_CODE}" == *"weekly"* ]] || \
+ [[ "${TEST_CODE}" == *"timed"* ]];
+ then
+ echo "Downloading latest DPDK packages from repo..."
+ # URL is not in quotes, calling command from variable keeps them.
+ wget_command=("wget" "--no-check-certificate" "--compression=auto")
+ wget_command+=("-nv" "-O" "-")
+ wget_command+=("${dpdk_repo}")
+ dpdk_stable_ver="$("${wget_command[@]}" | grep -v "2015"\
+ | grep -Eo 'dpdk-[^\"]+xz' | tail -1)" || {
+ die "Composite piped command failed."
+ }
+ else
+ echo "Downloading DPDK package of specific version from repo ..."
+ # Downloading DPDK version based on what VPP is using. Currently
+ # it is not easy way to detect from VPP version automatically.
+ dpdk_stable_ver="$(< "${CSIT_DIR}/DPDK_VPP_VER")".tar.xz || {
+ die "Failed to read DPDK VPP version!"
+ }
+ fi
+ # TODO: Use "wget -N" instead checking for file presence?
+ if [[ ! -f "${dpdk_stable_ver}" ]]; then
+ wget -nv --no-check-certificate "${dpdk_repo}/${dpdk_stable_ver}" || {
+ die "Failed to get DPDK package from: ${dpdk_repo}"
+ }
+ fi
+}
diff --git a/resources/libraries/bash/function/gather_trex.sh b/resources/libraries/bash/function/gather_trex.sh
new file mode 100644
index 0000000000..99591affc3
--- /dev/null
+++ b/resources/libraries/bash/function/gather_trex.sh
@@ -0,0 +1,30 @@
+# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2024 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:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
+
+# This library defines functions used mainly by "bootstrap" entry scripts.
+# Generally, the functions assume "common.sh" library has been sourced already.
+
+# Keep functions ordered alphabetically, please.
+
+function gather_trex () {
+
+ # This function is required to bypass download dir check.
+ # Currently it creates empty file in download dir.
+
+ set -exuo pipefail
+
+ touch trex-download-to-be-added.txt
+}
diff --git a/resources/libraries/bash/function/gather_vpp.sh b/resources/libraries/bash/function/gather_vpp.sh
new file mode 100644
index 0000000000..6ed4aa981c
--- /dev/null
+++ b/resources/libraries/bash/function/gather_vpp.sh
@@ -0,0 +1,80 @@
+# Copyright (c) 2024 Cisco and/or its affiliates.
+# Copyright (c) 2024 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:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
+
+# This library defines functions used mainly by "bootstrap" entry scripts.
+# Generally, the functions assume "common.sh" library has been sourced already.
+
+# Keep functions ordered alphabetically, please.
+
+function gather_vpp () {
+
+ # Variables read:
+ # - BASH_FUNCTION_DIR - Bash directory with functions.
+ # - TEST_CODE - The test selection string from environment or argument.
+ # - DOWNLOAD_DIR - Path to directory robot takes the build to test from.
+ # - CSIT_DIR - Path to existing root of local CSIT git repository.
+ # Variables set:
+ # - VPP_VERSION - VPP stable version under test.
+ # Files read:
+ # - ${CSIT_DIR}/DPDK_STABLE_VER - DPDK version to use
+ # by csit-vpp not-timed jobs.
+ # - ${CSIT_DIR}/${VPP_VER_FILE} - Ubuntu VPP version to use.
+ # - ../*vpp*.deb|rpm - Relative to ${DOWNLOAD_DIR},
+ # copied for vpp-csit jobs.
+ # Directories updated:
+ # - ${DOWNLOAD_DIR}, vpp-*.deb files are copied here for vpp-csit jobs.
+ # - ./ - Assumed ${DOWNLOAD_DIR}, *vpp*.deb|rpm files
+ # are downloaded here for csit-vpp.
+ # Functions called:
+ # - die - Print to stderr and exit, defined in common_functions.sh
+ # Bash scripts executed:
+ # - ${CSIT_DIR}/resources/tools/scripts/download_install_vpp_pkgs.sh
+ # - Should download and extract requested files to ./.
+
+ set -exuo pipefail
+
+ case "${TEST_CODE}" in
+ "csit-"*)
+ # Use downloaded packages with specific version.
+ if [[ "${TEST_CODE}" == *"daily"* ]] || \
+ { [[ "${TEST_CODE}" == *"weekly"* ]] && \
+ [[ "${TEST_CODE}" != *"device"* ]]; } || \
+ [[ "${TEST_CODE}" == *"semiweekly"* ]] || \
+ [[ "${TEST_CODE}" == *"hourly"* ]];
+ then
+ warn "Downloading latest VPP packages from Packagecloud."
+ else
+ warn "Downloading stable VPP packages from Packagecloud."
+ VPP_VERSION="$(<"${CSIT_DIR}/${VPP_VER_FILE}")" || {
+ die "Read VPP stable version failed."
+ }
+ fi
+ source "${BASH_FUNCTION_DIR}/artifacts.sh" || die "Source failed."
+ download_artifacts || die
+ ;;
+ "vpp-csit-"*)
+ # Shorten line.
+ pkgs="${PKG_SUFFIX}"
+ # Use locally built packages.
+ mv "${DOWNLOAD_DIR}"/../*vpp*."${pkgs}" "${DOWNLOAD_DIR}"/ || {
+ die "Move command failed."
+ }
+ ;;
+ *)
+ die "Unable to identify job type from: ${TEST_CODE}"
+ ;;
+ esac
+}
diff --git a/resources/libraries/bash/function/hugo.sh b/resources/libraries/bash/function/hugo.sh
index 052e8333fb..4d0e3eccc7 100644
--- a/resources/libraries/bash/function/hugo.sh
+++ b/resources/libraries/bash/function/hugo.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco 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:
@@ -26,12 +26,12 @@ function go_install () {
aarch64) architecture="arm64" ;;
esac
- go_version="go1.20.2.linux-${architecture}.tar.gz"
+ go_version="go1.22.5.linux-${architecture}.tar.gz"
go_url="https://go.dev/dl"
wget "${go_url}/${go_version}"
- rm -rf "/usr/local/go"
- tar -C "/usr/local" -xzf "go1.20.2.linux-${architecture}.tar.gz"
- rm "go1.20.2.linux-${architecture}.tar.gz"
+ sudo rm -rf "/usr/local/go"
+ sudo tar -C "/usr/local" -xzf "go1.22.5.linux-${architecture}.tar.gz"
+ rm "go1.22.5.linux-${architecture}.tar.gz"
export PATH=$PATH:/usr/local/go/bin
}
@@ -45,8 +45,12 @@ function hugo_build_site () {
# Functions called:
# - die - Print to stderr and exit.
+ if ! install go; then
+ go_install || die "Please install Go!"
+ fi
+
if ! installed hugo; then
- die "Please install Hugo!"
+ hugo_install || die "Please install Hugo!"
fi
pushd "${CSIT_DIR}"/docs || die "Pushd failed!"
@@ -64,8 +68,12 @@ function hugo_init_modules () {
# Functions called:
# - die - Print to stderr and exit.
+ if ! install go; then
+ go_install || die "Please install Go!"
+ fi
+
if ! installed hugo; then
- die "Please install Hugo!"
+ hugo_install || die "Please install Hugo!"
fi
hugo_book_url="github.com/alex-shpak/hugo-book"
@@ -92,7 +100,7 @@ function hugo_install () {
hugo_url="https://github.com/gohugoio/hugo/releases/download"
hugo_link="${hugo_url}/${hugo_version}"
wget -O "hugo.deb" "${hugo_link}" || die "Failed to install Hugo!"
- dpkg -i "hugo.deb" || die "Failed to install Hugo!"
+ sudo dpkg -i "hugo.deb" || die "Failed to install Hugo!"
rm "hugo.deb" || die "Failed to install Hugo!"
}