utils

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConfig

func AddConfig(t *testing.T, jsonCfg string, node TestbedNode)

AddConfig issues netdcli with -add-cfg flag

func AddConfigConsul

func AddConfigConsul(t *testing.T, jsonCfg string, node TestbedNode)

AddConfigConsul issues netdcli with -add-cfg flag and uses consul state-store

func ApplyDesiredConfig

func ApplyDesiredConfig(t *testing.T, jsonCfg string, node TestbedNode)

ApplyDesiredConfig issues netdcli with -cfg flag

func ApplyDesiredConfigConsul

func ApplyDesiredConfigConsul(t *testing.T, jsonCfg string, node TestbedNode)

ApplyDesiredConfigConsul issues netdcli with -cfg flag and uses consul state-store

func ApplyHostBindingsConfig

func ApplyHostBindingsConfig(t *testing.T, jsonCfg string, node TestbedNode)

ApplyHostBindingsConfig issues netdcli with -host-bindings-cfg flag

func ConfigCleanupCommon

func ConfigCleanupCommon(t *testing.T, nodes []TestbedNode)

ConfigCleanupCommon performs common cleanup after each test

func ConfigSetupCommon

func ConfigSetupCommon(t *testing.T, jsonCfg string, nodes []TestbedNode)

ConfigSetupCommon performs common configuration setup on specified testbed nodes

func ConfigSetupCommonWithConsul

func ConfigSetupCommonWithConsul(t *testing.T, jsonCfg string, nodes []TestbedNode)

ConfigSetupCommonWithConsul performs common configuration setup on specified testbed nodes

func DelConfig

func DelConfig(t *testing.T, jsonCfg string, node TestbedNode)

DelConfig issues netdcli with -del-cfg flag

func DelConfigConsul

func DelConfigConsul(t *testing.T, jsonCfg string, node TestbedNode)

DelConfigConsul issues netdcli with -del-cfg flag and uses consul state-store

func DockerCleanup

func DockerCleanup(t *testing.T, node TestbedNode, contName string)

DockerCleanup kills and removes a container on a specified testbed node

func DockerCleanupWithEnv

func DockerCleanupWithEnv(t *testing.T, node TestbedNode, contName string, env []string)

DockerCleanupWithEnv kills and removes a container on a specified testbed node and with specified env-variables

func DumpNetpluginLogs

func DumpNetpluginLogs(node TestbedNode)

DumpNetpluginLogs prints netplugin logs from the specified testbed node

func FixUpContainerUUIDs

func FixUpContainerUUIDs(t *testing.T, nodes []TestbedNode, jsonCfg string) (string, error)

FixUpContainerUUIDs fills up UUID information in passed jsonCfg and returns host-binding configuration

func FixUpInfraContainerUUIDs

func FixUpInfraContainerUUIDs(t *testing.T, nodes []TestbedNode, jsonCfg, infraContCfg string) (string, error)

FixUpInfraContainerUUIDs fills up UUID information in passed jsonCfg and returns host-binding configuration

func GetCfgFile

func GetCfgFile(fileName string) string

GetCfgFile returns the path string for specified file name in examples directory

func GetIPAddress

func GetIPAddress(t *testing.T, node TestbedNode, ep, stateStore string) string

GetIPAddress returns IP-address information for specified endpoint

func GetNetpluginConfigWithConsul

func GetNetpluginConfigWithConsul() string

GetNetpluginConfigWithConsul returns netplugin config that uses consul state store

func NetworkStateExists

func NetworkStateExists(node TestbedNode, network, stateStore string) error

NetworkStateExists tests if state for specified network exists

func OkToCleanup

func OkToCleanup(testFailed bool) bool

OkToCleanup tests if a testbed cleanup should be performed.

func OvsDumpInfo

func OvsDumpInfo(node TestbedNode)

OvsDumpInfo dumps the ovs state on the specified testbed node

func StartClient

func StartClient(t *testing.T, node TestbedNode, contName, ipAddress string)

StartClient starts a client container. It expects ping to server container to succeed

func StartClientFailure

func StartClientFailure(t *testing.T, node TestbedNode, contName, ipAddress string)

StartClientFailure starts a client container. It expects ping to server container to fail

func StartClientFailureWithEnvAndArgs

func StartClientFailureWithEnvAndArgs(t *testing.T, node TestbedNode, contName, ipAddress string,
	env, dockerArgs []string)

StartClientFailureWithEnvAndArgs starts a client container with specified env-variables. It expects ping to server container to failure

func StartClientWithEnvAndArgs

func StartClientWithEnvAndArgs(t *testing.T, node TestbedNode, contName, ipAddress string,
	env, dockerArgs []string)

StartClientWithEnvAndArgs starts a client container with specified env-variables. It expects ping to server container to succeed

func StartNetPlugin

func StartNetPlugin(t *testing.T, nodes []TestbedNode, nativeInteg bool)

StartNetPlugin starts netplugin on specified testbed nodes

func StartNetPluginWithConfig

func StartNetPluginWithConfig(t *testing.T, nodes []TestbedNode, nativeInteg bool,
	configStr string)

StartNetPluginWithConfig starts netplugin on specified testbed nodes with specified config

func StartNetmaster

func StartNetmaster(t *testing.T, node TestbedNode)

StartNetmaster starts netplugin on specified testbed node

func StartNetmasterWithFlags

func StartNetmasterWithFlags(t *testing.T, node TestbedNode, flags map[string]string)

StartNetmasterWithFlags starts netplugin on specified testbed nodes with specified flags

func StartServer

func StartServer(t *testing.T, node TestbedNode, contName string)

