devices

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 7

Documentation

Index

Constants

View Source
const (
	// Unknown is the constant that defines unknown things
	Unknown = "Unknown"

	// HP is the constant that defines the vendor HP
	HP = "HP"
	// Dell is the constant that defines the vendor Dell
	Dell = "Dell"
	// Supermicro is the constant that defines the vendor Supermicro
	Supermicro = "Supermicro"
	// Cloudline is the constant that defines the cloudlines
	Cloudline = "Cloudline"
	// Quanta is the contant to identify Quanta hardware
	Quanta = "Quanta"
	// Common is the constant of thinks we could use across multiple vendors
	Common = "Common"
	// Quanta is the contant to identify Intel hardware
	Intel = "Intel"

	// Grid describes the power redundancy mode when using grid redundancy
	Grid = "Grid"

	// PowerSupply describes the power redundancy mode when using power supply redundancy
	PowerSupply = "PowerSupply"

	// NoRedundancy describes the power redundancy mode we don't have redundancy
	NoRedundancy = "NoRedundancy"

	// BladeHwType is the constant defining the blade hw type
	BladeHwType = "blade"
	// DiscreteHwType is the constant defining the Discrete hw type
	DiscreteHwType = "discrete"
	// ChassisHwType is the constant defining the chassis hw type
	ChassisHwType = "chassis"

	// Redfish firmware apply at constants
	// FirmwareApplyImmediate sets the firmware to be installed immediately after upload
	FirmwareApplyImmediate = "Immediate"
	//FirmwareApplyOnReset sets the firmware to be install on device power cycle/reset
	FirmwareApplyOnReset = "OnReset"

	// FirmwareInstallInitializing indicates the device is performing init actions to install the update
	// this covers the redfish states - 'starting', 'downloading'
	// no action is required from the callers part in this state
	FirmwareInstallInitializing = "initializing"

	// FirmwareInstallQueued indicates the device has queued the update, but has not started the update task yet
	// this covers the redfish states - 'pending', 'new'
	// no action is required from the callers part in this state
	FirmwareInstallQueued = "queued"

	// FirmwareInstallRunner indicates the device is installing the update
	// this covers the redfish states - 'running', 'stopping', 'cancelling'
	// no action is required from the callers part in this state
	FirmwareInstallRunning = "running"

	// FirmwareInstallComplete indicates the device completed the firmware install
	// this covers the redfish state - 'complete'
	FirmwareInstallComplete = "complete"

	// FirmwareInstallFailed indicates the firmware install failed
	// this covers the redfish states - 'interrupted', 'killed', 'exception', 'cancelled', 'suspended'
	FirmwareInstallFailed = "failed"

	// FirmwareInstallPowerCycleHost indicates the firmware install requires a host power cycle
	FirmwareInstallPowerCyleHost = "powercycle-host"

	// FirmwareInstallPowerCycleBMC indicates the firmware install requires a BMC power cycle
	FirmwareInstallPowerCycleBMC = "powercycle-bmc"

	FirmwareInstallUnknown = "unknown"

	// device BIOS/UEFI POST code bmclib identifiers
	POSTStateBootINIT = "boot-init/pxe"
	POSTStateUEFI     = "uefi"
	POSTStateOS       = "grub/os"
	POSTCodeUnknown   = "unknown"

	// Generic component slugs
	// Slugs are set on Device types to identify the type of component
	SlugBackplaneExpander     = "Backplane Expander"
	SlugChassis               = "Chassis"
	SlugTPM                   = "TPM"
	SlugGPU                   = "GPU"
	SlugCPU                   = "CPU"
	SlugPhysicalMem           = "PhysicalMemory"
	SlugStorageController     = "StorageController"
	SlugStorageControllers    = "StorageControllers"
	SlugBMC                   = "BMC"
	SlugBIOS                  = "BIOS"
	SlugDrive                 = "Drive"
	SlugDrives                = "Drives"
	SlugDriveTypePCIeNVMEeSSD = "NVMe PCIe SSD"
	SlugDriveTypeSATASSD      = "Sata SSD"
	SlugDriveTypeSATAHDD      = "Sata HDD"
	SlugNIC                   = "NIC"
	SlugNICs                  = "NICs"
	SlugPSU                   = "Power Supply"
	SlugPSUs                  = "Power Supplies"
	SlugCPLD                  = "CPLD"
	SlugEnclosure             = "ENCLOSURE"
	SlugUnknown               = "unknown"
)

Variables

This section is empty.

Functions

func ListSupportedVendors added in v0.2.7

