feat(bootstrap): Introduce VPP build. 18/42818/15
authorPeter Mikus <[email protected]>
Tue, 15 Apr 2025 11:56:15 +0000 (13:56 +0200)
committerPeter Mikus <[email protected]>
Fri, 9 May 2025 07:10:13 +0000 (07:10 +0000)
Signed-off-by: Peter Mikus <[email protected]>
Change-Id: I734733944dc6d3bad196e719a3964d4a415a762d

VPP_DEVICE_IMAGE_UBUNTU_NOBLE_ARM [deleted file]
VPP_STABLE_COMMIT [new file with mode: 0644]
fdio.infra.ansible/roles/cleanup/tasks/kill_containers.yaml
resources/libraries/bash/entry/per_patch_perf.sh
resources/libraries/bash/function/build_vpp.sh [new file with mode: 0644]
resources/libraries/bash/function/common.sh
resources/libraries/bash/function/gather.sh
resources/libraries/bash/function/per_patch.sh
topologies/available/lf_3n_oct_testbed215.yaml

diff --git a/VPP_DEVICE_IMAGE_UBUNTU_NOBLE_ARM b/VPP_DEVICE_IMAGE_UBUNTU_NOBLE_ARM
deleted file mode 100644 (file)
index fcc3f1e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-csit_sut-ubuntu2404:local
diff --git a/VPP_STABLE_COMMIT b/VPP_STABLE_COMMIT
new file mode 100644 (file)
index 0000000..e17814d
--- /dev/null
@@ -0,0 +1 @@
+64a4e8d7cde13eeb0034bc2d835defef88d8f345
\ No newline at end of file
index 9c3dc17..41dec65 100644 (file)
     - name: "Restart Docker Daemon"
       ansible.builtin.systemd:
         name: "docker"
-        state: "restarted"
-
-- name: "Kill LXC Containers"
-  block:
-    - name: "Get Running LXC Containers"
-      ansible.builtin.shell: "lxc-ls"
-      register: running_containers
-      changed_when: false
-      tags:
-        - kill-containers
-
-    - name: "Remove All LXC Containers"
-      ansible.builtin.shell: "lxc-destroy --force -n {{ item }}"
-      with_items: "{{ running_containers.stdout_lines }}"
-      tags:
-        - kill-containers
-
-  rescue:
-    - fail:
-        msg: "Kill LXC containers failed!"
+        state: "restarted"
\ No newline at end of file
index 9a825a0..15df8ff 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-# Copyright (c) 2023 Cisco and/or its affiliates.
+# Copyright (c) 2025 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:
@@ -43,6 +43,8 @@ source "${BASH_FUNCTION_DIR}/per_patch.sh" || die "Source failed."
 source "${BASH_FUNCTION_DIR}/ansible.sh" || die "Source failed."
 common_dirs || die
 check_prerequisites || die
+get_test_code "${1-}" || die
+get_test_tag_string || die
 set_perpatch_vpp_dir || die
 git status || die
 git describe || die
@@ -54,8 +56,6 @@ git describe || die
 build_vpp_ubuntu "PARENT" || die
 set_aside_build_artifacts "parent" || die
 initialize_csit_dirs "parent" "current" || die
-get_test_code "${1-}" || die
-get_test_tag_string || die
 set_perpatch_dut || die
 select_topology || die
 select_arch_os || die
