ilo

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

Documentation

Index

Constants

View Source
const (
	// BmcType defines the bmc model that is supported by this package
	BmcType = "ilo"

	// Ilo2 is the constant for iLO2
	Ilo2 = "ilo2"
	// Ilo3 is the constant for iLO3
	Ilo3 = "ilo3"
	// Ilo4 is the constant for iLO4
	Ilo4 = "ilo4"
	// Ilo5 is the constant for iLO5
	Ilo5 = "ilo5"
)

Variables

View Source
var TimezonesIlo4 = map[string]int{
	"CET":           368,
	"CST6CDT":       371,
	"EET":           373,
	"EST":           376,
	"EST5EDT":       377,
	"Etc/GMT":       378,
	"Etc/GMT+0":     379,
	"Etc/GMT+1":     380,
	"Etc/GMT+10":    381,
	"Etc/GMT+11":    382,
	"Etc/GMT+12":    383,
	"Etc/GMT+2":     384,
	"Etc/GMT+3":     385,
	"Etc/GMT+4":     386,
	"Etc/GMT+5":     387,
	"Etc/GMT+6":     388,
	"Etc/GMT+7":     389,
	"Etc/GMT+8":     390,
	"Etc/GMT+9":     391,
	"Etc/GMT-0":     392,
	"Etc/GMT-1":     393,
	"Etc/GMT-10":    394,
	"Etc/GMT-11":    395,
	"Etc/GMT-12":    396,
	"Etc/GMT-13":    397,
	"Etc/GMT-14":    398,
	"Etc/GMT-2":     399,
	"Etc/GMT-3":     400,
	"Etc/GMT-4":     401,
	"Etc/GMT-5":     402,
	"Etc/GMT-6":     403,
	"Etc/GMT-7":     404,
	"Etc/GMT-8":     405,
	"Etc/GMT-9":     406,
	"Etc/GMT0":      407,
	"Etc/Greenwich": 408,
	"Etc/UCT":       409,
	"Etc/Universal": 410,
	"Etc/UTC":       411,
	"GMT":           464,
	"GMT+0":         465,
	"GMT-0":         466,
	"GMT0":          467,
	"Greenwich":     468,
	"HST":           470,
	"MET":           488,
	"MST":           492,
	"MST7MDT":       493,
	"PST8PDT":       543,
	"UCT":           548,
	"Universal":     549,
	"UTC":           562,
	"WET":           564,
}

TimezonesIlo4 declares valid timezones. Important timezone ints taken from https://10.193.251.48/html/network_sntp.html?intf=0

View Source
var TimezonesIlo5 = map[string]int{
	"Etc/GMT+12":                     0,
	"Pacific/Midway":                 1,
	"US/Hawaii":                      2,
	"US/Alaska":                      3,
	"US/Pacific":                     4,
	"US/Mountain":                    5,
	"US/Central":                     6,
	"US/Eastern":                     7,
	"America/Caracas":                8,
	"Canada/Atlantic":                9,
	"Canada/Newfoundland":            10,
	"America/Argentina/Buenos_Aires": 11,
	"Atlantic/South_Georgia":         12,
	"Atlantic/Cape_Verde":            13,
	"Greenwich":                      14,
	"CET":                            15,
	"EET":                            16,
	"Asia/Kuwait":                    17,
	"Asia/Tehran":                    18,
	"Asia/Dubai":                     19,
	"Asia/Kabul":                     20,
	"Asia/Yekaterinburg":             21,
	"Asia/Kolkata":                   22,
	"Asia/Kathmandu":                 23,
	"Asia/Almaty":                    24,
	"Asia/Rangoon":                   25,
	"Asia/Bangkok":                   26,
	"Asia/Taipei":                    27,
	"Asia/Tokyo":                     28,
	"Australia/Adelaide":             29,
	"Australia/Canberra":             30,
	"Asia/Magadan":                   31,
	"Pacific/Auckland":               32,
	"Pacific/Fakaofo":                33,
	"Pacific/Kiritimati":             34,
	"Unspecified Time Zone":          35,
}