func ListSupportedVendors() []string

ListSupportedVendors returns a list of supported vendors

func VendorFromProductName added in v0.5.3

func VendorFromProductName(productName string) string

VendorFromProductName attempts to identify the vendor from the given productname

Types

type BIOS added in v0.5.3

type BIOS struct {
	Description   string    `json:"description,omitempty"`
	Vendor        string    `json:"vendor,omitempty"`
	Model         string    `json:"model,omitempty"`
	SizeBytes     int64     `json:"size_bytes,omitempty"`
	CapacityBytes int64     `json:"capacity_bytes,omitempty" diff:"immutable"`
	Firmware      *Firmware `json:"firmware,omitempty"`
}

BIOS component

type BMC added in v0.5.3

type BMC struct {
	ID          string    `json:"id,omitempty"`
	Description string    `json:"description,omitempty"`
	Vendor      string    `json:"vendor,omitempty"`
	Model       string    `json:"model,omitempty"`
	NIC         *NIC      `json:"nic,omitempty"`
	Status      *Status   `json:"status,omitempty"`
	Firmware    *Firmware `json:"firmware,omitempty"`
}

BMC component

type Blade

type Blade struct {
	Serial               string
	Name                 string
	BiosVersion          string
	BmcType              string
	BmcAddress           string
	BmcVersion           string
	BmcLicenceType       string
	BmcLicenceStatus     string
	Disks                []*Disk
	Nics                 []*Nic
	BladePosition        int
	Model                string
	PowerState           string
	TempC                int
	PowerKw              float64
	Status               string
	Vendor               string
	ChassisSerial        string
	Processor            string
	ProcessorCount       int
	ProcessorCoreCount   int
	ProcessorThreadCount int
	StorageBlade         StorageBlade
	Memory               int
	FlexAddressEnabled   bool
}

Blade contains all the blade information we will expose across different vendors

type Bmc

type Bmc interface {
	// Configure interface
	Configure

	// BmcCollection interface
	BmcCollection

	CheckCredentials() error
	Close(context.Context) error
	PowerOn() (bool, error)       // PowerSetter
	PowerOff() (bool, error)      // PowerSetter
	PxeOnce() (bool, error)       // BootDeviceSetter
	PowerCycleBmc() (bool, error) // BMCResetter
	PowerCycle() (bool, error)    // PowerSetter
	UpdateCredentials(string, string)
	UpdateFirmware(string, string) (bool, string, error)
	CheckFirmwareVersion() (string, error)
}

Bmc represents all the required bmc items

type BmcCollection added in v0.2.4

type BmcCollection interface {
	BiosVersion() (string, error)
	HardwareType() string // ilo4, ilo5, idrac8 or idrac9, etc
	Version() (string, error)
	CPU() (string, int, int, int, error)
	Disks() ([]*Disk, error)
	IsBlade() (bool, error)
	License() (string, string, error)
	Memory() (int, error)
	Model() (string, error)
	Name() (string, error)
	Nics() ([]*Nic, error)
	PowerKw() (float64, error)
	PowerState() (string, error) // PowerStateGetter
	IsOn() (bool, error)         // PowerStateGetter
	Serial() (string, error)
	Status() (string, error)
	TempC() (int, error)
	Vendor() string
	Slot() (int, error)
	Screenshot() ([]byte, string, error)
	ServerSnapshot() (interface{}, error)
	ChassisSerial() (string, error)
}

BmcCollection represents the requirement of items to be collected a server

type CPLD added in v0.5.3

type CPLD struct {
	Description string    `json:"description,omitempty"`
	Vendor      string    `json:"vendor,omitempty"`
	Model       string    `json:"model,omitempty"`
	Serial      string    `json:"serial,omitempty"`
	Firmware    *Firmware `json:"firmware,omitempty"`
}

CPLD component

type CPU added in v0.5.3

type CPU struct {
	ID           string    `json:"id,omitempty"`
	Description  string    `json:"description,omitempty"`
	Vendor       string    `json:"vendor,omitempty"`
	Model        string    `json:"model,omitempty"`
	Serial       string    `json:"serial,omitempty"`
	Slot         string    `json:"slot,omitempty"`
	Architecture string    `json:"architecture,omitempty"`
	ClockSpeedHz int64     `json:"clock_speeed_hz,omitempty"`
	Cores        int       `json:"cores,omitempty"`
	Threads      int       `json:"threads,omitempty"`
	Status       *Status   `json:"status,omitempty"`
	Firmware     *Firmware `json:"firmware,omitempty"`
}

