Commit 03032941 authored by Xiao Liang's avatar Xiao Liang Committed by Jakub Kicinski
Browse files

selftests: net: Add python context manager for netns entering



Change netns of current thread and switch back on context exit.
For example:

    with NetNSEnter("ns1"):
        ip("link add dummy0 type dummy")

The command be executed in netns "ns1".

Signed-off-by: default avatarXiao Liang <shaw.leon@gmail.com>
Link: https://patch.msgid.link/20250219125039.18024-13-shaw.leon@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 7ca486d0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment