task

package
v0.8.16 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2021 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HarborNet      = "harbor.net"
	HarborSvcAddr  = "172.31.0.2" //XXX hardcode
	HarborVindex   = 2
	HarborInfraVNI = 2
	HarborInfraVID = 2
	HarborXpVNI    = 2
)

Constants used by the harbor materialization

View Source
const (

	// Container tasks
	ContainerKind   = "container"
	LaunchCtr       = "launch"
	PullCtrImage    = "pull-image"
	CreateCtr       = "create"
	CreateCtrTask   = "create-task"
	CreateCtrNs     = "create-ns"
	ConfigCtrLo     = "config-lo"
	CreateCtrRecord = "create-record"
	DeleteCtr       = "delete"
	DeleteCtrTask   = "delete-task"
	DeleteCtrImg    = "delete-img"
	DeleteCtrRecord = "delete-record"
	DeleteCtrNS     = "delete-ctr-ns"

	// Node tasks
	NodeSetupKind   = "NodeSetup"
	NodeRecycleKind = "NodeRecycle"

	// Plumbing tasks
	PlumbingKind          = "plumbing"
	CreateEnclave         = "create-enclave"
	DestroyEnclave        = "destroy-enclave"
	AdvertiseInterfaceMac = "advertise-interface-mac"
	AdvertiseMac          = "advertise-mac"
	WithdrawMac           = "withdraw-mac"
	DeleteNS              = "delete-ns"
	PlanInfranet          = "plan-infranet"
	DestroyInfranet       = "destroy-infranet"

	// Nex tasks
	NexKind          = "Nex"
	CreateNexNetwork = "CreateNetwork"
	DeleteNexNetwork = "DeleteNetwork"
	DeleteNexMembers = "DeleteMembers"
	AddNexMembers    = "AddMembers"

	// Canopy tasks
	CanopyKind              = "Canopy"
	SetCanopyLinks          = "SetLinks"
	SetCanopyServiceVtep    = "SetServiceVtep"
	RemoveCanopyServiceVtep = "RemoveServiceVtep"
	RemoveCanopyLinks       = "RemoveLinks"

	// Moa tasks
	MoaKind           = "Moa"
	InitEmulation     = "InitEmulation"
	CreateMoaLink     = "CreateMoaLink"
	RemoveMoaLink     = "RemoveMoaLink"
	FinalizeEmulation = "FinalizeEmulation"
	StartEmulation    = "StartEmulation"
	TeardownEmulation = "TeardownEmulation"
	MoaControlKind    = "MoaControl"

	// Bookkeeping tasks
	BookkeepingKind = "bookkeeping"
	DeleteMzinfo    = "DeleteMzinfo"
	SetStatus       = "UpdateStatus"
)

Task family and action names shared between Driver and Rex

View Source
const (
	// InfraCanopyHost is the name of the host that infrapods enter the network
	// on. We currently assume this is the same host rex is running on.
	InfraCanopyHost = "localhost"

	// Svcbr is the name of the service bridge that connects an infrastructure
	// host to infrapod containers
	Svcbr = "svcbr"
)
View Source
const (
	// FoundryCertMountName is the name of the foundry TLS cert container mount
	// point
	FoundryCertMountName = "foundry-cert"
	// FoundryCertMountSource is the host location of the foundry TLS cert
	FoundryCertMountSource = "/etc/foundry/manage.pem"
	// FoundryCertMountDest is the container filesystem location of the foundry
	// TLS cert
	FoundryCertMountDest = "/etc/foundry/manage.pem"
	// FoundryKeyMountName is the name of the foundry TLS key container mount
	// point
	FoundryKeyMountName = "foundry-key"
	// FoundryKeyMountSource is the host location of the foundry TLS key
	FoundryKeyMountSource = "/etc/foundry/manage-key.pem"
	// FoundryKeyMountDest is the container filesystem location of the foundry TLS
	// key
	FoundryKeyMountDest = "/etc/foundry/manage-key.pem"
	// FoundryEnv is the environment variable used to pass args to foundry
	FoundryEnv = "FOUNDRYD_ARGS"
	// FoundryArgs are the args passed to the foundry infrapod container
	FoundryArgs = "-maxsize 512"
)
View Source
const (
	MoactldMountName   = "moactld-token"
	MoactldMountSource = "/etc/moa/token"
	MoactldMountDest   = "/etc/moa/token"
)
View Source
const (
	// NexMountName is the name of the mount used for mounting nex configs.
	NexMountName = "nex-config"
	// NexMountSource is the host location for the nex container config mount.
	NexMountSource = "/etc/cogs/nex.yml"
	// NexMountDest is the container location for the nex container config mount.
	NexMountDest = "/etc/nex/nex.yml"
	// NexDomainEnv is the nex domain name environment variable key.
	NexDomainEnv = "DOMAIN"
)
View Source
const (
	// InfrapodMznIfx is the name of the materialization interface in an infrapod
	InfrapodMznIfx = "ceth0"
	// InfrapodSvcIfx is the name of the service interface in an infrapod
	InfrapodSvcIfx = "ceth1"
	// DefaultInternalGateway is the infrapod default internal gateway
	DefaultInternalGateway = "172.30.0.1"
	// DefaultInternalGatewayCIDR is the infrapod default internal gateway CIDR
	DefaultInternalGatewayCIDR = "172.30.0.1/16"
	// DefaultServiceGateway is the default service gateway for an infrapod
	DefaultServiceGateway = "172.31.0.1"

	// HarborVni is the VXLAN VNI used for the harbor
	HarborVni = 2
	// HarborVid is the VLAN VID used for the harbor
	HarborVid = 2
	// MaxSystemVindex is the maximum value that can be used for system-level
	// virtual network indices.
	MaxSystemVindex = 100

	// VindexKey is the datastore key used to access the vindex counter
	VindexKey = "vindex"
	// InfraVniKey is the datastore key used to access the infrapod VXLAN VNI
	// counter
	InfraVniKey = "ivni"
	// InfraVidKey is the datastore key used to access the infrapod VLAN VID
	// counter
	InfraVidKey = "ivid"
	// XpVniKey is the datastore key used to access the experiment VXLAN VNI
	// counter
	XpVniKey = "xvni"
	// XpVidKey is the datastore key used to access the experiment VLAN VID
	// counter
	XpVidKey = "xvid"

	// HarborControlAddr is the address used to access harbor infrapod containers
	// from the host
	HarborControlAddr = "172.31.0.2"

	// HarborMzid is the materialization name of the harbor
	HarborMzid = "harbor.mergetb.io" //TODO XXX change to harbor.mergetb.io

	// MoaInterfaceType defines the type of interface moa is to use
	MoaInterfaceType = "xdpinterface"
	// MoaXDPMode defines the express data path mode Moa should use
	MoaXDPMode = "skb"
)
View Source
const (
	// TimeFormat is the format used by the cogs in logs.
	TimeFormat = "2 Jan 06 15:04:05.00 MST"
	// IDAlphabet is the alphabet used for task UUIDs
	IDAlphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@"
)
View Source
const (
	// DefaultMountType specifies the default way in which files and directories
	// are mounted into containers.
	DefaultMountType = "bind"
)
View Source
const (
	// RetryWait is how long to wait for various gRPC operations
	RetryWait = 1 * time.Second
)