CPU component

type Chassis

type Chassis struct {
	Serial            string
	Name              string
	BmcAddress        string
	Blades            []*Blade
	StorageBlades     []*StorageBlade
	Fans              []*Fan
	Nics              []*Nic
	Psus              []*Psu
	PsuRedundancyMode string
	IsPsuRedundant    bool
	TempC             int
	PassThru          string
	Status            string
	PowerKw           float64
	Model             string
	Vendor            string
	FwVersion         string
}

Chassis contains all the chassis the information we will expose across different vendors

type Cmc added in v0.2.4

type Cmc interface {
	//  Configure interface
	Configure

	// CmcSetup interface
	CmcSetup

	// CmcCollection Interface
	CmcCollection

	ApplyCfg(*cfgresources.ResourcesConfig) error
	ChassisSnapshot() (*Chassis, error)
	CheckCredentials() error
	Close() error
	PowerCycle() (bool, error) // PowerSetter
	PowerCycleBlade(int) (bool, error)
	PowerCycleBmcBlade(int) (bool, error)
	PowerOff() (bool, error) // PowerSetter
	PowerOffBlade(int) (bool, error)
	PowerOn() (bool, error) // PowerSetter
	PowerOnBlade(int) (bool, error)
	PxeOnceBlade(int) (bool, error)
	ReseatBlade(int) (bool, error)
	UpdateCredentials(string, string)
	UpdateFirmware(string, string) (bool, string, error)
	CheckFirmwareVersion() (string, error)
}

Cmc represents all the required cmc items

type CmcCollection added in v0.2.4

type CmcCollection interface {
	Blades() ([]*Blade, error)
	HardwareType() string
	FindBladePosition(string) (int, error)
	Version() (string, error)
	Fans() ([]*Fan, error)
	IsActive() bool
	IsOn() (bool, error) // PowerStateGetter
	IsOnBlade(int) (bool, error)
	Model() (string, error)
	Name() (string, error)
	Nics() ([]*Nic, error)
	PassThru() (string, error)
	PowerKw() (float64, error)
	Psus() ([]*Psu, error)
	Serial() (string, error)
	Status() (string, error)
	IsPsuRedundant() (bool, error)
	PsuRedundancyMode() (string, error)
	StorageBlades() ([]*StorageBlade, error)
	TempC() (int, error)
	Vendor() string
}

CmcCollection represents the requirement of items to be collected from a chassis

type CmcSetup added in v0.2.4

type CmcSetup interface {
	ResourcesSetup() []string
	RemoveBladeBmcUser(string) error
	AddBladeBmcAdmin(string, string) error
	ModBladeBmcUser(string, string) error
	SetDynamicPower(bool) (bool, error)
	SetIpmiOverLan(int, bool) (bool, error)
	SetFlexAddressState(int, bool) (bool, error)
}

CmcSetup interface declares methods that are used to apply one time configuration to a Chassis.

type Configure added in v0.2.3

type Configure interface {
	Resources() []string
	User([]*cfgresources.User) error // UserCreator, UserUpdater, UserDeleter, UserReader
	Syslog(*cfgresources.Syslog) error
	Ntp(*cfgresources.Ntp) error
	Ldap(*cfgresources.Ldap) error
	LdapGroups([]*cfgresources.LdapGroup, *cfgresources.Ldap) error
	Network(*cfgresources.Network) (bool, error)
	SetLicense(*cfgresources.License) error
	Bios(*cfgresources.Bios) error
	Power(*cfgresources.Power) error
	CurrentHTTPSCert() ([]*x509.Certificate, bool, error)
	GenerateCSR(*cfgresources.HTTPSCertAttributes) ([]byte, error)
	UploadHTTPSCert([]byte, string, []byte, string) (bool, error)
}

Configure interface declares methods implemented to apply configuration to BMCs.

type Device added in v0.5.3

type Device struct {
	Oem                bool                 `json:"oem"`
	HardwareType       string               `json:"hardware_type,omitempty"`
	Vendor             string               `json:"vendor,omitempty"`
	Model              string               `json:"model,omitempty"`
	Serial             string               `json:"serial,omitempty"`
	Chassis            string               `json:"chassis,omitempty"`
	BIOS               *BIOS                `json:"bios,omitempty"`
	BMC                *BMC                 `json:"bmc,omitempty"`
	Mainboard          *Mainboard           `json:"mainboard,omitempty"`
	CPLDs              []*CPLD              `json:"cplds"`
	TPMs               []*TPM               `json:"tpms,omitempty"`
	GPUs               []*GPU               `json:"gpus,omitempty"`
	CPUs               []*CPU               `json:"cpus,omitempty"`
	Memory             []*Memory            `json:"memory,omitempty"`
	NICs               []*NIC               `json:"nics,omitempty"`
	Drives             []*Drive             `json:"drives,omitempty"`
	StorageControllers []*StorageController `json:"storage_controller,omitempty"`
	PSUs               []*PSU               `json:"power_supplies,omitempty"`
	Enclosures         []*Enclosure         `json:"enclosures,omitempty"`
	Status             *Status              `json:"status,omitempty"`
	Metadata           map[string]string    `json:"metadata,omitempty"`
}

Device type is composed of various components

func NewDevice added in v0.5.3

func NewDevice() *Device

NewDevice returns a pointer to an initialized Device type

type Discrete

type Discrete struct {
	Serial               string
	Name                 string
	BiosVersion          string
	BmcType              string
	BmcAddress           string
	BmcVersion           string
	BmcSSHReachable      bool
	BmcWEBReachable      bool
	BmcIpmiReachable     bool
	BmcLicenceType       string
	BmcLicenceStatus     string
	BmcAuth              bool
	Disks                []*Disk
	Nics                 []*Nic
	Psus                 []*Psu
	Model                string
	TempC                int
	PowerKw              float64
	PowerState           string
	Status               string
	Vendor               string
	Processor            string
	ProcessorCount       int
	ProcessorCoreCount   int
	ProcessorThreadCount int
	Memory               int
}

Discrete contains all the blade information we will expose across different vendors

type Disk

type Disk struct {
	Status    string
	Serial    string
	Type      string
	Size      string
	Model     string
	Location  string
	FwVersion string
}

Disk represents a disk device

type Drive added in v0.5.3

type Drive struct {
	ID                  string            `json:"id,omitempty"`
	ProductName         string            `json:"name,omitempty"`
	Type                string            `json:"drive_type,omitempty"`
	Description         string            `json:"description,omitempty"`
	Serial              string            `json:"serial,omitempty" diff:"identifier"`
	StorageController   string            `json:"storage_controller,omitempty"`
	Vendor              string            `json:"vendor,omitempty"`
	Model               string            `json:"model,omitempty"`
	WWN                 string            `json:"wwn,omitempty"`
	Protocol            string            `json:"protocol,omitempty"`
	CapacityBytes       int64             `json:"capacity_bytes,omitempty"`
	BlockSizeBytes      int64             `json:"block_size_bytes,omitempty"`
	CapableSpeedGbps    int64             `json:"capable_speed_gbps,omitempty"`
	NegotiatedSpeedGbps int64             `json:"negotiated_speed_gbps,omitempty"`
	Metadata            map[string]string `json:"metadata,omitempty"` // Additional metadata if any
	Oem                 bool              `json:"oem,omitempty"`      // Component is an OEM component
	Firmware            *Firmware         `json:"firmware,omitempty"`
	Status              *Status           `json:"status,omitempty"`
}

Drive component

type Enclosure added in v0.5.3

type Enclosure struct {
	ID          string    `json:"id,omitempty"`
	Description string    `json:"description,omitempty"`
	ChassisType string    `json:"chassis_type,omitempty"`
	Vendor      string    `json:"vendor,omitempty"`
	Model       string    `json:"model,omitempty"`
	Serial      string    `json:"serial,omitempty"`
	Firmware    *Firmware `json:"firmware,omitempty"`
	Status      *Status   `json:"status,omitempty"`
}

Enclosure component

type Fan added in v0.2.4

type Fan struct {
	Serial     string
	Status     string
	Position   int
	Model      string
	CurrentRPM int64
	PowerKw    float64
}

Fan represents que current status a fan

type Firmware added in v0.5.3

