env

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppEnv

type AppEnv interface {
	ServiceEnv

	// Remove removes the application
	Remove() error

	// RemoveOrDie removes the application and panics if the remove fails
	RemoveOrDie()
}

AppEnv provides the environment for an app

func App

func App(name string) AppEnv

App returns the environment for an application

type AppSetup

type AppSetup interface {
	// SetName sets the application name
	SetName(name string) AppSetup

	// SetReplicas sets the number of application replicas
	SetReplicas(replicas int) AppSetup

	// SetImage sets the image to deploy
	SetImage(image string) AppSetup

	// SetPullPolicy sets the image pull policy
	SetPullPolicy(pullPolicy corev1.PullPolicy) AppSetup

	// AddPort adds a port to expose
	AddPort(name string, port int) AppSetup

	// SetPorts sets the ports to expose
	SetPorts(ports map[string]int) AppSetup

	// SetDebug sets whether to enable debug mode
	SetDebug(debug bool) AppSetup

	// SetUser sets the user with which to run the application
	SetUser(user int) AppSetup

	// SetPrivileged sets the application to run in privileged mode
	SetPrivileged(privileged bool) AppSetup

	// SetSecrets sets the app secrets
	SetSecrets(secrets map[string]string) AppSetup

	// AddSecret adds a secret to the app
	AddSecret(path string, secret string) AppSetup

	// SetEnv sets the environment variables
	SetEnv(env map[string]string) AppSetup

	// AddEnv adds an environment variable
	AddEnv(name, value string) AppSetup

	// SetArgs sets the application arguments
	SetArgs(args ...string) AppSetup

	// Add adds the application to the cluster
	Add() (AppEnv, error)

	// AddOrDie adds the application and panics if the deployment fails
	AddOrDie() AppEnv
}

AppSetup is an interface for setting up an application

func NewApp

func NewApp() AppSetup

NewApp returns the setup configuration for a new application

type AppsEnv

type AppsEnv interface {
	// List returns a list of all apps in the environment
	List() []AppEnv

	// Get returns the environment for an app by name
	Get(name string) AppEnv

	// New adds an app to the environment
	New() AppSetup
}

AppsEnv provides the environment for applications

func Apps

func Apps() AppsEnv

Apps returns the environment for applications

type AtomixEnv

type AtomixEnv interface {
	ServiceEnv
}

AtomixEnv provides the Atomix environment

func Atomix

func Atomix() AtomixEnv

Atomix returns the Atomix environment

type CLIEnv

type CLIEnv interface {
	DeploymentEnv
}

CLIEnv provides the CLI environment

func CLI

func CLI() CLIEnv

CLI returns the CLI environment

type ClusterEnv

type ClusterEnv interface {
	// Atomix returns the Atomix environment
	Atomix() AtomixEnv

	// Storage returns the storage environment
	Storage() StorageEnv

	// CLI returns the CLI environment
	CLI() CLIEnv

	// Topo returns the topo environment
	Topo() TopoEnv

	// RIC returns the RIC environment
	RIC() RICEnv

	// Config returns the config environment
	Config() ConfigEnv

	// Simulators returns the simulators environment
	Simulators() SimulatorsEnv

	// Simulator returns the environment for a simulator by name
	Simulator(name string) SimulatorEnv

	// NewSimulator returns a new SimulatorSetup for adding a simulator to the cluster
	NewSimulator() SimulatorSetup

	// AddSimulators returns a new SimulatorsSetup for adding multiple simulators concurrently
	AddSimulators(simulators ...SimulatorSetup) SimulatorsSetup

	// Networks returns the networks environment
	Networks() NetworksEnv

	// Network returns the environment for a network by name
	Network(name string) NetworkEnv

	// History returns the environment for the history
	History() HistoryEnv

	// NewNetwork returns a new NetworkSetup for adding a network to the cluster
	NewNetwork() NetworkSetup

	// Apps returns the applications environment
	Apps() AppsEnv

	// App returns the environment for an app by name
	App(name string) AppEnv

	// NewApp returns a new AppSetup for adding an application to the cluster
	NewApp() AppSetup
}

ClusterEnv is an interface for tests to operate on the ONOS environment

func New

func New(kube kube.API) ClusterEnv

New returns a new onit ClusterEnv

type ConfigEnv