Variables

View Source
var (
	// ErrASMapEmpty is the error returned by functions when given an empty map
	// of actions
	ErrASMapEmpty error = fmt.Errorf("empty action status map")
	// ErrASMapNil is the error returned by functions when given a nil map of
	// actions
	ErrASMapNil error = fmt.Errorf("nil action status map")
)
View Source
var DefaultImages = NodeImages{
	Default: "debian:10",
}

DefaultImages is an exported variabled used by rex/sled.go to determine if the image contained within the node spec is different from the default image. This is necessary for sledc's daemon mode which downloads by default the default image on demat, and on materialization must verify if it can kexec or if it needs to copy a new image down to sledc.

View Source
var (
	// DefaultMountOptions specifies the default options for file and directory
	// mounts for infrapod containers.
	DefaultMountOptions = []string{"rbind", "ro"}
)

Functions

func AllResourceIDs

func AllResourceIDs(net *xir.Net) []string

AllResourceIDs returns all the resource IDs in a network.

func BasicLinkConstraints

func BasicLinkConstraints(model xir.Props) (latency int32, capacity int64, loss float64)

func CancelTask

func CancelTask(mzid, taskid string) error

CancelTask removes all data attached to a task

func CreateLinks(
	topo *xir.Net,
	mzInfo *MzInfo,
	fragments []*site.MzFragment,
) error

CreateLinks creates a set of virtual links for the specified materialization ID given a set of materialization fragments that are link specs.

func DeleteMzInfo

func DeleteMzInfo(mzinfo *MzInfo) error

DeleteMzInfo deletes the mzinfo data

func DeleteTasks

func DeleteTasks(mzid string) error

DeleteTasks removes everything related to the mzid (tasks, stages, actions, etc)

func DestroyLinks(
	topo *xir.Net,
	mzInfo *MzInfo,
	fragments []*site.MzFragment,
) error

DestroyLinks destroys a set of virtual links for the specofied materialization ID given a set of materialization fragments that are links specs.

func EtcdPrefix

func EtcdPrefix(objStr, optkey string) ([]interface{}, error)

EtcdPrefix is helper function for all the code calling etcd with prefix make code more DRY

func ExtractConstraint

func ExtractConstraint(props map[string]interface{}, key string) *xir.Constraint

ExtractConstraint extracts the constraint at the specified key as an XIR constraint object.

func GenerateID

func GenerateID() (string, error)

GenerateID generates an ID or Key for Stage/Action

func GetAllAS

func GetAllAS() (map[string]*ActionStatus, error)

GetAllAS all action statuses

func GetAllActions

func GetAllActions() (map[string]*Action, error)

GetAllActions all actions

func GetInfraEndpoint

func GetInfraEndpoint(n *xir.Node) *xir.Endpoint

GetInfraEndpoint tries to find an endpoint from the specified node on an infrastructure network. If one can not be found nil is returned.

func GetMzidAS

func GetMzidAS(mzid, taskid string) (map[string]*ActionStatus, error)

GetMzidAS all actions associated to an mzid

func GetMzidActions

func GetMzidActions(mzid, taskid string) (map[string]*Action, error)

GetMzidActions all actions associated to an mzid

func GetNodeSwitch

func GetNodeSwitch(nodeEndpoint *xir.Endpoint) *xir.Endpoint

GetNodeSwitch gets the switch attached to a node. If no leaf switch is attached to the node, nil is returned.

func GetTaskStagesMap

func GetTaskStagesMap(mzid, taskid string) (map[string]*Stage, error)

GetTaskStagesMap return all stages associated with a task

func InitInfranet

func InitInfranet(mzinfo *MzInfo, props map[string]interface{}) error

