From 212d917967d22e54cfe276b9d07a643122c03759 Mon Sep 17 00:00:00 2001 From: Laszlo Kiraly Date: Wed, 21 Feb 2024 14:58:16 +0100 Subject: [PATCH 1/3] run ovs kernel mechanism test Signed-off-by: Laszlo Kiraly --- .github/workflows/ci.yaml | 4 ++-- scripts/ovs/enable-ovs.sh | 3 +++ scripts/ovs/setup-ovs.sh | 28 ++++++++++++++++++++++++++++ scripts/setup-cluster.sh | 9 ++++++--- tests_calico-vpp/main_test.go | 20 ++++++++++++++++++++ tests_default/main_test.go | 12 ++++++++++++ 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100755 scripts/ovs/enable-ovs.sh create mode 100755 scripts/ovs/setup-ovs.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e6ded3d4..a04da15a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -127,9 +127,9 @@ jobs: run: | export KUBECONFIG=$HOME/.kube/config_packet if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then - go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4 || true + go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -run TestRunOVS -parallel 4 || true else - go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4 + go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -run TestRunOVS -parallel 4 fi env: ARTIFACTS_DIR: logs diff --git a/scripts/ovs/enable-ovs.sh b/scripts/ovs/enable-ovs.sh new file mode 100755 index 00000000..e2fc5546 --- /dev/null +++ b/scripts/ovs/enable-ovs.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +modprobe openvswitch diff --git a/scripts/ovs/setup-ovs.sh b/scripts/ovs/setup-ovs.sh new file mode 100755 index 00000000..66fc0970 --- /dev/null +++ b/scripts/ovs/setup-ovs.sh @@ -0,0 +1,28 @@ +#!/bin/bash -x +# shellcheck disable=SC2086 + +master_ip="$1" + +worker_ip="$2" + +SSH_OPTS="$3" + +OVS_DIR=$(dirname "$0") + +# wait_pids pid_1 ... pid_n +source scripts/include/wait-pids.sh + +# Create ovs scripts directory on nodes +ssh ${SSH_OPTS} root@${master_ip} mkdir ovs +ssh ${SSH_OPTS} root@${worker_ip} mkdir ovs + +# Enable ovs and wait for scripts to execute +scp ${SSH_OPTS} ${OVS_DIR}/enable-ovs.sh root@${master_ip}:ovs/enable-ovs.sh || exit 1 +scp ${SSH_OPTS} ${OVS_DIR}/enable-ovs.sh root@${worker_ip}:ovs/enable-ovs.sh || exit 2 + +pids="" +ssh ${SSH_OPTS} root@${master_ip} ./ovs/enable-ovs.sh & +pids+=" $!" +ssh ${SSH_OPTS} root@${worker_ip} ./ovs/enable-ovs.sh & +pids+=" $!" +wait_pids "${pids}" "ovs setup failed" || exit 3 diff --git a/scripts/setup-cluster.sh b/scripts/setup-cluster.sh index 64992b73..5aecc120 100755 --- a/scripts/setup-cluster.sh +++ b/scripts/setup-cluster.sh @@ -98,16 +98,19 @@ done ## Setup SR-IOV /bin/bash scripts/sriov/setup-SRIOV.sh "${master_node}" "${master_ip}" "${worker_node}" "${worker_ip}" "${sriov_vlan}" "${enable8021q}" "${SSH_OPTS}" || exit 12 +## Setup ovs +/bin/bash scripts/ovs/setup-ovs.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" || exit 13 + ## Remove master label from the control-plane node to be able to use it as worker node # For some versions of kubernetes you need to use node-role.kubernetes.io/master- -kubectl --kubeconfig=$KUBECONFIG_PACK taint nodes --selector='node-role.kubernetes.io/control-plane' node-role.kubernetes.io/control-plane:NoSchedule- || exit 13 +kubectl --kubeconfig=$KUBECONFIG_PACK taint nodes --selector='node-role.kubernetes.io/control-plane' node-role.kubernetes.io/control-plane:NoSchedule- || exit 14 ## CNI installation if [[ "$CNI" == "default" ]]; then # use calico CNI in case of default - kubectl --kubeconfig=$KUBECONFIG_PACK apply -k scripts/defaultCNI || exit 14 + kubectl --kubeconfig=$KUBECONFIG_PACK apply -k scripts/defaultCNI || exit 15 elif [[ "$CNI" == "calico-vpp" ]]; then # calico-VPP CNI export KUBECONFIG=$KUBECONFIG_PACK - /bin/bash scripts/calico/deploy-calico.sh || exit 15 + /bin/bash scripts/calico/deploy-calico.sh || exit 16 fi ## SPIRE server requires StorageClass diff --git a/tests_calico-vpp/main_test.go b/tests_calico-vpp/main_test.go index 93371ac7..164269a6 100644 --- a/tests_calico-vpp/main_test.go +++ b/tests_calico-vpp/main_test.go @@ -2,6 +2,8 @@ // // Copyright (c) 2023 Cisco and/or its affiliates. // +// Copyright (c) 2024 Nordix and/or its affiliates. +// // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,6 +31,7 @@ import ( "github.com/networkservicemesh/integration-tests/suites/memory" "github.com/networkservicemesh/integration-tests/suites/multiforwarder" "github.com/networkservicemesh/integration-tests/suites/observability" + "github.com/networkservicemesh/integration-tests/suites/ovs" "github.com/networkservicemesh/integration-tests/suites/sriov" ) @@ -67,3 +70,20 @@ func (s *featuresSuite) BeforeTest(suiteName, testName string) { func TestRunFeatureSuiteCalico(t *testing.T) { parallel.Run(t, new(featuresSuite), "TestVl3_basic", "TestVl3_dns", "TestScale_from_zero", "TestVl3_scale_from_zero", "TestSelect_forwarder") } + +type ovsSuite struct { + ovs.Suite +} + +func (s *ovsSuite) BeforeTest(suiteName, testName string) { + switch testName { + case + "TestSmartVF2SmartVF", + "TestKernel2KernelVLAN": + s.T().Skip() + } +} + +func TestRunOVS(t *testing.T) { + suite.Run(t, new(ovsSuite)) +} diff --git a/tests_default/main_test.go b/tests_default/main_test.go index 7adce8c7..3280669a 100644 --- a/tests_default/main_test.go +++ b/tests_default/main_test.go @@ -2,6 +2,8 @@ // // Copyright (c) 2023 Cisco and/or its affiliates. // +// Copyright (c) 2024 Nordix and/or its affiliates. +// // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -19,8 +21,10 @@ package main_test import ( + "flag" "testing" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/networkservicemesh/integration-tests/extensions/parallel" @@ -29,6 +33,7 @@ import ( "github.com/networkservicemesh/integration-tests/suites/memory" "github.com/networkservicemesh/integration-tests/suites/multiforwarder_vlantag" "github.com/networkservicemesh/integration-tests/suites/observability" + "github.com/networkservicemesh/integration-tests/suites/ovs" "github.com/networkservicemesh/integration-tests/suites/sriov_vlantag" ) @@ -55,3 +60,10 @@ func TestRunObservabilitySuite(t *testing.T) { func TestFeatureSuite(t *testing.T) { parallel.Run(t, new(features.Suite), "TestVl3_basic", "TestVl3_dns", "TestScale_from_zero", "TestVl3_scale_from_zero", "TestSelect_forwarder") } + +func TestRunOVS(t *testing.T) { + f := flag.Lookup("testify.m") + require.NoError(t, flag.Set("testify.m", "TestKernel2Kernel")) + defer func() { _ = flag.Set("testify.m", f.Value.String()) }() + suite.Run(t, new(ovs.Suite)) +} From 42e9ae23f51741b44b677014a9559b77590d9438 Mon Sep 17 00:00:00 2001 From: Laszlo Kiraly Date: Thu, 22 Feb 2024 10:32:39 +0100 Subject: [PATCH 2/3] add ovs forwarder specific config scripts Signed-off-by: Laszlo Kiraly --- scripts/setup-cluster.sh | 13 +++++-- scripts/smartnic/config-SmartNIC.sh | 51 ++++++++++++++++++++++++++ scripts/smartnic/enable-SmartNIC.sh | 34 ++++++++++++++++++ scripts/smartnic/setup-SmartNIC.sh | 55 +++++++++++++++++++++++++++++ 4 files changed, 150 insertions(+), 3 deletions(-) create mode 100755 scripts/smartnic/config-SmartNIC.sh create mode 100755 scripts/smartnic/enable-SmartNIC.sh create mode 100755 scripts/smartnic/setup-SmartNIC.sh diff --git a/scripts/setup-cluster.sh b/scripts/setup-cluster.sh index 5aecc120..fa2a4d85 100755 --- a/scripts/setup-cluster.sh +++ b/scripts/setup-cluster.sh @@ -101,16 +101,23 @@ done ## Setup ovs /bin/bash scripts/ovs/setup-ovs.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" || exit 13 +## Setup SmartNIC +if [[ "$CNI" == "calico-vpp" ]]; then # calico + /bin/bash scripts/smartnic/setup-SmartNIC.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" "${CALICO_INTERFACE}" || exit 14 +else + /bin/bash scripts/smartnic/setup-SmartNIC.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" "${SRIOV_INTERFACE}" || exit 14 +fi + ## Remove master label from the control-plane node to be able to use it as worker node # For some versions of kubernetes you need to use node-role.kubernetes.io/master- -kubectl --kubeconfig=$KUBECONFIG_PACK taint nodes --selector='node-role.kubernetes.io/control-plane' node-role.kubernetes.io/control-plane:NoSchedule- || exit 14 +kubectl --kubeconfig=$KUBECONFIG_PACK taint nodes --selector='node-role.kubernetes.io/control-plane' node-role.kubernetes.io/control-plane:NoSchedule- || exit 15 ## CNI installation if [[ "$CNI" == "default" ]]; then # use calico CNI in case of default - kubectl --kubeconfig=$KUBECONFIG_PACK apply -k scripts/defaultCNI || exit 15 + kubectl --kubeconfig=$KUBECONFIG_PACK apply -k scripts/defaultCNI || exit 16 elif [[ "$CNI" == "calico-vpp" ]]; then # calico-VPP CNI export KUBECONFIG=$KUBECONFIG_PACK - /bin/bash scripts/calico/deploy-calico.sh || exit 16 + /bin/bash scripts/calico/deploy-calico.sh || exit 17 fi ## SPIRE server requires StorageClass diff --git a/scripts/smartnic/config-SmartNIC.sh b/scripts/smartnic/config-SmartNIC.sh new file mode 100755 index 00000000..e85c0074 --- /dev/null +++ b/scripts/smartnic/config-SmartNIC.sh @@ -0,0 +1,51 @@ +#!/bin/bash -x +# shellcheck disable=SC2064,SC2129 + +set -e + +CONFIG_DIRECTORY="/var/lib/networkservicemesh" +CONFIG_FILE="${CONFIG_DIRECTORY}/smartnic.config" + +function softlink_target() { + softlink="$1" + + raw_target="$(stat -c %N "${softlink}")" + test $? -eq 0 || return 1 + + target=$(echo "${raw_target}" | sed -E "s/(.*\/)(.*)'/\2/g") + test $? -eq 0 || return 2 + + echo "${target}" + return 0 +} + +function config_link() { + device="/sys/class/net/$1/device" + IFS=","; read -ra domains <<< "$2"; unset IFS + + pci_addr="$(softlink_target "${device}")" + test $? -eq 0 || return 1 + + echo " ${pci_addr}:" >> "${CONFIG_FILE}" + echo " pfKernelDriver: mlx5_core" >> "${CONFIG_FILE}" + echo " vfKernelDriver: mlx5_core" >> "${CONFIG_FILE}" + echo " capabilities:" >> "${CONFIG_FILE}" + echo " - 100G" >> "${CONFIG_FILE}" + echo " serviceDomains:" >> "${CONFIG_FILE}" + for domain in "${domains[@]}"; do + echo " - ${domain}" >> "${CONFIG_FILE}" + done + + return 0 +} + +mkdir -p "${CONFIG_DIRECTORY}" + +echo "---" > "${CONFIG_FILE}" +echo "physicalFunctions:" >> "${CONFIG_FILE}" + +for link_domains in "$@"; do + IFS="="; read -ra args <<< "${link_domains}"; unset IFS + config_link "${args[0]}" "${args[1]}" + test $? -eq 0 || exit 1 +done \ No newline at end of file diff --git a/scripts/smartnic/enable-SmartNIC.sh b/scripts/smartnic/enable-SmartNIC.sh new file mode 100755 index 00000000..2c63af83 --- /dev/null +++ b/scripts/smartnic/enable-SmartNIC.sh @@ -0,0 +1,34 @@ +#!/bin/bash -x +# shellcheck disable=SC2086,SC2064 + +set -e + +ls /sys/class/net +device="/sys/class/net/$1/device" + +# modprobe mlx5_core driver +MLX5_CORE_DRIVER_DIR="/sys/bus/pci/drivers/mlx5_core" +ls -l "${MLX5_CORE_DRIVER_DIR}" || modprobe mlx5_core || exit 1 + +# Don't forget to remove VFs for the link +trap "echo 0 >'${device}/sriov_numvfs'" err exit + +# Add 2 Smart VFs for the link +echo 2 > "${device}/sriov_numvfs" || exit 2 + +# Change PF to appropriate modes +echo legacy > "${device}/compat/devlink/vport_match_mode" || exit 2 +echo dmfs > "${device}/compat/devlink/steering_mode" || exit 2 +echo switchdev > "${device}/compat/devlink/mode" || exit 2 + +# Enable mlx5_core driver for the VFs +for i in $(seq 0 2); do pci_id=$(grep "PCI_ID" "${device}/virtfn$i/uevent" | sed -E "s/PCI_ID=(.*):(.*)/\1 \2/g"); test $? -eq 0 || exit 3; echo "${pci_id}" > "${MLX5_CORE_DRIVER_DIR}/new_id" || exit 4; done + +# Waiting for the SmartVF devices to be up again +while [ "$(ip link | grep -c smartvf)" != "2" ]; do sleep 1; done + +# Assign the representor MAC addresses to the VF MAC adresses +for i in $(seq 0 2); do mac=$(ip l show smartvf0_$i | grep -o "link/ether [^ ]*" | cut -d' ' -f2); echo "vf $i: $mac"; ip l set $1 vf $i mac $mac; done + +# Representor devices manually have to be set to "up" +for p in $(ip l | grep -o "ens5f0[^:]*"); do echo $p; ip link set $p up; done \ No newline at end of file diff --git a/scripts/smartnic/setup-SmartNIC.sh b/scripts/smartnic/setup-SmartNIC.sh new file mode 100755 index 00000000..c58e592d --- /dev/null +++ b/scripts/smartnic/setup-SmartNIC.sh @@ -0,0 +1,55 @@ +#!/bin/bash -x +# shellcheck disable=SC2086 + +set -e + +master_ip="$1" +worker_ip="$2" +SSH_OPTS="$3" +snic="$4" + +function wait_pids() { + pids="$1" + message="$2" + for pid in ${pids}; do + echo "waiting for PID ${pid}" + wait ${pid} + code=$? + if test $code -ne 0; then + echo "${message}: process exited with code $code, aborting..." + return 1 + fi + done + return 0 +} + +SMARTNIC_DIR=$(dirname "$0") + +# Create SmartNIC scripts directory on nodes +ssh ${SSH_OPTS} root@${master_ip} mkdir smartnic +ssh ${SSH_OPTS} root@${worker_ip} mkdir smartnic + + +# Configure SmartNIC on the nodes +scp ${SSH_OPTS} ${SMARTNIC_DIR}/enable-SmartNIC.sh root@${master_ip}:smartnic/enable-SmartNIC.sh || exit 1 +scp ${SSH_OPTS} ${SMARTNIC_DIR}/enable-SmartNIC.sh root@${worker_ip}:smartnic/enable-SmartNIC.sh || exit 2 + +pids="" +ssh ${SSH_OPTS} root@${master_ip} ./smartnic/enable-SmartNIC.sh $snic & +pids+=" $!" +ssh ${SSH_OPTS} root@${worker_ip} ./smartnic/enable-SmartNIC.sh $snic & +pids+=" $!" +wait_pids "${pids}" "SmartNIC setup failed" || exit 3 + +sleep 5 + +# Create SmartNIC config +scp ${SSH_OPTS} ${SMARTNIC_DIR}/config-SmartNIC.sh root@${master_ip}:smartnic/config-SmartNIC.sh || exit 4 +scp ${SSH_OPTS} ${SMARTNIC_DIR}/config-SmartNIC.sh root@${worker_ip}:smartnic/config-SmartNIC.sh || exit 5 + +pids="" +ssh ${SSH_OPTS} root@${master_ip} ./smartnic/config-SmartNIC.sh ${snic}=worker.domain & +pids+=" $!" +ssh ${SSH_OPTS} root@${worker_ip} ./smartnic/config-SmartNIC.sh ${snic}=worker.domain & +pids+=" $!" +wait_pids "${pids}" "NSM SmartNIC config failed" || exit 6 \ No newline at end of file From 28e7d51b5f0ebcabdb6b17aeae200cc01f9f8119 Mon Sep 17 00:00:00 2001 From: Laszlo Kiraly Date: Thu, 22 Feb 2024 17:32:01 +0100 Subject: [PATCH 3/3] run ovs forwarder with pure SRIOV config instead smartnic and printout devices Signed-off-by: Laszlo Kiraly --- .github/workflows/ci.yaml | 7 ++-- scripts/setup-cluster.sh | 4 +-- scripts/smartnic/config-SmartNIC.sh | 51 ----------------------------- scripts/smartnic/enable-SmartNIC.sh | 30 ++--------------- scripts/smartnic/setup-SmartNIC.sh | 13 ++------ tests_calico-vpp/main_test.go | 5 +-- tests_default/main_test.go | 19 +++++++---- 7 files changed, 22 insertions(+), 107 deletions(-) delete mode 100755 scripts/smartnic/config-SmartNIC.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a04da15a..398147c7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -126,11 +126,8 @@ jobs: - name: Integration tests run: | export KUBECONFIG=$HOME/.kube/config_packet - if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then - go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -run TestRunOVS -parallel 4 || true - else - go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -run TestRunOVS -parallel 4 - fi + go test -count 1 -timeout 50m -race -v ./tests_${{ matrix.CNI }} -run TestRunOVS + false env: ARTIFACTS_DIR: logs working-directory: ${{ github.repository }} diff --git a/scripts/setup-cluster.sh b/scripts/setup-cluster.sh index fa2a4d85..88b780a8 100755 --- a/scripts/setup-cluster.sh +++ b/scripts/setup-cluster.sh @@ -101,11 +101,9 @@ done ## Setup ovs /bin/bash scripts/ovs/setup-ovs.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" || exit 13 -## Setup SmartNIC +## Setup ovs if [[ "$CNI" == "calico-vpp" ]]; then # calico /bin/bash scripts/smartnic/setup-SmartNIC.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" "${CALICO_INTERFACE}" || exit 14 -else - /bin/bash scripts/smartnic/setup-SmartNIC.sh "${master_ip}" "${worker_ip}" "${SSH_OPTS}" "${SRIOV_INTERFACE}" || exit 14 fi ## Remove master label from the control-plane node to be able to use it as worker node diff --git a/scripts/smartnic/config-SmartNIC.sh b/scripts/smartnic/config-SmartNIC.sh deleted file mode 100755 index e85c0074..00000000 --- a/scripts/smartnic/config-SmartNIC.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -x -# shellcheck disable=SC2064,SC2129 - -set -e - -CONFIG_DIRECTORY="/var/lib/networkservicemesh" -CONFIG_FILE="${CONFIG_DIRECTORY}/smartnic.config" - -function softlink_target() { - softlink="$1" - - raw_target="$(stat -c %N "${softlink}")" - test $? -eq 0 || return 1 - - target=$(echo "${raw_target}" | sed -E "s/(.*\/)(.*)'/\2/g") - test $? -eq 0 || return 2 - - echo "${target}" - return 0 -} - -function config_link() { - device="/sys/class/net/$1/device" - IFS=","; read -ra domains <<< "$2"; unset IFS - - pci_addr="$(softlink_target "${device}")" - test $? -eq 0 || return 1 - - echo " ${pci_addr}:" >> "${CONFIG_FILE}" - echo " pfKernelDriver: mlx5_core" >> "${CONFIG_FILE}" - echo " vfKernelDriver: mlx5_core" >> "${CONFIG_FILE}" - echo " capabilities:" >> "${CONFIG_FILE}" - echo " - 100G" >> "${CONFIG_FILE}" - echo " serviceDomains:" >> "${CONFIG_FILE}" - for domain in "${domains[@]}"; do - echo " - ${domain}" >> "${CONFIG_FILE}" - done - - return 0 -} - -mkdir -p "${CONFIG_DIRECTORY}" - -echo "---" > "${CONFIG_FILE}" -echo "physicalFunctions:" >> "${CONFIG_FILE}" - -for link_domains in "$@"; do - IFS="="; read -ra args <<< "${link_domains}"; unset IFS - config_link "${args[0]}" "${args[1]}" - test $? -eq 0 || exit 1 -done \ No newline at end of file diff --git a/scripts/smartnic/enable-SmartNIC.sh b/scripts/smartnic/enable-SmartNIC.sh index 2c63af83..7fb1a172 100755 --- a/scripts/smartnic/enable-SmartNIC.sh +++ b/scripts/smartnic/enable-SmartNIC.sh @@ -4,31 +4,5 @@ set -e ls /sys/class/net -device="/sys/class/net/$1/device" - -# modprobe mlx5_core driver -MLX5_CORE_DRIVER_DIR="/sys/bus/pci/drivers/mlx5_core" -ls -l "${MLX5_CORE_DRIVER_DIR}" || modprobe mlx5_core || exit 1 - -# Don't forget to remove VFs for the link -trap "echo 0 >'${device}/sriov_numvfs'" err exit - -# Add 2 Smart VFs for the link -echo 2 > "${device}/sriov_numvfs" || exit 2 - -# Change PF to appropriate modes -echo legacy > "${device}/compat/devlink/vport_match_mode" || exit 2 -echo dmfs > "${device}/compat/devlink/steering_mode" || exit 2 -echo switchdev > "${device}/compat/devlink/mode" || exit 2 - -# Enable mlx5_core driver for the VFs -for i in $(seq 0 2); do pci_id=$(grep "PCI_ID" "${device}/virtfn$i/uevent" | sed -E "s/PCI_ID=(.*):(.*)/\1 \2/g"); test $? -eq 0 || exit 3; echo "${pci_id}" > "${MLX5_CORE_DRIVER_DIR}/new_id" || exit 4; done - -# Waiting for the SmartVF devices to be up again -while [ "$(ip link | grep -c smartvf)" != "2" ]; do sleep 1; done - -# Assign the representor MAC addresses to the VF MAC adresses -for i in $(seq 0 2); do mac=$(ip l show smartvf0_$i | grep -o "link/ether [^ ]*" | cut -d' ' -f2); echo "vf $i: $mac"; ip l set $1 vf $i mac $mac; done - -# Representor devices manually have to be set to "up" -for p in $(ip l | grep -o "ens5f0[^:]*"); do echo $p; ip link set $p up; done \ No newline at end of file +ip -details link show +lspci | egrep -i 'network|ethernet' \ No newline at end of file diff --git a/scripts/smartnic/setup-SmartNIC.sh b/scripts/smartnic/setup-SmartNIC.sh index c58e592d..3dcb7e27 100755 --- a/scripts/smartnic/setup-SmartNIC.sh +++ b/scripts/smartnic/setup-SmartNIC.sh @@ -43,13 +43,6 @@ wait_pids "${pids}" "SmartNIC setup failed" || exit 3 sleep 5 -# Create SmartNIC config -scp ${SSH_OPTS} ${SMARTNIC_DIR}/config-SmartNIC.sh root@${master_ip}:smartnic/config-SmartNIC.sh || exit 4 -scp ${SSH_OPTS} ${SMARTNIC_DIR}/config-SmartNIC.sh root@${worker_ip}:smartnic/config-SmartNIC.sh || exit 5 - -pids="" -ssh ${SSH_OPTS} root@${master_ip} ./smartnic/config-SmartNIC.sh ${snic}=worker.domain & -pids+=" $!" -ssh ${SSH_OPTS} root@${worker_ip} ./smartnic/config-SmartNIC.sh ${snic}=worker.domain & -pids+=" $!" -wait_pids "${pids}" "NSM SmartNIC config failed" || exit 6 \ No newline at end of file +# Copy SRIOV config as SmartNIC config +ssh ${SSH_OPTS} root@${master_ip} cp /var/lib/networkservicemesh/sriov.config /var/lib/networkservicemesh/smartnic.config +ssh ${SSH_OPTS} root@${worker_ip} cp /var/lib/networkservicemesh/sriov.config /var/lib/networkservicemesh/smartnic.config \ No newline at end of file diff --git a/tests_calico-vpp/main_test.go b/tests_calico-vpp/main_test.go index 164269a6..6e1f9eed 100644 --- a/tests_calico-vpp/main_test.go +++ b/tests_calico-vpp/main_test.go @@ -76,10 +76,7 @@ type ovsSuite struct { } func (s *ovsSuite) BeforeTest(suiteName, testName string) { - switch testName { - case - "TestSmartVF2SmartVF", - "TestKernel2KernelVLAN": + if testName == "TestKernel2KernelVLAN" { s.T().Skip() } } diff --git a/tests_default/main_test.go b/tests_default/main_test.go index 3280669a..328332c5 100644 --- a/tests_default/main_test.go +++ b/tests_default/main_test.go @@ -21,10 +21,8 @@ package main_test import ( - "flag" "testing" - "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/networkservicemesh/integration-tests/extensions/parallel" @@ -61,9 +59,18 @@ func TestFeatureSuite(t *testing.T) { parallel.Run(t, new(features.Suite), "TestVl3_basic", "TestVl3_dns", "TestScale_from_zero", "TestVl3_scale_from_zero", "TestSelect_forwarder") } +type ovsSuite struct { + ovs.Suite +} + +func (s *ovsSuite) BeforeTest(suiteName, testName string) { + switch testName { + case + "TestSmartVF2SmartVF", + "TestKernel2KernelVLAN": + s.T().Skip() + } +} func TestRunOVS(t *testing.T) { - f := flag.Lookup("testify.m") - require.NoError(t, flag.Set("testify.m", "TestKernel2Kernel")) - defer func() { _ = flag.Set("testify.m", f.Value.String()) }() - suite.Run(t, new(ovs.Suite)) + suite.Run(t, new(ovsSuite)) }