Documentation ¶
Index ¶
Constants ¶
const ( // magic values that we monitor on the Testground runner side to detect when Testground // testplan instances are initialised and at the stage of actually running a test // check cluster_k8s.go for more information InitialisationSuccessful = "network initialisation successful" InitialisationFailed = "network initialisation failed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient returns a new network client. Use this client to request network changes, such as setting latencies, jitter, packet loss, connectedness, etc.
func (*Client) ConfigureNetwork ¶
ConfigureNetwork asks the sidecar to configure the network, and returns either when the sidecar signals back to us, or when the context expires.
func (*Client) MustConfigureNetwork ¶
MustConfigureNetwork calls ConfigureNetwork, and panics if it errors. It is suitable to use with runner.Invoke/InvokeMap, as long as this method is called from the main goroutine of the test plan.
func (*Client) MustWaitNetworkInitialized ¶
MustWaitNetworkInitialized calls WaitNetworkInitialized, and panics if it errors. It is suitable to use with runner.Invoke/InvokeMap, as long as this method is called from the main goroutine of the test plan.
type Config ¶
type Config struct { // Network is the name of the network to configure Network string // IPv4 and IPv6 set the IP addresses of this network device. If // unspecified, the sidecar will leave them alone. // // Your test-case will be assigned a B block in the range // 16.0.0.1-32.0.0.0. X.Y.0.1 will always be reserved for the gateway // and shouldn't be used by the test. // // TODO: IPv6 is currently not supported. IPv4, IPv6 *net.IPNet // Enable enables this network device. Enable bool // Default is the default link shaping rule. Default LinkShape // Rules defines how traffic should be shaped to different subnets. // // TODO: This is not implemented. Rules []LinkRule // CallbackState will be signalled when the link changes are applied. // // Nodes can use the same state to wait for _all_ or a subset of nodes to // enter the desired network state. See CallbackTarget. CallbackState sync.State `json:"State"` // CallbackTarget is the amount of instances that will have needed to signal // on the Callback state to consider the configuration operation a success. // // A zero value falls back to runenv.TestInstanceCount (i.e. all instances // participating in the test run). CallbackTarget int `json:"-"` }
NetworkConfig specifies how a node's network should be configured.
type LinkShape ¶
type LinkShape struct { // Latency is the egress latency Latency time.Duration // Jitter is the egress jitter Jitter time.Duration // Bandwidth is egress bytes per second Bandwidth uint64 // Drop all inbound traffic. // TODO: Not implemented Filter FilterAction // Loss is the egress packet loss (%) Loss float32 // Corrupt is the egress packet corruption probability (%) Corrupt float32 // Corrupt is the egress packet corruption correlation (%) CorruptCorr float32 // Reorder is the probability that an egress packet will be reordered (%) // // Reordered packets will skip the latency delay and be sent // immediately. You must specify a non-zero Latency for this option to // make sense. Reorder float32 // ReorderCorr is the egress packet reordering correlation (%) ReorderCorr float32 // Duplicate is the percentage of packets that are duplicated (%) Duplicate float32 // DuplicateCorr is the correlation between egress packet duplication (%) DuplicateCorr float32 }
LinkShape defines how traffic should be shaped.