InitInfranet creates an enclave for an infranet and then deploys and configures the base containers within that enclave: foundry, etcd, nex

func LaunchTask

func LaunchTask(task *Task, taskObjects *[]common.Object) error

LaunchTask launches the specified task

func MaskAction

func MaskAction(mzid, taskid, actionid string, unmask bool) error

MaskAction masks any error condition on an action. This makes a failed task appear complete from the perspective of dependency resolution.

func Merge2Local

func Merge2Local(net *xir.Net, devID string) (string, error)

Merge2Local transforms a Merge node ID into a node label

func NodeRecycle

func NodeRecycle(
	topo *xir.Net, mzid, instance string, fragments []*site.MzFragment) error

NodeRecycle launches a set of tasks that collectively recycle a node.

func NodeSetup

func NodeSetup(
	topo *xir.Net, mzid, instance string, fragments []*site.MzFragment) error

NodeSetup launches a set of tasks that collectively setup a node.

func SetImageConfig added in v0.6.10

func SetImageConfig(cfg *Images)

func SvcAddress

func SvcAddress(vindex int) string

SvcAddress returns the IP address of a CIDR given the associated virtual network index.

func SvcCidr

func SvcCidr(vindex int) string

SvcCidr returns the CIDR of a service given the associated virtual network index.

func TeardownInfranet

func TeardownInfranet(mzinfo *MzInfo, props map[string]interface{}) error

TeardownInfranet tears down an infrapod. This deletes the network enclave and the containers within the enclave.

Types

type ASError

type ASError struct {
	Mzid     string `yaml:",omitempty"`
	Taskid   string `yaml:",omitempty"`
	Actionid string `yaml:",omitempty"`
	// contains filtered or unexported fields
}

ASError is a struct that fits within our storage achitecture for managing actions in the error queue

func EtcdActionErrorPrefix

func EtcdActionErrorPrefix() ([]*ASError, error)

EtcdActionErrorPrefix uses EtcdPrefix helper function and type casts back to ActionError

func ExtractASError

func ExtractASError(asErrorJSON string) (*ASError, error)

ExtractASError takes a json string an unmarshals it into a ASError object

func (*ASError) GetVersion

func (as *ASError) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*ASError) Key

func (as *ASError) Key() string

Key returns the datastore key for this object.

func (*ASError) SetVersion

func (as *ASError) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*ASError) Value

func (as *ASError) Value() interface{}

Value returns this object as an interface{}

type ASReady

type ASReady struct {
	Mzid     string `yaml:",omitempty"`
	Taskid   string `yaml:",omitempty"`
	Actionid string `yaml:",omitempty"`
	// contains filtered or unexported fields
}

ASReady is a struct that fits within our storage achitecture for managing actions in the incomplete queue

func EtcdActionReadyPrefix

func EtcdActionReadyPrefix() ([]*ASReady, error)

EtcdActionReadyPrefix uses EtcdPrefix helper function and type casts back to ActionReady

func ExtractASReady

func ExtractASReady(asReadyJSON string) (*ASReady, error)

ExtractASReady takes a json string an unmarshals it into a ASReady object

func (*ASReady) GetVersion

func (as *ASReady) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*ASReady) Key

func (as *ASReady) Key() string

Key returns the datastore key for this object.

func (*ASReady) SetVersion

func (as *ASReady) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*ASReady) Value

func (as *ASReady) Value() interface{}

Value returns this object as an interface{}

type Action

type Action struct {
	Kind       string      `yaml:",omitempty"`
	Mzid       string      `yaml:",omitempty"`
	MzOp       MzOperation `yaml:",omitempty"`
	MzInstance string      `yaml:",omitempty"`
	Action     string      `yaml:",omitempty"`
	Data       interface{} `yaml:",omitempty"`
	ID         string      `yaml:",omitempty"`
	Taskid     string      `yaml:",omitempty"`
	Stageid    string      `yaml:",omitempty"`
	// contains filtered or unexported fields
}

An Action is the basic unit of coglet execution. It defines a single task that a coglet thread executes until completion or failure. TODO: Remove from Etcd

func CreateInfranetLinkplan added in v0.7.5

func CreateInfranetLinkplan(nodes []string, mzi *MzInfo) (*Action, error)

func EtcdActionPrefix

func EtcdActionPrefix(prefix string) ([]*Action, error)

EtcdActionPrefix uses EtcdPrefix helper function and type casts back to Action

func ExtractAction

func ExtractAction(actionJSON string) (*Action, error)

ExtractAction extracts actionstatus

func GetAction

func GetAction(mzid, taskid, actionid string) (*Action, error)

GetAction returns the action from storage

func NexCreateMembers

func NexCreateMembers(mzid string, endpoints []Endpoint) *Action

NexCreateMembers adds the specified endpoints as nex DHCP/DNS members on the network identified by the provided mzid.

func NexDeleteMembers

func NexDeleteMembers(mzid string, endpoints []Endpoint) *Action

NexDeleteMembers deletes the specified endpoints from the nex DHCP/DNS network identified by the provided mzid.

func NexDeleteNetwork

func NexDeleteNetwork(name string) *Action

NexDeleteNetwork deletes the specified nex DHCP/DNS network by name.

func (*Action) GetVersion

func (a *Action) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*Action) Key

func (a *Action) Key() string

Key returns the datastore key for this object.

func (*Action) SetActionComplete

func (a *Action) SetActionComplete() error

SetActionComplete sets the current action's status to complete

func (*Action) SetVersion

func (a *Action) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*Action) Stage

