shell

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package shell generate shell script

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCmd

func BuildCmd(nodes []Node) string

BuildCmd

func DockerPs

func DockerPs(all bool) string

DockerPs Show docker ps

func ExecCmd

func ExecCmd(cmds []Cmd) []string

ExecCmd Execute cmds

func GenerateFile

func GenerateFile() (string, error)

GenerateFile Generate tinet template config file

func GetContainerPid

func GetContainerPid(nodename string) string

GetContainerPid func is Output get Docker PID Command

func HostLinkUp

func HostLinkUp(linkName string) string

HostLinkUp Link up link of host

func NetnsLinkUp

func NetnsLinkUp(netnsName string, linkName string) string

NetnsLinkUp Link up link of netns

func NetnsPs

func NetnsPs() string

NetnsPs Show ip netns list

func Pull

func Pull(nodes []Node) []string

Pull pull Docker Image

Types

type Cmd

type Cmd struct {
	Cmd string `yaml:"cmd"`
}

Cmd

type Interface

type Interface struct {
	Name string `yaml:"name"`
	Type string `yaml:"type"`
	Args string `yaml:"args"`
	Addr string `yaml:"addr"`
}

Interface

func (inf *Interface) N2nLink(nodeName string) []string

N2nLink Connect links between nodes

func (inf *Interface) P2cLink(nodeName string) []string

P2cLink Connect links between phys-eth and container

func (inf *Interface) S2nLink(nodeName string) []string

S2nLink Connect links between nodes and switches

func (inf *Interface) V2cLink(nodeName string) []string

V2cLink Connect links between veth and container

type Node

type Node struct {
	Name           string      `yaml:"name" mapstructure:"name"`
	Type           string      `yaml:"type" mapstructure:"type"`
	NetBase        string      `yaml:"net_base" mapstructure:"net_base"`
	VolumeBase     string      `yaml:"volume" mapstructure:"volume"`
	Image          string      `yaml:"image" mapstructure:"image"`
	Interfaces     []Interface `yaml:"interfaces" mapstructure:"interfaces"`
	Sysctls        []Sysctl    `yaml:"sysctls" mapstructure:"sysctls"`
	Mounts         []string    `yaml:"mounts,flow" mapstructure:"mounts,flow"`
	HostNameIgnore bool        `yaml:"hostname_ignore" mapstructure:"hostname_ignore"`
	EntryPoint     string      `yaml:"entrypoint" mapstructure:"entrypoint"`
	ExtraArgs      string      `yaml:"docker_run_extra_args" mapstructure:"docker_run_extra_args"`
}

Node

func (*Node) CreateNode

func (node *Node) CreateNode() []string

CreateNode Create nodes set in config

func (*Node) DelNsCmd

func (node *Node) DelNsCmd() string

DelNsCmds

func (*Node) DeleteNode

func (node *Node) DeleteNode() []string

DeleteNode Delete docker and netns

func (*Node) Mount_docker_netns

func (node *Node) Mount_docker_netns() []string

Mount_docker_netns Mount docker netns to ip netns

type NodeConfig

type NodeConfig struct {
	Name string `yaml:"name"`
	Cmds []Cmd  `yaml:"cmds" mapstructure:"cmds"`
}

NodeConfig

func (*NodeConfig) ExecConf

func (nodeConfig *NodeConfig) ExecConf(nodeType string) []string

ExecConf Execute NodeConfig command

type PostFini

type PostFini struct {
	Cmds []Cmd `yaml:"cmds" mapstructure:"cmds"`
}

PostFini

type PostInit

type PostInit struct {
	Cmds []Cmd `yaml:"cmds" mapstructure:"cmds"`
}

PostInit

type PreCmd

type PreCmd struct {
	// Cmds []Cmd `yaml:"cmds"`
	Cmds []Cmd `yaml:"cmds" mapstructure:"cmds"`
}

PreCmd

type PreInit

type PreInit struct {
	Cmds []Cmd `yaml:"cmds" mapstructure:"cmds"`
}

PreInit

type Switch

type Switch struct {
	Name       string      `yaml:"name"`
	Interfaces []Interface `yaml:"interfaces" mapstructure:"interfaces"`
}

Switch

func (*Switch) CreateSwitch

func (bridge *Switch) CreateSwitch() []string

CreateSwitch Create bridge set in config

func (*Switch) DeleteSwitch

func (br *Switch) DeleteSwitch() string

DeleteSwitch Delete bridge

type Sysctl

type Sysctl struct {
	Sysctl string `yaml:"string"`
}

Sysctl

type Test

type Test struct {
	Name string
	Cmds []Cmd `yaml:"cmds" mapstructure:"cmds"`
}

Test

func (*Test) TnTestCmdExec

func (t *Test) TnTestCmdExec() []string

TnTestCmdExec Execute test cmds

type Tn

type Tn struct {
	PreCmd      []PreCmd     `yaml:"precmd"`
	PreInit     []PreInit    `yaml:"preinit"`
	PostInit    []PostInit   `yaml:"postinit"`
	PostFini    []PostFini   `yaml:"postfini"`
	Nodes       []Node       `yaml:"nodes" mapstructure:"nodes"`
	Switches    []Switch     `yaml:"switches" mapstructure:"switches"`
	NodeConfigs []NodeConfig `yaml:"node_configs" mapstructure:"node_configs"`
	Test        []Test       `yaml:"test"`
}

Tn tinet config

func (*Tn) Exec

func (tnconfig *Tn) Exec(nodeName string, Cmds []string) string

Exec Select Node exec command

Jump to

Keyboard shortcuts

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