Documentation ¶
Index ¶
- Constants
- func DisableTxOffload(n *NodeConfig) error
- type ConfigDispatcher
- type Endpoint
- type Extras
- 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) GetEnforceStartupConfig() bool
- func (n *NodeDefinition) GetEntrypoint() string
- func (n *NodeDefinition) GetEnv() map[string]string
- func (n *NodeDefinition) GetExec() []string
- func (n *NodeDefinition) GetExtras() *Extras
- 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) GetNodeCPU() float64
- func (n *NodeDefinition) GetNodeCPUSet() string
- func (n *NodeDefinition) GetNodeKernel() string
- func (n *NodeDefinition) GetNodeMemory() 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) GetStartupDelay() uint
- func (n *NodeDefinition) GetType() string
- func (n *NodeDefinition) GetUser() string
- func (n *NodeDefinition) ImportEnvs()
- 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) GetNodeCPU(name string) float64
- func (t *Topology) GetNodeCPUSet(name string) string
- func (t *Topology) GetNodeCmd(name string) string
- func (t *Topology) GetNodeConfigDispatcher(name string) *ConfigDispatcher
- func (t *Topology) GetNodeEnforceStartupConfig(name string) bool
- func (t *Topology) GetNodeEntrypoint(name string) string
- func (t *Topology) GetNodeEnv(name string) map[string]string
- func (t *Topology) GetNodeExec(name string) []string
- func (t *Topology) GetNodeExtras(name string) *Extras
- 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) GetNodeMemory(name string) string
- 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) GetNodeStartupDelay(name string) uint
- func (t *Topology) GetNodeType(name string) string
- func (t *Topology) GetNodeUser(name string) string
- func (t *Topology) ImportEnvs()
Constants ¶
const (
// env var containing the expected number of interfaces injected into every container
CLAB_ENV_INTFS = "CLAB_INTFS"
)
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
type ConfigDispatcher struct {
Vars map[string]interface{} `yaml:"vars,omitempty"`
}
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]interface{}
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 Extras ¶ added in v0.18.0
type Extras struct { SRLAgents []string `yaml:"srl-agents,omitempty"` // Nokia SR Linux agents. As of now just the agents spec files can be provided here MysocketProxy string `yaml:"mysocket-proxy,omitempty"` // Proxy address that mysocketctl will use }
Extras contains extra node parameters which are not entitled to be part of a generic node config
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]interface{} }
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"` IPv4Gw string `yaml:"ipv4-gw,omitempty"` IPv6Subnet string `yaml:"ipv6_subnet,omitempty"` IPv6Gw string `yaml:"ipv6-gw,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 StartupDelay uint // optional delay (in seconds) to wait before creating this node EnforceStartupConfig bool // when set to true will enforce the use of startup-config, even when config is present in the lab directory 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 Exec []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 ExtraHosts []string // Extra /etc/hosts entries for all nodes // 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 // Resource requirements CPU float64 CPUSet string Memory string DeploymentStatus string // status that is set by containerlab to indicate deployment stage // Extras Extras *Extras // Extra node parameters }
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 template 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"` StartupDelay uint `yaml:"startup-delay,omitempty"` EnforceStartupConfig bool `yaml:"enforce-startup-config,omitempty"` Config *ConfigDispatcher `yaml:"config,omitempty"` Image string `yaml:"image,omitempty"` License string `yaml:"license,omitempty"` Position string `yaml:"position,omitempty"` Entrypoint string `yaml:"entrypoint,omitempty"` Cmd string `yaml:"cmd,omitempty"` // list of commands to run in container Exec []string `yaml:"exec,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"` // Set node CPU (cgroup or hypervisor) CPU float64 `yaml:"cpu,omitempty"` // Set node CPUs to use CPUSet string `yaml:"cpu-set,omitempty"` // Set node Memory (cgroup or hypervisor) Memory string `yaml:"memory,omitempty"` // Extra options, may be kind specific Extras *Extras `yaml:"extras,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) GetEnforceStartupConfig ¶ added in v0.17.0
func (n *NodeDefinition) GetEnforceStartupConfig() bool
func (*NodeDefinition) GetEntrypoint ¶ added in v0.18.0
func (n *NodeDefinition) GetEntrypoint() string
func (*NodeDefinition) GetEnv ¶ added in v0.15.0
func (n *NodeDefinition) GetEnv() map[string]string
func (*NodeDefinition) GetExec ¶ added in v0.18.0
func (n *NodeDefinition) GetExec() []string
func (*NodeDefinition) GetExtras ¶ added in v0.18.0
func (n *NodeDefinition) GetExtras() *Extras
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) GetNodeCPU ¶ added in v0.16.2
func (n *NodeDefinition) GetNodeCPU() float64
func (*NodeDefinition) GetNodeCPUSet ¶ added in v0.20.0
func (n *NodeDefinition) GetNodeCPUSet() string
func (*NodeDefinition) GetNodeKernel ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeKernel() string
func (*NodeDefinition) GetNodeMemory ¶ added in v0.20.0
func (n *NodeDefinition) GetNodeMemory() 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) GetStartupDelay ¶ added in v0.17.0
func (n *NodeDefinition) GetStartupDelay() uint
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
func (*NodeDefinition) ImportEnvs ¶ added in v0.17.0
func (n *NodeDefinition) ImportEnvs()
ImportEnvs imports all environment variales defined in the shell if __IMPORT_ENVS is set to true
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) GetNodeCPU ¶ added in v0.16.2
func (*Topology) GetNodeCPUSet ¶ added in v0.20.0
func (*Topology) GetNodeCmd ¶ added in v0.15.0
func (*Topology) GetNodeConfigDispatcher ¶ added in v0.15.0
func (t *Topology) GetNodeConfigDispatcher(name string) *ConfigDispatcher
func (*Topology) GetNodeEnforceStartupConfig ¶ added in v0.17.0
func (*Topology) GetNodeEntrypoint ¶ added in v0.18.0
func (*Topology) GetNodeEnv ¶ added in v0.15.0
func (*Topology) GetNodeExec ¶ added in v0.18.0
func (*Topology) GetNodeExtras ¶ added in v0.18.0
Returns the 'extras' section for the given node
func (*Topology) GetNodeGroup ¶ added in v0.15.0
func (*Topology) GetNodeImage ¶ added in v0.15.0
func (*Topology) GetNodeKernel ¶ added in v0.15.0
func (*Topology) GetNodeKind ¶ added in v0.15.0
func (*Topology) GetNodeLabels ¶ added in v0.15.0
func (*Topology) GetNodeLicense ¶ added in v0.15.0
func (*Topology) GetNodeMemory ¶ added in v0.20.0
func (*Topology) GetNodeNetworkMode ¶ added in v0.15.0
func (*Topology) GetNodePorts ¶ added in v0.15.0
func (*Topology) GetNodePosition ¶ added in v0.15.0
func (*Topology) GetNodePublish ¶ added in v0.15.0
func (*Topology) GetNodeRuntime ¶ added in v0.15.0
func (*Topology) GetNodeSandbox ¶ added in v0.15.0
func (*Topology) GetNodeStartupConfig ¶ added in v0.15.0
func (*Topology) GetNodeStartupDelay ¶ added in v0.17.0
func (*Topology) GetNodeType ¶ added in v0.15.0
func (*Topology) GetNodeUser ¶ added in v0.15.0
func (*Topology) ImportEnvs ¶ added in v0.17.0
func (t *Topology) ImportEnvs()