func (a *Action) Stage() (*Stage, error)

Stage returns the parent stage of an action.

func (*Action) Task

func (a *Action) Task() (*Task, error)

Task returns the parent task of an action or an error if unable to return the task

func (*Action) ToStatus

func (a *Action) ToStatus() *ActionStatus

ToStatus creates the action status object which can then be used to read from database

func (*Action) Value

func (a *Action) Value() interface{}

Value returns this object as an interface{}

type ActionStatus

type ActionStatus struct {
	Mzid     string  `yaml:",omitempty"`
	Taskid   string  `yaml:",omitempty"`
	ID       string  `yaml:",omitempty"`
	Complete bool    `yaml:",omitempty"`
	Error    *string `yaml:",omitempty"`
	Masked   bool    `yaml:",omitempty"`
	// contains filtered or unexported fields
}

ActionStatus is the status of an action. Removed from the task to reduce writes to the task object

func EtcdActionStatusPrefix

func EtcdActionStatusPrefix(prefix string) ([]*ActionStatus, error)

EtcdActionStatusPrefix uses EtcdPrefix helper function and type casts back to ActionStatus

func ExtractAS

func ExtractAS(asJSON string) (*ActionStatus, error)

ExtractAS extracts actionstatus

func ExtractBadAS

func ExtractBadAS(asJSON string) (*ActionStatus, error)

ExtractBadAS extracts actionstatus

func GetActionStatus

func GetActionStatus(mzid, taskid, asID string) (*ActionStatus, error)

GetActionStatus returns the actionstatus associated to an action's actionstatus uuid

func GetAllReadyAS

func GetAllReadyAS() ([]*ActionStatus, error)

GetAllReadyAS returns the list of all action statuses that are ready

func (*ActionStatus) GetVersion

func (as *ActionStatus) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*ActionStatus) Key

func (as *ActionStatus) Key() string

Key returns the datastore key for this object.

func (*ActionStatus) SetVersion

func (as *ActionStatus) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*ActionStatus) ToError

func (as *ActionStatus) ToError() *ASError

ToError returns the ASError struct

func (*ActionStatus) ToReady

func (as *ActionStatus) ToReady() *ASReady

ToReady returns the ASReady struct

func (*ActionStatus) Value

func (as *ActionStatus) Value() interface{}

Value returns this object as an interface{}

type BelugaSpec

type BelugaSpec struct {
	Soft  bool
	Nodes []string
}

BelugaSpec encapsulates required data for beluga power control commands.

type Container

type Container struct {
	Name      string
	Namespace string
	Vindex    int
	Image     string
	// contains filtered or unexported fields
}

Container tracks container parameters in the datastore

func (*Container) GetVersion

func (x *Container) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*Container) Key

func (x *Container) Key() string

Key returns the datastore key for this object.

func (*Container) SetVersion

func (x *Container) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*Container) Value

func (x *Container) Value() interface{}

Value returns this object as an interface{}

type ContainerImageData

type ContainerImageData struct {
	Image     string
	Namespace string
}

ContainerImageData encapsulates data needed to pull or remove a container image.

type ContainerMount

type ContainerMount struct {
	Name        string
	specs.Mount `mapstructure:",squash" yaml:",inline"`

	CtrComponent `mapstructure:",squash" yaml:",inline"`
	// contains filtered or unexported fields
}

ContainerMount tracks information about container mounts.

func (*ContainerMount) GetVersion

func (x *ContainerMount) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*ContainerMount) Key

func (x *ContainerMount) Key() string

Key returns the datastore key for this object.

func (*ContainerMount) SetVersion

func (x *ContainerMount) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*ContainerMount) Value

func (x *ContainerMount) Value() interface{}

Value returns this object as an interface{}

type ContainerSpec

type ContainerSpec struct {
	Container   `mapstructure:",squash" yaml:",inline"`
	Mounts      []*ContainerMount
	Environment map[string]string
}

ContainerSpec tracks information about containers.

func (*ContainerSpec) Env

func (ctr *ContainerSpec) Env() []string

Env returns the environment of a container spec as a list of strings.

type CtrComponent

type CtrComponent struct {
	CtrName      string `yaml:",omitempty"`
	CtrNamespace string `yaml:",omitempty"`
}

CtrComponent tracks low level containerd properties

type DeleteContainerData

type DeleteContainerData struct {
	Name      string
	Namespace string
}

DeleteContainerData encapsulates information needed to delete a container.

type DeleteContainerIfxData

type DeleteContainerIfxData struct {
	Name         string
	EvpnWithdraw bool
}

DeleteContainerIfxData encapsulates data needed to delete a container interface.

type DeleteContainerNsData

type DeleteContainerNsData struct {
	Name string
}

DeleteContainerNsData encapsulates data needed to delete a container namespace.

type EdgeInfo

type EdgeInfo struct {
	Resource      string `json:",omitempty"`
	Mac           string `json:",omitempty"`
	NodeName      string `json:",omitempty"`
	NodeInterface string `json:",omitempty"`
	Multidegree   bool   `json:",omitempty"`
}

EdgeInfo contains information about the node at the edge of a link

func (*EdgeInfo) String

func (e *EdgeInfo) String() string

type EnclaveSpec

type EnclaveSpec struct {
	Mzid       string
	Vindex     int
	Interfaces []*EnclaveVeth
	SvcAddress string
	// contains filtered or unexported fields
}

An EnclaveSpec describes a network enclave in which an infrapod lives.

func (*EnclaveSpec) GetVersion

