sfe

package
v1.3.31 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CPUCostPerCore    = 45.0
	MemoryCostPerByte = 7.0 / 1024 / 1024 / 1024
	NetworkCostPerBit = 8.0 / 1024 / 1024 / 1024
	DiskCostPerByte   = 3.0 / 1024 / 1024 / 1024
)
View Source
const (
	HarborLsi          = 3
	LsiBegin           = 100
	MarinerInfraBridge = "mbr"
	DefaultMtu         = 1500
	JumboMtu           = 9216
)
View Source
const (
	SwitchMask = uint8(32)
	HostMask   = uint8(16)
)

Variables

This section is empty.

Functions

func AssignAddrs

func AssignAddrs(
	tbAddr TPA,
	tbx *xir.Topology,
	switchRoles []xir.Role,
	hostRoles []xir.Role,
) (
	map[*xir.Device]TPA, map[*xir.Interface]TPA,
)

func AssignTPAsInfraNet

func AssignTPAsInfraNet(tbAddr TPA, tbx *xir.Topology) (
	map[*xir.Device]TPA, map[*xir.Interface]TPA,
)

func AssignTPAsXpNet

func AssignTPAsXpNet(tbAddr TPA, tbx *xir.Topology) (
	map[*xir.Device]TPA, map[*xir.Interface]TPA,
)
func CheckLinks(e *Embedding) portal.Diagnostics

func CleanSegments

func CleanSegments(e *Embedding)

func CollectHops

func CollectHops(wp *Waypoint) [][]*xir.Interface
func CollectLinks(wp *Waypoint) []*xir.Connection

func ComputeCosts

func ComputeCosts(hs []*Host)

func ComputeInterfaceConstraints

func ComputeInterfaceConstraints(tbx *xir.Topology)

func DiagnosticDebugf

func DiagnosticDebugf(format string, a ...interface{}) *rz.Diagnostic

func DiagnosticErrorf

func DiagnosticErrorf(format string, a ...interface{}) *rz.Diagnostic

func DiagnosticWarningf

func DiagnosticWarningf(format string, a ...interface{}) *rz.Diagnostic

func DiagnosticsMacWarning

func DiagnosticsMacWarning(ifx *xir.Interface) *rz.Diagnostic
func EmbedHarborLinks(
	e *Embedding,
	tbx *xir.Topology,
	rt RoutingTable,
	rvx *xir.Device,
) portal.Diagnostics
func EmbedInfranetLinks(
	net NetworkMode,
	e *Embedding,
	tbx *xir.Topology,
	rt RoutingTable,
	rvx *xir.Device,
) portal.Diagnostics
func EmbedLink(
	e *Embedding,
	x *xir.Connection,
	tbx *xir.Topology,
	rt RoutingTable,
	a *portal.AllocationTable,
	emubackend xir.Emulation,
) portal.Diagnostics

TODO somewhat of a bottleneck for large LANs

func EmbedLinks(
	e *Embedding,
	tbx, xp *xir.Topology,
	rt RoutingTable,
	a *portal.AllocationTable,
	emubackend xir.Emulation,
) portal.Diagnostics

func EmbedNodes

func EmbedNodes(
	e *Embedding, a *portal.AllocationTable,
	guests []*Guest, metal, virt []*Host,
	mzid string,
) portal.Diagnostics

func Equals

func Equals(x, other Route) bool

func FillInHostGuestInfo

func FillInHostGuestInfo(ds rz.Diagnostics, nodes map[string]*NodeEmbedding) rz.Diagnostics

func FormatUnits

func FormatUnits(s string) string

func Oversubscribed

func Oversubscribed(component string) *rz.Diagnostic

func Provision

func Provision(
	g *Guest,
	hosts []*Host,
	e *Embedding,
	a *portal.AllocationTable,
	kind portal.NodeRealization_Kind,
	mzid string,
) portal.Diagnostics

func ResolveDisks