diff --git a/resources/libraries/bash/function/build_vpp.sh b/resources/libraries/bash/function/build_vpp.sh
new file mode 100644 (file)
index 0000000..2becccf
--- /dev/null
@@ -0,0 +1,67 @@
+# Copyright (c) 2025 Cisco and/or its affiliates.
+# Copyright (c) 2025 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 build_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}/${VPP_COMMIT_FILE} - VPP commit to use.
+    # Directories updated:
+    # - ${DOWNLOAD_DIR}, vpp-*.deb files are copied here for testing.
+    # Functions called:
+    # - die - Print to stderr and exit, defined in common.sh
+
+    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 "Cloning latest commit from VPP repository."
+            else
+                warn "Cloning stable commit from VPP repository."
+                VPP_VERSION="$(<"${CSIT_DIR}/${VPP_COMMIT_FILE}")" || {
+                    die "Read VPP stable version failed."
+                }
+            fi
+            source "${BASH_FUNCTION_DIR}/per_patch.sh" || die "Source failed."
+            clone_vpp_repo || die
+            set_csit_vpp_dir || die
+            build_vpp_ubuntu "CURRENT" || die
+            select_build "build-root" || die
+            remove_vpp_repo || die
+            ;;
+        *)
+            die "Unsupported job type from: ${TEST_CODE}"
+            ;;
+    esac
+}
index 438a8c0..b02a29a 100644 (file)
@@ -427,6 +427,7 @@ function get_test_code () {
     # - TEST_CODE - The test selection string from environment or argument.
     # - NODENESS - Node multiplicity of desired testbed.
     # - FLAVOR - Node flavor string, usually describing the processor.
+    # - VPP_PLATFORM - VPP build optimisation string.
 
     set -exuo pipefail
 
@@ -535,6 +536,7 @@ function get_test_code () {
         *"3n-oct")
             NODENESS="3n"
             FLAVOR="oct"
+            VPP_PLATFORM="octeon10"
             ;;
         *"-x-2n"*)
             TESTBED="${TEST_CODE#${TEST_CODE%2n*}}"
@@ -864,8 +866,10 @@ function select_arch_os () {
     # Set variables affected by local CPU architecture and operating system.
     #
     # Variables set:
-    # - VPP_VER_FILE - Name of file in CSIT dir containing vpp stable version.
     # - IMAGE_VER_FILE - Name of file in CSIT dir containing the image name.
+    # - VPP_COMMIT_FILE - Name of file in CSIT dir containing vpp commit
+    #   version.
+    # - VPP_VER_FILE - Name of file in CSIT dir containing vpp stable version.
     # - PKG_SUFFIX - Suffix of OS package file name, "rpm" or "deb."
 
     set -exuo pipefail
@@ -877,11 +881,13 @@ function select_arch_os () {
             case "${VERSION}" in
                 *"LTS (Jammy Jellyfish)"*)
                     IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU_JAMMY"
+                    VPP_COMMIT_FILE="VPP_STABLE_COMMIT"
                     VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_JAMMY"
                     PKG_SUFFIX="deb"
                     ;;
                 *"LTS (Noble Numbat)"*)
                     IMAGE_VER_FILE="VPP_DEVICE_IMAGE_UBUNTU_NOBLE"
+                    VPP_COMMIT_FILE="VPP_STABLE_COMMIT"
                     VPP_VER_FILE="VPP_STABLE_VER_UBUNTU_NOBLE"
                     PKG_SUFFIX="deb"
                     ;;
index a5820a5..23918c5 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (c) 2024 Cisco and/or its affiliates.
-# Copyright (c) 2024 PANTHEON.tech and/or its affiliates.
+# Copyright (c) 2025 Cisco and/or its affiliates.
+# Copyright (c) 2025 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:
@@ -31,8 +31,8 @@ function gather_build () {
     # - ${DOWNLOAD_DIR} - Files needed by tests are gathered here.
     # Functions called:
     # - die - Print to stderr and exit, defined in common.sh
-    # - gather_os - Parse os parameter for OS/distro name.
     # - gather_dpdk, gather_vpp - See their definitions.
+    # - build_vpp - See their definitions.
     # Multiple other side effects are possible,
     # see functions called from here for their current description.
 
@@ -40,6 +40,11 @@ function gather_build () {
 
     pushd "${DOWNLOAD_DIR}" || die "Pushd failed."
     case "${TEST_CODE}" in
+        *"vpp"*"3n-oct")
+            DUT="vpp"
+            source "${BASH_FUNCTION_DIR}/build_${DUT}.sh" || die "Source fail."
+            build_vpp || die "The function should have died on error."
+            ;;
         *"vpp"*)
             DUT="vpp"
             source "${BASH_FUNCTION_DIR}/gather_${DUT}.sh" || die "Source fail."
index 44bd57d..44d73c5 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (c) 2023 Cisco and/or its affiliates.
-# Copyright (c) 2023 PANTHEON.tech s.r.o.
+# Copyright (c) 2025 Cisco and/or its affiliates.
+# Copyright (c) 2025 PANTHEON.tech s.r.o.
 # 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:
