From: Paul Szczepanek <paul.szczepanek@arm.com>
To: dev@dpdk.org
Cc: probb@iol.unh.edu, "Paul Szczepanek" <paul.szczepanek@arm.com>,
"Juraj Linkeš" <juraj.linkes@pantheon.tech>
Subject: [PATCH] dts: remove redundant test suite
Date: Fri, 15 Nov 2024 15:50:08 +0000 [thread overview]
Message-ID: <20241115155008.821427-1-paul.szczepanek@arm.com> (raw)
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š <juraj.linkes@pantheon.tech>
Signed-off-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
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
next reply other threads:[~2024-11-15 15:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-15 15:50 Paul Szczepanek [this message]
2024-11-15 17:01 ` Luca Vizzarro
2024-11-15 17:07 ` Patrick Robb
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241115155008.821427-1-paul.szczepanek@arm.com \
--to=paul.szczepanek@arm.com \
--cc=dev@dpdk.org \
--cc=juraj.linkes@pantheon.tech \
--cc=probb@iol.unh.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).