func (e *EnclaveSpec) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*EnclaveSpec) Key

func (e *EnclaveSpec) Key() string

Key returns the datastore key for this object.

func (*EnclaveSpec) SetVersion

func (e *EnclaveSpec) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*EnclaveSpec) Value

func (e *EnclaveSpec) Value() interface{}

Value returns this object as an interface{}

type EnclaveVeth

type EnclaveVeth struct {
	Inner         string
	Outer         string
	Vni           int  `yaml:",omitempty"`
	Vid           int  `yaml:",omitempty"`
	Vindex        int  `yaml:",omitempty"`
	EvpnAdvertise bool `yaml:",omitempty"`
	Bridge        string
	Address       string
	HostMac       string `yaml:",omitempty"`
	CtrMac        string `yaml:",omitempty"`
	// contains filtered or unexported fields
}

EnclaveVeth tracks information about virtual ethernet interfaces for infrapod enclaves.

func (*EnclaveVeth) GetVersion

func (x *EnclaveVeth) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*EnclaveVeth) Key

func (x *EnclaveVeth) Key() string

Key returns the datastore key for this object.

func (*EnclaveVeth) SetVersion

func (x *EnclaveVeth) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*EnclaveVeth) Value

func (x *EnclaveVeth) Value() interface{}

Value returns this object as an interface{}

type Endpoint

type Endpoint struct {
	// The node being connected
	Node string
	// The interface being connected
	Interface string
	// Whether or not the interface multiplexes multiple virtual links
	Multidegree bool
}

An Endpoint describes how a testbed node connects to a virtual network.

type FoundrySetSpec

type FoundrySetSpec struct {
	Endpoint string
	Machines []*foundry.MachineConfig
}

A FoundrySetSpec encapsulates the information needed to configure a set of machines using foundry.

type ImageBinding

type ImageBinding struct {
	Image *sled.Image // image storage information
	Kexec *sled.Kexec // local kexec after initial sled write
}

An ImageBinding contains the required information to bind an image to a node using sled.

type ImageDefaults

type ImageDefaults struct {
	Image sled.Image
	// contains filtered or unexported fields
}

ImageDefaults contains default image information for a node type.

func (*ImageDefaults) GetVersion

func (d *ImageDefaults) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*ImageDefaults) Key

func (d *ImageDefaults) Key() string

Key returns the datastore key for this object.

func (*ImageDefaults) SetVersion

func (d *ImageDefaults) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*ImageDefaults) Value

func (d *ImageDefaults) Value() interface{}

Value returns this object as an interface{}

type ImageSpec

type ImageSpec struct {
	Endpoint string // location of sledb
	List     []ImageBinding
	NoVerify bool
}

An ImageSpec contains all the information needed to create a set of image bindings through sled.

type Images added in v0.7.0

type Images struct {
	Node     *NodeImages
	Infrapod *InfrapodImages
}

type InfrapodImages added in v0.6.10

type InfrapodImages struct {
	Belugactl string
	Moactl    string
	Foundry   string
	Etcd      string
	Nex       string
}

type InterfaceMacAdvSpec

type InterfaceMacAdvSpec struct {
	Netns     string
	Interface string
	Vni       int
	Vindex    int
}

A InterfaceMacAdvSpec describes an interface to derive a type-2 EVPN (MACADV) advertisement from..

type LinkAction

type LinkAction int

A LinkAction is a Create or Destroy Link

const (
	// CreateLink creates links
	CreateLink LinkAction = iota
	// DestroyLink creates links
	DestroyLink
)

func (LinkAction) Canopy

func (a LinkAction) Canopy() string

Canopy takes the link action and applies it to canopy links

func (LinkAction) Moa

func (a LinkAction) Moa() string

Moa takes the link action and applies it to moa links

type LinkInfo

type LinkInfo struct {
	Mzid     string
	Vindex   int
	Kind     LinkKind
	XpID     string     // virtual link identifier from merge
	Props    xir.Props  // User defined link properties
	TBVLinks []*TBVLink // A list of testbed virtual links
	Core     []string   // Non-edge link resource ids
	// contains filtered or unexported fields
}

LinkInfo maps a virtual link id in the experiment space e.g., an identifier for a link in an experiment onto a set of virtual and physical testbed links. Core links are physical testbed links that interconnect edge links.

func GenLinkInfo

func GenLinkInfo(
	mzInfo *MzInfo,
	fragment *site.MzFragment,
	linkModel *site.LinkModel,
	topo *xir.Net,
	init bool,
) (*LinkInfo, error)

func InfranetLinkInfos added in v0.7.5

func InfranetLinkInfos(
	nodes []string, vni, vid int, mzid string, tbmodel *xir.Net) ([]*LinkInfo, error)

func ListLinkInfos

func ListLinkInfos(mzid string) ([]*LinkInfo, error)

ListLinkInfo lists all linkinfos for a mzid

func (*LinkInfo) AssignIDs

func (li *LinkInfo) AssignIDs() error

AssignIDs TODO

func (*LinkInfo) Del

func (li *LinkInfo) Del() error

Del TODO

func (li *LinkInfo) EdgeLink(name string) *TBVLink

EdgeLink gets the edge link for a specified node

func (*LinkInfo) Edges

func (li *LinkInfo) Edges() []*EdgeInfo

func (*LinkInfo) GetVersion

func (l *LinkInfo) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*LinkInfo) Init

func (li *LinkInfo) Init() error

Init a link info object by allocating virtual link ids.

func (*LinkInfo) Key