type Firmware struct {
	Installed  string            `json:"installed,omitempty"`
	SoftwareID string            `json:"software_id,omitempty"`
	Previous   []*Firmware       `json:"previous,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
}

Firmware struct holds firmware attributes of a device component

func NewFirmwareObj added in v0.5.3

func NewFirmwareObj() *Firmware

NewFirmwareObj returns a *Firmware object

type GPU added in v0.5.3

type GPU struct {
}

GPU component

type Mainboard added in v0.5.3

type Mainboard struct {
	ProductName string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Vendor      string    `json:"vendor,omitempty"`
	Model       string    `json:"model,omitempty"`
	Serial      string    `json:"serial,omitempty"`
	PhysicalID  string    `json:"physid,omitempty"`
	Firmware    *Firmware `json:"firmware,omitempty"`
}

Mainboard component

type Memory added in v0.5.3

type Memory struct {
	ID           string    `json:"id,omitempty"`
	Description  string    `json:"description,omitempty"`
	Slot         string    `json:"slot,omitempty"`
	Type         string    `json:"type,omitempty"`
	Vendor       string    `json:"vendor,omitempty"`
	Model        string    `json:"model,omitempty"`
	Serial       string    `json:"serial,omitempty"`
	SizeBytes    int64     `json:"size_bytes,omitempty"`
	FormFactor   string    `json:"form_factor,omitempty"`
	PartNumber   string    `json:"part_number,omitempty"`
	ClockSpeedHz int64     `json:"clock_speed_hz,omitempty"`
	Status       *Status   `json:"status,omitempty"`
	Firmware     *Firmware `json:"firmware,omitempty"`
}

Memory component

type NIC added in v0.5.3

type NIC struct {
	ID          string            `json:"id,omitempty"`
	Description string            `json:"description,omitempty"`
	Vendor      string            `json:"vendor,omitempty"`
	Model       string            `json:"model,omitempty"`
	Serial      string            `json:"serial,omitempty" diff:"identifier"`
	SpeedBits   int64             `json:"speed_bits,omitempty"`
	PhysicalID  string            `json:"physid,omitempty"`
	MacAddress  string            `json:"macaddress,omitempty"`
	Oem         bool              `json:"oem"`
	Metadata    map[string]string `json:"metadata"`
	Status      *Status           `json:"status,omitempty"`
	Firmware    *Firmware         `json:"firmware,omitempty"`
}

NIC component

type Nic

type Nic struct {
	MacAddress string
	Name       string
	Up         bool
	Speed      string
}

Nic represents a network interface devices

type PSU added in v0.5.3

type PSU struct {
	ID                 string    `json:"id,omitempty"`
	Description        string    `json:"description,omitempty"`
	Vendor             string    `json:"vendor,omitempty"`
	Model              string    `json:"model,omitempty"`
	Serial             string    `json:"serial,omitempty"`
	PowerCapacityWatts int64     `json:"power_capacity_watts,omitempty"`
	Oem                bool      `json:"oem"`
	Status             *Status   `json:"status,omitempty"`
	Firmware           *Firmware `json:"firmware,omitempty"`
}

PSU component

type Psu

type Psu struct {
	Serial     string
	CapacityKw float64
	PowerKw    float64
	Status     string
	PartNumber string
	Position   int
}

Psu represents a power supply device

type Status added in v0.5.3

type Status struct {
	Health         string
	State          string
	PostCode       int    `json:"post_code,omitempty"`
	PostCodeStatus string `json:"post_code_status,omitempty"`
}

Status is the health status of a component

type StorageBlade

type StorageBlade struct {
	Serial        string
	FwVersion     string
	BladePosition int
	Model         string
	TempC         int
	PowerKw       float64
	Status        string
	Vendor        string
	ChassisSerial string
	BladeSerial   string
}

StorageBlade contains all the storage blade information we will expose across different vendors

type StorageController added in v0.5.3

type StorageController struct {
	ID                           string            `json:"id,omitempty"`
	Description                  string            `json:"description,omitempty"`
	Vendor                       string            `json:"vendor,omitempty"`
	Model                        string            `json:"model,omitempty"`
	Serial                       string            `json:"serial,omitempty"`
	SupportedControllerProtocols string            `json:"supported_controller_protocol,omitempty"` // PCIe
	SupportedDeviceProtocols     string            `json:"supported_device_protocol,omitempty"`     // Attached device protocols - SAS, SATA
	SupportedRAIDTypes           string            `json:"supported_raid_types,omitempty"`
	PhysicalID                   string            `json:"physid,omitempty"`
	SpeedGbps                    int64             `json:"speed_gbps,omitempty"`
	Oem                          bool              `json:"oem"`
	Status                       *Status           `json:"status,omitempty"`
	Metadata                     map[string]string `json:"metadata"`
	Firmware                     *Firmware         `json:"firmware,omitempty"`
}

StorageController component

type TPM added in v0.5.3

type TPM struct {
	InterfaceType string    `json:"interface_type,omitempty"`
	Firmware      *Firmware `json:"firmware,omitempty"`
	Status        *Status   `json:"status,omitempty"`
}

TPM component

Jump to

Keyboard shortcuts

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