ci: add functional tests to verification/merge jobs 27/36827/7
authorMauro Sardara <msardara@cisco.com>
Tue, 9 Aug 2022 12:18:05 +0000 (14:18 +0200)
committerMauro Sardara <msardara@cisco.com>
Tue, 9 Aug 2022 13:14:10 +0000 (15:14 +0200)
Ref: ICN-732

Signed-off-by: Mauro Sardara <msardara@cisco.com>
Change-Id: Iabfce26c446c502dc1d8f50da0d607791ce392e9

13 files changed:
scripts/build-packages.sh
scripts/functions.sh
scripts/install-vpp.sh
tests/1-node.yml
tests/2-nodes-hicn-light.yml
tests/2-nodes-vpp-bridge.yml
tests/2-nodes-vpp-memif-replication.yml
tests/2-nodes-vpp-memif.yml
tests/2-nodes.yml
tests/Dockerfile.ci
tests/Makefile
tests/channel.sh
tests/config.sh

index d7684e4..a17e180 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2019 Cisco and/or its affiliates.
+# Copyright (c) 2017-2022 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:
@@ -28,9 +28,9 @@ function build_package() {
     echo "*******************************************************************"
 
     # Make the package
-    make -C ${SCRIPT_PATH}/.. INSTALL_PREFIX=/usr test package-release
+    make -C "${SCRIPT_PATH}/.." BUILD_PATH="${SCRIPT_PATH}/../packages" INSTALL_PREFIX=/usr test package-release
 
-    pushd ${SCRIPT_PATH}/../build-release-${ID}
+    pushd ${SCRIPT_PATH}/../packages
       find . -not -name '*.deb' -not -name '*.rpm' -print0 | xargs -0 rm -rf -- || true
       rm *Unspecified* *Development* *development* || true
     popd
@@ -40,6 +40,21 @@ function build_package() {
     echo "*******************************************************************"
 }
 
+function functional_test() {
+    echo "*******************************************************************"
+    echo "********************* STARTING FUNCTIONAL TESTS *******************"
+    echo "*******************************************************************"
+
+    # Run functional tests
+    pushd ${SCRIPT_PATH}/..
+      BUILD_SOFTWARE=0 DOCKERFILE="tests/Dockerfile.ci" bash ./tests/run-functional.sh
+    popd
+
+    echo "*******************************************************************"
+    echo "**********  FUNCTIONAL TESTS COMPLETED SUCCESSFULLY ***************"
+    echo "*******************************************************************"
+}
+
 build_sphinx() {
     setup
 
@@ -69,6 +84,7 @@ case "${1}" in
     ;;
   packages)
     build_package
+    functional_test
     ;;
   *)
     usage