func (l *LinkInfo) Key() string

Key returns the datastore key for this object.

func (*LinkInfo) SetVersion

func (l *LinkInfo) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*LinkInfo) Value

func (l *LinkInfo) Value() interface{}

Value returns this object as an interface{}

type LinkKind

type LinkKind string
const (
	// InfraLink is an infrastructure link
	InfraLink LinkKind = "infra"

	// XpLink is an experiment link
	XpLink LinkKind = "xp"

	// MoaLink is a Moa emulated link
	MoaLink LinkKind = "moa"
)

func ParseLinkKind

func ParseLinkKind(s string) (LinkKind, error)

type MacAdvSpec

type MacAdvSpec struct {
	Mac    string
	Vni    int
	Vindex int
	Router string
	Addr   string
	Asn    int
}

A MacAdvSpec describes a type-2 EVPN (MACADV) advertisement.

type MzInfo

type MzInfo struct {
	Mzid     string
	Instance string
	Vindex   int
	Vni      int
	Vid      int

	Status MzStatus

	IncomingTaskID string
	TeardownTaskID string

	NodeSetupTaskID   string
	NodeRecycleTaskID string

	LinkCreateTaskID  string
	LinkDestroyTaskID string
	// contains filtered or unexported fields
}

MzInfo contains various information about a materialization

func GetMzInfo

func GetMzInfo(mzid, instance string) (*MzInfo, error)

func ListMaterializations

func ListMaterializations(prefix string) ([]*MzInfo, error)

ListMaterializations lists all materializations with the given prefix.

func MzInfoRead

func MzInfoRead(mzid string) (*MzInfo, error)

func MzInfoWait

func MzInfoWait(mzid, instance string) (*MzInfo, error)

func (*MzInfo) GetVersion

func (m *MzInfo) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*MzInfo) Key

func (m *MzInfo) Key() string

Key returns the datastore key for this object.

func (*MzInfo) SetVersion

func (m *MzInfo) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*MzInfo) Value

func (m *MzInfo) Value() interface{}

Value returns this object as an interface{}

type MzOperation

type MzOperation string

MzOperation indicates the type of a materialization operation an action is a part of.

const (
	// MzOutgoing indicates a dematerialization process.
	MzOutgoing MzOperation = "outgoing"
	// MzIncoming indicates a materialization process.
	MzIncoming MzOperation = "incoming"
	// MzMod indicates that a materialization is being modified.
	MzMod MzOperation = "mod"
)

type MzStatus

type MzStatus int

MzStatus indicates the overal status of a materialization

const (
	// MzNone indicates that there is no materialization status
	MzNone MzStatus = iota
	// Materializing indicates that a materialization is in progress
	Materializing
	// Active indicates that all materialization tasks have finished
	Active
	// Dematerializing indicates a dematerialization is in progress
	Dematerializing
)

func (MzStatus) String

func (s MzStatus) String() string

String returns the string form of an MzStatus

type MzfIndex

type MzfIndex struct {
	Resource string
	Fragment *site.MzFragment
	// contains filtered or unexported fields
}

MzfIndex tracks materialization fragments.

func (*MzfIndex) GetVersion

func (x *MzfIndex) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*MzfIndex) Key

func (x *MzfIndex) Key() string

Key returns the datastore key for this object.

func (*MzfIndex) SetVersion

func (x *MzfIndex) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*MzfIndex) Value

func (x *MzfIndex) Value() interface{}

Value returns this object as an interface{}

type NexMemberSpec

type NexMemberSpec struct {
	nex.MemberList `mapstructure:",squash" yaml:",inline"`
	Endpoint       string
}

NexMemberSpec is a wrapper around a nex member list that adds an endpoint at which the nex service may be reached.

type NexNetworkSpec

type NexNetworkSpec struct {
	// Core Nex data
	Network nex.Network

	// Nex endpoint address
	Endpoint string
}

NexNetworkSpec is a wrapper around a nex network specification that adds an endpoint at which the nex service may be reached.

type NodeImages added in v0.7.0

type NodeImages struct {
	Default string
}

type NodeInfo

type NodeInfo struct {
	Mzid    string // key under mzinfo
	Machine string // key under nodes

	XpName string
	Image  *ImageBinding
	Config *foundry.MachineConfig
	Nex    *nex.Member
	// contains filtered or unexported fields
}

NodeInfo contains various information about a testbed node

func ListNodeInfo

func ListNodeInfo(mzid string) ([]*NodeInfo, error)

ListNodeInfo lists all linkinfos for a mzid

func (*NodeInfo) GetVersion

func (ni *NodeInfo) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*NodeInfo) Key

func (ni *NodeInfo) Key() string

Key returns the datastore key for this object.

func (*NodeInfo) SetVersion

func (ni *NodeInfo) SetVersion(x int64)

SetVersion sets the current datastore version of the object

func (*NodeInfo) Value

func (ni *NodeInfo) Value() interface{}

Value returns this object as an interface{}

type NodeSpec

type NodeSpec struct {
	Resource    string
	Xname       string
	Mac         string
	Interface   string
	Multidegree bool
	SvcEndpoint string
	Infranet    *TargetNetwork
	Binding     *ImageBinding
	Config      *foundry.MachineConfig
}

A NodeSpec encapsulates the data needed to provision or recycle a testbed node.

type NodeState

type NodeState struct {
	Name   string
	Mzid   string
	Status NodeStateStatus
	// contains filtered or unexported fields
}

NodeState tracks the state of individual testbed nodes.

func GetNodeStatus