func ResolveDisks(
	r *xir.Resource, s *xir.DiskSpec, a *xir.DisksAllocation,
) (*xir.DisksAllocation, rz.Diagnostics)

func ResolveImage

func ResolveImage(r *xir.Resource, s *xir.Node) rz.Diagnostics

func ResolveMemory

func ResolveMemory(
	r *xir.Resource, s *xir.MemorySpec, a *xir.MemoryAllocation,
) (*xir.MemoryAllocation, rz.Diagnostics)

func ResolveNIC

func ResolveNIC(
	r *xir.Resource, s *xir.NICSpec, a *xir.NICsAllocation,
) (*xir.NICsAllocation, rz.Diagnostics)

ResolveNIC: find the NICs/Ports that we can allocate to the requested NICSpec return the resulting xir.NICsAllocation

func ResolveNode

func ResolveNode(
	r *xir.Resource, s *xir.Node, as []*xir.ResourceAllocation, mzid string,
) (*xir.ResourceAllocation, rz.Diagnostics)

func ResolveProc

func ResolveProc(
	r *xir.Resource, s *xir.ProcSpec, a *xir.ProcAllocation,
) (*xir.ProcAllocation, rz.Diagnostics)

resolve a processor specification embodied by a set of constraints against a resource definition containing a set of processors and return a set of virtual processors as a unit of allocation, given an existing set of allocations

func Shorter

func Shorter(x, other Route) bool

func Sort

func Sort(hs []*Host) ([]*Host, []*Host)

func StringTPAs

func StringTPAs(tbx *xir.Topology) string

func WithGuest

func WithGuest(ds rz.Diagnostics, g *Guest) rz.Diagnostics

func WithHost

func WithHost(ds rz.Diagnostics, h *Host) rz.Diagnostics

Types

type Cost

type Cost struct {
	Exclusive  float64
	MTA        float64
	Emulation  float64
	Simulation float64
}

type DevAddrMap

type DevAddrMap map[*xir.Device]TPA

func (DevAddrMap) Dump

func (dam DevAddrMap) Dump()

type Direction

type Direction byte
const (
	Egress Direction = iota
	Ingress
)

type Embedding

type Embedding struct {
	Nodes     map[string]*NodeEmbedding                   // map xpnode name to the embedding of that node
	Links     map[*xir.Connection]*portal.LinkRealization // map connection to link realization
	Endpoints map[*xir.Interface][]*portal.Endpoint       // map interface to slice of endpoints on that interface

	InfrapodServer string               // hostname of infrapod server supporting this realization.
	InfrapodSite   string               // facility hosting the infrapod server
	VirtualMacs    map[string]bool      // MACs allocated for VMs in this embedding
	LinkEmulation  *LinkEmulationParams // Link emulation parameters
	// contains filtered or unexported fields
}

func Embed

func Embed(
	tbroot *xir.Device,
	tbx, xp *xir.Topology,
	a *portal.AllocationTable,
	resourcePool *portal.Pool,
	mzid string,
	emubackend xir.Emulation,
) (
	*Embedding, portal.Diagnostics, error,
)

func EmbedSys

func EmbedSys(
	tbroot *xir.Device,
	tbx *xir.Topology,
) (*Embedding, portal.Diagnostics, error)

Perform system static embeddings. This is for creating static virtual networks that always exist.

  • Imaging Network
  • Mass storage network

func NewEmbedding

func NewEmbedding() *Embedding

func (Embedding) Dump

func (e Embedding) Dump()

func (*Embedding) String

func (e *Embedding) String() string

type End

type End struct {
	Interface *xir.Interface
	Endpoint  *rz.Endpoint
}

type EndpointMode

type EndpointMode uint8
const (
	TrunkMode EndpointMode = iota
	AccessMode
	VtepMode
)

type ExpectedResult

type ExpectedResult int
const (
	Failure ExpectedResult = iota
	Success
	Any
)

type Guest

type Guest struct {
	Device *xir.Device
}

func Guests

