Documentation ¶
Index ¶
- Constants
- type CapturePreview
- type ChassisInfo
- type ConfigDateTime
- type ConfigLdap
- type ConfigPort
- type ConfigSyslog
- type ConfigUser
- type SupermicroX
- func (s *SupermicroX) ApplyCfg(config *cfgresources.ResourcesConfig) (err error)
- func (s *SupermicroX) Bios(cfg *cfgresources.Bios) (err error)
- func (s *SupermicroX) BiosVersion() (version string, err error)
- func (s *SupermicroX) CPU() (cpu string, cpuCount int, coreCount int, hyperthreadCount int, err error)
- func (s *SupermicroX) ChassisSerial() (serial string, err error)
- func (s *SupermicroX) CheckCredentials() (err error)
- func (s *SupermicroX) CheckFirmwareVersion() (version string, err error)
- func (s *SupermicroX) Close(ctx context.Context) (err error)
- func (s *SupermicroX) CurrentHTTPSCert() ([]*x509.Certificate, bool, error)
- func (s *SupermicroX) Disks() (disks []*devices.Disk, err error)
- func (s *SupermicroX) FirmwareUpdateBMC(ctx context.Context, filePath string) error
- func (s *SupermicroX) GenerateCSR(cert *cfgresources.HTTPSCertAttributes) ([]byte, error)
- func (s *SupermicroX) GetBIOSVersion(ctx context.Context) (string, error)
- func (s *SupermicroX) GetBMCVersion(ctx context.Context) (string, error)
- func (s *SupermicroX) HardwareType() (model string)
- func (s *SupermicroX) IsBlade() (isBlade bool, err error)
- func (s *SupermicroX) IsOn() (status bool, err error)
- func (s *SupermicroX) Ldap(cfgLdap *cfgresources.Ldap) error
- func (s *SupermicroX) LdapGroups(cfgGroups []*cfgresources.LdapGroup, cfgLdap *cfgresources.Ldap) (err error)
- func (s *SupermicroX) License() (name string, licType string, err error)
- func (s *SupermicroX) Memory() (mem int, err error)
- func (s *SupermicroX) Model() (model string, err error)
- func (s *SupermicroX) Name() (name string, err error)
- func (s *SupermicroX) Network(cfg *cfgresources.Network) (reset bool, err error)
- func (s *SupermicroX) Nics() (nics []*devices.Nic, err error)
- func (s *SupermicroX) Ntp(cfg *cfgresources.Ntp) (err error)
- func (s *SupermicroX) Power(cfg *cfgresources.Power) (err error)
- func (s *SupermicroX) PowerCycle() (status bool, err error)
- func (s *SupermicroX) PowerCycleBmc() (status bool, err error)
- func (s *SupermicroX) PowerKw() (power float64, err error)
- func (s *SupermicroX) PowerOff() (status bool, err error)
- func (s *SupermicroX) PowerOn() (status bool, err error)
- func (s *SupermicroX) PowerState() (state string, err error)
- func (s *SupermicroX) PxeOnce() (status bool, err error)
- func (s *SupermicroX) Resources() []string
- func (s *SupermicroX) Screenshot() (response []byte, extension string, err error)
- func (s *SupermicroX) Serial() (serial string, err error)
- func (s *SupermicroX) ServerSnapshot() (server interface{}, err error)
- func (s *SupermicroX) SetLicense(cfg *cfgresources.License) (err error)
- func (s *SupermicroX) Slot() (slot int, err error)
- func (s *SupermicroX) Status() (health string, err error)
- func (s *SupermicroX) Syslog(cfg *cfgresources.Syslog) (err error)
- func (s *SupermicroX) TempC() (temp int, err error)
- func (s *SupermicroX) UpdateCredentials(username string, password string)
- func (s *SupermicroX) UpdateFirmware(source, file string) (status bool, output string, err error)
- func (s *SupermicroX) UploadHTTPSCert(cert []byte, certFileName string, key []byte, keyFileName string) (bool, error)
- func (s *SupermicroX) User(users []*cfgresources.User) (err error)
- func (s *SupermicroX) Vendor() (vendor string)
- func (s *SupermicroX) Version() (bmcVersion string, err error)
- type SupermicroXOption
- type URLRedirect
Constants ¶
const ( // BmcType defines the bmc model that is supported by this package BmcType = "supermicrox" // X10 is the constant for x10 servers X10 = "x10" // X11 is the constant for x11 servers X11 = "x11" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapturePreview ¶
type CapturePreview struct { IkvmPreview string `url:"IKVM_PREVIEW.XML"` // IKVM_PREVIEW.XML=(0,0) TimeStamp string `url:"time_stamp"` // time_stamp=Wed Oct 17 2018 15:56:08 GMT+0200 (CEST) }
CapturePreview declares payload to capture screen previews.
type ChassisInfo ¶ added in v0.4.13
type ConfigDateTime ¶
type ConfigDateTime struct { Op string `url:"op"` // op=config_date_time Timezone int `url:"timezone"` // timezone=-7200 DstEn bool `url:"dst_en,int"` // dst_en=0 Enable string `url:"ntp"` // ntp=on NtpServerPrimary string `url:"ntp_server_pri"` // ntp_server_pri=ntp0.example.com NtpServerSecondary string `url:"ntp_server_2nd"` // ntp_server_2nd=ntp1.example.com Year int `url:"year"` // year=2018 Month int `url:"month"` // month=6 Day int `url:"day"` // day=1 Hour int `url:"hour"` // hour=05 Minute int `url:"min"` // min=49 Second int `url:"sec"` // sec=42 TimeStamp string `url:"time_stamp"` // time_stamp=Fri%20Jun%2001%202018%2009%3A58%3A19%20GMT%2B0200%20(CEST) }
ConfigDateTime declares payload to configure time parameters. /cgi/op.cgi
type ConfigLdap ¶
type ConfigLdap struct { Op string `url:"op"` // op=config_ldap Enable string `url:"en_ldap"` // en_ldap=on EnableSsl bool `url:"enSSL,int"` // enSSL=1 LdapIP string `url:"ldapip"` // ldapip=10.252.13.5 BaseDn string `url:"basedn"` // basedn=cn=Supermicro,cn=bmcUsers LdapPort int `url:"ldapport"` // ldapport=636 BindDn string `url:"bind_dn"` // bind_dn=undefined <- default value BindPassword string `url:"bind_pwd"` // bind_pwd=******** <- default value }
ConfigLdap declares payload to configure LDAP. /cgi/op.cgi
type ConfigPort ¶
type ConfigPort struct { Op string `url:"op"` // op=config_port HTTPPort int `url:"HTTP_PORT"` // HTTP_PORT=80 HTTPSPort int `url:"HTTPS_PORT"` // HTTPS_PORT=443 IkvmPort int `url:"IKVM_PORT"` // IKVM_PORT=5900 VMPort int `url:"VM_PORT"` // VM_PORT=623 <- virtual media port SSHPort int `url:"SSH_PORT"` // SSH_PORT=22 WsmanPort int `url:"WSMAN_PORT"` // WSMAN_PORT=5985 SnmpPort int `url:"SNMP_PORT"` // SNMP_PORT=161 IkvmEnable bool `url:"IKVM_SERVICE,int"` // IKVM_SERVICE=1 VMEnable bool `url:"VM_SERVICE,int"` // VM_SERVICE=1 SSHEnable bool `url:"SSH_SERVICE,int"` // SSH_SERVICE=1 SnmpEnable bool `url:"SNMP_SERVICE,int"` // SNMP_SERVICE=1 WsmanEnable bool `url:"WSMAN_SERVICE,int"` // WSMAN_SERVICE=0 SslRedirectEnable bool `url:"SSL_REDIRECT,int"` // SSL_REDIRECT=1 // contains filtered or unexported fields }
ConfigPort declares payload to configure services.
type ConfigSyslog ¶
type ConfigSyslog struct { Op string `url:"op"` // op=config_syslog SyslogIP1 string `url:"syslogip1"` // syslogip1=10.01.12.1 SyslogIP2 string `url:"syslogip2"` // syslogip1=10.01.12.2 SyslogIP3 string `url:"syslogip3"` // syslogip1=10.01.12.3 SyslogPort1 int `url:"syslogport1"` // syslogport1=514 SyslogPort2 int `url:"syslogport2"` // syslogport2=0 SyslogPort3 int `url:"syslogport3"` // syslogport3=0 Enable bool `url:"enable,int"` // enable=1 }
ConfigSyslog declares payload to configure syslog parameters. /cgi/op.cgi
type ConfigUser ¶
type ConfigUser struct { Username string `url:"username"` UserID int `url:"original_username"` // username integer Password string `url:"password,omitempty"` NewPrivilege int `url:"new_privilege,omitempty"` // 4 == administrator, 3 == operator }
ConfigUser declares payload to configure User accounts. /cgi/config_user.cgi
type SupermicroX ¶
type SupermicroX struct {
// contains filtered or unexported fields
}
SupermicroX holds the status and properties of a connection to a supermicro bmc
func New ¶
func New(ctx context.Context, ip string, username string, password string, log logr.Logger) (sm *SupermicroX, err error)
New returns a new SupermicroX instance ready to be used
func NewWithOptions ¶ added in v0.5.3
func NewWithOptions(ctx context.Context, ip string, username string, password string, log logr.Logger, opts ...SupermicroXOption) (*SupermicroX, error)
NewWithOptions returns a new SupermicroX with options ready to be used
func (*SupermicroX) ApplyCfg ¶
func (s *SupermicroX) ApplyCfg(config *cfgresources.ResourcesConfig) (err error)
ApplyCfg implements the Bmc interface this is to be deprecated.
func (*SupermicroX) Bios ¶
func (s *SupermicroX) Bios(cfg *cfgresources.Bios) (err error)
Bios implements the Configure interface.
func (*SupermicroX) BiosVersion ¶
func (s *SupermicroX) BiosVersion() (version string, err error)
BiosVersion returns the current version of the bios
func (*SupermicroX) CPU ¶
func (s *SupermicroX) CPU() (cpu string, cpuCount int, coreCount int, hyperthreadCount int, err error)
CPU returns the cpu, cores and hyperthreads of the server
func (*SupermicroX) ChassisSerial ¶
func (s *SupermicroX) ChassisSerial() (serial string, err error)
ChassisSerial returns the serial number of the chassis where the blade is attached
func (*SupermicroX) CheckCredentials ¶
func (s *SupermicroX) CheckCredentials() (err error)
CheckCredentials verify whether the credentials are valid or not
func (*SupermicroX) CheckFirmwareVersion ¶ added in v0.4.14
func (s *SupermicroX) CheckFirmwareVersion() (version string, err error)
func (*SupermicroX) Close ¶
func (s *SupermicroX) Close(ctx context.Context) (err error)
Close closes the connection properly
func (*SupermicroX) CurrentHTTPSCert ¶
func (s *SupermicroX) CurrentHTTPSCert() ([]*x509.Certificate, bool, error)
CurrentHTTPSCert returns the current x509 certficates configured on the BMC the bool value returned is set to true if the BMC support CSR generation. CurrentHTTPSCert implements the Configure interface.
func (*SupermicroX) Disks ¶
func (s *SupermicroX) Disks() (disks []*devices.Disk, err error)
Disks returns a list of disks installed on the device
func (*SupermicroX) FirmwareUpdateBMC ¶ added in v0.4.11
func (s *SupermicroX) FirmwareUpdateBMC(ctx context.Context, filePath string) error
Updates the BMC firmware, implements the Firmware interface
func (*SupermicroX) GenerateCSR ¶
func (s *SupermicroX) GenerateCSR(cert *cfgresources.HTTPSCertAttributes) ([]byte, error)
GenerateCSR generates a CSR request on the BMC. GenerateCSR implements the Configure interface.
func (*SupermicroX) GetBIOSVersion ¶ added in v0.4.11
func (s *SupermicroX) GetBIOSVersion(ctx context.Context) (string, error)
BiosVersion returns the BIOS version from the BMC, implements the Firmware interface
func (*SupermicroX) GetBMCVersion ¶ added in v0.4.11
func (s *SupermicroX) GetBMCVersion(ctx context.Context) (string, error)
BMCVersion returns the BMC version, implements the Firmware interface
func (*SupermicroX) HardwareType ¶
func (s *SupermicroX) HardwareType() (model string)
HardwareType returns just Model id string - supermicrox TODO(ncode): Juliano of the future, please refactor everything related to HardwareType,
so that we don't silently swallow errors like you just for this commit
func (*SupermicroX) IsBlade ¶
func (s *SupermicroX) IsBlade() (isBlade bool, err error)
IsBlade returns if the current hardware is a blade or not
func (*SupermicroX) IsOn ¶
func (s *SupermicroX) IsOn() (status bool, err error)
IsOn tells if a machine is currently powered on
func (*SupermicroX) Ldap ¶
func (s *SupermicroX) Ldap(cfgLdap *cfgresources.Ldap) error
Ldap applies LDAP configuration params. Ldap implements the Configure interface. Configuration for LDAP is applied in the LdapGroup method, since supermicros just support a single LDAP group.
func (*SupermicroX) LdapGroups ¶ added in v0.4.14
func (s *SupermicroX) LdapGroups(cfgGroups []*cfgresources.LdapGroup, cfgLdap *cfgresources.Ldap) (err error)
LdapGroups applies LDAP and LDAP Group/Role related configuration, LdapGroups implements the Configure interface. Supermicro does not have any separate configuration for Ldap groups just for generic ldap nolint: gocyclo
func (*SupermicroX) License ¶
func (s *SupermicroX) License() (name string, licType string, err error)
License returns the iLO's license information
func (*SupermicroX) Memory ¶
func (s *SupermicroX) Memory() (mem int, err error)
Memory returns the total amount of memory of the server
func (*SupermicroX) Model ¶
func (s *SupermicroX) Model() (model string, err error)
Model returns the device model
func (*SupermicroX) Name ¶
func (s *SupermicroX) Name() (name string, err error)
Name returns the hostname of the machine
func (*SupermicroX) Network ¶
func (s *SupermicroX) Network(cfg *cfgresources.Network) (reset bool, err error)
Network method implements the Configure interface applies various network parameters.
func (*SupermicroX) Nics ¶
func (s *SupermicroX) Nics() (nics []*devices.Nic, err error)
Nics returns all found Nics in the device
func (*SupermicroX) Ntp ¶
func (s *SupermicroX) Ntp(cfg *cfgresources.Ntp) (err error)
Ntp applies NTP configuration params Ntp implements the Configure interface.
func (*SupermicroX) Power ¶ added in v0.3.5
func (s *SupermicroX) Power(cfg *cfgresources.Power) (err error)
Power implemented the Configure interface
func (*SupermicroX) PowerCycle ¶
func (s *SupermicroX) PowerCycle() (status bool, err error)
PowerCycle reboots the machine via bmc
func (*SupermicroX) PowerCycleBmc ¶
func (s *SupermicroX) PowerCycleBmc() (status bool, err error)
PowerCycleBmc reboots the bmc we are connected to
func (*SupermicroX) PowerKw ¶
func (s *SupermicroX) PowerKw() (power float64, err error)
PowerKw returns the current power usage in Kw
func (*SupermicroX) PowerOff ¶
func (s *SupermicroX) PowerOff() (status bool, err error)
PowerOff power off the machine via bmc
func (*SupermicroX) PowerOn ¶
func (s *SupermicroX) PowerOn() (status bool, err error)
PowerOn power on the machine via bmc
func (*SupermicroX) PowerState ¶
func (s *SupermicroX) PowerState() (state string, err error)
PowerState returns the current power state of the machine
func (*SupermicroX) PxeOnce ¶
func (s *SupermicroX) PxeOnce() (status bool, err error)
PxeOnce makes the machine to boot via pxe once
func (*SupermicroX) Resources ¶
func (s *SupermicroX) Resources() []string
Resources returns a slice of supported resources and the order they are to be applied in.
func (*SupermicroX) Screenshot ¶
func (s *SupermicroX) Screenshot() (response []byte, extension string, err error)
Screenshot returns a thumbnail of video display from the bmc. 1. request capture preview. 2. sleep for 3 seconds to give ikvm time to ensure preview was captured 3. request for preview.
func (*SupermicroX) Serial ¶
func (s *SupermicroX) Serial() (serial string, err error)
Serial returns the device serial
func (*SupermicroX) ServerSnapshot ¶
func (s *SupermicroX) ServerSnapshot() (server interface{}, err error)
ServerSnapshot do best effort to populate the server data and returns a blade or discrete nolint: gocyclo
func (*SupermicroX) SetLicense ¶
func (s *SupermicroX) SetLicense(cfg *cfgresources.License) (err error)
SetLicense implements the Configure interface.
func (*SupermicroX) Slot ¶
func (s *SupermicroX) Slot() (slot int, err error)
Slot returns the current slot within the chassis
func (*SupermicroX) Status ¶
func (s *SupermicroX) Status() (health string, err error)
Status returns health string status from the bmc
func (*SupermicroX) Syslog ¶
func (s *SupermicroX) Syslog(cfg *cfgresources.Syslog) (err error)
Syslog applies the Syslog configuration resource Syslog implements the Configure interface this also enables alerts from the BMC
func (*SupermicroX) TempC ¶
func (s *SupermicroX) TempC() (temp int, err error)
TempC returns the current temperature of the machine
func (*SupermicroX) UpdateCredentials ¶
func (s *SupermicroX) UpdateCredentials(username string, password string)
UpdateCredentials updates login credentials
func (*SupermicroX) UpdateFirmware ¶
func (s *SupermicroX) UpdateFirmware(source, file string) (status bool, output string, err error)
UpdateFirmware updates the bmc firmware
func (*SupermicroX) UploadHTTPSCert ¶
func (s *SupermicroX) UploadHTTPSCert(cert []byte, certFileName string, key []byte, keyFileName string) (bool, error)
UploadHTTPSCert uploads the given CRT cert, UploadHTTPSCert implements the Configure interface. 1. Upload the certificate and key pair 2. delay for a second (to let the BMC process the certificate) 3. Get the BMC to validate the certificate: SSL_VALIDATE.XML (0,0) 4. delay for a second 5. Request for the current: SSL_STATUS.XML (0,0)
func (*SupermicroX) User ¶
func (s *SupermicroX) User(users []*cfgresources.User) (err error)
User applies the User configuration resource, if the user exists, it updates the users password, User implements the Configure interface. supermicro user accounts start with 1, account 0 which is a large empty string :\. nolint: gocyclo
func (*SupermicroX) Vendor ¶
func (s *SupermicroX) Vendor() (vendor string)
Vendor returns bmc's vendor
func (*SupermicroX) Version ¶
func (s *SupermicroX) Version() (bmcVersion string, err error)
Version returns the version of the bmc we are running
type SupermicroXOption ¶ added in v0.5.3
type SupermicroXOption func(*SupermicroX)
SupermicroXOption is a type that can configure a *SupermicroX
func WithSecureTLS ¶ added in v0.5.3
func WithSecureTLS(rootCAs *x509.CertPool) SupermicroXOption
WithSecureTLS enforces trusted TLS connections, with an optional CA certificate pool. Using this option with an nil pool uses the system CAs.
type URLRedirect ¶
type URLRedirect struct { URLName string `url:"url_name"` // url_name=Snapshot URLType string `url:"url_type"` // url_type=img TimeStamp string `url:"time_stamp"` // time_stamp=Wed Oct 17 2018 15:56:08 GMT+0200 (CEST) }
URLRedirect declares payload sent when capturing screen previews