TimezonesIlo5 declares valid timezone for ilo5 devices.

Functions

This section is empty.

Types

type AccessSettings added in v0.2.4

type AccessSettings struct {
	SSHStatus                    int          `json:"ssh_status"`
	SSHPort                      int          `json:"ssh_port"`
	HTTPPort                     int          `json:"http_port"`
	HTTPSPort                    int          `json:"https_port"`
	RemoteConsolePort            int          `json:"remote_console_port"`
	VirtualMediaPort             int          `json:"virtual_media_port"`
	IpmiLanStatus                int          `json:"ipmi_lan_status"`
	IpmiPort                     int          `json:"ipmi_port"`
	SNMPSettings                 SNMPSettings `json:"snmp_settings"`
	SessionTimeout               int          `json:"session_timeout"`
	IloFunctEnabled              int          `json:"ilo_funct_enabled"`
	IloFunctRequired             int          `json:"ilo_funct_required"`
	RbsuEnabled                  int          `json:"rbsu_enabled"`
	F8LoginRequired              int          `json:"f8_login_required"`
	RbsuPostIP                   int          `json:"rbsu_post_ip"`
	SerialCliStatus              int          `json:"serial_cli_status"`
	SystemNoUart                 int          `json:"system_no_uart"`
	SerialCliSpeed               int          `json:"serial_cli_speed"`
	VspLogging                   int          `json:"vsp_logging"`
	AuthenticationFailureLogging int          `json:"authentication_failure_logging"`
	MinPassword                  int          `json:"min_password"`
	AuthFailureDelayTime         int          `json:"auth_failure_delay_time"`
	AuthNodelayFailures          int          `json:"auth_nodelay_failures"`
	ServerName                   string       `json:"server_name"`
	ServerFqdn                   string       `json:"server_fqdn"`
	DefaultLang                  string       `json:"default_lang"`
	SessionKey                   string       `json:"session_key"`
	Method                       string       `json:"method"`
}

AccessSettings declares BMC network service ports Updating these params requires the BMC to be reset.

type Directory

type Directory struct {
	ServerAddress         string   `json:"server_address"`
	ServerPort            int      `json:"server_port"`
	UserContexts          []string `json:"user_contexts"`
	AuthenticationEnabled int      `json:"authentication_enabled"`
	LocalUserAcct         int      `json:"local_user_acct"` // enable local user accounts
	EnableGroupAccount    int      `json:"enable_group_acct"`
	EnableKerberos        int      `json:"enable_kerberos"`
	KerberosKdcAddress    string   `json:"kerberos_kdc_address,omitempty"`
	KerberosRealm         string   `json:"kerberos_realm,omitempty"`
	EnableGenericLdap     int      `json:"enable_generic_ldap"`
	Method                string   `json:"method"`
	SessionKey            string   `json:"session_key"`
}

Directory struct declares LDAP configuration payload. /json/directory {"server_address":"ldap.example.com","method":"mod_dir_config","session_key":"51b01f402d65eb2f42342f6d67832989","server_port":637,"user_contexts":["ou=People,dc=example,dc=con"],"authentication_enabled":1,"enable_group_acct":1,"enable_kerberos":0,"local_user_acct":1,"enable_generic_ldap":1}

type DirectoryGroupAccts

type DirectoryGroupAccts struct {
	Groups []DirectoryGroups `json:"group_accts"`
}

DirectoryGroupAccts struct declares directory group account payload.

type DirectoryGroups

type DirectoryGroups struct {
	Dn               string `json:"dn"`
	NewDn            string `json:"new_dn,omitempty"` // same as Dn, unless being modified
	Sid              string `json:"sid,omitempty"`
	LoginPriv        int    `json:"login_priv,omitempty"`
	RemoteConsPriv   int    `json:"remote_cons_priv,omitempty"`
	VirtualMediaPriv int    `json:"virtual_media_priv,omitempty"`
	ResetPriv        int    `json:"reset_priv,omitempty"`
	ConfigPriv       int    `json:"config_priv,omitempty"`
	UserPriv         int    `json:"user_priv,omitempty"`
	Method           string `json:"method"` // add_group, mod_group, del_group
	SessionKey       string `json:"session_key"`
}

