sls

package
v1.33.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CabinetKindRiver    = "river"
	CabinetKindHill     = "hill"
	CabinetKindMountain = "mountain"
	CabinetKindEX2000   = "EX2000"
	CabinetKindEX2500   = "EX2500"
	CabinetKindEX3000   = "EX3000"
	CabinetKindEX4000   = "EX4000"
)

Enumerations of CabinetKinds for valid cabinet types.

Variables

ValidCabinetTypes is the list of strings that enumerate valid cabinet types

Functions

This section is empty.

Types

type CabinetDetail added in v1.33.0

type CabinetDetail struct {
	ID           int           `mapstructure:"id" yaml:"id" valid:"numeric"`
	ChassisCount *ChassisCount `mapstructure:"chassis-count" yaml:"chassis-count" valid:"-"` // This field is only respected for EX2500 cabinets with variable chassis counts
	NMNSubnet    string        `mapstructure:"nmn-subnet" yaml:"nmn-subnet" valid:"-"`
	NMNVlanID    int16         `mapstructure:"nmn-vlan" yaml:"nmn-vlan" valid:"numeric"`
	HMNSubnet    string        `mapstructure:"hmn-subnet" yaml:"hmn-subnet" valid:"-"`
	HMNVlanID    int16         `mapstructure:"hmn-vlan" yaml:"hmn-vlan" valid:"numeric"`
}

CabinetDetail stores information about individual cabinets

type CabinetDetailFile added in v1.33.0

type CabinetDetailFile struct {
	Cabinets []CabinetGroupDetail `yaml:"cabinets"`
}

CabinetDetailFile is a struct that matches the syntax of the configuration file for non-sequential cabinet ids

func LoadCabinetDetailFile added in v1.33.0

func LoadCabinetDetailFile(path string) (
	CabinetDetailFile, error,
)

LoadCabinetDetailFile loads the cabinet details from the filesystem

func (*CabinetDetailFile) CabinetTypes added in v1.33.0

func (cdf *CabinetDetailFile) CabinetTypes() []CabinetKind

CabinetTypes returns a list of cabinet types from the file

type CabinetFilterFunc added in v1.33.0

type CabinetFilterFunc func(
	CabinetGroupDetail, CabinetDetail,
) bool

CabinetFilterFunc is a function type that functions can implement to define rules if a cabinet with its its CabinetGroupDetail and CabinetDetail should be filtered out or not.

func AndCabinetFilter added in v1.33.0

func AndCabinetFilter(cabinetFilters ...CabinetFilterFunc) CabinetFilterFunc

AndCabinetFilter allows for multiple cabinets filters to be chained together, and all must pass.

func CabinetAirCooledChassisCountFilter added in v1.33.0

func CabinetAirCooledChassisCountFilter(airCooledChassisCount int) CabinetFilterFunc

CabinetAirCooledChassisCountFilter returns true when a CabinetDetail has a matching number of air-cooled chassis in a ChassisCount structure.

func CabinetClassFilter added in v1.33.0

func CabinetClassFilter(expectedClass slsCommon.CabinetType) CabinetFilterFunc

CabinetClassFilter returns true when a CabinetGroupDetail is of the specified kind. For example, CabinetClassFilter(slsCommon.ClassRiver) would match for river cabinets.

func CabinetKindFilter added in v1.33.0

func CabinetKindFilter(kind CabinetKind) CabinetFilterFunc

CabinetKindFilter returns true when a CabinetGroupDetail is of the specified kind. For example, CabinetKindSelector(CabinetKindRiver) would match for river cabinets.

func CabinetLiquidCooledChassisCountFilter added in v1.33.0

func CabinetLiquidCooledChassisCountFilter(liquidCooledChassisCount int) CabinetFilterFunc

CabinetLiquidCooledChassisCountFilter returns true when a CabinetDetail has a matching number of liquid-cooled chassis in a ChassisCount structure.

func OrCabinetFilter added in v1.33.0

func OrCabinetFilter(cabinetFilters ...CabinetFilterFunc) CabinetFilterFunc

OrCabinetFilter allows for multiple cabinets filters to be chained together, and all must pass.

type CabinetGroupDetail added in v1.33.0

type CabinetGroupDetail struct {
	Kind            CabinetKind     `mapstructure:"cabinet-type" yaml:"type" valid:"-"`
	Cabinets        int             `mapstructure:"number" yaml:"total_number" valid:"-"`
	StartingCabinet int             `mapstructure:"starting-cabinet" yaml:"starting_id" valid:"-"`
	CabinetDetails  []CabinetDetail `mapstructure:"cabinets" yaml:"cabinets" valid:"-"`
}

CabinetGroupDetail stores information that can only come from Manufacturing

func (*CabinetGroupDetail) CabinetIDs added in v1.33.0

func (cgd *CabinetGroupDetail) CabinetIDs() []int

CabinetIDs returns the list of all cabinet ids

func (*CabinetGroupDetail) GetCabinetDetails added in v1.33.0

func (cgd *CabinetGroupDetail) GetCabinetDetails() map[int]CabinetDetail

GetCabinetDetails will retrieve all cabinets that have cabinet specific overrides present

func (*CabinetGroupDetail) Length added in v1.33.0

func (cgd *CabinetGroupDetail) Length() int

Length returns the expected number of cabinets from the total_number passed in or the length of the cabinet_ids array

func (*CabinetGroupDetail) PopulateIds added in v1.33.0

func (cgd *CabinetGroupDetail) PopulateIds()

PopulateIds fills out the cabinet ids by doing simple math

type CabinetKind added in v1.33.0

type CabinetKind string

CabinetKind is the type of the cabinet. This can either be a generic identifier like river, hill, or mountain. It can also be a cabinet model number like EX2000, EX25000, EX3000, or EX4000.

func (CabinetKind) Class added in v1.33.0

func (ck CabinetKind) Class() (
	slsCommon.CabinetType, error,
)

Class will determine the SLS cabinet class of this Cabinet group

func (CabinetKind) IsModel added in v1.33.0

func (ck CabinetKind) IsModel() bool

IsModel will return true if this cabinet type is the actual model of the cabinet.

type ChassisCount added in v1.33.0

type ChassisCount struct {
	LiquidCooled int `mapstructure:"liquid-cooled" yaml:"liquid-cooled" valid:"numeric"`
	AirCooled    int `mapstructure:"air-cooled" yaml:"air-cooled" valid:"numeric"`
}

ChassisCount stores optional information about the chassis composition of the cabinet

type IPReservation

type IPReservation struct {
	Name      string   `json:"Name"`
	IPAddress string   `json:"IPAddress"`
	Aliases   []string `json:"Aliases,omitempty"`

	Comment string `json:"Comment,omitempty"`
}

IPReservation is a type for managing IP Reservations

type IPV4Subnet

type IPV4Subnet struct {
	FullName        string          `json:"FullName"`
	CIDR            string          `json:"CIDR"`
	IPReservations  []IPReservation `json:"IPReservations,omitempty"`
	Name            string          `json:"Name"`
	VlanID          int16           `json:"VlanID"`
	Gateway         string          `json:"Gateway"`
	DHCPStart       string          `json:"DHCPStart,omitempty"`
	DHCPEnd         string          `json:"DHCPEnd,omitempty"`
	Comment         string          `json:"Comment,omitempty"`
	MetalLBPoolName string          `json:"MetalLBPoolName,omitempty"`
}

IPV4Subnet is a type for managing IPv4 Subnets

func (*IPV4Subnet) ReservationsByName added in v1.16.16

func (subnet *IPV4Subnet) ReservationsByName() map[string]IPReservation

ReservationsByName presents the IPReservations in a map by name

type NetworkExtraProperties

type NetworkExtraProperties struct {
	CIDR      string  `json:"CIDR"`
	VlanRange []int16 `json:"VlanRange"`
	MTU       int16   `json:"MTU,omitempty"`
	Comment   string  `json:"Comment,omitempty"`
	PeerASN   int     `json:"PeerASN,omitempty"`
	MyASN     int     `json:"MyASN,omitempty"`

	Subnets []IPV4Subnet `json:"Subnets"`
}

NetworkExtraProperties provides additional network information

func (*NetworkExtraProperties) LookupSubnet added in v1.16.16

func (network *NetworkExtraProperties) LookupSubnet(name string) (IPV4Subnet, error)

LookupSubnet returns a subnet by name

type UtilsClient

type UtilsClient struct {
	// contains filtered or unexported fields
}

UtilsClient - Structure for SLS client.

func NewSLSClient

func NewSLSClient(baseURL string, httpClient *http.Client, token string) *UtilsClient

NewSLSClient - Creates a new SLS client.

func (*UtilsClient) GetManagementNCNs

func (utilsClient *UtilsClient) GetManagementNCNs() (managementNCNs []slsCommon.GenericHardware, err error)

GetManagementNCNs - Returns all the management NCNs from SLS.

func (*UtilsClient) GetNetworks

func (utilsClient *UtilsClient) GetNetworks() (networks slsCommon.NetworkArray, err error)

GetNetworks - Returns all the networks from SLS.

Jump to

Keyboard shortcuts

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