Separate Linux session into an interface for the API,
and a logical module in the framework.

Signed-off-by: Andrew Bailey <[email protected]>
Signed-off-by: Dean Marx <[email protected]>
---
 dts/api/testbed_model/linux_session.py       | 42 ++++++++++++++++++++
 dts/framework/testbed_model/linux_session.py |  3 +-
 dts/tests/TestSuite_smoke_tests.py           |  2 +-
 dts/tests/TestSuite_virtio_forward.py        |  3 +-
 4 files changed, 47 insertions(+), 3 deletions(-)
 create mode 100644 dts/api/testbed_model/linux_session.py

diff --git a/dts/api/testbed_model/linux_session.py 
b/dts/api/testbed_model/linux_session.py
new file mode 100644
index 0000000000..1b9f6d8339
--- /dev/null
+++ b/dts/api/testbed_model/linux_session.py
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2026 University of New Hampshire
+
+"""Linux OS translator.
+
+Translate OS-unaware calls into Linux calls/utilities. Most of Linux 
distributions are mostly
+compliant with POSIX standards, so this module only implements the parts that 
aren't.
+This intermediate module implements the common parts of mostly POSIX compliant 
distributions.
+"""
+
+from abc import ABC, abstractmethod
+from pathlib import PurePath
+
+
+class LinuxSession(ABC):
+    """The implementation of non-Posix compliant parts of Linux."""
+
+    @abstractmethod
+    def set_interface_link_up(self, name: str) -> None:
+        """Set the link status of an interface to up.
+
+        Args:
+            name: the name of the interface
+        """
+
+    @abstractmethod
+    def delete_interface(self, name: str) -> None:
+        """Delete a virtual interface.
+
+        Args:
+            name: the name of the interface to delete.
+        """
+
+    @property
+    @abstractmethod
+    def devbind_script_path(self) -> PurePath:
+        """The path to the dpdk-devbind.py script on the node."""
+
+    @devbind_script_path.setter
+    @abstractmethod
+    def devbind_script_path(self, value: PurePath) -> None:
+        """The path to the dpdk-devbind.py script on the node."""
diff --git a/dts/framework/testbed_model/linux_session.py 
b/dts/framework/testbed_model/linux_session.py
index 26c53f069c..13dce6455d 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -23,6 +23,7 @@
     InternalError,
     RemoteCommandExecutionError,
 )
+from api.testbed_model.linux_session import LinuxSession as LinuxSessionBase
 from api.utils import expand_range
 from framework.testbed_model.port import PortInfo
 
@@ -79,7 +80,7 @@ class LshwOutput(TypedDict):
     configuration: LshwConfigurationOutput
 
 
-class LinuxSession(PosixSession):
+class LinuxSession(PosixSession, LinuxSessionBase):
     """The implementation of non-Posix compliant parts of Linux."""
 
     @staticmethod
diff --git a/dts/tests/TestSuite_smoke_tests.py 
b/dts/tests/TestSuite_smoke_tests.py
index fce83604a6..656e2e4bb7 100644
--- a/dts/tests/TestSuite_smoke_tests.py
+++ b/dts/tests/TestSuite_smoke_tests.py
@@ -19,12 +19,12 @@
     requires_link_topology,
 )
 from api.test import verify
+from api.testbed_model.linux_session import LinuxSession
 from api.testpmd import TestPmd
 from api.utils import REGEX_FOR_PCI_ADDRESS
 from framework.config.node import PortConfig
 from framework.settings import SETTINGS
 from framework.test_suite import TestSuite, func_test
-from framework.testbed_model.linux_session import LinuxSession
 
 
 @requires_link_topology(LinkTopology.NO_LINK)
diff --git a/dts/tests/TestSuite_virtio_forward.py 
b/dts/tests/TestSuite_virtio_forward.py
index 6efaa4e156..6c4d7532c7 100644
--- a/dts/tests/TestSuite_virtio_forward.py
+++ b/dts/tests/TestSuite_virtio_forward.py
@@ -12,11 +12,11 @@
 from api.capabilities import LinkTopology
 from api.packet import send_packets_and_capture
 from api.test import log, verify
+from api.testbed_model.linux_session import LinuxSession
 from api.testpmd import TestPmd
 from api.testpmd.config import PortTopology, SimpleForwardingModes
 from framework.test_suite import TestSuite, func_test
 from framework.testbed_model.capability import requires
-from framework.testbed_model.linux_session import LinuxSession
 from framework.testbed_model.virtual_device import VirtualDevice
 
 
@@ -152,6 +152,7 @@ def pvp_loop(self) -> None:
         """
         self.sut_node = self._ctx.sut_node
         if not isinstance(self.sut_node.main_session, LinuxSession):
+            print(f"\n\nSESSION: {self.sut_node.main_session}")
             verify(False, "Must be running on a Linux environment.")
         # delete tap0 interface if it exists
         self.sut_node.main_session.delete_interface(name="tap0")
-- 
2.55.0

Reply via email to