DirectoryGroups declares LDAP groups configuration payload. /json/directory_groups {"dn":"cn=hp,cn=bmcUsers","new_dn":"cn=hp,cn=bmcUsers","sid":"","login_priv":1,"remote_cons_priv":1,"virtual_media_priv":1,"reset_priv":1,"config_priv":0,"user_priv":0,"method":"mod_group","session_key":"bc2dae77e36a45fbeffce0bddd2ccabe"}

type Ilo

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

Ilo holds the status and properties of a connection to an iLO device

func New

func New(ctx context.Context, host string, username string, password string, log logr.Logger) (*Ilo, error)

New returns a new Ilo ready to be used

func NewWithOptions added in v0.5.3

func NewWithOptions(ctx context.Context, host string, username string, password string, log logr.Logger, opts ...IloOption) (*Ilo, error)

NewWithOptions returns a new Ilo with options ready to be used

func (*Ilo) ApplyCfg

func (i *Ilo) ApplyCfg(config *cfgresources.ResourcesConfig) (err error)

ApplyCfg applies configuration To be deprecated once the Configure interface is ready.

func (*Ilo) Bios added in v0.2.3

func (i *Ilo) Bios(cfg *cfgresources.Bios) error

Bios method implements the Configure interface

func (*Ilo) BiosVersion

func (i *Ilo) BiosVersion() (version string, err error)

Returns the current version of the BIOS.

func (*Ilo) CPU

func (i *Ilo) CPU() (cpu string, cpuCount int, coreCount int, hyperthreadCount int, err error)

Finds the CPUs. Returns the description, cores count, and hyperthreads count of the first CPU it finds. Returns also the CPU count. TODO: Does this make any sense?! We either return all the information about all CPUs, or just say something generic!

func (*Ilo) ChassisSerial added in v0.2.9

func (i *Ilo) ChassisSerial() (string, error)

Returns the serial number of the chassis where the blade is attached.

func (*Ilo) CheckCredentials added in v0.1.6

func (i *Ilo) CheckCredentials() (err error)

CheckCredentials verify whether the credentials are valid or not

func (*Ilo) CheckFirmwareVersion added in v0.4.14

func (i *Ilo) CheckFirmwareVersion() (version string, err error)

func (*Ilo) Close added in v0.1.6

func (i *Ilo) Close(ctx context.Context) error

Close closes the connection properly

func (*Ilo) CurrentHTTPSCert added in v0.2.4

func (i *Ilo) CurrentHTTPSCert() ([]*x509.Certificate, bool, error)

CurrentHTTPSCert returns the current x509 certficates configured on the BMC The bool value returned indicates if the BMC supports CSR generation. CurrentHTTPSCert implements the Configure interface

func (*Ilo) Disks

func (i *Ilo) Disks() (disks []*devices.Disk, err error)

Disks returns a list of disks installed on the device

func (*Ilo) FirmwareUpdateBMC added in v0.4.11

func (i *Ilo) FirmwareUpdateBMC(ctx context.Context, filePath string) error

Updates the BMC firmware, implements the Firmware interface

func (*Ilo) GenerateCSR added in v0.2.4

func (i *Ilo) GenerateCSR(cert *cfgresources.HTTPSCertAttributes) ([]byte, error)

GenerateCSR generates a CSR request on the BMC. If its the first CSR attempt - the BMC is going to take a while to generate the CSR, the response will be a 500 with the body {"message":"JS_CERT_NOT_AVAILABLE","details":null} If the configuration for the Subject has not changed and the CSR is ready a CSR is returned.

func (*Ilo) GetBIOSVersion added in v0.4.11

func (i *Ilo) GetBIOSVersion(ctx context.Context) (string, error)

BiosVersion returns the BIOS version from the BMC, implements the Firmware interface

func (*Ilo) GetBMCVersion added in v0.4.11

