Skip to content

Commit

Permalink
ci: test: add framework for ovs test cases
Browse files Browse the repository at this point in the history
 * Add ovs test suite and the initial ping test cases.
 * This also adds the framework to control a remote
   board (currently assumed to be an Octeon) which is
   connected back to back with the EP Octeon.
 * Update the dpdk dependency commit.

Change-Id: I804f443f88566c4b38848d003583ee18de33e5c6
Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/133522
Reviewed-by: Rahul Bhansali <rbhansali@marvell.com>
Reviewed-by: Harman Kalra <hkalra@marvell.com>
Tested-by: sa_ip-toolkits-Jenkins <sa_ip-toolkits-jenkins@marvell.com>
  • Loading branch information
ashwinyes authored and jerinjacobk committed Aug 26, 2024
1 parent 75e1615 commit da3e689
Show file tree
Hide file tree
Showing 26 changed files with 1,439 additions and 403 deletions.
1 change: 0 additions & 1 deletion ci/build/build-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ function compile_libnl() {
fetch_dep https://github.com/thom311/libnl/releases/download/libnl3_7_0/$LIBNL_TARBALL.tar.gz
fi
tar xvf $LIBNL_TARBALL.tar.gz --strip-components=1
set -x
./configure --host=aarch64-marvell-linux-gnu --prefix=$LIBNL_PREFIX_DIR
make;
make install;
Expand Down
2 changes: 1 addition & 1 deletion ci/build/env/deps/dpdk.env
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
DATAPLANE_REPO=sj1git1.cavium.com:29418/IP/SW/dataplane
DPDK_REPO=$DATAPLANE_REPO/dpdk
DPDK_BRANCH=dpdk-23.11-devel
DPDK_COMMIT=74ff5554a08ab307dd2f2969f1d1befa1ad5d419
DPDK_COMMIT=9bea882577ef965e7625b158448bb31f791dfce2
6 changes: 5 additions & 1 deletion ci/test/common/exe_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ TEST_ARGS=$@
source $TEST_ENV_CONF

TEST_ENV_VARS="DAO_TEST=$DAO_TEST "
TEST_ENV_VARS="$TEST_ENV_VARS EP_DEVICE=$EP_DEVICE EP_HOST=$EP_HOST"
TEST_ENV_VARS+=" EP_DEVICE=$EP_DEVICE EP_HOST=$EP_HOST EP_REMOTE=$EP_REMOTE"
TEST_ENV_VARS+=" EP_SSH_CMD='$EP_SSH_CMD' EP_DIR=$EP_DIR"
TEST_ENV_VARS+=" EP_REMOTE_SUDO=$EP_REMOTE_SUDO EP_HOST_SUDO=$EP_HOST_SUDO"
TEST_ENV_VARS+=" EP_HOST_MODULE_DIR=${EP_HOST_MODULE_DIR:-}"
TEST_ENV_VARS+=" EP_DEVICE_OVS_PATH=${EP_DEVICE_OVS_PATH:-}"

add_test "$DAO_TEST" "$TEST_BINARY" "$TEST_DIR" "$TEST_ARGS" "$TEST_ENV_VARS"

Expand Down
21 changes: 12 additions & 9 deletions ci/test/common/test_list_helper_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# Functions required to manipulate the test.list file.

TEST_LIST=$RUN_DIR/test.list
TEST_ENV_VARS_DYNAMIC=""

function clean_test_list()
{
Expand All @@ -26,6 +27,7 @@ function get_test_name()
local test_num=$1
local num=1
local info="LIST_END"
touch $TEST_LIST
while read -r testinfo; do
if [[ $num == $test_num ]]; then
info=$testinfo
Expand All @@ -41,6 +43,7 @@ function get_test_info()
local test_name=$1
local name
local info="LIST_END"
touch $TEST_LIST
while read -r testinfo; do
name=$(echo $testinfo | awk -F'#' '{print $1}')
if [[ $name == $test_name ]]; then
Expand All @@ -55,14 +58,14 @@ function get_test_exec_bin()
{
local val
val=$(get_test_info $1 | awk -F'#' '{print $2}')
echo $val | sed "s#$BUILD_DIR#$EP_DEVICE_RUN_DIR#g"
echo $val | sed "s#$BUILD_DIR#$EP_DIR#g"
}

function get_test_dir()
{
local val
val=$(get_test_info $1 | awk -F'#' '{print $3}')
echo $val | sed "s#$BUILD_DIR#$EP_DEVICE_RUN_DIR#g"
echo $val | sed "s#$BUILD_DIR#$EP_DIR#g"
}

function get_test_args()
Expand Down Expand Up @@ -161,7 +164,7 @@ function test_info_print()
extra_args=$(get_test_extra_args $name)
echo "Test Binary/script -> $exec_bin"
echo "Test Timeout -> $tmo"
echo "Test Environment -> $envs"
echo "Test Environment -> $envs $TEST_ENV_VARS_DYNAMIC"
echo "Test Directory -> $test_dir"

# Remove unnecessary arguments from command line
Expand All @@ -179,6 +182,11 @@ function test_info_print()
echo "Test Command -> $cmd"
}

function add_test_env()
{
TEST_ENV_VARS_DYNAMIC+=" $@"
}

function get_test_command()
{
local name=$1
Expand Down Expand Up @@ -207,11 +215,6 @@ function get_test_command()
esac
done
cmd="cd $test_dir &&
$EP_DEVICE_SUDO DEPS_PREFIX=$EP_DEVICE_DIR/deps-prefix \
EP_HOST_DIR=$EP_HOST_DIR \
EP_DEVICE_DIR=$EP_DEVICE_DIR \
EP_SSH_CMD='$EP_SSH_CMD' \
EXTRA_EP_HOST_ENV='$EXTRA_EP_HOST_ENV' $envs $EXTRA_EP_DEVICE_ENV \
$exec_bin $args $extra_args"
$EP_DEVICE_SUDO $TEST_ENV_VARS_DYNAMIC $envs $exec_bin $args $extra_args"
echo "$cmd"
}
218 changes: 218 additions & 0 deletions ci/test/dao-test/common/ep_common_ops.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
#!/bin/bash
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2024 Marvell.

function ep_common_testpmd_launch()
{
local pfx=$1
local args=${@:2}
local eal_args
local app_args=""

for a in $args; do
if [[ $a == "--" ]]; then
eal_args=$app_args
app_args=""
continue
fi
app_args+=" $a"
done

echo "Launching testpmd pfx=$pfx"
testpmd_launch $pfx "$eal_args" "$app_args"
echo "Launched testpmd pfx=$pfx"
}

function ep_common_testpmd_stop()
{
local pfx=$1

echo "Stopping testpmd pfx=$pfx"
testpmd_quit $pfx
testpmd_cleanup $pfx
echo "Stopped testpmd pfx=$pfx"
}

function ep_common_hugepage_setup()
{
local hp_sz=$1
local hp_num=$2
local hp_pool_sz=$3

# Check for hugepages
if mount | grep hugetlbfs | grep none; then
echo "Hugepages already mounted"
else
echo "Mounting Hugepages"
mkdir -p /dev/huge
mount -t hugetlbfs none /dev/huge
fi
echo $hp_num > /proc/sys/vm/nr_hugepages
echo $hp_pool_sz >/sys/kernel/mm/hugepages/hugepages-${hp_sz}kB/nr_hugepages
}

function ep_common_pcie_addr_get()
{
local devid=$1
local num=${2:-}

if [[ -z $num ]]; then
num=1
elif [[ $num == "all" ]]; then
num=100
fi

echo $(lspci -Dd :$devid | awk '{print $1}' | head -n$num)
}

function ep_common_if_name_get()
{
local pcie_addr=$1

set +e
grep PCI_SLOT_NAME /sys/class/net/*/device/uevent | grep $pcie_addr | \
awk -F '/' '{print $5}'
set -e
}

function ep_common_if_configure()
{
local ip_addr
local opts
local iface_name
local pcie_addr=
local down=
local vxlan_remote_ip=
local vxlan_local_ip=
local vxlan_vni=
local vlan_id=

if ! opts=$(getopt \
-l "ip:,pcie-addr:,down,vxlan-remote-ip:,vxlan-local-ip:,vxlan-vni:,vlan-id:" \
-- configure_sdp_interface $@); then
echo "Failed to parse arguments"
exit 1
fi

eval set -- "$opts"
while [[ $# -gt 1 ]]; do
case $1 in
--ip) shift; ip_addr=$1;;
--pcie-addr) shift; pcie_addr=$1;;
--vxlan-vni) shift; vxlan_vni=$1;;
--vxlan-remote-ip) shift; vxlan_remote_ip=$1;;
--vxlan-local-ip) shift; vxlan_local_ip=$1;;
--vlan-id) shift; vlan_id=$1;;
--down) down=1;;
*) echo "Invalid argument $1"; exit 1;;
esac
shift
done

iface_name=$(ep_common_if_name_get $pcie_addr)
if [[ -z $iface_name ]]; then
echo "Failed to get interface name for $pcie_addr"
exit
fi

ep_common_cleanup_interfaces $iface_name

if [[ -z $down ]]; then
if [[ -n $vlan_id ]]; then
nmcli dev set $iface_name managed no &> /dev/null || true
ifconfig $iface_name up
ifconfig $iface_name 0
ip link add link $iface_name name $iface_name.v$vlan_id \
type vlan id $vlan_id
nmcli dev set $iface_name.v$vlan_id managed no &> /dev/null || true
ip link set dev $iface_name.v$vlan_id up
ip addr add $ip_addr/24 dev $iface_name.v$vlan_id
elif [[ -n $vxlan_vni ]]; then
nmcli dev set $iface_name managed no &> /dev/null || true
ifconfig $iface_name up
ifconfig $iface_name $vxlan_local_ip/24
ip link add $iface_name.vx$vxlan_vni \
type vxlan id $vxlan_vni \
remote $vxlan_remote_ip \
local $vxlan_local_ip \
dev $iface_name \
dstport 4789
nmcli dev set $iface_name.vx$vxlan_vni managed no &> /dev/null || true
ip link set dev $iface_name.vx$vxlan_vni up
ifconfig $iface_name.vx$vxlan_vni $ip_addr/24
else
nmcli dev set $iface_name managed no &> /dev/null || true
ifconfig $iface_name up
ifconfig $iface_name $ip_addr/24
fi
fi
}

function ep_common_ip_forwarding()
{
local op=$1

echo $op > /proc/sys/net/ipv4/ip_forward
}

function ep_common_ping()
{
local src=$1
local dst=$2
local count=${3:-32}
local ping_out

ping_out=$(ping -c $count -i 0.2 -I $src $dst || true)
if [[ -n $(echo $ping_out | grep ", 0% packet loss,") ]]; then
echo "SUCCESS"
else
echo "FAILURE"
fi
}

ep_common_cleanup_interfaces()
{
local prefix=$1
local ifcs=$(ifconfig | grep flags | grep "${prefix}.*:" | awk -F ':' '{print $1}')

for ifc in $ifcs; do
ifconfig $ifc down
ip link del $ifc 2>/dev/null || true
done
}

function ep_common_set_numvfs()
{
local dev=$1
local numvfs=$2

echo 0 > /sys/bus/pci/devices/$dev/sriov_numvfs
sleep 1
echo $numvfs > /sys/bus/pci/devices/$dev/sriov_numvfs
sleep 1
}

function ep_common_unbind_driver()
{
local s=$1
local dev=$2

if [[ -e /sys/bus/$s/devices/$dev/driver/unbind ]]; then
echo $dev > /sys/bus/$s/devices/$dev/driver/unbind
sleep 1
echo > /sys/bus/$s/devices/$dev/driver_override
sleep 1
fi
}

function ep_common_bind_driver()
{
local s=$1
local dev=$2
local driver=$3

ep_common_unbind_driver $s $dev
echo $driver > /sys/bus/$s/devices/$dev/driver_override
echo $dev > /sys/bus/$s/drivers/$driver/bind
echo $dev > /sys/bus/$s/drivers_probe
}
Loading

0 comments on commit da3e689

Please sign in to comment.