conntester

package
v0.0.0-...-a2e9de6 Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectivityTester

type ConnectivityTester interface {
	// TestConnectivity returns nil error if connectivity test has passed.
	// Additionally, it returns test result for each tested device network interface
	// and network traces of executed probes if withNetTrace was enabled.
	TestConnectivity(dns types.DeviceNetworkStatus,
		withNetTrace bool) (types.IntfStatusMap, []netdump.TracedNetRequest, error)
}

ConnectivityTester allows to probe the state of external connectivity. It is not required for ConnectivityTester to be thread-safe.

type MockConnectivityTester

type MockConnectivityTester struct {
	sync.Mutex
	TestDuration   time.Duration             // inject
	NetworkMonitor netmonitor.NetworkMonitor // inject
	// contains filtered or unexported fields
}

MockConnectivityTester is used for unit testing.

func (*MockConnectivityTester) SetConnectivityError

func (t *MockConnectivityTester) SetConnectivityError(dpcKey, ifName string, err error)

SetConnectivityError : allows to simulate failing connectivity for an interface with a config from a given DPC. With nil error value, any previously set error is removed.

func (*MockConnectivityTester) TestConnectivity

func (t *MockConnectivityTester) TestConnectivity(dns types.DeviceNetworkStatus,
	withNetTrace bool) (intfStatusMap types.IntfStatusMap, tracedReqs []netdump.TracedNetRequest, err error)

TestConnectivity simulates connectivity test.

type PortsNotReady

type PortsNotReady struct {
	WrappedErr error
	// Ports which are not ready.
	Ports []string
}

PortsNotReady can be returned by TestConnectivity to indicate that one or more ports do not have working connectivity due to a potentially transient error (e.g. missing DNS config, no suitable IP addresses, etc.). For the caller this is a signal to possibly wait and repeat the test later.

func (*PortsNotReady) Error

func (e *PortsNotReady) Error() string

Error message.

func (*PortsNotReady) Unwrap

func (e *PortsNotReady) Unwrap() error

Unwrap : return wrapped error.

type RemoteTemporaryFailure

type RemoteTemporaryFailure struct {
	Endpoint   string
	WrappedErr error
}

RemoteTemporaryFailure can be returned by TestConnectivity to indicate that test failed due to a remote failure (i.e. the remote endpoint is accessible but fails to respond to the test properly).

func (*RemoteTemporaryFailure) Error

func (e *RemoteTemporaryFailure) Error() string

Error message.

func (*RemoteTemporaryFailure) Unwrap

func (e *RemoteTemporaryFailure) Unwrap() error

Unwrap : return wrapped error.

type ZedcloudConnectivityTester

type ZedcloudConnectivityTester struct {
	// Exported attributes below should be injected.
	Log         *base.LogObject
	AgentName   string
	TestTimeout time.Duration // can be changed in run-time
	Metrics     *zedcloud.AgentMetrics
	// contains filtered or unexported fields
}

ZedcloudConnectivityTester implements external connectivity testing using the "/api/v2/edgeDevice/ping" endpoint provided by the zedcloud.

func (*ZedcloudConnectivityTester) TestConnectivity

TestConnectivity uses VerifyAllIntf from the zedcloud package, which tries to call the "ping" API of the controller.

Jump to

Keyboard shortcuts

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