Documentation
¶
Overview ¶
Package platform contains interface and implementation to run onet code amongst multiple platforms. Such implementations include Localhost (run your test locally) and Deterlab (similar to emulab).
Index ¶
- Variables
- func Build(path, out, goarch, goos string, buildArgs ...string) (string, error)
- func CheckOutOfFileDescriptors() error
- func KillGo()
- func Rsync(username, host, file, dest string) error
- func SSHRun(username, host, command string) ([]byte, error)
- func SSHRunStdout(username, host, command string) error
- func Scp(username, host, file, dest string) error
- func Simulate(suite, serverAddress, simul, monitorAddress string) error
- type Config
- type Deterlab
- type Localhost
- type MiniNet
- type Platform
- type RunConfig
- func (r *RunConfig) Clone() *RunConfig
- func (r *RunConfig) Delete(field string)
- func (r *RunConfig) Get(field string) string
- func (r *RunConfig) GetBuckets() ([][]string, error)
- func (r *RunConfig) GetDuration(field string) (time.Duration, error)
- func (r *RunConfig) GetInt(field string) (int, error)
- func (r *RunConfig) Map() map[string]string
- func (r *RunConfig) Put(field, value string)
- func (r *RunConfig) String() string
- func (r *RunConfig) Toml() []byte
Constants ¶
This section is empty.
Variables ¶
var ErrorFieldNotPresent = xerrors.New("field not present")
ErrorFieldNotPresent signals that a field is not in the RunConfig.
Functions ¶
func Build ¶
Build builds the the golang packages in `path` and stores the result in `out`. Besides specifying the environment variables GOOS and GOARCH you can pass any additional argument using the buildArgs argument. The command which will be executed is of the following form: $ go build -v buildArgs... -o out path
func CheckOutOfFileDescriptors ¶
func CheckOutOfFileDescriptors() error
CheckOutOfFileDescriptors tries to duplicate the stdout file descriptor and throws an error if it cannot do it. This is a horrible hack mainly for MacOSX where the file descriptor limit is quite low and we need to tell people running simulations what they can do about it.
func Rsync ¶
Rsync copies files or directories to the remote host. If the DebugVisible is > 1, the rsync-operation is displayed on screen.
func SSHRunStdout ¶
SSHRunStdout runs a command on the remote host but redirects stdout and stderr of the Ssh-command to the os.Stderr and os.Stdout
Types ¶
type Config ¶
type Config struct { // string denoting the group used for simulations // XXX find ways to remove that "one suite" assumption Suite string MonitorPort int Debug int }
Config is passed to Platform.Config and prepares the platform for specific system-wide configurations
type Deterlab ¶
type Deterlab struct { // *** Deterlab-related configuration // The login on the platform Login string // The outside host on the platform Host string // The name of the project Project string // Name of the Experiment - also name of hosts Experiment string // DNS-resolvable names Phys []string // VLAN-IP names (physical machines) Virt []string // ProxyAddress : the proxy will redirect every traffic it // receives to this address ProxyAddress string // MonitorAddress is the address given to clients to connect to the monitor // It is actually the Proxy that will listen to that address and clients // won't know a thing about it MonitorAddress string // Port number of the monitor and the proxy MonitorPort int // Number of available servers Servers int // Name of the simulation Simulation string // Number of machines Hosts int // Debugging-level: 0 is none - 5 is everything Debug int // RunWait for long simulations RunWait string // suite used for the simulation Suite string // PreScript defines a script that is run before the simulation PreScript string // Tags to use when compiling Tags string // contains filtered or unexported fields }
Deterlab holds all fields necessary for a Deterlab-run
func (*Deterlab) Build ¶
Build prepares all binaries for the Deterlab-simulation. If 'build' is empty, all binaries are created, else only the ones indicated. Either "simul" or "users"
func (*Deterlab) Cleanup ¶
Cleanup kills all eventually remaining processes from the last Deploy-run
func (*Deterlab) Configure ¶
Configure initialises the directories and loads the saved config for Deterlab
func (*Deterlab) Deploy ¶
Deploy creates the appropriate configuration-files and copies everything to the deterlab-installation.
type Localhost ¶
type Localhost struct { // Need mutex because build.go has a global variable that // is used for multiple experiments sync.Mutex // The simulation to run Simulation string // Suite used for the simulation Suite string // PreScript is run before the simulation is started PreScript string // RunWait for long simulations RunWait string // contains filtered or unexported fields }
Localhost is the platform for launching thee apps locally
type MiniNet ¶
type MiniNet struct { // *** Mininet-related configuration // The login on the platform Login string // The outside host on the platform External string // IPs of all hosts HostIPs []string // ProxyAddress : the proxy will redirect every traffic it // receives to this address ProxyAddress string // Port number of the monitor and the proxy MonitorPort int // Simulation to be run Simulation string // Number of servers to be used Servers int // Number of machines Hosts int // Debugging-level: 0 is none - 5 is everything Debug int // Whether to show time in debugging messages DebugTime bool // Whether to show color debugging-messages DebugColor bool // Whether to pad debugging-messages DebugPadding bool // The number of seconds to wait for closing the connection RunWait string // Delay in ms of the network connection Delay int // Bandwidth in Mbps of the network connection Bandwidth int // Suite used for the simulation Suite string // PreScript defines a script that is run before the simulation PreScript string // Tags to use when compiling Tags string // contains filtered or unexported fields }
MiniNet represents all the configuration that is necessary to run a simulation on remote hosts running Mininet.
func (*MiniNet) Build ¶
Build implements the Platform interface and is called once per runlevel-file. build is the name of the app to build empty = all otherwise build specific package
func (*MiniNet) Configure ¶
Configure implements the Platform-interface. It is called once to set up the necessary internal variables.
func (*MiniNet) Deploy ¶
Deploy creates the appropriate configuration-files and copies everything to the MiniNet-installation.
type Platform ¶
type Platform interface { // Does the initial configuration of all structures needed for the platform Configure(*Config) // Build builds all necessary binaries Build(build string, arg ...string) error // Makes sure that there is no part of the application still running Cleanup() error // Copies the binaries to the appropriate directory/machines, together with // the necessary configuration. RunConfig is a simple string that should // be copied as 'app.toml' to the directory where the app resides Deploy(*RunConfig) error // Starts the application and returns - non-blocking! Start(args ...string) error // Waits for the application to quit Wait() error }
Platform interface that has to be implemented to add another simulation- platform.
func NewPlatform ¶
NewPlatform returns the appropriate platform [deterlab,localhost]
type RunConfig ¶
RunConfig is a struct that represent the configuration to apply for one "test" Note: a "simulation" is a set of "tests"
func NewRunConfig ¶
func NewRunConfig() *RunConfig
NewRunConfig returns an initialised config to be used for reading in runconfig-files
func ReadRunFile ¶
ReadRunFile reads from a configuration-file for a run. The configuration-file has the following syntax: Name1 = value1 Name2 = value2 [empty line] n1, n2, n3, n4 v11, v12, v13, v14 v21, v22, v23, v24
The Name1...Namen are global configuration-options. n1..nn are configuration-options for one run Both the global and the run-configuration are copied to both the platform and the app-configuration.
func (*RunConfig) Clone ¶
Clone this runconfig so it has all fields-value relationship already present
func (*RunConfig) Delete ¶
Delete a field from the runconfig (delete for example Simulation which we dont care in the final csv)
func (*RunConfig) GetBuckets ¶
GetBuckets returns the list of buckets defined in the configuration file to split the statistics
func (*RunConfig) GetDuration ¶
GetDuration returns the field parsed as a duration, or error if a parse error occurs.