runtime

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: 34 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const (
	BgpSubnetMask = "/32"
)
View Source
const (
	// XXX hardcode emu1
	DefaultEmulator = "emu1"
)

Variables

View Source
var ConfigPath string

ConfigPath is the location of the runtime configuration file

View Source
var (
	//TODO just read from gobble/gobgp config?
	GobgpdPort = flag.Int("gobgpd-port", 50051, "gobgpd listening port")
)

Functions

func AdvertiseMoaLink(
	linkInfo *task.LinkInfo,
	tunnelip string,
	asn int,
) error

func ContainerdClient

func ContainerdClient() (*containerd.Client, error)

ContainerdClient connects to the local containerd socket interface, returning a client.

func CreateContainer

func CreateContainer(ctr *task.ContainerSpec) error

CreateContainer creates a container based on the provided specification.

func CreateContainerRecord

func CreateContainerRecord(spec *task.ContainerSpec) error

CreateContainerRecord stores a record of the provided container spec in the cogs datastore.

func CreateContainerTask

func CreateContainerTask(ctr *task.ContainerSpec) error

CreateContainerTask loads the container from the provided specification and creates a task for it.

func CreateIfx

func CreateIfx(netns string, ifx *task.EnclaveVeth, save bool) error

CreateIfx creates the specified virtual ethernet device in the provided netns.

func CreateInfrapodNS

func CreateInfrapodNS(name string) error

CreateInfrapodNS creates a network namespace for an infrapod.

func CreateTask

func CreateTask(
	ctx context.Context, ctr containerd.Container, ns, name string) error

CreateTask starts a task for the specified container, e.g. it runs the container.

func DelEnclaveBridge

func DelEnclaveBridge(spec *task.EnclaveSpec, ctx *rtnl.Context) error

DelEnclaveBridge deletes the materialization bridge from an enclave.

func DelEnclaveIptables

func DelEnclaveIptables(mzid string, spec *task.EnclaveSpec) error

DelEnclaveIptables deletes double NAT rules from an enclave

func DeleteContainer

func DeleteContainer(name, namespace string) error

DeleteContainer deletes a container.

func DeleteContainerIfx

func DeleteContainerIfx(namespace, name string) error

DeleteContainerIfx loads the virtual ethernet interface identified by name within the provided namespace and deletes it.

func DeleteContainerImg

func DeleteContainerImg(name, namespace string) error

DeleteContainerImg deletes an image form a container namespace.

func DeleteContainerNs

func DeleteContainerNs(namespace string) error

DeleteContainerNs deletes a container namespace.

func DeleteContainerRecord

func DeleteContainerRecord(name, namespace string) error

DeleteContainerRecord locates a record for for the container identified by name in the provided namespace and removes it from the cogs data store.

func DeleteContainerTask

func DeleteContainerTask(name, namespace string) error

DeleteContainerTask loads the container identified by the provided name / namespace combo and deletes its associated task.

func DeleteIfx

func DeleteIfx(netns string, ifx *task.EnclaveVeth) error

DeleteIfx removes a virtual ethernet device from a network namespace.

func DeleteInfrapodNS

func DeleteInfrapodNS(name string) error

DeleteInfrapodNS deletes the network namespace associated with the infrapod identified by name.

func DeleteTask

func DeleteTask(ctx context.Context, container containerd.Container) error

DeleteTask deletes a container's task.

func DestroyNetNS

func DestroyNetNS(netns *NetNS) error

DestroyNetNS deletes a network namespace.

func EmuInfo added in v0.8.8

func EmuInfo() (*tb.Resource, *sys.EvpnConfig, string, error)

func EnclaveBridge

func EnclaveBridge(spec *task.EnclaveSpec, ctx *rtnl.Context) error

EnclaveBridge creates the materialization enclave bridge. This bridge connects the enclave to a materializtions infrastructure network.

func EnclaveIptables

func EnclaveIptables(mzid string, spec *task.EnclaveSpec) error

EnclaveIptables implements the double nat rules for an enclave so testbed nodes can access the internet through the infrastructure network.

