• Jakub Kicinski's avatar
    selftests: drv-net: define endpoint structures · 1a20a9a0
    Jakub Kicinski authored
    Define the remote endpoint "model". To execute most meaningful device
    driver tests we need to be able to communicate with a remote system,
    and have it send traffic to the device under test.
    
    Various test environments will have different requirements.
    
    0) "Local" netdevsim-based testing can simply use net namespaces.
    netdevsim supports connecting two devices now, to form a veth-like
    construct.
    
    1) Similarly on hosts with multiple NICs, the NICs may be connected
    together with a loopback cable or internal device loopback.
    One interface may be placed into separate netns, and tests
    would proceed much like in the netdevsim case. Note that
    the loopback config or the moving of one interface
    into a netns is not expected to be part of selftest code.
    
    2) Some systems may need to communicate with the remote endpoint
    via SSH.
    
    3) Last but not least environment may have its own custom communication
    method.
    
    Fundamentally we only need two operations:
     - run a command remotely
     - deploy a binary (if some tool we need is built as part of kselftests)
    
    Wrap these two in a class. Use dynamic loading to load the Remote
    class. This will allow very easy definition of other communication
    methods without bothering upstream code base.
    
    Stick to the "simple" / "no unnecessary abstractions" model for
    referring to the remote endpoints. The host / remote object are
    passed as an argument to the usual cmd() or ip() invocation.
    For example:
    
     ip("link show", json=True, host=remote)
    Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
    Link: https://lore.kernel.org/r/20240420025237.3309296-2-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    1a20a9a0
remote_ssh.py 1.06 KB