netconf

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Allows the ability for the simulation of network conditions accross nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(client *ssh.Client, netconf Netconf, serverId int) error

Apply applies the given network config.

func ApplyAll

func ApplyAll(netconfs []Netconf, nodes []db.Node) error

ApplyAll applies all of the given netconfs

func ApplyToAll

func ApplyToAll(netconf Netconf, nodes []db.Node) error

ApplyToAll applies the given netconf to `nodes` nodes in the network on the given server

func CalculatePartitions

func CalculatePartitions(nodes []db.Node) ([][]int, error)

func CreateCommands

func CreateCommands(netconf Netconf, serverId int) []string

CreateCommands generates the commands needed to obtain the desired network conditions

func CreateLinks(pnts []util.Point, c *Calculator) [][]Link

func CreatePartitionOutage

func CreatePartitionOutage(side1 []db.Node, side2 []db.Node)

func MakeOutage

func MakeOutage(node1 db.Node, node2 db.Node) error

func MakeOutageCommands

func MakeOutageCommands(node1 db.Node, node2 db.Node) []string

func RemoveAll

func RemoveAll(nodes []db.Node) error

RemoveAll removes network conditions from the given number of nodes

func RemoveAllOnServer

func RemoveAllOnServer(client *ssh.Client, nodes int)

RemoveAll removes network conditions from the given number of nodes

func RemoveAllOutages

func RemoveAllOutages(client *ssh.Client) error

func RemoveOutage

func RemoveOutage(node1 db.Node, node2 db.Node) error

Types

type Calculator

type Calculator struct {
	Loss        func(float64) float64
	Delay       func(float64) int
	Rate        func(float64) string
	Duplication func(float64) float64
	Corrupt     func(float64) float64
	Reorder     func(float64) float64
}

func GetDefaultCalculator

func GetDefaultCalculator() *Calculator

Create a calculator which can be used to calculate latency

type Connection

type Connection struct {
	To   int `json:"to"`
	From int `json:"from"`
}

func GetCutConnections

func GetCutConnections(client *ssh.Client) ([]Connection, error)

TODO: Naive Implementation, does not yet take multiple servers into account

type Connections

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

func NewConnections

func NewConnections(nodes int) *Connections

func (*Connections) Networks

func (this *Connections) Networks() [][]int

func (*Connections) RemoveAll

func (this *Connections) RemoveAll(conns []Connection)
type Link struct {
	EgressNode  int     `json:"egressNode"`  //redundant info
	IngressNode int     `json:"ingressNode"` //redundant info
	Loss        float64 `json:"loss"`        //Loss % ie 100% = 100
	Delay       int     `json:"delay"`
	Rate        string  `json:"rate"`
	Duplication float64 `json:"duplicate"`
	Corrupt     float64 `json:"corrupt"`
	Reorder     float64 `json:"reorder"`
}

type Netconf

type Netconf struct {
	Node        int     `json:"node"`
	Limit       int     `json:"limit"`
	Loss        float64 `json:"loss"` //Loss % ie 100% = 100
	Delay       int     `json:"delay"`
	Rate        string  `json:"rate"`
	Duplication float64 `json:"duplicate"`
	Corrupt     float64 `json:"corrupt"`
	Reorder     float64 `json:"reorder"`
}

func GetConfigOnServer

func GetConfigOnServer(client *ssh.Client) ([]Netconf, error)

5 start index

Jump to

Keyboard shortcuts

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