From patchwork Fri Apr 19 13:52:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Juraj_Linke=C5=A1?= X-Patchwork-Id: 139546 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4971C43EB0; Fri, 19 Apr 2024 15:52:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0DBAB402D9; Fri, 19 Apr 2024 15:52:21 +0200 (CEST) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) by mails.dpdk.org (Postfix) with ESMTP id 59DD0402D4 for ; Fri, 19 Apr 2024 15:52:18 +0200 (CEST) Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a52582ecde4so191374966b.0 for ; Fri, 19 Apr 2024 06:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1713534738; x=1714139538; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=84NU6jJE+y6/gxJpJupr6roBwQQhxntC2am7pGP2nR0=; b=nQF3Gcb/mINjPG4rpeUsOBJWzZpHPvtv2HPa532TgnOeIQWvQLMfKr8Yt4JVOqnHot kQ5bg+gPN9htPbPT0yXSExMBS1tslV9U8cFqDu0uD9C5Wgg9wkAYMs3p+Zl4rMLJu9wb t56jeESAfyj/0SaWX3dWWbmiCbQ6iCL1Yrf6RhsPgUcFw/WaNqDUClccn0YXvjrS5Rw1 gLauIE31sGsiQIFIhVarHCwXd7c6BCzN7Ycj/y0tjMyXywNFOQXoQfrUJjNcPBT0uRDp tGoBFMH4FV/RdS7YOZBFtDkTEEvjg1qyrbTPAXCapOOcqMGkI+lE/sU0Pqap2xWhBl8t 9trA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713534738; x=1714139538; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=84NU6jJE+y6/gxJpJupr6roBwQQhxntC2am7pGP2nR0=; b=FehFExdlg/xG7TpFWJs4luzpaWQV26mHb2QT2DkluXwBvWZKpb1xaqLpuPz0SOojXh eefmPi1PE1UQ9jIA+OjsH9HTL+prMpk5uf4uHR+FF/fL5P0Fmw9tcunDZWk2ipBr7gXQ +pj9fnJRGrkYL7TjmmbC6h1K11J5qgxm5xWjfB7aLD0YDZ36pm5zbfPc+7evEQYWhhyp boGt4d9HZVHNLCkVr5jV+nE7Th1WBS+nMAtdey/NlF5SAPiN37Rv8E+NPJWgcHlNAPaQ O0ihJgpJZEMZPGpmTJD3QWDUg2TvMK/GoVTFtEN7vEYqiNQhsopkJUz+onbemB6Mz3up gy/g== X-Gm-Message-State: AOJu0YwR/YjOtGDg9ZDnBLf2B76LZkyAlY5scZ9oyaDjBSsaxy+3zkwn /kOKJSCcl86rlwlT+lfNYtPHQmoVeI/nCPoCqTdTRdHPJMbTJlov5IS+WYhMcpE= X-Google-Smtp-Source: AGHT+IGhJFAs5YckWtrYNnRStpCs9X4SBsPCcgdB5wiyXVo1gkj74M8MTBNIgB5Sjl4qoV8ozbRS6A== X-Received: by 2002:a17:906:bc98:b0:a55:68b2:4186 with SMTP id lv24-20020a170906bc9800b00a5568b24186mr1533958ejb.45.1713534738038; Fri, 19 Apr 2024 06:52:18 -0700 (PDT) Received: from jlinkes-PT-Latitude-5530.pantheon.local ([84.245.121.75]) by smtp.gmail.com with ESMTPSA id ju23-20020a170906e91700b00a558d5d28b6sm404224ejb.73.2024.04.19.06.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 06:52:17 -0700 (PDT) From: =?utf-8?q?Juraj_Linke=C5=A1?= To: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu, probb@iol.unh.edu, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com, npratte@iol.unh.edu Cc: dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= Subject: [PATCH v1] dts: remove the OS UDP test suite Date: Fri, 19 Apr 2024 15:52:16 +0200 Message-Id: <20240419135216.106445-1-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The test suite served as a demonstration of the Scapy traffic generator implementation. Now that we have a test suite that uses DPDK code (via testpmd), there is no reason to keep the test suite, as there's no expectation it'll be actually used in any setup. Signed-off-by: Juraj Linkeš --- dts/conf.yaml | 1 - dts/framework/config/conf_yaml_schema.json | 1 - dts/framework/test_suite.py | 36 ------------- dts/framework/testbed_model/linux_session.py | 27 +--------- dts/framework/testbed_model/node.py | 29 +---------- dts/framework/testbed_model/os_session.py | 36 +------------ dts/framework/testbed_model/sut_node.py | 9 ---- dts/tests/TestSuite_os_udp.py | 53 -------------------- 8 files changed, 4 insertions(+), 188 deletions(-) delete mode 100644 dts/tests/TestSuite_os_udp.py diff --git a/dts/conf.yaml b/dts/conf.yaml index 8068345dd5..d61fb39303 100644 --- a/dts/conf.yaml +++ b/dts/conf.yaml @@ -16,7 +16,6 @@ executions: skip_smoke_tests: false # optional test_suites: # the following test suites will be run in their entirety - hello_world - - os_udp # The machine running the DPDK test executable system_under_test_node: node_name: "SUT 1" diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index 4731f4511d..105671a639 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -186,7 +186,6 @@ "type": "string", "enum": [ "hello_world", - "os_udp", "pmd_buffer_scatter" ] }, diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 9c3b516002..9758a283de 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -139,42 +139,6 @@ def tear_down_test_case(self) -> None: This is done after *each* test case. """ - def configure_testbed_ipv4(self, restore: bool = False) -> None: - """Configure IPv4 addresses on all testbed ports. - - The configured ports are: - - * SUT ingress port, - * SUT egress port, - * TG ingress port, - * TG egress port. - - Args: - restore: If :data:`True`, will remove the configuration instead. - """ - delete = True if restore else False - enable = False if restore else True - self._configure_ipv4_forwarding(enable) - self.sut_node.configure_port_ip_address( - self._sut_ip_address_egress, self._sut_port_egress, delete - ) - self.sut_node.configure_port_state(self._sut_port_egress, enable) - self.sut_node.configure_port_ip_address( - self._sut_ip_address_ingress, self._sut_port_ingress, delete - ) - self.sut_node.configure_port_state(self._sut_port_ingress, enable) - self.tg_node.configure_port_ip_address( - self._tg_ip_address_ingress, self._tg_port_ingress, delete - ) - self.tg_node.configure_port_state(self._tg_port_ingress, enable) - self.tg_node.configure_port_ip_address( - self._tg_ip_address_egress, self._tg_port_egress, delete - ) - self.tg_node.configure_port_state(self._tg_port_egress, enable) - - def _configure_ipv4_forwarding(self, enable: bool) -> None: - self.sut_node.configure_ipv4_forwarding(enable) - def send_packet_and_capture( self, packet: Packet, diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py index 5d24030c3d..e3fd0534ce 100644 --- a/dts/framework/testbed_model/linux_session.py +++ b/dts/framework/testbed_model/linux_session.py @@ -10,8 +10,7 @@ """ import json -from ipaddress import IPv4Interface, IPv6Interface -from typing import TypedDict, Union +from typing import TypedDict from typing_extensions import NotRequired @@ -179,25 +178,6 @@ def _update_port_attr(self, port: Port, attr_value: str | None, attr_name: str) f"Attempted to get '{attr_name}' of port {port.pci}, but it doesn't exist." ) - def configure_port_state(self, port: Port, enable: bool) -> None: - """Overrides :meth:`~.os_session.OSSession.configure_port_state`.""" - state = "up" if enable else "down" - self.send_command(f"ip link set dev {port.logical_name} {state}", privileged=True) - - def configure_port_ip_address( - self, - address: Union[IPv4Interface, IPv6Interface], - port: Port, - delete: bool, - ) -> None: - """Overrides :meth:`~.os_session.OSSession.configure_port_ip_address`.""" - command = "del" if delete else "add" - self.send_command( - f"ip address {command} {address} dev {port.logical_name}", - privileged=True, - verify=True, - ) - def configure_port_mtu(self, mtu: int, port: Port) -> None: """Overrides :meth:`~.os_session.OSSession.configure_port_mtu`.""" self.send_command( @@ -205,8 +185,3 @@ def configure_port_mtu(self, mtu: int, port: Port) -> None: privileged=True, verify=True, ) - - def configure_ipv4_forwarding(self, enable: bool) -> None: - """Overrides :meth:`~.os_session.OSSession.configure_ipv4_forwarding`.""" - state = 1 if enable else 0 - self.send_command(f"sysctl -w net.ipv4.ip_forward={state}", privileged=True) diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 74061f6262..df5742d761 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -13,8 +13,7 @@ """ from abc import ABC -from ipaddress import IPv4Interface, IPv6Interface -from typing import Any, Callable, Type, Union +from typing import Any, Callable, Type from framework.config import ( OS, @@ -100,8 +99,6 @@ def __init__(self, node_config: NodeConfiguration): def _init_ports(self) -> None: self.ports = [Port(self.name, port_config) for port_config in self.config.ports] self.main_session.update_ports(self.ports) - for port in self.ports: - self.configure_port_state(port) def set_up_execution(self, execution_config: ExecutionConfiguration) -> None: """Execution setup steps. @@ -269,30 +266,6 @@ def _setup_hugepages(self) -> None: self.config.hugepages.amount, self.config.hugepages.force_first_numa ) - def configure_port_state(self, port: Port, enable: bool = True) -> None: - """Enable/disable `port`. - - Args: - port: The port to enable/disable. - enable: :data:`True` to enable, :data:`False` to disable. - """ - self.main_session.configure_port_state(port, enable) - - def configure_port_ip_address( - self, - address: Union[IPv4Interface, IPv6Interface], - port: Port, - delete: bool = False, - ) -> None: - """Add an IP address to `port` on this node. - - Args: - address: The IP address with mask in CIDR format. Can be either IPv4 or IPv6. - port: The port to which to add the address. - delete: If :data:`True`, will delete the address from the port instead of adding it. - """ - self.main_session.configure_port_ip_address(address, port, delete) - def close(self) -> None: """Close all connections and free other resources.""" if self.main_session: diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index d5bf7e0401..6d51e080ff 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -21,11 +21,11 @@ the :attr:`~.node.Node.main_session` translates that to ``rm -rf`` if the node's OS is Linux and other commands for other OSs. It also translates the path to match the underlying OS. """ + from abc import ABC, abstractmethod from collections.abc import Iterable -from ipaddress import IPv4Interface, IPv6Interface from pathlib import PurePath -from typing import Type, TypeVar, Union +from typing import Type, TypeVar from framework.config import Architecture, NodeConfiguration, NodeInfo from framework.logger import DTSLogger @@ -388,30 +388,6 @@ def update_ports(self, ports: list[Port]) -> None: ports: The ports to update. """ - @abstractmethod - def configure_port_state(self, port: Port, enable: bool) -> None: - """Enable/disable `port` in the operating system. - - Args: - port: The port to configure. - enable: If :data:`True`, enable the port, otherwise shut it down. - """ - - @abstractmethod - def configure_port_ip_address( - self, - address: Union[IPv4Interface, IPv6Interface], - port: Port, - delete: bool, - ) -> None: - """Configure an IP address on `port` in the operating system. - - Args: - address: The address to configure. - port: The port to configure. - delete: If :data:`True`, remove the IP address, otherwise configure it. - """ - @abstractmethod def configure_port_mtu(self, mtu: int, port: Port) -> None: """Configure `mtu` on `port`. @@ -420,11 +396,3 @@ def configure_port_mtu(self, mtu: int, port: Port) -> None: mtu: Desired MTU value. port: Port to set `mtu` on. """ - - @abstractmethod - def configure_ipv4_forwarding(self, enable: bool) -> None: - """Enable IPv4 forwarding in the operating system. - - Args: - enable: If :data:`True`, enable the forwarding, otherwise disable it. - """ diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py index 97aa26d419..ee3168d92b 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -10,7 +10,6 @@ An SUT node is where this SUT runs. """ - import os import tarfile import time @@ -429,14 +428,6 @@ def run_dpdk_app( f"{app_path} {eal_args}", timeout, privileged=True, verify=True ) - def configure_ipv4_forwarding(self, enable: bool) -> None: - """Enable/disable IPv4 forwarding on the node. - - Args: - enable: If :data:`True`, enable the forwarding, otherwise disable it. - """ - self.main_session.configure_ipv4_forwarding(enable) - def create_interactive_shell( self, shell_cls: Type[InteractiveShellType], diff --git a/dts/tests/TestSuite_os_udp.py b/dts/tests/TestSuite_os_udp.py deleted file mode 100644 index b4784dd95e..0000000000 --- a/dts/tests/TestSuite_os_udp.py +++ /dev/null @@ -1,53 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright(c) 2023 PANTHEON.tech s.r.o. - -"""Basic IPv4 OS routing test suite. - -Configure SUT node to route traffic from if1 to if2. -Send a packet to the SUT node, verify it comes back on the second port on the TG node. -""" - -from scapy.layers.inet import IP, UDP # type: ignore[import] -from scapy.layers.l2 import Ether # type: ignore[import] - -from framework.test_suite import TestSuite - - -class TestOsUdp(TestSuite): - """IPv4 UDP OS routing test suite.""" - - def set_up_suite(self) -> None: - """Set up the test suite. - - Setup: - Bind the SUT ports to the OS driver, configure the ports and configure the SUT - to route traffic from if1 to if2. - """ - self.sut_node.bind_ports_to_driver(for_dpdk=False) - self.configure_testbed_ipv4() - - def test_os_udp(self) -> None: - """Basic UDP IPv4 traffic test case. - - Steps: - Send a UDP packet. - Verify: - The packet with proper addresses arrives at the other TG port. - """ - packet = Ether() / IP() / UDP() - - received_packets = self.send_packet_and_capture(packet) - - expected_packet = self.get_expected_packet(packet) - - self.verify_packets(expected_packet, received_packets) - - def tear_down_suite(self) -> None: - """Tear down the test suite. - - Teardown: - Remove the SUT port configuration configured in setup. - """ - self.configure_testbed_ipv4(restore=True) - # Assume other suites will likely need dpdk driver - self.sut_node.bind_ports_to_driver(for_dpdk=True)