selftests: mlxsw: devlink_trap_police: Use defer for test cleanup

Use the defer framework to schedule cleanups as soon as the command is
executed.

Note that the start_traffic commands in __burst_test() are each sending a
fixed number of packets (note the -c flag) and then ending. They therefore
do not need a matching stop_traffic.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Petr Machata 2024-10-17 11:45:52 +02:00 • committed by Paolo Abeni
commit cebd281f3c