func EvpnAdvertiseMac

func EvpnAdvertiseMac(addr, router, mac string, asn, vni, vindex int) error

EvpnAdvertiseMac advertises the specified MAC on the specified VNI and updates associted vindex counters.

func EvpnAdvertiseMulticast

func EvpnAdvertiseMulticast(addr, router string, asn, vni, vindex int) error

EvpnAdvertiseMulticast sends out a type-3 multicast EVPN advertisement. The advertisement is sent to a GoBGP instance at the hostname specified by the router parameter. The addr parameter specifies the IP address to advertise, asn is the autonomous system number, vni is the VXLAN virtual network identifier and vindex in the Cogs virtual network index id.

func EvpnWithdrawMac

func EvpnWithdrawMac(addr, router, mac string, asn, vni, vindex int) error

EvpnWithdrawMac withdraws the specified MAC on the specified VNI and updates associated vindex counters.

func EvpnWithdrawMulticast

func EvpnWithdrawMulticast(addr, router string, asn, vni, vindex int) error

EvpnWithdrawMulticast sends out a type-3 multicast EVPN withdraw

func GetEvpnConfig added in v0.8.8

func GetEvpnConfig(r *tb.Resource) *sys.EvpnConfig

func GetNativePathAttributes added in v0.7.5

func GetNativePathAttributes(p *api.Path) ([]bgp.PathAttributeInterface, error)

func Init

func Init()

func ListContainers

func ListContainers(ctx context.Context) ([]containerd.Container, error)

ListContainers lists the containers in the specified context.

func ListNamespaces

func ListNamespaces() ([]string, error)

ListNamespaces lists current namespace names.

func NsDefaultRoute

func NsDefaultRoute(mzid string, spec *task.EnclaveSpec) error

NsDefaultRoute sets up a default route in an infrapod namespace

func PullContainerImage

func PullContainerImage(namespace, image string) error

PullContainerImage pulls the specified container image into the specified namespace.

func SetupContainerLo

func SetupContainerLo(namespace string) error

SetupContainerLo sets up a loopback network interface in the specified network namespace.

func WithCogCNI

func WithCogCNI(netns string) oci.SpecOpts

WithCogCNI is an OCI specification operator that binds a container to a network namespace.

func WithCtrMounts

func WithCtrMounts(mounts []*task.ContainerMount) oci.SpecOpts

WithCtrMounts is an OCI specifier that can be used on container creation to plumb in the set of provided container mount points.

func WithdrawMoaLink(
	linkInfo *task.LinkInfo,
	tunnelip string,
	asn int,
) error

Types

type CogletInfo

type CogletInfo struct {
	ID   string
	Cog  string
	Host string
	Pid  int
	// contains filtered or unexported fields
}

CogletInfo contains bookkeeping information about a coglet replica.

func ListCoglets

func ListCoglets() ([]*CogletInfo, error)

ListCoglets lists the coglets currently registered with the cogs datastore

func (*CogletInfo) GetVersion

func (c *CogletInfo) GetVersion() int64

GetVersion gets the datastore replica version information

func (*CogletInfo) Key

func (c *CogletInfo) Key() string

Key returns the datastore key for this coglet's info

func (*CogletInfo) SetVersion

func (c *CogletInfo) SetVersion(v int64)

SetVersion sets the datastore replica version information

func (*CogletInfo) Value

func (c *CogletInfo) Value() interface{}

Value returns this coglet as an interface object

type Config

type Config struct {
	Etcd   *common.ServiceConfig `yaml:",omitempty" json:",omitempty"`
	Beluga *common.ServiceConfig `yaml:",omitempty" json:",omitempty"`
	Tuning *Tuning               `yaml:",omitempty" json:",omitempty"`
	Net    *NetConfig            `yaml:",omitempty" json:",omitempty"`
	Sled   *SledConfig           `yaml:",omitempty" json:",omitempty"`
	Alerts []*common.AlertConfig `yaml:",omitempty" json:",omitempty"`
	Site   string                `yaml:",omitempty" json:",omitempty"`
}