func GetNodeStatus(nodeName string) (*NodeState, error)

GetNodeStatus returns the node state of node

func ListNodes

func ListNodes() ([]*NodeState, error)

ListNodes lists the node state of all nodes in a testbed.

func (*NodeState) GetVersion

func (n *NodeState) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*NodeState) Key

func (n *NodeState) Key() string

Key returns the datastore key for this object.

func (*NodeState) SetVersion

func (n *NodeState) SetVersion(x int64)

SetVersion sets the current datastore version of the object

func (*NodeState) Value

func (n *NodeState) Value() interface{}

Value returns this object as an interface{}

type NodeStateStatus

type NodeStateStatus struct {
	Current NodeStatus
	Target  NodeStatus
}

NodeStateStatus tracks the current and target state for a testbed node

type NodeStatus

type NodeStatus int

NodeStatus indicates the state of a node.

const (
	// NodeNone indicates that there is no available state for a node
	NodeNone NodeStatus = iota
	// Setup indicates a node is being setup
	Setup
	// Recycling indicates a node is being recycled
	Recycling
	// Ready indicates a node has been setup and is ready for use
	Ready
	// Clean indicates a node has been recycled
	Clean
)

func (NodeStatus) String

func (s NodeStatus) String() string

type NsnatSpec

type NsnatSpec struct {
	Src     string
	Dst     string
	Addr    string
	Gateway string
}

NsnatSpec tracks specification information about network namespace double NATs.

type PortMode

type PortMode int

PortMode defines the VLAN mode of a port.

const (
	// Access indicates VLAN access mode for a port
	Access PortMode = iota
	// Trunk indicates VLAN trunk mode for a port
	Trunk
)

type PortObj

type PortObj struct {
	Mzid string
	Host string
	Port string
	Mode PortMode
	Vids []int
	Up   bool
	// contains filtered or unexported fields
}

PortObj tracks various switch port properties.

func (*PortObj) GetVersion

func (x *PortObj) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*PortObj) Key

func (x *PortObj) Key() string

Key returns the datastore key for this object.

func (*PortObj) SetVersion

func (x *PortObj) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*PortObj) Value

func (x *PortObj) Value() interface{}

Value returns this object as an interface{}

type Resource added in v0.8.2

type Resource struct {
	Model   *site.NodeModel
	Element string
}

Resource is an amalgamation of model and element to track, in order to minimize bulk reads/writes

type Stage

type Stage struct {
	Mzid    string   `yaml:",omitempty"`
	Taskid  string   `yaml:",omitempty"`
	ID      string   `yaml:",omitempty"`
	Order   int      `yaml:",omitempty"` // instead of linked list implementation, we just know where we should be
	Actions []string `yaml:",omitempty"`
	// contains filtered or unexported fields
}

A Stage is a collection of actions. Actions within a stage are executed concurrently.

func EtcdStagePrefix

func EtcdStagePrefix(prefix string) ([]*Stage, error)

EtcdStagePrefix uses EtcdPrefix helper function and type casts back to Stage

func ExtractStage

func ExtractStage(stageJSON string) (*Stage, error)

ExtractStage takes a json string an unmarshals it into a Stage object

func GetStage

func GetStage(mzid, taskid, stageid string) (*Stage, error)

GetStage retrieves stage from etcd based on ID

func GetTaskStages

func GetTaskStages(mzid, taskid string) ([]*Stage, error)

GetTaskStages return all stages associated with a task

func (*Stage) GetVersion

func (s *Stage) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*Stage) Key

func (s *Stage) Key() string

Key returns the datastore key for this object.

func (*Stage) SetVersion

func (s *Stage) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*Stage) Value

func (s *Stage) Value() interface{}

Value returns this object as an interface{}

type StageWithActions

type StageWithActions struct {
	Stage   *Stage
	Actions []*Action
}

StageWithActions holds the array of actions

func NewStage

func NewStage(actions ...*Action) *StageWithActions

NewStage creates a new stage.

func (*StageWithActions) AddActions

func (s *StageWithActions) AddActions(actions ...*Action)

AddActions to a StageWithAction struct

type TBVLink struct {
	Vni            int
	Vid            int
	Edges          []*EdgeInfo
	Advertisements []string
}

TBVLink represents a virtual testbed link in terms of the underlying physical links it's constructed from. Edge links are physical testbed links that connect directly to end-hosts.

type TargetNetwork

type TargetNetwork struct {
	Vni int
	Vid int
}

TargetNetwork describes the infrastructure network a testbed node will attach to.

type Task

type Task struct {
	Mzid      string   `yaml:",omitempty"`
	ID        string   `yaml:",omitempty"`
	Instance  string   `yaml:",omitempty"`
	Stages    []string `yaml:",omitempty"`
	Deps      []string `yaml:",omitempty"`
	Timestamp string   `yaml:",omitempty"`
	// contains filtered or unexported fields
}

A Task is a collecion of stages that are executed in sequence by a coglet.

func EtcdTaskPrefix

func EtcdTaskPrefix(prefix string) ([]*Task, error)

EtcdTaskPrefix uses EtcdPrefix helper function and type casts back to Task

func ExtractTask

func ExtractTask(taskJSON string) (*Task, error)

ExtractTask takes a json string an unmarshals it into a Task object

func ListTasks

func ListTasks(mzid string) ([]*Task, error)

ListTasks all tasks for a materialization

func NewTask

func NewTask(mzid, instance string, stages ...*StageWithActions) (*Task, *[]common.Object, error)