func (i *Ilo) GetBMCVersion(ctx context.Context) (string, error)

BMCVersion returns the BMC version, implements the Firmware interface

func (*Ilo) HardwareType added in v0.3.3

func (i *Ilo) HardwareType() (bmcType string)

HardwareType returns the type of bmc we are talking to

func (*Ilo) IsBlade

func (i *Ilo) IsBlade() (isBlade bool, err error)

Returns whether the current hardware is a blade.

func (*Ilo) IsOn added in v0.1.6

func (i *Ilo) IsOn() (bool, error)

IsOn tells if a machine is currently powered on

func (*Ilo) Ldap added in v0.2.3

func (i *Ilo) Ldap(cfg *cfgresources.Ldap) (err error)

Ldap applies LDAP configuration params. Ldap implements the Configure interface.

func (*Ilo) LdapGroups added in v0.4.14

func (i *Ilo) LdapGroups(cfgGroups []*cfgresources.LdapGroup, cfgLdap *cfgresources.Ldap) (err error)

LdapGroups applies LDAP Group/Role related configuration LdapGroups implements the Configure interface. nolint: gocyclo

func (*Ilo) License

func (i *Ilo) License() (name string, licType string, err error)

Returns the ILO's license information.

func (*Ilo) Memory

func (i *Ilo) Memory() (mem int, err error)

Returns the total amount of memory of the server.

func (*Ilo) Model

func (i *Ilo) Model() (model string, err error)

Model returns the device model

func (*Ilo) Name

func (i *Ilo) Name() (name string, err error)

Returns the name of this server from the ILO point of view.

func (*Ilo) Network added in v0.2.3

func (i *Ilo) Network(cfg *cfgresources.Network) (reset bool, err error)

Network method implements the Configure interface nolint: gocyclo

func (*Ilo) Nics

func (i *Ilo) Nics() (nics []*devices.Nic, err error)

Nics returns all found Nics in the device

func (*Ilo) Ntp added in v0.2.3

func (i *Ilo) Ntp(cfg *cfgresources.Ntp) (err error)

Ntp applies NTP configuration params Ntp implements the Configure interface.

func (*Ilo) Power added in v0.3.5

func (i *Ilo) Power(cfg *cfgresources.Power) error

Power settings

func (*Ilo) PowerCycle added in v0.1.6

func (i *Ilo) PowerCycle() (bool, error)

PowerCycle reboots the machine via bmc

func (*Ilo) PowerCycleBmc added in v0.1.6

func (i *Ilo) PowerCycleBmc() (bool, error)

PowerCycleBmc reboots the bmc we are connected to

func (*Ilo) PowerKw

func (i *Ilo) PowerKw() (power float64, err error)

PowerKw returns the current power usage in Kw

func (*Ilo) PowerOff added in v0.1.6

func (i *Ilo) PowerOff() (bool, error)

PowerOff power off the machine via bmc

func (*Ilo) PowerOn added in v0.1.6

func (i *Ilo) PowerOn() (bool, error)

PowerOn power on the machine via bmc

func (*Ilo) PowerState

func (i *Ilo) PowerState() (state string, err error)

PowerState returns the current power state of the machine

func (*Ilo) Psus

func (i *Ilo) Psus() (psus []*devices.Psu, err error)

Psus returns a list of psus installed on the device

func (*Ilo) PxeOnce added in v0.1.6

func (i *Ilo) PxeOnce() (bool, error)

PxeOnce makes the machine to boot via pxe once

func (*Ilo) Resources added in v0.2.3

func (i *Ilo) Resources() []string

Resources returns a slice of supported resources and the order they are to be applied in.

func (*Ilo) Screenshot added in v0.2.2

func (i *Ilo) Screenshot() (response []byte, extension string, err error)

Screenshot returns a thumbnail of video display from the bmc.

func (*Ilo) Serial

func (i *Ilo) Serial() (serial string, err error)

Serial returns the device serial

func (*Ilo) ServerSnapshot

func (i *Ilo) ServerSnapshot() (server interface{}, err error)

ServerSnapshot do best effort to populate the server data and returns a blade or discrete

