remotehost

package
v0.1.0-latest-stable Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package remotehost runs SSH and docker/podman commands on remote test machines.

Index

Constants

View Source
const (
	// DefaultTimeout is the default Eventually timeout.
	DefaultTimeout = 1 * time.Minute
	// LongTimeout is the Eventually timeout for slow host operations.
	LongTimeout = 6 * time.Minute
)

Variables

This section is empty.

Functions

func ConfigureVRFDHCP

func ConfigureVRFDHCP(mtu int, links []VRFLink, hosts []Host)

ConfigureVRFDHCP writes transient networkd drop-ins and runs DHCP for each link Family.

func RemoveVRFNetworkd

func RemoveVRFNetworkd(links []VRFLink, hosts []Host)

RemoveVRFNetworkd removes transient networkd drop-ins (best-effort).

func RunIBWriteBW

func RunIBWriteBW(
	client, server Host,
	cfg Net,
	duration time.Duration,
	minAvgBWGbit float32,
	mtu int,
	extraArgs ...string,
)

RunIBWriteBW runs ib_write_bw and asserts average BW above minAvgBWGbit.

func RunTrafficTest

func RunTrafficTest(client, server Host, cfg Net)

RunTrafficTest runs bidirectional iperf3 using cfg Destination and optional ClientBindIP.

func SpinUpAll

func SpinUpAll(hosts []Host, image string)

SpinUpAll starts privileged host-network containers on the given hosts.

Types

type Host

type Host struct {
	// Addr is the SSH address.
	Addr string
	// User is the SSH user, empty defaults to root.
	User string
	// Password is the SSH password for sshpass.
	Password string
	// ContainerName is the docker/podman container name.
	ContainerName string
	// Runtime is docker or podman.
	Runtime string
	// RegistryAuth is the registry credentials for pulling images, nil skips the login.
	RegistryAuth *RegistryAuth
}

Host is a remote SSH machine with an optional container runtime.

func (Host) AssertPingFailure

func (h Host) AssertPingFailure(cfg Net)

AssertPingFailure asserts ping to Destination consistently fails.

func (Host) FlushIface

func (h Host) FlushIface(iface, subnet string, family IPFamily)

FlushIface best-effort flushes host addresses on iface and drops the subnet route.

func (Host) GetLinkMAC

func (h Host) GetLinkMAC(iface string) string

GetLinkMAC returns the link MAC for iface on the remote host.

func (Host) Login

func (h Host) Login()

Login authenticates the host runtime against RegistryAuth, no-op when unset.

func (Host) Ping

func (h Host) Ping(cfg Net)

Ping pings Destination, optionally inside VRF.

func (Host) Remove

func (h Host) Remove()

Remove force-removes the container if it exists.

func (Host) SSH

func (h Host) SSH(cmd string) (string, error)

SSH runs cmd on the host, not in the container.

func (Host) SpinUp

func (h Host) SpinUp(image string)

SpinUp starts a detached privileged host-network container.

type IPFamily

type IPFamily int

IPFamily is IPv4 or IPv6 for DHCP and traffic helpers, zero value is IPv4, no dual-stack until a caller needs it.

const (
	// IPFamilyV4 is IPv4.
	IPFamilyV4 IPFamily = iota
	// IPFamilyV6 is IPv6.
	IPFamilyV6
)

func (IPFamily) Bits

func (f IPFamily) Bits() int

Bits returns 32 for IPv4 or 128 for IPv6.

func (IPFamily) IPVersion

func (f IPFamily) IPVersion() string

IPVersion returns 4 or 6 for ip -4/-6.

func (IPFamily) String

func (f IPFamily) String() string

String returns ipv4 or ipv6.

type Net

type Net struct {
	// VRF, when set, wraps commands with ip vrf exec.
	VRF string
	// Destination is the ping, iperf, or RDMA peer IP.
	Destination string
	// ClientBindIP is the optional iperf -B address.
	ClientBindIP string
	// RDMADev is the RDMA device for ib_write_bw.
	RDMADev string
	// Family is IPv4 or IPv6, zero value is IPv4.
	Family IPFamily
}

Net is the network context for traffic helpers, empty VRF uses the default namespace.

type RegistryAuth

type RegistryAuth struct {
	// Registry is the registry host.
	Registry string
	// Username is the registry user.
	Username string
	// Password is the registry password or API key.
	Password string
}

RegistryAuth are credentials for pulling images on the remote host.

type VRFLink struct {
	// Iface is the host netdev.
	Iface string
	// VRF is the VRF device to enslave Iface to.
	VRF string
	// Table is the VRF routing table ID.
	Table int
	// Family is IPv4 or IPv6, zero value is IPv4.
	Family IPFamily
}

VRFLink is a host iface enslaved to a VRF.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL