ilo

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: Apache-2.0 Imports: 26 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(ip string, username string, password string) (ilo *Ilo, err error)

New returns a new Ilo 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)

BiosVersion returns the current version of the bios

func (*Ilo) BmcType

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

BmcType returns the type of bmc we are talking to

func (*Ilo) BmcVersion

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

BmcVersion returns the version of the bmc we are running

func (*Ilo) CPU

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

CPU returns the cpu, cores and hyperthreads of the server

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) Close added in v0.1.6

func (i *Ilo) Close() (err 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) 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) GetCollection added in v0.2.4

func (i *Ilo) GetCollection() devices.BmcCollection

GetCollection returns itself as a configure interface to avoid using reflect

func (*Ilo) GetConfigure added in v0.2.4

func (i *Ilo) GetConfigure() devices.Configure

GetConfigure returns itself as a configure interface to avoid using reflect

func (*Ilo) IsBlade

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

IsBlade returns if the current hardware is a blade or not

func (*Ilo) IsOn added in v0.1.6

func (i *Ilo) IsOn() (status bool, err 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) LdapGroup added in v0.2.3

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

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

func (*Ilo) License

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

License returns the iLO's license information

func (*Ilo) Memory

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

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

Name 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) PowerCycle added in v0.1.6

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

PowerCycle reboots the machine via bmc

func (*Ilo) PowerCycleBmc added in v0.1.6

func (i *Ilo) PowerCycleBmc() (status bool, err 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() (status bool, err error)

PowerOff power off the machine via bmc

func (*Ilo) PowerOn added in v0.1.6

func (i *Ilo) PowerOn() (status bool, err 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() (status bool, err 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) Status

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

Status returns health string status from the bmc

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)

TempC returns the current temperature of the machine

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) (status bool, err 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 users password, User implements the Configure interface. nolint: gocyclo

func (*Ilo) Vendor

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

Vendor returns bmc's vendor

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 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"`
	SnmpExternalDisable int `json:"snmp_external_disable"`
}

SNMPSettings declares BMC SNMP params

type UserInfo

type UserInfo struct {
	ID               int    `json:"id,int,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,int,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