DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
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, "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Subject: [PATCH v1] dts: remove the OS UDP test suite
Date: Fri, 19 Apr 2024 15:52:16 +0200	[thread overview]
Message-ID: <20240419135216.106445-1-juraj.linkes@pantheon.tech> (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>
---
 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)
-- 
2.34.1


             reply	other threads:[~2024-04-19 13:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19 13:52 Juraj Linkeš [this message]
2024-04-23 10:39 ` Luca Vizzarro
2024-04-23 12:00   ` Juraj Linkeš
2024-04-26  8:55     ` Juraj Linkeš
2024-04-26 10:59       ` Luca Vizzarro

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=20240419135216.106445-1-juraj.linkes@pantheon.tech \
    --to=juraj.linkes@pantheon.tech \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=Luca.Vizzarro@arm.com \
    --cc=dev@dpdk.org \
    --cc=jspewock@iol.unh.edu \
    --cc=npratte@iol.unh.edu \
    --cc=paul.szczepanek@arm.com \
    --cc=probb@iol.unh.edu \
    --cc=thomas@monjalon.net \
    /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).