type ConfigEnv interface {
	ServiceEnv

	// Destination returns the gNMI client destination
	Destination() client.Destination

	// NewAdminServiceClient returns the config AdminService client
	NewAdminServiceClient() (admin.ConfigAdminServiceClient, error)

	// NewChangeServiceClient returns the config AdminService client
	NewChangeServiceClient() (diags.ChangeServiceClient, error)

	// NewGNMIClient returns the gNMI client
	NewGNMIClient() (*gnmi.Client, error)
}

ConfigEnv provides the config environment

func Config

func Config() ConfigEnv

Config returns the onos-config environment

type DatabaseEnv

type DatabaseEnv interface {
	// List returns a list of partitions in the database
	List() []PartitionEnv

	// Get returns the environment for a partition service by name
	Get(name string) PartitionEnv

	// Connect connects to the partition group
	Connect() (*client.Database, error)
}

DatabaseEnv is an Atomix database

type DeploymentEnv

type DeploymentEnv interface {
	// Name is the name of the deployment
	Name() string

	// Nodes returns the deployment nodes
	Nodes() []NodeEnv

	// Node returns a specific node environment
	Node(name string) NodeEnv

	// AwaitReady waits for all nodes in the deployment to become ready
	AwaitReady() error

	// Execute executes the given command and returns the output
	Execute(command ...string) ([]string, int, error)
}

DeploymentEnv is a base interface for deployment environments

type DevicePredicate

type DevicePredicate func(*device.Device) bool

DevicePredicate is a function for evaluating the state of a device

type HistoryEnv

type HistoryEnv interface {

	// GetTestsMap returns a map of tests
	GetTestsMap() map[string]cluster.JobInfo

	// GetBenchmarksMap returns a map of benchmarks
	GetBenchmarksMap() map[string]cluster.JobInfo

	// ListTests returns a history of tests
	ListTests() []cluster.JobInfo

	// ListBenchmarks returns a history of benchmarks
	ListBenchmarks() []cluster.JobInfo
}

HistoryEnv provides the history environment

func History

func History() HistoryEnv

History returns the environment for the history

type NetworkEnv

type NetworkEnv interface {
	NodeEnv

	// Devices returns a list of devices in the network
	Devices() []NodeEnv

	// Remove removes the network
	Remove() error

	// RemoveOrDie removes the network and panics if the remove fails
	RemoveOrDie()
}

NetworkEnv provides the environment for a network node

func Network

func Network(name string) NetworkEnv

Network returns the environment for a network

type NetworkSetup

type NetworkSetup interface {
	// SetName sets the network name
	SetName(name string) NetworkSetup

	// SetSingle creates a single node topology
	SetSingle() NetworkSetup

	// SetLinear creates a linear topology with the given number of devices
	SetLinear(devices int) NetworkSetup

	// SetCustom creates a custom topology
	SetCustom(topo string, devices int) NetworkSetup

	// SetImage sets the image to deploy
	SetImage(image string) NetworkSetup

	// SetPullPolicy sets the image pull policy
	SetPullPolicy(pullPolicy corev1.PullPolicy) NetworkSetup

	// SetDeviceType sets the device type
	SetDeviceType(deviceType string) NetworkSetup

	// SetDeviceVersion sets the device version
	SetDeviceVersion(version string) NetworkSetup

	// SetDeviceTimeout sets the device timeout
	SetDeviceTimeout(timeout time.Duration) NetworkSetup

	// Add adds the network to the cluster
	Add() (NetworkEnv, error)

	// AddOrDie adds the network and panics if the deployment fails
	AddOrDie() NetworkEnv
}

NetworkSetup is an interface for deploying up a network

func NewNetwork

func NewNetwork() NetworkSetup

NewNetwork returns the setup configuration for a new network

type NetworksEnv

type NetworksEnv interface {
	// List returns a list of networks in the environment
	List() []NetworkEnv

	// Get returns the environment for a network service by name
	Get(name string) NetworkEnv

	// New adds a new network to the environment
	New() NetworkSetup
}

NetworksEnv provides the networks environment

func Networks

func Networks() NetworksEnv

Networks returns the networks environment

type NodeEnv

type NodeEnv interface {
	// Name returns the name of the node
	Name() string

	// Address returns the node address
	Address() string

	// Execute executes the given command and returns the output
	Execute(command ...string) ([]string, int, error)

	// Credentials returns the node credentials
	Credentials() *tls.Config

	// Connect connects to the node
	Connect() (*grpc.ClientConn, error)

	// Kill kills the node
	Kill() error

	// KillOrDie kills the node or panics if an error occurs
	KillOrDie()
}

NodeEnv provides the environment for a single node