Config is the top level configuration object for the cogs system.

func GetConfig

func GetConfig(fullRuntime bool) *Config

GetConfig loads the cogs config from a well known file location.

type Destination

type Destination struct {
	Paths []*Path
}

Destination is a set of paths.

func (*Destination) MarshalJSON

func (d *Destination) MarshalJSON() ([]byte, error)

MarshalJSON creates a JSON representation of a destination.

type EvpnInfo

type EvpnInfo struct {
	BgpIP net.IP
	Rd    bgp.RouteDistinguisherInterface
	Rt    bgp.ExtendedCommunityInterface
}

EvpnInfo encapsulates commonly used EVPN advertisement info.

type EvpnWithdrawData

type EvpnWithdrawData struct {
	Asn    int    `yaml:",omitempty"`
	Addr   string `yaml:",omitempty"`
	Vindex int    `yaml:",omitempty"`
	Vni    int    `yaml:",omitempty"`
}

EvpnWithdrawData encapsulates information necessary to send an EVPN withdraw request

type NetConfig

type NetConfig struct {
	VtepIfx         string `yaml:"vtepIfx,omitempty" json:"vtepIfx,omitempty"`
	Mtu             int    `yaml:"mtu,omitempty" json:"mtu,omitempty"`
	VtepMtu         int    `yaml:"vtepMtu,omitempty" json:"vtepMtu,omitempty"`
	ServiceTunnelIP string `yaml:"serviceTunnelIP,omitempty" json:"serviceTunnelIP,omitempty"`
	BgpAS           int    `yaml:"bgpAS,omitempty" json:"bgpAS,omitempty"`
	ExternalIfx     string `yaml:"externalIfx,omitempty" json:"externalIfx,omitempty"`
	ExternalIP      string `yaml:"externalIP,omitempty" json:"externalIP,omitempty"`
	ExternalSubnet  string `yaml:"externalSubnet,omitempty" json:"externalSubnet,omitempty"`
	ExternalGateway string `yaml:"externalGateway,omitempty" json:"externalGateway,omitempty"`
}

NetConfig contains the cogs networking configuration.

type NetNS

type NetNS struct {
	Name       string
	Containers []string
	// contains filtered or unexported fields
}

NetNS is a network namespace record that tracks containers in the netns.

func (*NetNS) GetVersion

func (x *NetNS) GetVersion() int64

GetVersion returns the current datastore version of the object

func (*NetNS) Key

func (x *NetNS) Key() string

Key returns the datastore key for this object.

func (*NetNS) RemoveContainer

func (x *NetNS) RemoveContainer(ctr string)

RemoveContainer removes a container from a netns object

func (*NetNS) SetVersion

func (x *NetNS) SetVersion(v int64)

SetVersion sets the current datastore version of the object

func (*NetNS) Value

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

Value returns this object as an interface{}

type Path

type Path struct {
	Nlri       bgp.AddrPrefixInterface      `json:"nlri"`
	Age        int64                        `json:"age"`
	Best       bool                         `json:"best"`
	Attrs      []bgp.PathAttributeInterface `json:"attrs"`
	Stale      bool                         `json:"stale"`
	Withdrawal bool                         `json:"withdrawal,omitempty"`
	SourceID   net.IP                       `json:"source-id,omitempty"`
	NeighborIP net.IP                       `json:"neighbor-ip,omitempty"`
}

Path is a workaround. This for the json format compatibility. Once we update senario tests, we can remove this.

type SledConfig added in v0.7.5

type SledConfig struct {
	MatTimeout   int `yaml:"mattimeout"`
	DematTimeout int `yaml:"demattimeout"`
	ConnTimeout  int `yaml:"conntimeout"`
}

SledConfig contains configurable sled items

type Tuning

type Tuning struct {
	TaskLease int `yaml:"taskLease"`
}

Tuning contains tasks that can be tuned by a cogs administrator to tweak performance.

Jump to

Keyboard shortcuts

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