nodes

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: BSD-3-Clause Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// default connection mode for vrnetlab based containers.
	VrDefConnMode = "tc"
	// keys for the map returned by GetImages.
	ImageKey   = "image"
	KernelKey  = "kernel"
	SandboxKey = "sandbox"

	NodeKindBridge = "bridge"

	NodeKindHOST = "host"
	NodeKindOVS  = "ovs-bridge"
	NodeKindSRL  = "srl"
)

Variables

View Source
var (
	NodeKind string
	// a map of node kinds overriding the default global runtime.
	NonDefaultRuntimes = map[string]string{}

	// Nodes is a map of all supported kinds and their init functions.
	Nodes = map[string]Initializer{}

	DefaultConfigTemplates = map[string]string{
		"vr-sros": "",
	}

	// ErrCommandExecError is an error returned when a command is failed to execute on a given node.
	ErrCommandExecError = errors.New("command execution error")
)

Functions

func GetDefaultCredentialsForKind added in v0.27.0

func GetDefaultCredentialsForKind(kind string) ([]string, error)

GetDefaultCredentialsForKind retrieve the default credentials for a certain kind the first element in the slice is the Username, the second is the password.

func Register

func Register(names []string, initFn Initializer)

func SetDefaultCredentials added in v0.27.0

func SetDefaultCredentials(kindnames []string, user, password string) error

SetDefaultCredentials register default credentials per provided kindname.

func SetNonDefaultRuntimePerKind added in v0.27.0

func SetNonDefaultRuntimePerKind(kindnames []string, runtime string) error

SetNonDefaultRuntimePerKind sets a non default runtime for kinds that requires that (see cvx).

Types

type DefaultNode added in v0.33.0

type DefaultNode struct {
	Cfg     *types.NodeConfig
	Mgmt    *types.MgmtNet
	Runtime runtime.ContainerRuntime
}

func (*DefaultNode) Config added in v0.33.0

func (d *DefaultNode) Config() *types.NodeConfig

func (*DefaultNode) Delete added in v0.33.0

func (d *DefaultNode) Delete(ctx context.Context) error

func (*DefaultNode) Deploy added in v0.33.0

func (d *DefaultNode) Deploy(ctx context.Context) error

func (*DefaultNode) GetImages added in v0.33.0

func (d *DefaultNode) GetImages() map[string]string

func (*DefaultNode) GetRuntime added in v0.33.0

func (d *DefaultNode) GetRuntime() runtime.ContainerRuntime

func (*DefaultNode) PostDeploy added in v0.33.0

func (d *DefaultNode) PostDeploy(_ context.Context, _ map[string]Node) error

func (*DefaultNode) PreDeploy added in v0.33.0

func (d *DefaultNode) PreDeploy(_, _, _ string) error

func (*DefaultNode) SaveConfig added in v0.33.0

func (d *DefaultNode) SaveConfig(_ context.Context) error

func (*DefaultNode) WithMgmtNet added in v0.33.0

func (d *DefaultNode) WithMgmtNet(mgmt *types.MgmtNet)

func (*DefaultNode) WithRuntime added in v0.33.0

func (d *DefaultNode) WithRuntime(r runtime.ContainerRuntime)

type Initializer

type Initializer func() Node

type Node

type Node interface {
	Init(*types.NodeConfig, ...NodeOption) error
	Config() *types.NodeConfig
	PreDeploy(configName, labCADir, labCARoot string) error
	Deploy(context.Context) error
	PostDeploy(context.Context, map[string]Node) error
	WithMgmtNet(*types.MgmtNet)
	WithRuntime(runtime.ContainerRuntime)
	SaveConfig(context.Context) error
	Delete(context.Context) error
	GetImages() map[string]string
	GetRuntime() runtime.ContainerRuntime
}

type NodeOption

type NodeOption func(Node)

func WithMgmtNet

func WithMgmtNet(mgmt *types.MgmtNet) NodeOption

func WithRuntime

func WithRuntime(r runtime.ContainerRuntime) NodeOption

Jump to

Keyboard shortcuts

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