func (*Ilo) SetLicense added in v0.2.3

func (i *Ilo) SetLicense(cfg *cfgresources.License) (err error)

SetLicense applies license configuration params SetLicense implements the Configure interface.

func (*Ilo) Slot added in v0.2.9

func (i *Ilo) Slot() (slot int, err error)

Slot returns the current slot within the chassis

func (*Ilo) Status

func (i *Ilo) Status() (health string, err error)

Returns the health status from the ILO point of view.

func (*Ilo) Syslog added in v0.2.3

func (i *Ilo) Syslog(cfg *cfgresources.Syslog) (err error)

Syslog applies the Syslog configuration resource Syslog implements the Configure interface

func (*Ilo) TempC

func (i *Ilo) TempC() (temp int, err error)

Returns the current temperature of the server.

func (*Ilo) UpdateCredentials

func (i *Ilo) UpdateCredentials(username string, password string)

UpdateCredentials updates login credentials

func (*Ilo) UpdateFirmware added in v0.2.4

func (i *Ilo) UpdateFirmware(source, file string) (bool, string, error)

UpdateFirmware updates the bmc firmware

func (*Ilo) UploadHTTPSCert added in v0.2.4

func (i *Ilo) UploadHTTPSCert(cert []byte, certFileName string, key []byte, keyFileName string) (bool, error)

UploadHTTPSCert uploads the given CRT cert, UploadHTTPSCert implements the Configure interface. return true if the bmc requires a reset.

func (*Ilo) User added in v0.2.3

func (i *Ilo) User(users []*cfgresources.User) (err error)

User applies the User configuration resource. If the user exists, it updates the password. User implements the Configure interface.

func (*Ilo) Vendor

func (i *Ilo) Vendor() (vendor string)

Vendor returns bmc's vendor

func (*Ilo) Version added in v0.3.3

func (i *Ilo) Version() (bmcVersion string, err error)

Version returns the version of the bmc we are running

type IloOption added in v0.5.3

type IloOption func(*Ilo)

IloOption is a type that can configure an *Ilo

func WithSecureTLS added in v0.5.3

func WithSecureTLS(rootCAs *x509.CertPool) IloOption

WithSecureTLS enforces trusted TLS connections, with an optional CA certificate pool. Using this option with an nil pool uses the system CAs.

type LicenseInfo added in v0.2.2

type LicenseInfo struct {
	Key        string `json:"key,omitempty"`
	Method     string `json:"method,omitempty"`
	SessionKey string `json:"session_key,omitempty"`
}

LicenseInfo declares License information payload. POST https://10.183.244.173/json/license_info

type NetworkIPv4 added in v0.2.4

type NetworkIPv4 struct {
	Interface                   int    `json:"interface"`
	PendingChange               int    `json:"pending_change"`
	DhcpEnabled                 int    `json:"dhcp_enabled"`
	UseDhcpSuppliedGateway      int    `json:"use_dhcp_supplied_gateway"`
	UseDhcpSuppliedDNS          int    `json:"use_dhcp_supplied_dns"`
	UseDhcpSuppliedWins         int    `json:"use_dhcp_supplied_wins"`
	UseDhcpSuppliedStaticRoutes int    `json:"use_dhcp_supplied_static_routes"`
	UseDhcpSuppliedDomainName   int    `json:"use_dhcp_supplied_domain_name"`
	UseDhcpSuppliedTimeServers  int    `json:"use_dhcp_supplied_time_servers"`
	IPAddress                   string `json:"ip_address"`
	SubnetMask                  string `json:"subnet_mask"`
	GatewayIPAddress            string `json:"gateway_ip_address"`
	PingGateway                 int    `json:"ping_gateway"`
	RegWinsServer               int    `json:"reg_wins_server"`
	DNS                         []ipv4 `json:"dns"`
	Wins                        []ipv4 `json:"wins"`
	RegDdnsServer               int    `json:"reg_ddns_server"`
	StaticRouteDest             []ipv4 `json:"static_route_dest"`
	StaticRouteMask             []ipv4 `json:"static_route_mask"`
	StaticRouteGate             []ipv4 `json:"static_route_gate"`
	Wcount                      int    `json:"wcount"`
	SessionKey                  string `json:"session_key"`
	Method                      string `json:"method"`
}

