tb

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasAllocMode

func HasAllocMode(x *xir.Node, allocModes ...AllocMode) bool

HasAllocMode checks if the specified node has any of the specified alloc modes.

func HasRole

func HasRole(x *xir.Node, roles ...Role) bool

HasRole checks if the specified node has any of the specified roles.

func ToXir

func ToXir(t Testbed) *xir.Net

Types

type AllocMode

type AllocMode uint16

AllocMode indicates the allocation mode of a resource

const (
	// AllocUnspec indicates the resource has no specified allocation mode
	AllocUnspec AllocMode = iota

	// NoAlloc indicates the resource cannot be allocated
	NoAlloc

	// NetAlloc indicates the resource can be allocated as a network appliance
	NetAlloc

	// NetEmuAlloc indicates the resource can be allocated as a network emulator
	NetEmuAlloc

	// FilesystemAlloc indicates the resource can be allocated as mass storage
	FilesystemAlloc

	// BlockDeviceAlloc indicates the resource can be allocated as a block device
	// server
	BlockDeviceAlloc

	// PhysicalAlloc indicates the resource can be allocated as a physical device
	PhysicalAlloc

	// VirtualAlloc indicates the resource can be virtually allocated
	VirtualAlloc
)

type BasicInterfaceConfig

type BasicInterfaceConfig struct {
	Ip InterfaceIPConfig
}

type InterfaceIPConfig

type InterfaceIPConfig struct {
	Addrs []string
	Mtu   int
}

type MzLinkInfo

type MzLinkInfo struct {
	LinkId int
}

type Resource

type Resource struct {
	Alloc     []AllocMode
	Roles     []Role
	Props     xir.Props
	LinkRoles map[string]Role //system.link.name -> role
	System    *sys.System
}

A Resource captures testbed operation relevant information about a resource. It contains a System object that captures OS level details about the unerlying device.

func DecodeResource

func DecodeResource(props xir.Props) *Resource

DecodeResource attempts to extract and decode a resource spec from a property set. Returns null if a decoding cannot be done.

func GetResourceSpec

func GetResourceSpec(x *xir.Node) *Resource

GetResourceSpec attempts to get a testbed resource specification associated with the provided node. If none can be found, nil is returned.

func (*Resource) GetLinksByRole

func (r *Resource) GetLinksByRole(role Role) []*sys.Link

GetLinksByRole returns all OS level links that have the specified testbed role.

func (*Resource) HasAllocMode

func (r *Resource) HasAllocMode(modes ...AllocMode) bool

HasAllocMode checks if the resource has any of the specified alloc modes.

func (*Resource) HasRole

func (r *Resource) HasRole(roles ...Role) bool

HasRole checks if the resource has any of the specified roles.

func (*Resource) Nic

func (r *Resource) Nic(i int) hw.Nic

Nic a NIC contained within the resource at the spcified index

func (*Resource) Node

func (r *Resource) Node() *xir.Node

Node generates an XIR node from a resource.

type Role

type Role uint16

Role indicates the usage model of a resource in a testbed. A resource may have multiple roles. Roles have an unsigned 16 bit integer identifier. Roles 0-1024 are reserved. The values in the reserved range are defined here.

const (
	// RoleUnspec indicates no role is specified
	RoleUnspec Role = iota

	// Node indicates the resource is a testbed node
	Node

	// InfraServer indicates the resource is an infrastructure server
	InfraServer

	// ConsoleServer indicates the resource is a console server
	ConsoleServer

	// PowerController indidcates the resource is a power controller
	PowerController

	// NetworkEmulator indicates the resource is a network emulator
	NetworkEmulator

	// XpSwitch indicates the resource is an experiment plane switch
	XpSwitch

	// InfraSwitch indicates the resource is an infrastructure plane switch
	InfraSwitch

	// MgmtSwitch indicates the resource is a management plane switch
	MgmtSwitch

	// Gateway indicates the resource is a testbed gateway
	Gateway

	// Leaf indicates the resource is a leaf switch
	Leaf

	// Fabric indicates the resource is a fabric switch
	Fabric

	// Spine indicates the resource is a spine switch
	Spine

	// InfraLink indicates the resource is an infrastructure link
	InfraLink

	// XpLink indicates the resource is an experiment link
	XpLink

	// Tor indicates the resource is a top of rack switch
	Tor

	// EmuLink indicates that the link carries emulation traffic
	EmuLink

	// StorageServer indicates that the server can be used for providing storage
	StorageServer
)

type Testbed

type Testbed interface {
	Components() ([]*Resource, []*hw.Cable)
}

Jump to

Keyboard shortcuts

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