index e416ee2..147f666 100644 (file)
@@ -56,6 +56,8 @@ function call_once() {
 
 # Install dependencies
 function install_deps() {
+  curl -fsSL https://get.docker.com -o get-docker.sh
+  sudo sh get-docker.sh
   make -C ${SCRIPT_PATH}/.. deps
 }
 
index 855587a..3c2d210 100644 (file)
@@ -31,6 +31,9 @@ fi
 # Prevent vpp to set sysctl
 export VPP_INSTALL_SKIP_SYSCTL=1
 
+apt-get update
+apt-get install -y curl
+
 curl -s https://packagecloud.io/install/repositories/fdio/${VPP_VERSION}/script.deb.sh | bash
 curl -L https://packagecloud.io/fdio/${VPP_VERSION}/gpgkey | apt-key add -
 sed -E -i 's/(deb.*)(\[.*\])(.*)/\1\3/g' /etc/apt/sources.list.d/fdio_"${VPP_VERSION}".list
index a543e70..be693c7 100644 (file)
@@ -4,8 +4,6 @@ services:
     build:
       context: ..
       dockerfile: ${DOCKERFILE}
-      args:
-        BASE_IMAGE: ${BASE_IMAGE}
     image: hicn-base
     privileged: true
     container_name: forwarder
index 0aee8cf..674df3e 100644 (file)
@@ -58,8 +58,8 @@ services:
 
         sleep 4
 
-        hiperf -q -z hicnlightng_module -S -R -B 4000kbps ${RTC_PRODUCER} -P 2 &
-        hiperf -q -z hicnlightng_module -S ${RAAQM_PRODUCER}/128 &
-        hicn-ping-server -q -z hicnlightng_module -s 0 -n ${PING_PRODUCER}/128 &
+        hiperf -q -z hicnlight_module -S -R -B 4000kbps ${RTC_PRODUCER} -P 2 &
+        hiperf -q -z hicnlight_module -S ${RAAQM_PRODUCER}/128 &
+        hicn-ping-server -q -z hicnlight_module -s 0 -n ${PING_PRODUCER}/128 &
 
         tail -f /dev/null
index db1fa6f..5a61874 100644 (file)
@@ -18,7 +18,7 @@ services:
         sudo tee /etc/vpp/startup.conf <<EOF
         cpu { main-core 1 }
         plugins {
-            path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+            path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
             plugin default { disable }
             plugin acl_plugin.so { enable }
             plugin nat_plugin.so { enable }
@@ -70,7 +70,7 @@ services:
         sudo tee /etc/vpp/startup.conf <<EOF
         cpu { main-core 2 }
         plugins {
-            path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+            path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
             plugin default { disable }
             plugin acl_plugin.so { enable }
             plugin nat_plugin.so { enable }
index 45de824..c5b0d38 100644 (file)
@@ -4,8 +4,6 @@ services:
     build:
       context: ..
       dockerfile: ${DOCKERFILE}
-      args:
-        BASE_IMAGE: ${BASE_IMAGE}
     stdin_open: true
     tty: true
     working_dir: /workspace
@@ -26,7 +24,7 @@ services:
         cpu { main-core 1 }
         buffers { buffers-per-numa 600000 }
         plugins {
-            path /hicn-root/lib/vpp_plugins:/usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+            path /hicn-root/lib/vpp_plugins:/usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
             plugin default { disable }
             plugin acl_plugin.so { enable }
             plugin nat_plugin.so { enable }
@@ -75,8 +73,6 @@ services:
     build:
       context: ..
       dockerfile: ${DOCKERFILE}
-      args:
-        BASE_IMAGE: ${BASE_IMAGE}
     stdin_open: true
     tty: true
     working_dir: /workspace
@@ -98,7 +94,7 @@ services:
         buffers { buffers-per-numa 600000 }
 
         plugins {
-            path /hicn-root/lib/vpp_plugins:/usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+            path /hicn-root/lib/vpp_plugins:/usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
             plugin default { disable }
             plugin acl_plugin.so { enable }
             plugin nat_plugin.so { enable }
index 48b4a1c..e02c947 100644 (file)
@@ -17,7 +17,7 @@ services:
         cpu { main-core 1 }
         buffers { buffers-per-numa 600000 }
         plugins {
-            path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+            path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
             plugin default { disable }
             plugin acl_plugin.so { enable }
             plugin nat_plugin.so { enable }
@@ -75,7 +75,7 @@ services:
         buffers { buffers-per-numa 600000 }
 
         plugins {
-            path /usr/lib/x86_64-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
+            path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins
             plugin default { disable }
             plugin acl_plugin.so { enable }
             plugin nat_plugin.so { enable }
index 72dcc22..e1740db 100644 (file)
@@ -4,9 +4,6 @@ services:
     build:
       context: ..
       dockerfile: ${DOCKERFILE}
-      args:
-        BASE_IMAGE: ${BASE_IMAGE}
-    image: hicn-base
     privileged: true
     stdin_open: true
     hostname: client
@@ -24,8 +21,6 @@ services:
     build:
       context: ..
       dockerfile: ${DOCKERFILE}
-      args:
-        BASE_IMAGE: ${BASE_IMAGE}
     privileged: true
     stdin_open: true
     hostname: server
index 29f2e9d..b4c03f7 100644 (file)
@@ -1,5 +1,40 @@
-ARG BASE_IMAGE
+FROM ubuntu:focal
 
-FROM ${BASE_IMAGE}
+ARG DEBIAN_FRONTEND=noninteractive
+ARG DEB_FOLDER="./packages"
 
-RUN sudo sed -i 's,secure_path="\(.*\)",secure_path="/hicn-root/bin:\1",' /etc/sudoers
+WORKDIR /hicn-release
+
+################################################################
+# Copy DEB files
+################################################################
+COPY ${DEB_FOLDER} deb
+
+################################################################
+# Install VPP and hicn debs
+################################################################
+ARG VERSION_PATH=/tmp/versions.cmake
+COPY versions.cmake ${VERSION_PATH}
+ARG INSTALL_VPP_SCRIPT=/tmp/install-vpp.sh
+COPY scripts/install-vpp.sh ${INSTALL_VPP_SCRIPT}
+
+RUN bash -x ${INSTALL_VPP_SCRIPT}                       \
+    && cd deb                                                   \
+    && apt-get install -y                                  \
+    iproute2 sudo \
+    ./libhicn_*.deb                                         \
+    ./hicn-light_*.deb                                      \
+    ./hicn-plugin_*.deb                                     \
+    ./libhicnctrl_*.deb                                     \
+    ./libhicnctrl-modules_*.deb                             \
+    ./libhicntransport-io-modules_*.deb                     \
+    ./libhicntransport_*.deb                                \
+    ./facemgr_*.deb                                         \
+    ./hicn-apps_*.deb                                       \
+    && rm ${VERSION_PATH}                                  \
+    && rm -rf deb                                          \
+    && rm -rf /var/lib/apt/lists/*                         \
+    && apt-get autoremove -y                               \
+    && apt-get clean
+
+WORKDIR /
index 0f30d6a..f9c166b 100644 (file)
@@ -1,12 +1,12 @@
 # Use when building for the fist time,
 # then `make test` forces a rebuild if local changes
 build:
-       BASE_IMAGE=hicn DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
+       DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
                docker-compose -f build.yml up --force-recreate --remove-orphans
 
 # Rebuild from scratch (to avoid cmake cache)
 rebuild:
-       BASE_IMAGE=hicn DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
+       DOCKERFILE=Dockerfile.dev BUILD_SOFTWARE=1 \
                REBUILD=1 \
                docker-compose -f build.yml up --force-recreate --remove-orphans
 
index 28a187e..59335da 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
 set -e
 
index 654bad5..9d8e80d 100755 (executable)
@@ -12,11 +12,10 @@ source ${SCRIPT_PATH}/.env
 
 set -a
 DOCKERFILE=${DOCKERFILE:-Dockerfile.dev}
-BASE_IMAGE=${BASE_IMAGE:-hicn}
 BUILD_SOFTWARE=${BUILD_SOFTWARE:-1}
 set +a
 
-HIPERF_CMD_RTC="hiperf -q -n 50 -C -H -R ${RTC_PRODUCER} -P 2"
+HIPERF_CMD_RTC="/usr/bin/hiperf -q -n 50 -C -H -R ${RTC_PRODUCER} -P 2"
 HIPERF_CMD_MEMIF_RTC="${HIPERF_CMD_RTC} -z memif_module"
 POSTPROCESS_COMMAND_RAAQM_RTC='tail -n +3 | \
   tr -s " " |                               \
@@ -34,7 +33,7 @@ POSTPROCESS_COMMAND_RAAQM_RTC='tail -n +3 | \
     print int(a[0]), int(a[n-1]), int(s/n)  \
   }"'
 
-HIPERF_CMD_RAAQM="hiperf -q -n 50 -i 200 -C -H ${RAAQM_PRODUCER}"
+HIPERF_CMD_RAAQM="/usr/bin/hiperf -q -n 50 -i 200 -C -H ${RAAQM_PRODUCER}"
 HIPERF_CMD_CBR="${HIPERF_CMD_RAAQM} -W 350 -M 0"
 HIPERF_CMD_MEMIF_RAAQM="${HIPERF_CMD_RAAQM} -z memif_module"
 HIPERF_CMD_MEMIF_CBR="${HIPERF_CMD_CBR} -z memif_module"