On Mon, Dec 18, 2023 at 7:13 PM <jspew...@iol.unh.edu> wrote:
>
> From: Jeremy Spewock <jspew...@iol.unh.edu>
>
> Adds methods in both os_session and linux session to allow for setting
> MTU of port interfaces in an OS agnostic way.
>

The previous two commit messages had a little bit of an explanation,
but this one is missing one. Something like why a test case/suite
needs to set the MTU.

> Signed-off-by: Jeremy Spewock <jspew...@iol.unh.edu>
> ---
>  dts/framework/remote_session/linux_session.py | 8 ++++++++
>  dts/framework/remote_session/os_session.py    | 9 +++++++++
>  2 files changed, 17 insertions(+)
>
> diff --git a/dts/framework/remote_session/linux_session.py 
> b/dts/framework/remote_session/linux_session.py
> index fd877fbfae..aaa4d57a36 100644
> --- a/dts/framework/remote_session/linux_session.py
> +++ b/dts/framework/remote_session/linux_session.py
> @@ -177,6 +177,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:
>          state = 1 if enable else 0
>          self.send_command(f"sysctl -w net.ipv4.ip_forward={state}", 
> privileged=True)
> diff --git a/dts/framework/remote_session/os_session.py 
> b/dts/framework/remote_session/os_session.py
> index 8a709eac1c..cd073f5774 100644
> --- a/dts/framework/remote_session/os_session.py
> +++ b/dts/framework/remote_session/os_session.py
> @@ -277,6 +277,15 @@ def configure_port_ip_address(
>          Configure (add or delete) an IP address of the input port.
>          """
>
> +    @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:
>          """
> --
> 2.43.0
>

Reply via email to