Documentation ¶
Index ¶
- func DisableTxOffload(n *NodeConfig) error
- type ConfigDispatcher
- type Endpoint
- type GenericContainer
- type GenericFilter
- type GenericMgmtIPs
- type Link
- type LinkConfig
- type MgmtNet
- type NodeConfig
- type NodeDefinition
- func (n *NodeDefinition) GetBinds() []string
- func (n *NodeDefinition) GetCmd() string
- func (n *NodeDefinition) GetConfigDispatcher() *ConfigDispatcher
- func (n *NodeDefinition) GetEnv() map[string]string
- func (n *NodeDefinition) GetGroup() string
- func (n *NodeDefinition) GetImage() string
- func (n *NodeDefinition) GetKind() string
- func (n *NodeDefinition) GetLabels() map[string]string
- func (n *NodeDefinition) GetLicense() string
- func (n *NodeDefinition) GetMgmtIPv4() string
- func (n *NodeDefinition) GetMgmtIPv6() string
- func (n *NodeDefinition) GetNetworkMode() string
- func (n *NodeDefinition) GetNodeKernel() string
- func (n *NodeDefinition) GetNodeRuntime() string
- func (n *NodeDefinition) GetNodeSandbox() string
- func (n *NodeDefinition) GetPorts() []string
- func (n *NodeDefinition) GetPostion() string
- func (n *NodeDefinition) GetPublish() []string
- func (n *NodeDefinition) GetStartupConfig() string
- func (n *NodeDefinition) GetType() string
- func (n *NodeDefinition) GetUser() string
- type Topology
- func (t *Topology) GetDefaults() *NodeDefinition
- func (t *Topology) GetKind(kind string) *NodeDefinition
- func (t *Topology) GetKinds() map[string]*NodeDefinition
- func (t *Topology) GetNodeBinds(name string) []string
- func (t *Topology) GetNodeCmd(name string) string
- func (t *Topology) GetNodeConfigDispatcher(name string) *ConfigDispatcher
- func (t *Topology) GetNodeEnv(name string) map[string]string
- func (t *Topology) GetNodeGroup(name string) string
- func (t *Topology) GetNodeImage(name string) string
- func (t *Topology) GetNodeKernel(name string) string
- func (t *Topology) GetNodeKind(name string) string
- func (t *Topology) GetNodeLabels(name string) map[string]string
- func (t *Topology) GetNodeLicense(name string) (string, error)
- func (t *Topology) GetNodeNetworkMode(name string) string
- func (t *Topology) GetNodePorts(name string) (nat.PortSet, nat.PortMap, error)
- func (t *Topology) GetNodePosition(name string) string
- func (t *Topology) GetNodePublish(name string) []string
- func (t *Topology) GetNodeRuntime(name string) string
- func (t *Topology) GetNodeSandbox(name string) string
- func (t *Topology) GetNodeStartupConfig(name string) (string, error)
- func (t *Topology) GetNodeType(name string) string
- func (t *Topology) GetNodeUser(name string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableTxOffload ¶ added in v0.15.0
func DisableTxOffload(n *NodeConfig) error
Types ¶
type ConfigDispatcher ¶ added in v0.15.0
ConfigDispatcher represents the config of a configuration machine that is responsible to execute configuration commands on the nodes after they started
func (*ConfigDispatcher) GetVars ¶ added in v0.15.0
func (cd *ConfigDispatcher) GetVars() map[string]string
type Endpoint ¶
type Endpoint struct { Node *NodeConfig // e1-x, eth, etc EndpointName string // mac address MAC string }
Endpoint is a struct that contains information of a link endpoint
type GenericContainer ¶
type GenericContainer struct { Names []string ID string ShortID string // trimmed ID for display purposes Image string State string Status string Labels map[string]string Pid int NetworkSettings *GenericMgmtIPs }
Data struct storing generic container data
type GenericFilter ¶ added in v0.15.0
type GenericFilter struct { // defined by now "label" FilterType string // defines e.g. the label name for FilterType "label" Field string // = | != | exists Operator string // match value Match string }
func FilterFromLabelStrings ¶ added in v0.15.0
func FilterFromLabelStrings(labels []string) []*GenericFilter
type GenericMgmtIPs ¶
type Link ¶
type Link struct { A *Endpoint B *Endpoint MTU int Labels map[string]string Vars map[string]string }
Link is a struct that contains the information of a link between 2 containers
type LinkConfig ¶ added in v0.15.0
type MgmtNet ¶
type MgmtNet struct { Network string `yaml:"network,omitempty"` // docker network name Bridge string `yaml:"bridge,omitempty"` // linux bridge backing the docker network (or containerd bridge net) IPv4Subnet string `yaml:"ipv4_subnet,omitempty"` IPv6Subnet string `yaml:"ipv6_subnet,omitempty"` MTU string `yaml:"mtu,omitempty"` }
mgmtNet struct defines the management network options it is provided via docker network object
type NodeConfig ¶ added in v0.15.0
type NodeConfig struct { ShortName string // name of the Node inside topology YAML LongName string // containerlab-prefixed unique container name Fqdn string LabDir string // LabDir is a directory related to the node, it contains config items and/or other persistent state Index int Group string Kind string StartupConfig string // path to config template file that is used for startup config generation ResStartupConfig string // path to config file that is actually mounted to the container and is a result of templation Config *ConfigDispatcher ResConfig string // path to config file that is actually mounted to the container and is a result of templation NodeType string Position string License string Image string Sysctls map[string]string User string Entrypoint string Cmd string Env map[string]string Binds []string // Bind mounts strings (src:dest:options) PortBindings nat.PortMap // PortBindings define the bindings between the container ports and host ports PortSet nat.PortSet // PortSet define the ports that should be exposed on a container // container networking mode. if set to `host` the host networking will be used for this node, else bridged network NetworkMode string MgmtNet string // name of the docker network this node is connected to with its first interface MgmtIPv4Address string MgmtIPv4PrefixLength int MgmtIPv6Address string MgmtIPv6PrefixLength int MacAddress string ContainerID string TLSCert string TLSKey string TLSAnchor string NSPath string // network namespace path for this node Publish []string //list of ports to publish with mysocketctl // container labels Labels map[string]string // Slice of pointers to local endpoints Endpoints []*Endpoint // Ignite sandbox and kernel imageNames Sandbox, Kernel string // Configured container runtime Runtime string }
NodeConfig is a struct that contains the information of a container element
func (*NodeConfig) GenerateConfig ¶ added in v0.15.0
func (node *NodeConfig) GenerateConfig(dst, templ string) error
GenerateConfig generates configuration for the nodes out of the templ based on the node configuration and saves the result to dst
type NodeDefinition ¶ added in v0.15.0
type NodeDefinition struct { Kind string `yaml:"kind,omitempty"` Group string `yaml:"group,omitempty"` Type string `yaml:"type,omitempty"` StartupConfig string `yaml:"startup-config,omitempty"` Config *ConfigDispatcher `yaml:"config,omitempty"` Image string `yaml:"image,omitempty"` License string `yaml:"license,omitempty"` Position string `yaml:"position,omitempty"` Cmd string `yaml:"cmd,omitempty"` // list of bind mount compatible strings Binds []string `yaml:"binds,omitempty"` // list of port bindings Ports []string `yaml:"ports,omitempty"` // user-defined IPv4 address in the management network MgmtIPv4 string `yaml:"mgmt_ipv4,omitempty"` // user-defined IPv6 address in the management network MgmtIPv6 string `yaml:"mgmt_ipv6,omitempty"` // list of ports to publish with mysocketctl Publish []string `yaml:"publish,omitempty"` // environment variables Env map[string]string `yaml:"env,omitempty"` // linux user used in a container User string `yaml:"user,omitempty"` // container labels Labels map[string]string `yaml:"labels,omitempty"` // container networking mode. if set to `host` the host networking will be used for this node, else bridged network NetworkMode string `yaml:"network-mode,omitempty"` // Ignite sandbox and kernel imageNames Sandbox string `yaml:"sandbox,omitempty"` Kernel string `yaml:"kernel,omitempty"` // Override container runtime Runtime string `yaml:"runtime,omitempty"` }
NodeDefinition represents a configuration a given node can have in the lab definition file
func (*NodeDefinition) GetBinds ¶ added in v0.15.0
func (n *NodeDefinition) GetBinds() []string
func (*NodeDefinition) GetCmd ¶ added in v0.15.0
func (n *NodeDefinition) GetCmd() string
func (*NodeDefinition) GetConfigDispatcher ¶ added in v0.15.0
func (n *NodeDefinition) GetConfigDispatcher() *ConfigDispatcher
func (*NodeDefinition) GetEnv ¶ added in v0.15.0
func (n *NodeDefinition) GetEnv() map[string]string
func (*NodeDefinition) GetGroup ¶ added in v0.15.0
func (n *NodeDefinition) GetGroup() string
func (*NodeDefinition) GetImage ¶ added in v0.15.0
func (n *NodeDefinition) GetImage() string
func (*NodeDefinition) GetKind ¶ added in v0.15.0
func (n *NodeDefinition) GetKind() string
func (*NodeDefinition) GetLabels ¶ added in v0.15.0
func (n *NodeDefinition) GetLabels() map[string]string
func (*NodeDefinition) GetLicense ¶ added in v0.15.0
func (n *NodeDefinition) GetLicense() string
func (*NodeDefinition) GetMgmtIPv4 ¶ added in v0.15.0
func (n *NodeDefinition) GetMgmtIPv4() string
func (*NodeDefinition) GetMgmtIPv6 ¶ added in v0.15.0
func (n *NodeDefinition) GetMgmtIPv6() string
func (*NodeDefinition) GetNetworkMode ¶ added in v0.15.0
func (n *NodeDefinition) GetNetworkMode() string
func (*NodeDefinition) GetNodeKernel ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeKernel() string
func (*NodeDefinition) GetNodeRuntime ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeRuntime() string
func (*NodeDefinition) GetNodeSandbox ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeSandbox() string
func (*NodeDefinition) GetPorts ¶ added in v0.15.0
func (n *NodeDefinition) GetPorts() []string
func (*NodeDefinition) GetPostion ¶ added in v0.15.0
func (n *NodeDefinition) GetPostion() string
func (*NodeDefinition) GetPublish ¶ added in v0.15.0
func (n *NodeDefinition) GetPublish() []string
func (*NodeDefinition) GetStartupConfig ¶ added in v0.15.0
func (n *NodeDefinition) GetStartupConfig() string
func (*NodeDefinition) GetType ¶ added in v0.15.0
func (n *NodeDefinition) GetType() string
func (*NodeDefinition) GetUser ¶ added in v0.15.0
func (n *NodeDefinition) GetUser() string
type Topology ¶ added in v0.15.0
type Topology struct { Defaults *NodeDefinition `yaml:"defaults,omitempty"` Kinds map[string]*NodeDefinition `yaml:"kinds,omitempty"` Nodes map[string]*NodeDefinition `yaml:"nodes,omitempty"` Links []*LinkConfig `yaml:"links,omitempty"` }
Topology represents a lab topology
func NewTopology ¶ added in v0.15.0
func NewTopology() *Topology
func (*Topology) GetDefaults ¶ added in v0.15.0
func (t *Topology) GetDefaults() *NodeDefinition
func (*Topology) GetKind ¶ added in v0.15.0
func (t *Topology) GetKind(kind string) *NodeDefinition
func (*Topology) GetKinds ¶ added in v0.15.0
func (t *Topology) GetKinds() map[string]*NodeDefinition
func (*Topology) GetNodeBinds ¶ added in v0.15.0
func (*Topology) GetNodeCmd ¶ added in v0.15.0
func (*Topology) GetNodeConfigDispatcher ¶ added in v0.15.0
func (t *Topology) GetNodeConfigDispatcher(name string) *ConfigDispatcher