NetworkIPv4 sets IPv4 network settings The BMC would require a reset if these params are updated.

type NetworkSntp

type NetworkSntp struct {
	Interface                   int    `json:"interface"`
	PendingChange               int    `json:"pending_change"`
	NicWcount                   int    `json:"nic_wcount"`
	TzWcount                    int    `json:"tz_wcount"`
	Ipv4Disabled                int    `json:"ipv4_disabled"`
	Ipv6Disabled                int    `json:"ipv6_disabled"`
	DhcpEnabled                 int    `json:"dhcp_enabled"`
	Dhcp6Enabled                int    `json:"dhcp6_enabled"`
	UseDhcpSuppliedTimeServers  int    `json:"use_dhcp_supplied_time_servers"`
	UseDhcp6SuppliedTimeServers int    `json:"use_dhcp6_supplied_time_servers"`
	Sdn1WCount                  int    `json:"sdn1_wcount"`
	Sdn2WCount                  int    `json:"sdn2_wcount"`
	SntpServer1                 string `json:"sntp_server1"`
	SntpServer2                 string `json:"sntp_server2"`
	TimePropagate               int    `json:"time_propagate"` // propagate time from OA to blade
	OurZone                     int    `json:"our_zone"`       // 368 - see Timezones
	Method                      string `json:"method"`         // set_sntp
	SessionKey                  string `json:"session_key,omitempty"`
}

NetworkSntp struct declares network services configuration payload. /json/network_sntp

type PowerRegulator added in v0.3.5

type PowerRegulator struct {
	PowerMode  string `json:"prmode"`
	SessionKey string `json:"session_key"`
	Method     string `json:"method"`
}

PowerRegulator declares json payload to set power regulator mode

type RemoteSyslog

type RemoteSyslog struct {
	SyslogEnable int    `json:"syslog_enable"`
	SyslogPort   int    `json:"syslog_port"`
	Method       string `json:"method"` // syslog_save
	SyslogServer string `json:"syslog_server"`
	SessionKey   string `json:"session_key,omitempty"`
}

RemoteSyslog struct declares Syslog configuration payload. Set syslog params POST https://10.193.251.48/json/remote_syslog

type SNMPSettings added in v0.2.4

type SNMPSettings struct {
	SnmpPort                int  `json:"snmp_port"`
	TrapPort                int  `json:"trap_port"`
	SnmpExternalDisableIlo4 *int `json:"snmp_external_disable,omitempty"` // this is iLO4
	SnmpExternalEnabledIlo5 *int `json:"snmp_external_enabled,omitempty"` // this is iLO5
}

SNMPSettings declares BMC SNMP params

type UserInfo

type UserInfo struct {
	ID               int    `json:"id,omitempty"`
	LoginName        string `json:"login_name,omitempty"`
	UserName         string `json:"user_name,omitempty"`
	Password         string `json:"password,omitempty"`
	RemoteConsPriv   int    `json:"remote_cons_priv,omitempty"`
	VirtualMediaPriv int    `json:"virtual_media_priv,omitempty"`
	ResetPriv        int    `json:"reset_priv,omitempty"`
	ConfigPriv       int    `json:"config_priv,omitempty"`
	UserPriv         int    `json:"user_priv,omitempty"`
	LoginPriv        int    `json:"login_priv,omitempty"`
	Method           string `json:"method"` // mod_user, add_user, del_user
	UserID           int    `json:"user_id,omitempty"`
	SessionKey       string `json:"session_key,omitempty"`
}

UserInfo struct declares payload for a user account. Add/Modify/Delete a user account POST https://10.193.251.48/json/user_info

type Users

type Users struct {
	UsersInfo []UserInfo `json:"users"`
}

Users struct declares payload to un/marshal user accounts.

Jump to

Keyboard shortcuts

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