type PartitionEnv

type PartitionEnv interface {
	DeploymentEnv
}

PartitionEnv provides the environment for a partition

type RICEnv

type RICEnv interface {
	ServiceEnv

	// NewRICC1ServiceClient returns a RIC C1 service client
	NewRICC1ServiceClient() (nb.C1InterfaceServiceClient, error)
}

RICEnv provides the RIC environment

func RIC

func RIC() RICEnv

RIC returns the onos-ric environment

type ServiceEnv

type ServiceEnv interface {
	DeploymentEnv

	// Address returns the service address
	Address() string

	// Credentials returns the service credentials
	Credentials() *tls.Config

	// Connect connects to the service
	Connect() (*grpc.ClientConn, error)
}

ServiceEnv is a base interface for service environments

type SimulatorEnv

type SimulatorEnv interface {
	NodeEnv

	// Destination returns the gNMI client destination
	Destination() client.Destination

	// NewGNMIClient returns the gNMI client
	NewGNMIClient() (*gnmi.Client, error)

	// Await waits for the simulator device state to match the given predicate
	Await(predicate DevicePredicate, timeout time.Duration) error

	// Remove removes the simulator
	Remove() error

	// RemoveOrDie removes the simulator and panics if the remove fails
	RemoveOrDie()
}

SimulatorEnv provides the environment for a single simulator

func Simulator

func Simulator(name string) SimulatorEnv

Simulator returns the environment for a device simulator

type SimulatorSetup

type SimulatorSetup interface {
	// SetName sets the simulator name
	SetName(name string) SimulatorSetup

	// SetImage sets the image to deploy
	SetImage(image string) SimulatorSetup

	// SetPullPolicy sets the image pull policy
	SetPullPolicy(pullPolicy corev1.PullPolicy) SimulatorSetup

	// SetDeviceType sets the device type
	SetDeviceType(deviceType string) SimulatorSetup

	// SetDeviceVersion sets the device version
	SetDeviceVersion(version string) SimulatorSetup

	// SetDeviceTimeout sets the device timeout
	SetDeviceTimeout(timeout time.Duration) SimulatorSetup

	// SetAddDevice sets whether to add the device to the topo service
	SetAddDevice(add bool) SimulatorSetup

	// Add deploys the simulator in the cluster
	Add() (SimulatorEnv, error)

	// AddOrDie deploys the simulator and panics if the deployment fails
	AddOrDie() SimulatorEnv

	// SetPort sets the simulator port
	SetPort(port int) SimulatorSetup
}

SimulatorSetup is an interface for setting up a simulator

func NewSimulator

func NewSimulator() SimulatorSetup

NewSimulator returns the setup configuration for a new device simulator

type SimulatorsEnv

type SimulatorsEnv interface {
	// List returns a list of simulators in the environment
	List() []SimulatorEnv

	// Get returns the environment for a simulator service by name
	Get(name string) SimulatorEnv

	// New adds a new simulator to the environment
	New() SimulatorSetup
}

SimulatorsEnv provides the simulators environment

func Simulators

func Simulators() SimulatorsEnv

Simulators returns the device simulators environment

type SimulatorsSetup

type SimulatorsSetup interface {
	// With adds a simulator setup
	With(setups ...SimulatorSetup) SimulatorsSetup

	// AddAll deploys the simulators in the cluster
	AddAll() ([]SimulatorEnv, error)

	// AddAllOrDie deploys the simulators and panics if the deployment fails
	AddAllOrDie() []SimulatorEnv
}

SimulatorsSetup provides a setup configuration for multiple simulators

func AddSimulators

func AddSimulators(simulators ...SimulatorSetup) SimulatorsSetup

AddSimulators returns a new SimulatorsSetup for adding multiple simulators concurrently

type StorageEnv

type StorageEnv interface {
	// Database returns all database partitions
	Database(name string) DatabaseEnv
}

StorageEnv provides the storage environment

func Storage

func Storage() StorageEnv

Storage returns the database environment

type TopoEnv

type TopoEnv interface {
	ServiceEnv

	// NewAdminServiceClient returns the topo AdminService client
	NewAdminServiceClient() (admin.TopoAdminServiceClient, error)

	// NewDeviceServiceClient returns a topo device service client
	NewDeviceServiceClient() (device.DeviceServiceClient, error)
}

TopoEnv provides the topo environment

func Topo

func Topo() TopoEnv

Topo returns the onos-topo environment

Jump to

Keyboard shortcuts

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