[v1] dts: fix multicast set function in testpmd shell
Checks
Commit Message
Fixes verification method in multicast set function by changing
the stats capture to use show_port_info_all(). This way, the
method will continue to work even after DTS lifts the restriction
on port topologies.
Fixes: abf8a3bc793b ("dts: add multicast set function to shell")
Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
dts/framework/remote_session/testpmd_shell.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Comments
On 16/01/2025 19:33, Dean Marx wrote:
> Fixes verification method in multicast set function by changing
> the stats capture to use show_port_info_all(). This way, the
> method will continue to work even after DTS lifts the restriction
> on port topologies.
>
> Fixes: abf8a3bc793b ("dts: add multicast set function to shell")
>
> Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
> ---
> dts/framework/remote_session/testpmd_shell.py | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py
> index d25952e2fa..37cd981264 100644
> --- a/dts/framework/remote_session/testpmd_shell.py
> +++ b/dts/framework/remote_session/testpmd_shell.py
> @@ -1795,7 +1795,7 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats:
>
> return TestPmdPortStats.parse(output)
>
> - def set_multicast_all(self, on: bool, verify: bool = True):
> + def set_multicast_all(self, on: bool, verify: bool = True) -> None:
> """Turns multicast mode on/off for the specified port.
>
> Args:
> @@ -1809,9 +1809,8 @@ def set_multicast_all(self, on: bool, verify: bool = True):
> """
> multicast_cmd_output = self.send_command(f"set allmulti all {'on' if on else 'off'}")
> if verify:
> - stats0 = self.show_port_info(port_id=0)
> - stats1 = self.show_port_info(port_id=1)
> - if on ^ (stats0.is_allmulticast_mode_enabled and stats1.is_allmulticast_mode_enabled):
> + port_stats = self.show_port_info_all()
> + if on ^ all(stats.is_allmulticast_mode_enabled for stats in port_stats):
> self._logger.debug(
> f"Failed to set multicast mode on all ports.: \n{multicast_cmd_output}"
> )
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
@@ -1795,7 +1795,7 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats:
return TestPmdPortStats.parse(output)
- def set_multicast_all(self, on: bool, verify: bool = True):
+ def set_multicast_all(self, on: bool, verify: bool = True) -> None:
"""Turns multicast mode on/off for the specified port.
Args:
@@ -1809,9 +1809,8 @@ def set_multicast_all(self, on: bool, verify: bool = True):
"""
multicast_cmd_output = self.send_command(f"set allmulti all {'on' if on else 'off'}")
if verify:
- stats0 = self.show_port_info(port_id=0)
- stats1 = self.show_port_info(port_id=1)
- if on ^ (stats0.is_allmulticast_mode_enabled and stats1.is_allmulticast_mode_enabled):
+ port_stats = self.show_port_info_all()
+ if on ^ all(stats.is_allmulticast_mode_enabled for stats in port_stats):
self._logger.debug(
f"Failed to set multicast mode on all ports.: \n{multicast_cmd_output}"
)