func Guests(net *xir.Topology) []*Guest

func (Guest) String

func (h Guest) String() string

func (*Guest) WantsMetal

func (g *Guest) WantsMetal() bool

type Host

type Host struct {
	Device   *xir.Device
	Cost     Cost
	Order    uint
	Guests   []*Guest
	Facility string
}

func Hosts

func Hosts(device *xir.Device) []*Host

func (Host) String

func (h Host) String() string

type IfxAddrMap

type IfxAddrMap map[*xir.Interface]TPA

func (IfxAddrMap) Dump

func (iam IfxAddrMap) Dump()

type InterfaceSelection

type InterfaceSelection struct {
	XpNode      *xir.Node
	TbInterface *xir.Interface
	XpKind      portal.NodeRealization_Kind
	AlreadyUsed bool
}

type LinkEmulation

type LinkEmulation struct {
	Interfaces []*portal.Vtep // vteps on the emu server
	Link       *portal.LinkEmulation
}

type LinkEmulationParams

type LinkEmulationParams struct {
	Links   []*LinkEmulation   // the emulated links
	Servers storage.EmuServers // emu server allocations
	Backend xir.Emulation      // emulation type
}

type MiniLinkRealization

type MiniLinkRealization struct {
	Segments map[uint64]*MiniLinkSegment
}

func (*MiniLinkRealization) Equals

func (lrz *MiniLinkRealization) Equals(other *MiniLinkRealization) bool

func (*MiniLinkRealization) ToString

func (lrz *MiniLinkRealization) ToString(indent string) string

type MiniLinkSegment

type MiniLinkSegment struct {
	Endpoints []*MiniNetPoint
	Waypoints []*MiniNetPoint
}

func MiniLinkSegmentFromLinkSegment

func MiniLinkSegmentFromLinkSegment(seg *portal.LinkSegment) *MiniLinkSegment

func (*MiniLinkSegment) Equals

func (seg *MiniLinkSegment) Equals(other interface{}) bool

func (*MiniLinkSegment) ToString

func (seg *MiniLinkSegment) ToString(indent string, lsi uint64) string

type MiniNetPoint

type MiniNetPoint struct {
	Host string
	Ifx  string
	Net  string // is something along the lines of vlan/phy/vtep or trunk/access/vtep/peer or so
	Ext  string // extra stuff, like is virtual
}

func NetPointFromEndpoint

func NetPointFromEndpoint(ep *portal.Endpoint) *MiniNetPoint

func NetPointFromWaypoint

func NetPointFromWaypoint(wp *portal.Waypoint) *MiniNetPoint

func (*MiniNetPoint) Equals

func (np *MiniNetPoint) Equals(other interface{}) bool

func (*MiniNetPoint) Hash

func (np *MiniNetPoint) Hash() uint32

func (MiniNetPoint) String

func (np MiniNetPoint) String() string

type MiniRealization

type MiniRealization struct {
	Nodes map[string]string
	Links map[string]*MiniLinkRealization
}

func (MiniRealization) Equals

func (mr MiniRealization) Equals(other MiniRealization) bool

func (MiniRealization) ToString

func (mr MiniRealization) ToString() string

type NetworkMode

type NetworkMode uint8
const (
	HarborMode NetworkMode = iota
	InfranetMode
	XpnetMode
)

type NextHop

type NextHop struct {
	Interface  *xir.Interface
	Connection *xir.Connection
}

type NodeEmbedding

type NodeEmbedding struct {
	Node         *xir.Node                   // node represents the cyber entity
	Resource     *xir.Device                 // resource represents the physical resource hosting the node
	Kind         portal.NodeRealization_Kind // whether the node is a bare metal or VM entity
	InfranetAddr string                      // the infranet address assigned to the node
	XpnetIdx     uint32                      // Number of xpnet NICs allocated for the node embedding (VMs only)
	VmAlloc      *xir.ResourceAllocation     // XIR representation of the resources allocated for the node (VMs only)
}

