[v9,5/7] dts: allow configuring MTU of ports
Checks
Commit Message
From: Jeremy Spewock <jspewock@iol.unh.edu>
Adds methods in both os_session and linux session to allow for setting
MTU of port interfaces so that suites that require the sending and
receiving of packets of a specific size, or the rejection of packets
over a certain size, can configure this maximum as needed.
Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
dts/framework/testbed_model/linux_session.py | 8 ++++++++
dts/framework/testbed_model/os_session.py | 9 +++++++++
2 files changed, 17 insertions(+)
@@ -198,6 +198,14 @@ def configure_port_ip_address(
verify=True,
)
+ def configure_port_mtu(self, mtu: int, port: Port) -> None:
+ """Overrides :meth:`~.os_session.OSSession.configure_port_mtu`."""
+ self.send_command(
+ f"ip link set dev {port.logical_name} mtu {mtu}",
+ 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
@@ -412,6 +412,15 @@ def configure_port_ip_address(
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`.
+
+ Args:
+ 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.