View Source
const (
	AllocUnspec      AllocMode = 0
	NoAlloc                    = 1
	NetAlloc                   = 2
	NetEmuAlloc                = 3
	FilesystemAlloc            = 4
	BlockDeviceAlloc           = 5
	PhysicalAlloc              = 6
	VirtualAlloc               = 7
	InfrapodAlloc              = 8
View Source
const (
	RoleUnspec      Role = 0
	Node                 = 1
	InfraServer          = 2
	ConsoleServer        = 3
	PowerController      = 4
	NetworkEmulator      = 5
	XpSwitch             = 6
	InfraSwitch          = 7
	MgmtSwitch           = 8
	Gateway              = 9
	Leaf                 = 10
	Fabric               = 11
	Spine                = 12
	InfraLink            = 13
	XpLink               = 14
	Tor                  = 15
	EmuLink              = 16
	StorageServer        = 17
	InfrapodServer       = 18
	MgmtLink             = 19
	EtcdHost             = 20
	MinIOHost            = 21
	RexHost              = 22
	DriverHost           = 23
	ManagerHost          = 24
	CommanderHost        = 25
	SledHost             = 26
	RallyHost            = 27
	GatewayLink          = 28
	HarborEndpoint       = 29
	PDU                  = 30
	EmuSwitch            = 31
	Hypervisor           = 32
	RallyEndpoint        = 33

    todo this would be better as a 64-bit flag


    This section is empty.


    func AssignSwpRole

    func AssignSwpRole(resource *Resource, role Role)

      Assign switch port role

      func DecodeCable

      func DecodeCable(props xir.Props) *hw.Cable

      func GetCableSpec

      func GetCableSpec(x *xir.Link) *hw.Cable

      func HasAllocMode

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

      func HasRole

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

      func IsXp

      func IsXp(x *xir.Endpoint) bool

      func PrintMaterials

      func PrintMaterials(
      	tw *tabwriter.Writer,
      	lom LOM,
      	parentQuantity int,
      	depth int,

      func ToXir

      func ToXir(t Testbed, name string) *xir.Net


      type AllocMode

      type AllocMode uint16

        AllocMode indicates the allocation mode of a resource

        type BasicInterfaceConfig

        type BasicInterfaceConfig struct {
        	Ip InterfaceIPConfig

        type Cost

        type Cost struct {
        	Price    float64
        	Quantity int
        	SKU      string

        type InterfaceIPConfig

        type InterfaceIPConfig struct {
        	Addrs []string
        	Mtu   int

        type LOM

        type LOM []*Material

        func (*LOM) AddDevice

        func (b *LOM) AddDevice(sku string, dev *hw.Device)

        func (*LOM) AddUnit

        func (b *LOM) AddUnit(e hw.Element) *Material

        func (LOM) Print

        func (b LOM) Print()

        type Material

        type Material struct {
        	Unit     hw.Element
        	Quantity int
        	LOM      LOM

        func (*Material) ConfigItems

        func (m *Material) ConfigItems() int

        type MzLinkInfo

        type MzLinkInfo struct {
        	LinkId int

        type Resource

        type Resource struct {
        	Alloc        []AllocMode `json:"alloc"`
        	Roles        []Role      `json:"roles"`
        	DefaultImage string      `json:"default_image,omitempty" mapstructure:"default_image"`
        	ImageVariant string      `json:"image_variant,omitempty" mapstructure:"image_variant"`
        	Ptags        []string    `json:"ptags,omitempty" mapstructure:"ptag"`
        	Props        xir.Props   `json:"xir,omitempty"`
        	// -> role
        	LinkRoles map[string]Role `json:"link_roles,omitempty" mapstructure:"link_roles"`
        	System    *sys.System     `json:"-"`

          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 GenericFabric

            func GenericFabric(kind, role Role, name, ip string, radix int, gbps uint64) *Resource

            func GenericLeaf

            func GenericLeaf(kind Role, name string, radix int, gbps uint64) *Resource

            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 LargeServer

              func LargeServer(name, imac, xmac string, ptags ...string) *Resource

              func MediumServer

              func MediumServer(name, imac, xmac string, ptags ...string) *Resource

              func SmallServer

              func SmallServer(name, imac, xmac string, ptags ...string) *Resource

              func (*Resource) Eth

              func (r *Resource) Eth(i int) *hw.Port

              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) Ipmi

                    func (r *Resource) Ipmi(i int) *hw.Port

                    func (*Resource) NextSwp

                    func (r *Resource) NextSwp() *hw.Port

                    func (*Resource) Nic

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

                      Nic a NIC contained within the resource at the spcified index

                      func (*Resource) NicKind

                      func (r *Resource) NicKind(kind string) []hw.Nic

                      func (*Resource) Node

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

                        Node generates an XIR node from a resource.

                        func (*Resource) Port

                        func (r *Resource) Port(kind string, i int) *hw.Port

                        func (*Resource) Swp

                        func (r *Resource) Swp(i int) *hw.Port

                        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.

                          func (Role) String

                          func (r Role) String() string

                          type TBLOM

                          type TBLOM struct {
                          	Nodes    LOM
                          	Switches LOM
                          	Cables   LOM

                          func CalculateLOM

                          func CalculateLOM(net *xir.Net) TBLOM

                          func (TBLOM) Print

                          func (tbl TBLOM) Print()

                          type Tally

                          type Tally map[string]*Cost

                          func CalculateCost

                          func CalculateCost(net *xir.Net) Tally

                          func (Tally) Add

                          func (t Tally) Add(item, sku string, price float64)

                          func (Tally) Print

                          func (t Tally) Print()

                          type TallyItem

                          type TallyItem struct {
                          	Name string
                          	Cost *Cost

                          type Testbed

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