Warning

This documentation is actively being updated as the project evolves and may not be complete in all areas.

Network drivers

jumpstarter-driver-network provides functionality for interacting with network servers and connections, redirecting DUT network services to the client handling the lease.

Installation

$ pip3 install --extra-index-url https://pkg.jumpstarter.dev/simple jumpstarter-driver-network

Configuration

Example configuration:

export:
  network:
    type: jumpstarter_driver_network.driver.TcpNetwork
    config:
      host: 192.168.1.2
      port: 5201
      enable_address: true

Config parameters

Parameter

Description

Type

Required

Default

host

Hostname or IP address of the DUT

str

yes

port

Port number of the DUT service to connect to

int

yes

enable_address

Whether to enable address mode (reporting the address of the client)

bool

no

true

API Reference

Network driver classes:

class jumpstarter_driver_network.driver.TcpNetwork

TcpNetwork is a driver for connecting to TCP sockets

>>> addr = getfixture("tcp_echo_server") # start a tcp echo server
>>> config = f"""
... type: jumpstarter_driver_network.driver.TcpNetwork
... config:
...   host: {addr[0]} # 127.0.0.1
...   port: {addr[1]} # random port
... """
>>> with run(config) as tcp:
...     with tcp.stream() as conn:
...         conn.send(b"hello")
...         assert conn.receive() == b"hello"
class jumpstarter_driver_network.driver.UdpNetwork

UdpNetwork is a driver for connecting to UDP sockets

>>> config = f"""
... type: jumpstarter_driver_network.driver.UdpNetwork
... config:
...   host: 127.0.0.1
...   port: 41336
... """
>>> with run(config) as udp:
...     pass
class jumpstarter_driver_network.driver.UnixNetwork

UnixNetwork is a driver for connecting to Unix domain sockets

>>> config = f"""
... type: jumpstarter_driver_network.driver.UnixNetwork
... config:
...   path: /tmp/example.sock
... """
>>> with run(config) as unix:
...     pass
class jumpstarter_driver_network.driver.EchoNetwork

EchoNetwork is a mock driver implementing the NetworkInterface

>>> config = """
... type: jumpstarter_driver_network.driver.EchoNetwork
... """
>>> with run(config) as echo:
...     with echo.stream() as conn:
...         conn.send(b"hello")
...         assert conn.receive() == b"hello"

Client API:

class jumpstarter_driver_network.client.NetworkClient