Add rx_vxlan_port add/rm method to testpmd shell for adding or removing a vxlan id to the specified port filter list.
Signed-off-by: Dean Marx <dm...@iol.unh.edu> Reviewed-by: Jeremy Spewock <jspew...@iol.unh.edu> --- dts/framework/remote_session/testpmd_shell.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py index aa55bd91d3..8ede47ca03 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -2083,6 +2083,27 @@ def set_verbose(self, level: int, verify: bool = True) -> None: f"Testpmd failed to set verbose level to {level}." ) + def rx_vxlan(self, vxlan_id: int, port_id: int, enable: bool, verify: bool = True) -> None: + """Add or remove vxlan id to/from filter list. + + Args: + vxlan_id: VXLAN ID to add to port filter list. + port_id: ID of the port to modify VXLAN filter of. + enable: If :data:`True`, adds specified VXLAN ID, otherwise removes it. + verify: If :data:`True`, the output of the command is checked to verify + the VXLAN ID was successfully added/removed from the port. + + Raises: + InteractiveCommandExecutionError: If `verify` is :data:`True` and VXLAN ID + is not successfully added or removed. + """ + action = "add" if enable else "rm" + vxlan_output = self.send_command(f"rx_vxlan_port {action} {vxlan_id} {port_id}") + if verify: + if "udp tunneling add error" in vxlan_output: + self._logger.debug(f"Failed to set VXLAN:\n{vxlan_output}") + raise InteractiveCommandExecutionError(f"Failed to set VXLAN:\n{vxlan_output}") + def _close(self) -> None: """Overrides :meth:`~.interactive_shell.close`.""" self.stop() -- 2.44.0