@@ -32,6 +32,7 @@ function build_vpp_ubuntu () {
     # - MAKE_PARALLEL_FLAGS - Make flags when building VPP.
     # - MAKE_PARALLEL_JOBS - Number of cores to use when building VPP.
     # - VPP_DIR - Path to existing directory, parent to accessed directories.
+    # - VPP_PLATFORM - Platform optiomizaion string.
     # Directories updated:
     # - ${VPP_DIR} - Whole subtree, many files (re)created by the build process.
     # Functions called:
@@ -51,13 +52,45 @@ function build_vpp_ubuntu () {
              "using build default ($(grep -c ^processor /proc/cpuinfo))."
     fi
 
-    make UNATTENDED=y pkg-verify || die "VPP build with make pkg-verify failed."
+    if [ -z "${VPP_PLATFORM-}" ]; then
+        make_params="UNATTENDED=y"
+    else
+        make_params="UNATTENDED=y VPP_PLATFORM=${VPP_PLATFORM}"
+    fi
+    make ${make_params} pkg-verify || die "VPP build failed."
     echo "* VPP ${1-} BUILD SUCCESSFULLY COMPLETED" || {
         die "Argument not found."
     }
 }
 
 
+function clone_vpp_repo () {
+
+    # Clones VPP repository into CSIT directory. In case VPP_VERSION is set,
+    # it checks out the specific commit id. Otherwise use the latest HEAD.
+    #
+    # Variables read:
+    # - CSIT_DIR - Path to existing root of local CSIT git repository.
+    # - GIT_URL - FD.io gerrit URL.
+    # - VPP_VERSION - VPP stable version under test.
+
+    set -exuo pipefail
+
+    pushd "${CSIT_DIR}/" || die "Pushd failed."
+    git clone "${GIT_URL}/vpp" --depth=1 --no-single-branch --no-checkout || \
+        die "Failed to clone VPP repository."
+    pushd "${CSIT_DIR}/vpp" || die "Pushd failed."
+    if [[ -n "${VPP_VERSION-}" ]]; then
+        git fetch "${GIT_URL}/vpp" "${VPP_VERSION}" || \
+            die "Failed to fetch specific commit id."
+        git checkout FETCH_HEAD || die "Checkout FETCH_HEAD failed."
+    else
+        git checkout HEAD || die "Checkout HEAD failed."
+    fi
+    popd || die "Popd failed."
+}
+
+
 function compare_test_results () {
 
     # Variables read:
@@ -195,6 +228,19 @@ function move_test_results () {
 }
 
 
+function remove_vpp_repo () {
+
+    # Removes directory with cloned VPP repository to save the space.
+    #
+    # Variables read:
+    # - VPP_DIR - Path to existing root of local VPP git repository.
+
+    set -exuo pipefail
+
+    popd || die "Popd failed."
+    rm -rf "${VPP_DIR}" || die "Directory deletion failed."
+}
+
 function select_build () {
 
     # Arguments:
@@ -281,3 +327,19 @@ function set_perpatch_vpp_dir () {
     # In perpatch, CSIT is cloned inside VPP clone.
     VPP_DIR="$(readlink -e "${CSIT_DIR}/..")" || die "Readlink failed."
 }
+
+
+function set_csit_vpp_dir () {
+
+    # Variables read:
+    # - CSIT_DIR - Path to existing root of local CSIT git repository.
+    # Variables set:
+    # - VPP_DIR - Path to existing root of local VPP git repository.
+    # Functions called:
+    # - die - Print to stderr and exit, defined in common.sh
+
+    set -exuo pipefail
+
+    # In verify, VPP is cloned within CSIT dir.
+    VPP_DIR="$(readlink -e "${CSIT_DIR}/vpp")" || die "Readlink failed."
+}
\ No newline at end of file
index e939803..6c47914 100644 (file)
@@ -60,7 +60,7 @@ nodes:
         model: Cavium-A063-100G
       port2:
         # s95-t215-sut1-c2/p1 - 100GE port2 Cavium A063 2p100GE.
-        mac_address: "1a:cc:6a:50:05:2a"
+        mac_address: "1a:cc:6a:50:05:2b"
         pci_address: "0002:03:00.0"
         ip4_address: 172.16.30.1
         driver: rvu_nicpf