From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0961545D13; Fri, 15 Nov 2024 16:50:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 905F842FEB; Fri, 15 Nov 2024 16:50:24 +0100 (CET) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id AB5A942F95 for ; Fri, 15 Nov 2024 16:50:22 +0100 (CET) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DBAA8143D; Fri, 15 Nov 2024 07:50:51 -0800 (PST) Received: from localhost.localdomain (unknown [10.57.66.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 263733F6A8; Fri, 15 Nov 2024 07:50:21 -0800 (PST) From: Paul Szczepanek To: dev@dpdk.org Cc: probb@iol.unh.edu, Paul Szczepanek , =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [PATCH] dts: remove redundant test suite Date: Fri, 15 Nov 2024 15:50:08 +0000 Message-Id: <20241115155008.821427-1-paul.szczepanek@arm.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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š Signed-off-by: Paul Szczepanek --- dts/framework/test_suite.py | 36 ------------- dts/framework/testbed_model/linux_session.py | 22 +------- dts/framework/testbed_model/node.py | 2 - dts/framework/testbed_model/os_session.py | 34 ------------ dts/framework/testbed_model/sut_node.py | 8 --- dts/tests/TestSuite_os_udp.py | 54 -------------------- 6 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 dts/tests/TestSuite_os_udp.py diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 7a75334cfa..adee01f031 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -209,42 +209,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 544a665b83..f87efb8f18 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( diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index 6031eaf937..85144f6f4e 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -96,8 +96,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_test_run( self, diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index 294f5b36ba..62add7a4df 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -25,9 +25,7 @@ from abc import ABC, abstractmethod from collections.abc import Iterable from dataclasses import dataclass -from ipaddress import IPv4Interface, IPv6Interface from pathlib import Path, PurePath, PurePosixPath -from typing import Union from framework.config import Architecture, NodeConfiguration from framework.logger import DTSLogger @@ -521,30 +519,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`. @@ -553,11 +527,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 be3faf7474..14d77c50a6 100644 --- a/dts/framework/testbed_model/sut_node.py +++ b/dts/framework/testbed_model/sut_node.py @@ -488,14 +488,6 @@ def run_dpdk_app( f"{app_path} {eal_params}", 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 bind_ports_to_driver(self, for_dpdk: bool = True) -> None: """Bind all ports on the SUT to a driver. diff --git a/dts/tests/TestSuite_os_udp.py b/dts/tests/TestSuite_os_udp.py deleted file mode 100644 index beaa5f425d..0000000000 --- a/dts/tests/TestSuite_os_udp.py +++ /dev/null @@ -1,54 +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-untyped] -from scapy.layers.l2 import Ether # type: ignore[import-untyped] - -from framework.test_suite import TestSuite, func_test - - -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() - - @func_test - 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) -- 2.39.2