diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index af50bc75..39b90b9b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -48,11 +48,3 @@ jobs: uses: actions/checkout@v3 - name: Build checkup image run: make build - build-traffic-gen: - name: Build traffic generator image - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 - - name: Build traffic generator image - run: make build-traffic-gen diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 16acf897..6e0e8568 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -26,9 +26,5 @@ jobs: ${CRI_BIN} login -u ${{ secrets.QUAY_USER }} -p ${{ secrets.QUAY_TOKEN }} quay.io - name: Build checkup image run: make build - - name: Build traffic-gen image - run: make build-traffic-gen - name: Push checkup image run: make push - - name: Push traffic-gen image - run: make push-traffic-gen diff --git a/Makefile b/Makefile index 73ef6093..0e27ead7 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,6 @@ ORG ?= kiagnose CHECKUP_IMAGE_NAME ?= kubevirt-dpdk-checkup CHECKUP_IMAGE_TAG ?= latest CHECKUP_GIT_TAG ?= $(shell git describe --always --abbrev=8 --tags) -TRAFFIC_GEN_IMAGE_NAME ?= kubevirt-dpdk-checkup-traffic-gen -TRAFFIC_GEN_IMAGE_TAG ?= latest -TRAFFIC_GEN_GIT_TAG ?= $(CHECKUP_GIT_TAG) VM_IMAGE_BUILDER_IMAGE_NAME := kubevirt-dpdk-checkup-vm-image-builder VM_IMAGE_BUILDER_IMAGE_TAG ?= latest VIRT_BUILDER_CACHE_DIR := $(CURDIR)/_virt_builder/cache @@ -98,16 +95,6 @@ vendor: $(GO_IMAGE_NAME):$(GO_IMAGE_TAG) go mod tidy -compat=$(GO_MOD_VERSION) && go mod vendor .PHONY: vendor -build-traffic-gen: - $(CRI_BIN) build -f traffic-gen/Dockerfile -t $(REG)/$(ORG)/$(TRAFFIC_GEN_IMAGE_NAME):$(TRAFFIC_GEN_IMAGE_TAG) traffic-gen -.PHONY: build-traffic-gen - -push-traffic-gen: - $(CRI_BIN) push $(REG)/$(ORG)/$(TRAFFIC_GEN_IMAGE_NAME):$(TRAFFIC_GEN_IMAGE_TAG) - $(CRI_BIN) tag $(REG)/$(ORG)/$(TRAFFIC_GEN_IMAGE_NAME):$(TRAFFIC_GEN_IMAGE_TAG) $(REG)/$(ORG)/$(TRAFFIC_GEN_IMAGE_NAME):$(TRAFFIC_GEN_GIT_TAG) - $(CRI_BIN) push $(REG)/$(ORG)/$(TRAFFIC_GEN_IMAGE_NAME):$(TRAFFIC_GEN_GIT_TAG) -.PHONY: push-traffic-gen - build-vm-image-builder: $(CRI_BIN) build $(CURDIR)/vm/image-builder -f $(CURDIR)/vm/image-builder/Dockerfile -t $(REG)/$(ORG)/$(VM_IMAGE_BUILDER_IMAGE_NAME):$(VM_IMAGE_BUILDER_IMAGE_TAG) .PHONY: build-vm-image-builder diff --git a/traffic-gen/Dockerfile b/traffic-gen/Dockerfile deleted file mode 100644 index 3ca32911..00000000 --- a/traffic-gen/Dockerfile +++ /dev/null @@ -1,37 +0,0 @@ -FROM quay.io/centos/centos:stream9 - -ARG TREX_VERSION=3.02 -ENV TREX_VERSION ${TREX_VERSION} - -# install requirements -RUN dnf update -y && \ - dnf install -y --nodocs \ - wget \ - procps \ - python3 \ - python3-pip \ - pciutils \ - gettext \ - hostname \ - iproute \ - ethtool \ - nmap iputils \ - perf \ - numactl \ - sysstat \ - rdma-core \ - libibverbs \ - net-tools && \ - dnf clean all - -# install trex server -WORKDIR /opt/ -RUN wget --no-check-certificate https://trex-tgn.cisco.com/trex/release/v${TREX_VERSION}.tar.gz && \ - tar -xzf v${TREX_VERSION}.tar.gz && \ - mv v${TREX_VERSION} trex && \ - rm v${TREX_VERSION}.tar.gz - -COPY scripts /opt/scripts -COPY templates /opt/templates - -WORKDIR /opt/trex diff --git a/traffic-gen/scripts/main.sh b/traffic-gen/scripts/main.sh deleted file mode 100755 index d91e05b9..00000000 --- a/traffic-gen/scripts/main.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# -# This file is part of the kiagnose project -# -# 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. -# -# Copyright 2023 Red Hat, Inc. -# - -set -eu - -echo "setting params to trex_cfg.yaml" -/opt/scripts/set_traffic_gen_cfg_file.sh - -echo "setting params to traffic-gen test files" -/opt/scripts/set_tests_files.sh - -echo "run traffic_gen daemon" -/opt/scripts/run_traffic_gen_daemon.sh diff --git a/traffic-gen/scripts/run_traffic_gen_daemon.sh b/traffic-gen/scripts/run_traffic_gen_daemon.sh deleted file mode 100755 index 392ad38f..00000000 --- a/traffic-gen/scripts/run_traffic_gen_daemon.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash -# -# This file is part of the kiagnose project -# -# 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. -# -# Copyright 2023 Red Hat, Inc. -# - -set -eu - -if [ "${SET_VERBOSE}" == "TRUE" ]; then - set -x -fi - -print_params() { - echo NUM_OF_TRAFFIC_CPUS="${NUM_OF_TRAFFIC_CPUS}" -} - -print_params - -./t-rex-64 --no-ofed-check --no-scapy-server --no-hw-flow-stat -i -c "${NUM_OF_TRAFFIC_CPUS}" --iom 0 diff --git a/traffic-gen/scripts/set_tests_files.sh b/traffic-gen/scripts/set_tests_files.sh deleted file mode 100755 index 686ccbc3..00000000 --- a/traffic-gen/scripts/set_tests_files.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -# -# This file is part of the kiagnose project -# -# 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. -# -# Copyright 2023 Red Hat, Inc. -# - -set -eu - -if [ "${SET_VERBOSE}" == "TRUE" ]; then - set -x -fi - -mkdir -p /opt/tests - -print_params() { - echo SRC_WEST_MAC_ADDRESS="${SRC_WEST_MAC_ADDRESS}" - echo SRC_EAST_MAC_ADDRESS="${SRC_EAST_MAC_ADDRESS}" - echo DST_WEST_MAC_ADDRESS="${DST_WEST_MAC_ADDRESS}" - echo DST_EAST_MAC_ADDRESS="${DST_EAST_MAC_ADDRESS}" - echo NUM_OF_TRAFFIC_CPUS="${NUM_OF_TRAFFIC_CPUS}" -} - -print_params - -# set tests files -envsubst < /opt/templates/testpmd.py.in > /opt/tests/testpmd.py -envsubst < /opt/templates/testpmd_addr.py.in > /opt/tests/testpmd_addr.py - -cat /opt/tests/testpmd.py -cat /opt/tests/testpmd_addr.py diff --git a/traffic-gen/scripts/set_traffic_gen_cfg_file.sh b/traffic-gen/scripts/set_traffic_gen_cfg_file.sh deleted file mode 100755 index 5eb43bd7..00000000 --- a/traffic-gen/scripts/set_traffic_gen_cfg_file.sh +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env bash -# -# This file is part of the kiagnose project -# -# 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. -# -# Copyright 2023 Red Hat, Inc. -# - -set -eu - -if [ "${SET_VERBOSE}" == "TRUE" ]; then - set -x -fi - -expand_number_list() { - local input_list=$1 - expanded_input="" - IFS=',' read -ra nums <<< "$input_list" - for num in "${nums[@]}"; do - if [[ $num == *"-"* ]]; then - IFS='-' read -ra range <<< "$num" - for i in $(seq "${range[0]}" "${range[1]}"); do - expanded_input+=",$i" - done - else - expanded_input+=",$num" - fi - done - expanded_input=${expanded_input:1} # remove the leading comma - echo "$expanded_input" -} - -remove_number() { - local list=$1 - local number=$2 - local new_list="" - IFS=',' read -r -a array <<< "$list" - for i in "${array[@]}"; do - if [ "$i" != "$number" ]; then - new_list="$new_list,$i" - fi - done - new_list=${new_list:1} # remove the leading comma - echo "${new_list}" -} - -set_pci_addresses() { - # set interfaces - IFS=',' read -r -a nics_array <<< "${!PCI_DEVICES_VAR_NAME}" - export PCIDEVICE_NIC_1="\"${nics_array[0]}\"" - export PCIDEVICE_NIC_2="\"${nics_array[1]}\"" -} - -get_numa_socket_by_nic() { - local nic_without_quotes="${1//\"/}" - local lspci_output=$(lspci -v -nn -mm -k -s "${nic_without_quotes}") - local numa_socket=$(echo "$lspci_output" | grep NUMANode | awk '{print $2}') - echo "${numa_socket}" -} - -set_numa_socket() { - local nic1_numa_socket=$(get_numa_socket_by_nic "${PCIDEVICE_NIC_1}") - local nic2_numa_socket=$(get_numa_socket_by_nic "${PCIDEVICE_NIC_2}") - - if [[ "${nic1_numa_socket}" != "${nic2_numa_socket}" ]]; then - echo "error - NUMA socket of NICs ${PCIDEVICE_NIC_1} (=${nic1_numa_socket}), ${PCIDEVICE_NIC_2} (=${nic2_numa_socket}) do not match" - exit 1 - fi - - export NUMA_SOCKET="${nic1_numa_socket}" -} - -set_cpu_configs() { - # set master - CPUS=$(cat /sys/fs/cgroup/cpuset/cpuset.cpus) - CPUS=$(expand_number_list "${CPUS}") - IFS=',' read -r -a cpus_array <<< "${CPUS}" - export MASTER=${cpus_array[0]} - - # set latency - SIBLINGS=$(cat /sys/devices/system/cpu/cpu"${MASTER}"/topology/core_cpus_list) - export LATENCY=$(remove_number "$SIBLINGS" "${MASTER}") - - # set cpu - CPU=${CPUS} - CPU=$(remove_number "${CPU}" "${MASTER}") - CPU=$(remove_number "${CPU}" "${LATENCY}") - export CPU=$CPU -} - -print_params() { - echo setting params: - echo PCIDEVICE_NIC_1="${PCIDEVICE_NIC_1}" - echo PCIDEVICE_NIC_2="${PCIDEVICE_NIC_2}" - echo MASTER="${MASTER}" - echo LATENCY="${LATENCY}" - echo NUMA_SOCKET="${NUMA_SOCKET}" - echo CPU="${CPU}" - echo PORT_BANDWIDTH_GB="${PORT_BANDWIDTH_GB}" -} - -set_pci_addresses - -set_numa_socket - -set_cpu_configs - -print_params - -# set config_template file -envsubst < /opt/templates/trex_cfg.yaml.in > /etc/trex_cfg.yaml - -cat /etc/trex_cfg.yaml diff --git a/traffic-gen/templates/testpmd.py.in b/traffic-gen/templates/testpmd.py.in deleted file mode 100644 index 1e3bcc66..00000000 --- a/traffic-gen/templates/testpmd.py.in +++ /dev/null @@ -1,42 +0,0 @@ -from trex_stl_lib.api import * - -from testpmd_addr import * - -# Wild local MACs -mac_localport0="$SRC_EAST_MAC_ADDRESS" -mac_localport1="$SRC_WEST_MAC_ADDRESS" - -class STLS1(object): - - def __init__ (self): - self.fsize =64; # the size of the packet - self.number = 0 - - def create_stream (self, direction = 0): - size = self.fsize - 4; # HW will add 4 bytes ethernet FCS - dport = 1026 + self.number - self.number = self.number + 1 - if direction == 0: - base_pkt = Ether(dst=mac_telco0,src=mac_localport0)/IP(src="16.0.0.1",dst=ip_telco0)/UDP(dport=dport,sport=1026) - else: - base_pkt = Ether(dst=mac_telco1,src=mac_localport1)/IP(src="16.1.0.1",dst=ip_telco1)/UDP(dport=dport,sport=1026) - pad = (60 - len(base_pkt)) * 'x' - - return STLStream( - packet = - STLPktBuilder( - pkt = base_pkt / pad - ), - mode = STLTXCont()) - - - def get_streams (self, direction = 0, **kwargs): - # create multiple streams, one stream per core generating traffic... - s = [] - for i in range($NUM_OF_TRAFFIC_CPUS): - s.append(self.create_stream(direction = direction)) - return s - -# dynamic load - used for trex console or simulator -def register(): - return STLS1() diff --git a/traffic-gen/templates/testpmd_addr.py.in b/traffic-gen/templates/testpmd_addr.py.in deleted file mode 100644 index 83c7f7dd..00000000 --- a/traffic-gen/templates/testpmd_addr.py.in +++ /dev/null @@ -1,7 +0,0 @@ -# wild first XL710 mac -mac_telco0 = "$DST_EAST_MAC_ADDRESS" -# wild second XL710 mac -mac_telco1 = "$DST_WEST_MAC_ADDRESS" -# we don’t care of the IP in this phase -ip_telco0 = '10.0.0.1' -ip_telco1 = '10.1.1.1' diff --git a/traffic-gen/templates/trex_cfg.yaml.in b/traffic-gen/templates/trex_cfg.yaml.in deleted file mode 100644 index c37575f1..00000000 --- a/traffic-gen/templates/trex_cfg.yaml.in +++ /dev/null @@ -1,17 +0,0 @@ -- port_limit: 2 - version: 2 - interfaces: - - $PCIDEVICE_NIC_1 - - $PCIDEVICE_NIC_2 - port_bandwidth_gb: $PORT_BANDWIDTH_GB - port_info: - - ip: 10.10.10.2 - default_gw: 10.10.10.1 - - ip: 10.10.20.2 - default_gw: 10.10.20.1 - platform: - master_thread_id: $MASTER - latency_thread_id: $LATENCY - dual_if: - - socket: $NUMA_SOCKET - threads: [$CPU]