Skip to content

Commit

Permalink
run ovs forwarder with pure SRIOV config instead smartnic and printou…
Browse files Browse the repository at this point in the history
…t devices

Signed-off-by: Laszlo Kiraly <[email protected]>
  • Loading branch information
ljkiraly committed Feb 26, 2024
1 parent 42e9ae2 commit 28e7d51
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 107 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 1 addition & 3 deletions scripts/setup-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
51 changes: 0 additions & 51 deletions scripts/smartnic/config-SmartNIC.sh

This file was deleted.

30 changes: 2 additions & 28 deletions scripts/smartnic/enable-SmartNIC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
ip -details link show
lspci | egrep -i 'network|ethernet'
13 changes: 3 additions & 10 deletions scripts/smartnic/setup-SmartNIC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
# 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
5 changes: 1 addition & 4 deletions tests_calico-vpp/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand Down
19 changes: 13 additions & 6 deletions tests_default/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
}

0 comments on commit 28e7d51

Please sign in to comment.