NewTask takes an mzid, and stages and returns the new task It will also write out all the stages and actions to etcd and is responsible for initializing both stages and actions

func ParseAction

func ParseAction(as *ActionStatus) (*Task, error)

ParseAction when action is found, execute corresponding task

func ReadTask

func ReadTask(file string) (*Task, *[]common.Object, error)

ReadTask reads a task from a YAML file.

func (*Task) AddDep

func (t *Task) AddDep(id string)

AddDep adds a dependency to a task. The id argument must be a UUID for an existing task. Once added, this task will be ignored by coglets until the specified UUID has completed successfully, or is masked.

func (*Task) Cancel

func (t *Task) Cancel() error

Cancel cancels the tasks with the specified prefix as well as the attached action statuses

func (*Task) ClearErrors

func (t *Task) ClearErrors(actionstatuses map[string]*ActionStatus) error

ClearErrors clears all errors from the underlying actions in a task. This means that it will become elegible for execution by a coglet again. this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) Complete

func (t *Task) Complete(actionstatuses map[string]*ActionStatus) (bool, error)

Complete returns if the task is complete. A task is considered complete if all its actions are either complete or masked. this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) DepsSatisfied

func (t *Task) DepsSatisfied() ([]*ActionStatus, error)

DepsSatisfied calculates if all dependencies of a task are satisfied it returns those statuses which are not, or empty if there are none this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) Failed

func (t *Task) Failed(actionstatuses map[string]*ActionStatus) ([]*ActionStatus, error)

Failed returns if a task has failed. this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) GetVersion

func (t *Task) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*Task) Incomplete

func (t *Task) Incomplete(actionstatuses map[string]*ActionStatus) ([]*ActionStatus, error)

Incomplete returns all incomplete actionstatuses this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) Key

func (t *Task) Key() string

Key returns the datastore key for this object.

func (*Task) Reset

func (t *Task) Reset(actionstatuses map[string]*ActionStatus) error

Reset marks all actions in a task as incomplete and clears any errors. this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) SetComplete

func (t *Task) SetComplete() error

SetComplete sets all the action statuses for a task to complete this function assumes GetMzidAS(task.Mzid, task.ID) as input

func (*Task) SetVersion

func (t *Task) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*Task) Value

func (t *Task) Value() interface{}

Value returns this object as an interface{}

func (*Task) Wait

func (t *Task) Wait() error

Wait blocks until a task is either complete or failed. this function assumes GetMzidAS(task.Mzid, task.ID) as input

type VLMap

type VLMap struct {
	Mzid    string
	Entries map[int]*VLMentry
	// contains filtered or unexported fields
}

VLMap maps virtual link identifers to VLMentries

func (*VLMap) GetVersion

func (v *VLMap) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*VLMap) Key

func (v *VLMap) Key() string

Key returns the datastore key for this object.

func (*VLMap) SetVersion

func (v *VLMap) SetVersion(x int64)

SetVersion sets the current datastore version of the object

func (*VLMap) Value

func (v *VLMap) Value() interface{}

Value returns this object as an interface{}

type VLMentry

type VLMentry struct {
	Vni int
	Vid int
}

VLMentry captures information about a virtual link materialization

type VLinkEdge

type VLinkEdge int

VLinkEdge defines how a virtual link terminates at its edge.

const (
	// VlanAccess indicates a virtual link terminates as a VLAN access port
	VlanAccess VLinkEdge = iota
	// VlanTrunk indicates a virtual link terminates as a VLAN trunk port
	VlanTrunk
	// Vxlan indicates a virtual link terminates as a VXLAN VTEP
	Vxlan
)

type Vtep

type Vtep struct {
	//Node     string XXX should alwyas be the host rex is running on
	//Dev      string XXX rex-local configuration
	Bridge string
}

Vtep encapsulates required data for canopy VTEP commands.

type VtepObj

type VtepObj struct {
	Mzid string
	Host string
	Name string
	Vni  int
	Vid  int
	// contains filtered or unexported fields
}

VtepObj tracks VTEP parameters in the datastore

func (*VtepObj) GetVersion

func (x *VtepObj) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*VtepObj) Key

func (x *VtepObj) Key() string

Key returns the datastore key for this object.

func (*VtepObj) SetVersion

func (x *VtepObj) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*VtepObj) Value

func (x *VtepObj) Value() interface{}

Value returns this object as an interface{}

type VtepSpec

type VtepSpec struct {
	Vni   int
	Vid   int
	Vteps []Vtep
}

VtepSpec encapsulates a canopy VTEP specification.

type VxLan

type VxLan struct {
	Vni        int
	Interfaces []string
	// contains filtered or unexported fields
}

VxLan Record

func (*VxLan) GetVersion

func (x *VxLan) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*VxLan) Key

func (x *VxLan) Key() string

Key returns the datastore key for this object.

func (*VxLan) RemoveInterface

func (x *VxLan) RemoveInterface(mac string)

RemoveInterface removes an interface from a VxLan record

func (*VxLan) SetVersion

func (x *VxLan) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*VxLan) Value

func (x *VxLan) Value() interface{}

Value returns this object as an interface{}

type YamlTask

type YamlTask struct {
	Mzid      string              `yaml:",omitempty"`
	ID        string              `yaml:",omitempty"`
	Instance  string              `yaml:",omitempty"`
	Stages    []*StageWithActions `yaml:",omitempty"`
	Timestamp string              `yaml:",omitempty"`
}

YamlTask are backwards compatable tasks

Jump to

Keyboard shortcuts

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