StartServer starts a server container

func StartServerWithEnvAndArgs

func StartServerWithEnvAndArgs(t *testing.T, node TestbedNode, contName string,
	env, dockerArgs []string)

StartServerWithEnvAndArgs starts a server container with specified env-variables

func StopNetPlugin

func StopNetPlugin(t *testing.T, nodes []TestbedNode)

StopNetPlugin stops the netplugin on specified testbed nodes

func StopNetmaster

func StopNetmaster(t *testing.T, node TestbedNode)

StopNetmaster stops the netmaster on specified testbed node

func StopOnError

func StopOnError(testFailed bool)

StopOnError stops the test and panics if CONTIV_SOE env-variable is set and test has failed

Types

type Dind

type Dind struct {
	// contains filtered or unexported fields
}

Dind implements docker-in-docker(dind) based testbed

func (*Dind) GetNodes

func (v *Dind) GetNodes() []TestbedNode

GetNodes returns the nodes in a dind setup

func (*Dind) Setup

func (v *Dind) Setup(env string, numNodes int) error

Setup brings up a dind testbed

func (*Dind) Teardown

func (v *Dind) Teardown()

Teardown cleans up a dind testbed

type DindNode

type DindNode struct {
	Name    string
	NodeNum int
}

DindNode implements a node in docker-in-docker (dind) testbed

func (DindNode) GetName

func (n DindNode) GetName() string

GetName returns dind node's name

func (DindNode) RunCommand

func (n DindNode) RunCommand(cmd string) error

RunCommand runs a shell command in a dind node and returns it's exit status

func (DindNode) RunCommandBackground

func (n DindNode) RunCommandBackground(cmd string) (string, error)

RunCommandBackground runs a background command in a dind node

func (DindNode) RunCommandWithOutput

func (n DindNode) RunCommandWithOutput(cmd string) (string, error)

RunCommandWithOutput runs a shell command in a dind node and returns it's exit status and output

type TempFileCtx

type TempFileCtx struct {
	// contains filtered or unexported fields
}

TempFileCtx allows managing temporary file contexts

func (*TempFileCtx) AddFile

func (ctx *TempFileCtx) AddFile(fileContents string) (*os.File, error)

AddFile adds a file to the context with specified file-contents

func (*TempFileCtx) Create

func (ctx *TempFileCtx) Create(fileContents string) (*os.File, error)

Create creates a context with specified file-contents

func (*TempFileCtx) Destroy

func (ctx *TempFileCtx) Destroy()

Destroy cleans up the context

type TestCommand

type TestCommand struct {
	ContivNodes int
	ContivEnv   string
}

TestCommand is a command that is run on a test node

func (*TestCommand) Run

func (c *TestCommand) Run(cmd string, args ...string) error

Run runs a command and return it's exit status

func (*TestCommand) RunWithOutput

func (c *TestCommand) RunWithOutput(cmd string, args ...string) ([]byte, error)

RunWithOutput runs a command and return it's exit status and output

type Testbed

type Testbed interface {
	Setup(env string, numNodes int) error
	Teardown()
	GetNodes() []TestbedNode
}

Testbed is a collection of test nodes

type TestbedNode

type TestbedNode interface {
	RunCommand(cmd string) (err error)
	RunCommandWithOutput(cmd string) (output string, err error)
	RunCommandBackground(cmd string) (output string, err error)
	GetName() string
}

TestbedNode is a node under test

type Vagrant

type Vagrant struct {
	// contains filtered or unexported fields
}

Vagrant implements a vagrant based testbed

func (*Vagrant) GetNodes

func (v *Vagrant) GetNodes() []TestbedNode

GetNodes returns the nodes in a vagrant setup

func (*Vagrant) Setup

func (v *Vagrant) Setup(env string, numNodes int) error

Setup brings up a vagrant testbed

func (*Vagrant) Teardown

func (v *Vagrant) Teardown()

Teardown cleans up a vagrant testbed

type VagrantCommand

type VagrantCommand struct {
	ContivNodes int
	ContivEnv   string
}

VagrantCommand is a command that is run on a vagrant node

func (*VagrantCommand) Run

func (c *VagrantCommand) Run(cmd string, args ...string) error

Run runs a command and return it's exit status

func (*VagrantCommand) RunWithOutput

func (c *VagrantCommand) RunWithOutput(cmd string, args ...string) ([]byte, error)

RunWithOutput runs a command and return it's exit status and output

type VagrantNode

type VagrantNode struct {
	Name string
	// contains filtered or unexported fields
}

VagrantNode implements a node in vagrant testbed

func NewVagrantNode

func NewVagrantNode(name, port, privKeyFile string) (*VagrantNode, error)

NewVagrantNode intializes a node in vagrant testbed

func (*VagrantNode) Cleanup

func (n *VagrantNode) Cleanup()

Cleanup clears the ssh client resources

func (*VagrantNode) GetName

func (n *VagrantNode) GetName() string

GetName returns vagrant node's name

func (*VagrantNode) RunCommand

func (n *VagrantNode) RunCommand(cmd string) error

RunCommand runs a shell command in a vagrant node and returns it's exit status

func (*VagrantNode) RunCommandBackground

func (n *VagrantNode) RunCommandBackground(cmd string) (string, error)

RunCommandBackground runs a background command in a vagrant node

func (*VagrantNode) RunCommandWithOutput

func (n *VagrantNode) RunCommandWithOutput(cmd string) (string, error)

RunCommandWithOutput runs a shell command in a vagrant node and returns it's exit status and output

Jump to

Keyboard shortcuts

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