ilo-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rubocop.yml +57 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +1 -0
- data/Gemfile +2 -0
- data/LICENSE +201 -0
- data/README.md +346 -0
- data/Rakefile +23 -0
- data/ilo-sdk.gemspec +29 -0
- data/lib/ilo-sdk.rb +15 -0
- data/lib/ilo-sdk/client.rb +65 -0
- data/lib/ilo-sdk/helpers/account_service_helper.rb +70 -0
- data/lib/ilo-sdk/helpers/bios_helper.rb +146 -0
- data/lib/ilo-sdk/helpers/boot_settings_helper.rb +74 -0
- data/lib/ilo-sdk/helpers/chassis_helper.rb +67 -0
- data/lib/ilo-sdk/helpers/computer_details_helper.rb +158 -0
- data/lib/ilo-sdk/helpers/computer_system_helper.rb +51 -0
- data/lib/ilo-sdk/helpers/date_time_helper.rb +72 -0
- data/lib/ilo-sdk/helpers/firmware_update.rb +32 -0
- data/lib/ilo-sdk/helpers/log_entry_helper.rb +53 -0
- data/lib/ilo-sdk/helpers/manager_network_protocol_helper.rb +32 -0
- data/lib/ilo-sdk/helpers/power_helper.rb +42 -0
- data/lib/ilo-sdk/helpers/secure_boot_helper.rb +32 -0
- data/lib/ilo-sdk/helpers/service_root_helper.rb +48 -0
- data/lib/ilo-sdk/helpers/snmp_service_helper.rb +41 -0
- data/lib/ilo-sdk/helpers/virtual_media_helper.rb +66 -0
- data/lib/ilo-sdk/rest.rb +165 -0
- data/lib/ilo-sdk/version.rb +13 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 48561d660167040166f3a0b2c0334ff8f3e8441d
|
4
|
+
data.tar.gz: b04c812919a0302e047202e792a4dddc205c78f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b3fcf018e1e6702c827329605bd560487d2b139fcbaf827a8aaf15cf8ba8cb4562ba3099b36045f775c7dc026fe5a22e0dcbc4adfac391ecb9623b807287b3c1
|
7
|
+
data.tar.gz: 0f6c11f5495382b6690ddb3432cdadb22a883c15cec08ea91582c1aca3c29020c8e5917e7fea77a43443e566f193f1ca21ba147dc54f8b26e424e4f04576d112
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
Berksfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
*.bundle
|
20
|
+
*.so
|
21
|
+
*.o
|
22
|
+
*.a
|
23
|
+
mkmf.log
|
24
|
+
*.sw*
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# See default at https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
2
|
+
|
3
|
+
Metrics/ClassLength:
|
4
|
+
Max: 200
|
5
|
+
|
6
|
+
Metrics/LineLength:
|
7
|
+
Max: 155
|
8
|
+
|
9
|
+
Metrics/ModuleLength:
|
10
|
+
Max: 150
|
11
|
+
|
12
|
+
Metrics/ParameterLists:
|
13
|
+
Max: 6
|
14
|
+
|
15
|
+
Style/FileName:
|
16
|
+
Exclude:
|
17
|
+
- 'lib/ilo-sdk.rb'
|
18
|
+
|
19
|
+
Style/IndentationWidth:
|
20
|
+
Width: 2
|
21
|
+
|
22
|
+
Style/VariableName:
|
23
|
+
EnforcedStyle: snake_case
|
24
|
+
|
25
|
+
|
26
|
+
Style/AccessorMethodName:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
Style/ClassAndModuleCamelCase:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Style/EmptyLines:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
Style/RescueModifier:
|
36
|
+
Enabled: false
|
37
|
+
|
38
|
+
Style/EmptyLinesAroundBlockBody:
|
39
|
+
Enabled: false
|
40
|
+
|
41
|
+
Style/EmptyLinesAroundClassBody:
|
42
|
+
Enabled: false
|
43
|
+
|
44
|
+
Metrics/AbcSize:
|
45
|
+
Enabled: false
|
46
|
+
|
47
|
+
Metrics/CyclomaticComplexity:
|
48
|
+
Enabled: false
|
49
|
+
|
50
|
+
Metrics/MethodLength:
|
51
|
+
Enabled: false
|
52
|
+
|
53
|
+
Metrics/PerceivedComplexity:
|
54
|
+
Enabled: false
|
55
|
+
|
56
|
+
Performance/Casecmp:
|
57
|
+
Enabled: false
|
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2016 Hewlett Packard Enterprise Development LP
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,346 @@
|
|
1
|
+
# Ruby SDK for HPE iLO
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/ilo-sdk.svg)](https://badge.fury.io/rb/ilo-sdk)
|
3
|
+
|
4
|
+
Software Development Kit for interacting with the Hewlett Packard Enterprise iLO (Integrated Lights-Out) server management technology.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
- Require the gem in your Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'ilo-sdk'
|
12
|
+
```
|
13
|
+
|
14
|
+
Then run `$ bundle install`
|
15
|
+
- Or run the command:
|
16
|
+
|
17
|
+
```bash
|
18
|
+
$ gem install ilo-sdk
|
19
|
+
```
|
20
|
+
|
21
|
+
|
22
|
+
## Client
|
23
|
+
Everything you do with this API happens through a client object.
|
24
|
+
Creating the client object is the first step; then you can perform actions on the client.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'ilo-sdk'
|
28
|
+
client = ILO_SDK::Client.new(
|
29
|
+
host: 'https://ilo.example.com',
|
30
|
+
user: 'Administrator', # This is the default
|
31
|
+
password: 'secret123',
|
32
|
+
ssl_enabled: true, # This is the default and strongly encouraged
|
33
|
+
logger: Logger.new(STDOUT), # This is the default
|
34
|
+
log_level: :info, # This is the default
|
35
|
+
)
|
36
|
+
```
|
37
|
+
|
38
|
+
:lock: Tip: Check the file permissions because the password is stored in clear-text.
|
39
|
+
|
40
|
+
### Custom logging
|
41
|
+
The default logger is a standard logger to STDOUT, but if you want to specify your own, you can. However, your logger must implement the following methods:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
debug(String)
|
45
|
+
info(String)
|
46
|
+
warn(String)
|
47
|
+
error(String)
|
48
|
+
level=(Symbol, etc.) # The parameter here will be the log_level attribute
|
49
|
+
```
|
50
|
+
|
51
|
+
|
52
|
+
## Actions
|
53
|
+
Actions are performed on the client, and defined in the [helper modules](lib/ilo-sdk/helpers).
|
54
|
+
|
55
|
+
#### Account Service
|
56
|
+
```ruby
|
57
|
+
# Get list of users:
|
58
|
+
users = client.get_users
|
59
|
+
|
60
|
+
# Create a user:
|
61
|
+
client.create_user('user1', 'password123')
|
62
|
+
|
63
|
+
# Change a user's password:
|
64
|
+
client.change_password('user1', 'newpassword123')
|
65
|
+
|
66
|
+
# Delete a user:
|
67
|
+
client.delete_user('user1')
|
68
|
+
```
|
69
|
+
|
70
|
+
#### Bios
|
71
|
+
```ruby
|
72
|
+
# Get BIOS base configuration:
|
73
|
+
baseconfig = client.get_bios_baseconfig
|
74
|
+
|
75
|
+
# Revert BIOS:
|
76
|
+
client.revert_bios
|
77
|
+
|
78
|
+
# Get UEFI shell startup settings:
|
79
|
+
uefi_shell_startup = client.get_uefi_shell_startup
|
80
|
+
|
81
|
+
# Set UEFI shell startup settings:
|
82
|
+
uefi_shell_startup_location = 'Auto'
|
83
|
+
uefi_shell_startup_url = 'http://wwww.uefi.com'
|
84
|
+
client.uefi_shell_startup('Enabled', uefi_shell_startup_location, uefi_shell_startup_url)
|
85
|
+
|
86
|
+
# Get BIOS DHCP settings:
|
87
|
+
bios_dhcp = client.get_bios_dhcp
|
88
|
+
|
89
|
+
# Set BIOS DHCP settings:
|
90
|
+
ipv4_address = '10.1.1.111'
|
91
|
+
ipv4_gateway = '10.1.1.0'
|
92
|
+
ipv4_primary_dns = '10.1.1.1'
|
93
|
+
ipv4_secondary_dns = '10.1.1.2'
|
94
|
+
ipv4_subnet_mark = '255.255.255.0'
|
95
|
+
client.set_bios_dhcp('Disabled', ipv4_address, ipv4_gateway, ipv4_primary_dns, ipv4_secondary_dns, ipv4_subnet_mark)
|
96
|
+
|
97
|
+
# Get the URL boot file:
|
98
|
+
url_boot_file = client.get_url_boot_file
|
99
|
+
|
100
|
+
# Set the URL boot file:
|
101
|
+
client.set_url_boot_file('http://www.urlbootfile.iso')
|
102
|
+
|
103
|
+
# Get BIOS service settings:
|
104
|
+
bios_service_settings = client.get_bios_service
|
105
|
+
|
106
|
+
# Set BIOS service settings:
|
107
|
+
service_name = 'my_name'
|
108
|
+
service_email = 'my_name@hpe.com'
|
109
|
+
client.set_bios_service(service_name, service_email)
|
110
|
+
```
|
111
|
+
|
112
|
+
#### Boot Settings
|
113
|
+
```ruby
|
114
|
+
# Get boot order base configuration:
|
115
|
+
baseconfig = client.get_boot_baseconfig
|
116
|
+
|
117
|
+
# Revert the boot:
|
118
|
+
client.revert_boot
|
119
|
+
|
120
|
+
# Get boot order:
|
121
|
+
boot_order = client.get_boot_order
|
122
|
+
|
123
|
+
# Set boot order:
|
124
|
+
client.set_boot_order([
|
125
|
+
"Generic.USB.1.1",
|
126
|
+
"NIC.LOM.1.1.IPv4",
|
127
|
+
"NIC.LOM.1.1.IPv6",
|
128
|
+
"NIC.Slot.1.1.IPv6",
|
129
|
+
"HD.Emb.5.2",
|
130
|
+
"HD.Emb.5.1",
|
131
|
+
"NIC.Slot.1.1.IPv4"
|
132
|
+
])
|
133
|
+
|
134
|
+
# Get temporary boot order:
|
135
|
+
temporary_boot_order = client.get_temporary_boot_order
|
136
|
+
|
137
|
+
# Set temporary boot order:
|
138
|
+
boot_source_override_target = 'CD'
|
139
|
+
client.set_temporary_boot_order(boot_source_override_target)
|
140
|
+
```
|
141
|
+
|
142
|
+
#### Chassis
|
143
|
+
```ruby
|
144
|
+
# Get power metrics information:
|
145
|
+
power_metrics = client.get_power_metrics
|
146
|
+
|
147
|
+
# Get thermal metrics information:
|
148
|
+
thermal_metrics = client.get_thermal_metrics
|
149
|
+
```
|
150
|
+
|
151
|
+
#### Computer Details
|
152
|
+
```ruby
|
153
|
+
# Get computer details (including general, network, and array controller details):
|
154
|
+
computer_details = client.get_computer_details
|
155
|
+
|
156
|
+
# Get general computer details:
|
157
|
+
general_details = client.get_general_computer_details
|
158
|
+
|
159
|
+
# Get computer network details:
|
160
|
+
network_details = client.get_computer_network_details
|
161
|
+
|
162
|
+
# Get array controller details:
|
163
|
+
array_controller_details = client.get_array_controller_details
|
164
|
+
```
|
165
|
+
|
166
|
+
#### Computer System
|
167
|
+
```ruby
|
168
|
+
# Get the computer system asset tag:
|
169
|
+
asset_tag = client.get_asset_tag
|
170
|
+
|
171
|
+
# Set the computer system asset tag:
|
172
|
+
client.set_asset_tag('HP001')
|
173
|
+
|
174
|
+
# Get the indicator led state:
|
175
|
+
indicator_led = client.get_indicator_led
|
176
|
+
|
177
|
+
# Set the indicator led state:
|
178
|
+
client.set_indicator_led('Lit')
|
179
|
+
```
|
180
|
+
|
181
|
+
#### Date Time
|
182
|
+
```ruby
|
183
|
+
# Get the time zone:
|
184
|
+
time_zone = client.get_time_zone
|
185
|
+
|
186
|
+
# Set the time zone:
|
187
|
+
client.set_time_zone('Africa/Abidjan')
|
188
|
+
|
189
|
+
# Get whether or not NTP servers are in use (true or false):
|
190
|
+
ntp_server_use = client.get_ntp
|
191
|
+
|
192
|
+
# Set whether or not to use NTP servers:
|
193
|
+
client.set_ntp(true)
|
194
|
+
|
195
|
+
# Get a list of NTP servers:
|
196
|
+
ntp_servers = client.get_ntp_servers
|
197
|
+
|
198
|
+
# Set the NTP servers:
|
199
|
+
ntp_servers = ['10.1.1.1', '10.1.1.2']
|
200
|
+
client.set_ntp_server(ntp_servers)
|
201
|
+
```
|
202
|
+
|
203
|
+
#### Firmware
|
204
|
+
```ruby
|
205
|
+
# Get the firmware version:
|
206
|
+
fw_version = client.get_fw_version
|
207
|
+
|
208
|
+
# Set the firmware URI for a firmware upgrade:
|
209
|
+
client.set_fw_upgrade('www.firmwareupgrade.com')
|
210
|
+
```
|
211
|
+
|
212
|
+
#### Log Entry
|
213
|
+
```ruby
|
214
|
+
# Clear a specific type of logs:
|
215
|
+
log_type = 'IEL'
|
216
|
+
client.clear_logs(log_type)
|
217
|
+
|
218
|
+
# Check to see if a specific type of logs are empty:
|
219
|
+
empty = client.logs_empty?(log_type)
|
220
|
+
|
221
|
+
# Get a specific type of logs based on severity level and duration:
|
222
|
+
severity_level = 'OK'
|
223
|
+
duration = 10 # hours
|
224
|
+
logs = client.get_log(severity_level, duration, log_type)
|
225
|
+
```
|
226
|
+
|
227
|
+
#### Manager Network Protocol
|
228
|
+
```ruby
|
229
|
+
# Get the minutes until session timeout:
|
230
|
+
timeout = client.get_timeout
|
231
|
+
|
232
|
+
# Set the minutes until session timeout:
|
233
|
+
client.set_timeout(60)
|
234
|
+
```
|
235
|
+
|
236
|
+
#### Power
|
237
|
+
```ruby
|
238
|
+
# Get the power state of the system:
|
239
|
+
power_state = client.get_power_state
|
240
|
+
|
241
|
+
# Set the power state of the system:
|
242
|
+
client.set_power_state('On')
|
243
|
+
|
244
|
+
# Reset the iLO:
|
245
|
+
client.reset_ilo
|
246
|
+
```
|
247
|
+
|
248
|
+
#### Secure Boot
|
249
|
+
```ruby
|
250
|
+
# Get whether or not UEFI secure boot is enabled:
|
251
|
+
uefi_secure_boot = client.get_uefi_secure_boot
|
252
|
+
|
253
|
+
# Set whether or not UEFI secure boot is enabled:
|
254
|
+
client.set_uefi_secure_boot(true)
|
255
|
+
```
|
256
|
+
|
257
|
+
#### Service Root
|
258
|
+
```ruby
|
259
|
+
# Get the schema information with a given prefix:
|
260
|
+
schema_prefix = 'Account'
|
261
|
+
schema = client.get_schema(schema_prefix)
|
262
|
+
|
263
|
+
# Get the registry information with a given prefix:
|
264
|
+
registry_prefix = 'Base'
|
265
|
+
registry = client.get_registry(registry_prefix)
|
266
|
+
```
|
267
|
+
|
268
|
+
#### SNMP
|
269
|
+
```ruby
|
270
|
+
# Get the SNMP mode:
|
271
|
+
snmp_mode = client.get_snmp_mode
|
272
|
+
|
273
|
+
# Get whether or not SNMP Alerts are enabled:
|
274
|
+
snmp_alerts_enabled = client.get_snmp_alerts_enabled
|
275
|
+
|
276
|
+
# Set the SNMP mode and whether or not SNMP Alerts are enabled:
|
277
|
+
snmp_mode = 'Agentless'
|
278
|
+
snmp_alerts_enabled = true
|
279
|
+
client.set_snmp(snmp_mode, snmp_alerts_enabled)
|
280
|
+
```
|
281
|
+
|
282
|
+
#### Virtual Media
|
283
|
+
```ruby
|
284
|
+
# Get the virtual media information:
|
285
|
+
virtual_media = client.get_virtual_media
|
286
|
+
|
287
|
+
# Get whether or not virtual media is inserted for a certain id:
|
288
|
+
id = 1
|
289
|
+
virtual_media_inserted = client.virtual_media_inserted?(id)
|
290
|
+
|
291
|
+
# Insert virtual media at a certain id:
|
292
|
+
image = 'http://10.254.224.38:5000/ubuntu-15.04-desktop-amd64.iso'
|
293
|
+
client.insert_virtual_media(id, image)
|
294
|
+
|
295
|
+
# Eject virtual media at a certain id:
|
296
|
+
client.eject_virtual_media(id)
|
297
|
+
```
|
298
|
+
|
299
|
+
## Custom requests
|
300
|
+
In most cases, interacting with the client object is enough, but sometimes you need to make your own custom requests to the iLO.
|
301
|
+
This project makes it extremely easy to do with some built-in methods for the client object. Here are some examples:
|
302
|
+
|
303
|
+
```ruby
|
304
|
+
# Get a list of schemas:
|
305
|
+
response = client.rest_api(:get, '/rest/v1/Schemas')
|
306
|
+
# or even more simple:
|
307
|
+
response = client.rest_get('/rest/v1/Schemas')
|
308
|
+
|
309
|
+
# Then we can validate the response and convert the response body into a hash...
|
310
|
+
data = client.response_handler(response)
|
311
|
+
```
|
312
|
+
|
313
|
+
This example is about as basic as it gets, but you can make any type of iLO request.
|
314
|
+
If a resource does not do what you need, this will allow you to do it.
|
315
|
+
Please refer to the documentation and [code](lib/ilo-sdk/rest.rb) for complete list of methods and information about how to use them.
|
316
|
+
|
317
|
+
## License
|
318
|
+
This project is licensed under the Apache 2.0 license. Please see [LICENSE](LICENSE) for more info.
|
319
|
+
|
320
|
+
|
321
|
+
## Contributing and feature requests
|
322
|
+
**Contributing:** You know the drill. Fork it, branch it, change it, commit it, and pull-request it.
|
323
|
+
We are passionate about improving this project, and glad to accept help to make it better.
|
324
|
+
|
325
|
+
NOTE: We reserve the right to reject changes that we feel do not fit the scope of this project, so for feature additions, please open an issue to discuss your ideas before doing the work.
|
326
|
+
|
327
|
+
**Feature Requests:** If you have a need that is not met by the current implementation, please let us know (via a new issue).
|
328
|
+
This feedback is crucial for us to deliver a useful product. Do not assume we have already thought of everything, because we assure you that is not the case.
|
329
|
+
|
330
|
+
### Building the Gem
|
331
|
+
First run `$ bundle` (requires the bundler gem), then...
|
332
|
+
- To build only, run `$ rake build`.
|
333
|
+
- To build and install the gem, run `$ rake install`.
|
334
|
+
|
335
|
+
### Testing
|
336
|
+
- RuboCop: `$ rake rubocop`
|
337
|
+
- Unit: `$ rake spec`
|
338
|
+
- All test: `$ rake test`
|
339
|
+
|
340
|
+
Note: run `$ rake -T` to get a list of all the available rake tasks.
|
341
|
+
|
342
|
+
## Authors
|
343
|
+
- Anirudh Gupta
|
344
|
+
- Bik Bajwa - [@bikbajwa](https://github.com/bikbajwa)
|
345
|
+
- Jared Smartt - [@jsmartt](https://github.com/jsmartt)
|
346
|
+
- Vivek Bhatia
|