type Path

type Path struct {
	Hops      [][]*xir.Interface
	Waypoints []*rz.Waypoint
}

type PathFinder

type PathFinder struct {
	Path *Path
	// contains filtered or unexported fields
}

func NewPathFinder

func NewPathFinder(
	start, finish *End,
	rt RoutingTable,
	lsi uint64,
	tbx *xir.Topology,
	vrf string,
) (*PathFinder, rz.Diagnostics)

func (*PathFinder) Direction

func (pf *PathFinder) Direction() Direction

func (*PathFinder) Run

func (pf *PathFinder) Run() rz.Diagnostics

type Route

type Route struct {
	Dev         *xir.Interface
	Destination TPA
	Mask        uint8
	Hops        uint8
	NextHop     *xir.Interface
	Connection  *xir.Connection
}

func (Route) Contains

func (r Route) Contains(x TPA) bool

func (Route) String

func (r Route) String() string

func (Route) StringWithId

func (r Route) StringWithId(id string) string

type RouteMessage

type RouteMessage struct {
	Node string
	Route
}

type RoutingTable

type RoutingTable map[string][]Route

A RoutingTable associates the name of a host with a set of routes.

func BuildInfraRoutingTable

func BuildInfraRoutingTable(tbx *xir.Topology) RoutingTable

func BuildRoutingTable

func BuildRoutingTable(
	tbx *xir.Topology,
	switchRoles, hostRoles []xir.Role,
	linkRole xir.LinkRole,
) RoutingTable

func BuildXpRoutingTable

func BuildXpRoutingTable(tbx *xir.Topology) RoutingTable

func (RoutingTable) AnyPaths

func (rt RoutingTable) AnyPaths(from *xir.Interface, to TPA) *Waypoint

func (RoutingTable) Dump

func (rt RoutingTable) Dump(tbx *xir.Topology)

func (RoutingTable) GetRandomShortestRouteTo

func (rt RoutingTable) GetRandomShortestRouteTo(host string, destination TPA) *Route

func (RoutingTable) GetRouteTo

func (rt RoutingTable) GetRouteTo(host string, destination TPA) []Route

func (RoutingTable) GetRouteUsing

func (rt RoutingTable) GetRouteUsing(ifx *xir.Interface) *Route

func (RoutingTable) GetShortestRoutesTo

func (rt RoutingTable) GetShortestRoutesTo(host string, destination TPA) []Route

func (RoutingTable) Paths

func (rt RoutingTable) Paths(from *xir.Interface, to TPA) *Waypoint

func (RoutingTable) ShortestPath

func (rt RoutingTable) ShortestPath(from *xir.Interface, to TPA) (*Waypoint, portal.Diagnostics)

func (RoutingTable) String

func (rt RoutingTable) String(tbx *xir.Topology) string

type TPA

type TPA uint64

func (TPA) GetGuest

func (t TPA) GetGuest() uint16

func (TPA) GetHost

func (t TPA) GetHost() uint16

func (TPA) GetNetwork

func (t TPA) GetNetwork() uint16

func (TPA) GetTestbed

func (t TPA) GetTestbed() uint16

func (TPA) SetGuest

func (t TPA) SetGuest(x uint16) TPA

func (TPA) SetHost

func (t TPA) SetHost(x uint16) TPA

func (TPA) SetNetwork

func (t TPA) SetNetwork(x uint16) TPA

func (TPA) SetTestbed

func (t TPA) SetTestbed(x uint16) TPA

func (TPA) String

func (t TPA) String() string

type Waypoint

type Waypoint struct {
	In  *xir.Interface
	Out map[*NextHop]*Waypoint
}

func (*Waypoint) Dump

func (wp *Waypoint) Dump()

func (*Waypoint) IsLocal

func (wp *Waypoint) IsLocal() bool

func (*Waypoint) JSONDump

func (wp *Waypoint) JSONDump()

Jump to

Keyboard shortcuts

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