Documentation ¶
Index ¶
- Constants
- Variables
- func BridgeByName(name string) (*netlink.Bridge, error)
- func CheckBrInUse(brname string) (bool, error)
- func ContainerNSToPID(cID string) (int, error)
- func ConvertEnvs(m map[string]string) []string
- func CopyFile(src, dst string, mode os.FileMode) (err error)
- func CopyFileContents(src, dst string, mode os.FileMode) (err error)
- func CreateDirectory(path string, perm os.FileMode)
- func CreateFile(file, content string) (err error)
- func DeleteLinkByName(name string) error
- func DeleteNetnsSymlink(n string) error
- func EthtoolTXOff(name string) error
- func ExpandEnvVarsInStrSlice(s []string)
- func ExpandHome(p string) string
- func FileExists(filename string) bool
- func FirstLinkIPs(ln string) (v4, v6 string, err error)
- func GenMac(oui string) string
- func GetCNIBinaryPath() string
- func GetCanonicalImageName(imageName string) string
- func LinkContainerNS(nspath, containerName string) error
- func LinkIPs(ln string) (v4addrs, v6addrs []netlink.Addr, err error)
- func LoadEnvVarFiles(basefolder string, files []string) (map[string]string, error)
- func MergeMaps(dicts ...map[string]interface{}) map[string]interface{}
- func MergeStringMaps(maps ...map[string]string) map[string]string
- func MergeStringSlices(ss ...[]string) []string
- func PauseProcessGroup(pgid int) error
- func ReadFileContent(file string) ([]byte, error)
- func ResolvePath(p, base string) string
- func SpawnCLIviaExec(platformName, contName, runtime string) (*network.Driver, error)
- func StringInSlice(slice []string, val string) (int, bool)
- func ToEnvKey(s string) string
- func UnpauseProcessGroup(pgid int) error
- type EthtoolValue
- type IFReqData
Constants ¶
const ( SIOCETHTOOL = 0x8946 // linux/sockios.h ETHTOOL_GTXCSUM = 0x00000016 // linux/ethtool.h ETHTOOL_STXCSUM = 0x00000017 // linux/ethtool.h IFNAMSIZ = 16 // linux/if.h )
Variables ¶
var ( // map of commands per platform which start a CLI app. NetworkOSCLICmd = map[string]string{ "arista_eos": "Cli", "nokia_srlinux": "sr_cli", } // map of the cli exec command and its argument per runtime // which is used to spawn CLI session. CLIExecCommand = map[string]map[string]string{ "docker": { "exec": "docker", "open": "exec -it", }, "containerd": { "exec": "ctr", "open": "-n clab task exec -t --exec-id clab", }, } )
var IfWaitScript string = `` /* 440-byte string literal not displayed */
IfWaitScript is used in ENTRYPOINT/CMD of the nodes that need to ensure that all of the clab links/interfaces are available in the container before calling the main process.
Functions ¶
func BridgeByName ¶
BridgeByName returns a *netlink.Bridge referenced by its name.
func CheckBrInUse ¶ added in v0.15.0
func ContainerNSToPID ¶ added in v0.26.0
ContainerNSToPID resolves the name of a container via the "/run/netns/<CONTAINERNAME>" to its PID.
func ConvertEnvs ¶
convertEnvs convert env variables passed as a map to a list of them.
func CopyFile ¶
CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherwise, copy the file contents from src to dst. mode is the desired target file permissions, e.g. "0644".
func CopyFileContents ¶
CopyFileContents copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. src can be an http(s) URL as well.
func CreateDirectory ¶
CreateDirectory creates a directory by a path with a mode/permission specified by perm. If directory exists, the function does not do anything.
func CreateFile ¶
CreateFile writes content to a file by path `file`.
func DeleteLinkByName ¶ added in v0.15.0
func DeleteNetnsSymlink ¶ added in v0.15.0
deleteNetnsSymlink deletes a network namespace and removes the symlink created by linkContainerNS func.
func EthtoolTXOff ¶
EthtoolTXOff disables TX checksum offload on specified interface.
func ExpandEnvVarsInStrSlice ¶ added in v0.25.0
func ExpandEnvVarsInStrSlice(s []string)
ExpandEnvVarsInStrSlice makes an in-place expansion of env vars in a slice of strings.
func ExpandHome ¶ added in v0.25.0
ExpandHome expands `~` char in the path to home path of a current user in provided path p.
func FileExists ¶
FileExists returns true if a file referenced by filename exists & accessible.
func FirstLinkIPs ¶ added in v0.23.0
FirstLinkIPs returns string representation of the first IPv4/v6 address found for a link referenced by name.
func GetCNIBinaryPath ¶ added in v0.15.0
func GetCNIBinaryPath() string
func GetCanonicalImageName ¶ added in v0.15.0
produces a canonical image name. returns the canonical image name including the tag if the input name did not specify a tag, the implicit "latest" tag is returned.
func LinkContainerNS ¶
linkContainerNS creates a symlink for containers network namespace so that it can be managed by iproute2 utility.
func LinkIPs ¶ added in v0.23.0
LinkIPs returns IPv4/IPv6 addresses assigned to a link referred by its name.
func LoadEnvVarFiles ¶ added in v0.26.0
LoadEnvVarFiles load EnvVars from the given files, resolving relative paths.
func MergeMaps ¶ added in v0.15.0
merge all dictionaries and return a new dictionary recursively if matching keys are both dictionaries.
func MergeStringMaps ¶ added in v0.15.0
merge all string maps and return a new map maps that are passed for merging will not be changed merging to empty maps return an empty map merging nils return nil.
func MergeStringSlices ¶ added in v0.24.0
MergeStringSlices merges string slices with duplicates removed.
func PauseProcessGroup ¶ added in v0.26.0
PauseProcessGroup sends the SIGSTOP signal to a process group, causing all the processes within the group to be Paused e.g. SRL runs multilpe processes, if the container is meant to be stopped, all the related processes must be paused. To me it seams like the ProcessGroupID is set correctly so we can count on that field. The syscall.Kill interpretes negative ints as a PGID and not as a common PID.
func ReadFileContent ¶
func ResolvePath ¶ added in v0.25.0
ResolvePath resolves a string path by expanding `~` to home dir or resolving a relative path by joining it with the base path.
func SpawnCLIviaExec ¶ added in v0.17.0
SpawnCLIviaExec spawns a CLI session over container runtime exec function end ensures the CLI is available to be used for sending commands over.
func StringInSlice ¶ added in v0.15.0
does a slice contain a string.
func ToEnvKey ¶ added in v0.26.0
ToEnvKey capitalizes and removes special chars from a string to is used as an environment variable key.
func UnpauseProcessGroup ¶ added in v0.26.0
UnpauseProcessGroup send the SIGCONT to the given ProcessGroup identified by its ID.
Types ¶
type EthtoolValue ¶
linux/ethtool.h 'struct ethtool_value'.