oneview-sdk 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -15
- data/README.md +8 -1
- data/Rakefile +65 -195
- data/lib/oneview-sdk.rb +2 -1
- data/lib/oneview-sdk/cli.rb +28 -1
- data/lib/oneview-sdk/resource/api300/synergy/os_deployment_plan.rb +1 -1
- data/lib/oneview-sdk/scmb.rb +71 -0
- data/lib/oneview-sdk/version.rb +1 -1
- data/oneview-sdk.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cc2cbbd0f9d00dbf62c661169c514f42206a68f
|
4
|
+
data.tar.gz: 821a796fbaf24f17b6ebe4795505ceb3c74f618e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85a0c2c7245423eecb8ebf9159e2c601917731e2caeb18d1d175162ae731373683ca2d569e1fdb1153166cb8ae33c21f78773dbd93ef9bcec7c68a6bd2ff141d
|
7
|
+
data.tar.gz: 450a60b26b39e64011522917b87f296cd85fa3e766337f7dfacaf226d4a39a05c1668bcc2f7c9b664f3e9252a2508f742931a679097fa503308bfabd607f84cf
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
|
1
|
+
## v4.3.0
|
2
|
+
|
3
|
+
#### New Features:
|
4
|
+
- Added SCMB module and CLI command
|
5
|
+
|
6
|
+
#### Bug fixes & Enhancements:
|
7
|
+
- [#222](https://github.com/HewlettPackard/oneview-sdk-ruby/issues/222) Error listing the OS Deployment Plans from OneView
|
8
|
+
|
9
|
+
## v4.2.0
|
2
10
|
|
3
11
|
#### New Resources:
|
4
12
|
- OS Deployment Plan
|
@@ -16,7 +24,7 @@
|
|
16
24
|
#### Design changes:
|
17
25
|
- Architecture for future API500 support. Features for API500 are not yet supported.
|
18
26
|
|
19
|
-
|
27
|
+
## v4.1.0
|
20
28
|
|
21
29
|
#### New Resources:
|
22
30
|
Added full support to Image Streamer Rest API version 300:
|
@@ -71,7 +79,7 @@ Added full support to Image Streamer Rest API version 300:
|
|
71
79
|
- Deployment Plan (unimplemented)
|
72
80
|
- Golden Image (unimplemented)
|
73
81
|
|
74
|
-
|
82
|
+
## v3.1.0
|
75
83
|
Added full support to OneView Rest API version 300 for the hardware variants C7000 and Synergy to the already existing features:
|
76
84
|
- Interconnect
|
77
85
|
- Logical Interconnect
|
@@ -127,12 +135,12 @@ Added full support to OneView Rest API version 300 for the hardware variants C70
|
|
127
135
|
- Unmanaged devices
|
128
136
|
|
129
137
|
# v3.0.0
|
130
|
-
|
138
|
+
#### Notes
|
131
139
|
This is the Third major version of the Ruby SDK for HPE OneView. It features a split in the API support, allowing for C7000 and Synergy hardware variants to be used, while maintaining compatibility to older versions. There are some code improvements applied throughout the release, as well as additional endpoints support.
|
132
140
|
This version of this SDK officially supports OneView appliances version 3.00.00 or higher, using the OneView Rest API version 300.
|
133
141
|
Support is provided for C7000 and Synergy enclosure types.
|
134
142
|
|
135
|
-
|
143
|
+
#### Major changes
|
136
144
|
1. Added full support to OneView Rest API version 300 for the hardware variants C7000 and Synergy to the already existing features:
|
137
145
|
- Connection template
|
138
146
|
- Datacenter
|
@@ -176,23 +184,23 @@ Added full support to OneView Rest API version 300 for the hardware variants C70
|
|
176
184
|
- Split features into API modules for each hardware variant
|
177
185
|
- Fixed/updated/added CLI commands
|
178
186
|
|
179
|
-
|
187
|
+
## v2.2.1
|
180
188
|
- Fixed issue #88 (firmware bundle file size). Uses multipart-post now
|
181
189
|
|
182
|
-
|
190
|
+
## v2.2.0
|
183
191
|
- Added the 'rest' and 'update' commands to the CLI
|
184
192
|
- Removed the --force option from the create_from_file CLI command
|
185
193
|
|
186
|
-
|
194
|
+
## v2.1.0
|
187
195
|
- Fixed issue with the :resource_named method for OneViewSDK::Resource in Ruby 2.3
|
188
196
|
|
189
197
|
# v2.0.0
|
190
|
-
|
198
|
+
#### Notes
|
191
199
|
This is the second version of the Ruby SDK for HPE OneView. It was given support to the major features of OneView, refactor in some of the already existing code, and also a full set of exceptions to make some common exceptions more explicit in the debugging process.
|
192
200
|
This version of this SDK officially supports OneView appliances version 2.00.00 or higher, using the OneView Rest API version 200.
|
193
201
|
For now only C7000 enclosure types are being supported.
|
194
202
|
|
195
|
-
|
203
|
+
#### Major changes
|
196
204
|
1. Added full support to the already existing features:
|
197
205
|
- Server Profile
|
198
206
|
- Server Profile Template
|
@@ -213,7 +221,7 @@ Added full support to OneView Rest API version 300 for the hardware variants C70
|
|
213
221
|
- Server hardware types
|
214
222
|
3. New exceptions to address the most common issues (Check them in *lib/oneview-sdk/resource/exceptions.rb*)
|
215
223
|
|
216
|
-
|
224
|
+
#### Breaking changes
|
217
225
|
1. Refactored some method names that may cause incompatibility with older SDK versions. Due to the nature of OneView, the `create` and `delete` methods did not fit the physical infrastructure elements like Enclosures, or Switches, so they now have `add` and `remove` methods that act the same as before, but now it leaves no margin to misunderstand that OneView could actually create these resources. They are:
|
218
226
|
- Datacenters
|
219
227
|
- Enclosure
|
@@ -229,7 +237,7 @@ Added full support to OneView Rest API version 300 for the hardware variants C70
|
|
229
237
|
- Switches
|
230
238
|
- Unmanaged devices
|
231
239
|
|
232
|
-
|
240
|
+
#### Features supported
|
233
241
|
- Ethernet network
|
234
242
|
- FC network
|
235
243
|
- FCOE network
|
@@ -265,13 +273,13 @@ Added full support to OneView Rest API version 300 for the hardware variants C70
|
|
265
273
|
- Unmanaged devices
|
266
274
|
|
267
275
|
# v1.0.0
|
268
|
-
|
276
|
+
#### Notes
|
269
277
|
This is the first release of the OneView SDK in Ruby and it adds full support to some core features listed bellow, with some execeptions that are explicit.
|
270
278
|
This version of this SDK supports OneView appliances version 2.00.00 or higher, using the OneView Rest API version 200.
|
271
279
|
For now it only supports C7000 enclosure types.
|
272
280
|
|
273
281
|
|
274
|
-
|
282
|
+
#### Features supported
|
275
283
|
- Ethernet Network
|
276
284
|
- FC Network
|
277
285
|
- FCoE Network
|
@@ -292,7 +300,7 @@ Added full support to OneView Rest API version 300 for the hardware variants C70
|
|
292
300
|
- Server Profile Template (CRUD supported)
|
293
301
|
- Server Hardware (CRUD Supported)
|
294
302
|
|
295
|
-
|
303
|
+
#### Known issues
|
296
304
|
The integration tests may warn about 3 issues:
|
297
305
|
|
298
306
|
1. OneviewSDK::LogicalInterconnect Firmware Updates perform the actions Stage
|
data/README.md
CHANGED
@@ -12,7 +12,7 @@ The OneView SDK provides a Ruby library to easily interact with HPE OneView and
|
|
12
12
|
- Require the gem in your Gemfile:
|
13
13
|
|
14
14
|
```ruby
|
15
|
-
gem 'oneview-sdk', '~> 4.
|
15
|
+
gem 'oneview-sdk', '~> 4.3'
|
16
16
|
```
|
17
17
|
|
18
18
|
Then run `$ bundle install`
|
@@ -410,6 +410,13 @@ $ oneview-sdk-ruby cert import https://oneview.example.com
|
|
410
410
|
Cert added to '/home/users/user1/.oneview-sdk-ruby/trusted_certs.cer'
|
411
411
|
```
|
412
412
|
|
413
|
+
##### Subscribe to the OneView State Change Message Bus (SCMB):
|
414
|
+
|
415
|
+
```bash
|
416
|
+
$ oneview-sdk-ruby scmb
|
417
|
+
$ oneview-sdk-ruby scmb -r 'scmb.ethernet-networks.#'
|
418
|
+
```
|
419
|
+
|
413
420
|
## License
|
414
421
|
This project is licensed under the Apache 2.0 license. Please see [LICENSE](LICENSE) for more info.
|
415
422
|
|
data/Rakefile
CHANGED
@@ -17,11 +17,24 @@ require 'rubocop/rake_task'
|
|
17
17
|
|
18
18
|
task default: :spec
|
19
19
|
spec_pattern = 'spec/**/*_spec.rb'
|
20
|
+
integration_pattern = 'spec/integration/resource/**/*_spec.rb'
|
21
|
+
integration_i3s_pattern = 'spec/integration/image-streamer/**/*_spec.rb'
|
22
|
+
system_pattern = 'spec/system/**/*_spec.rb'
|
20
23
|
def_spec_options = '--color '
|
21
24
|
def_int_spec_options = '-f d --color '
|
22
25
|
|
26
|
+
# Run RuboCop before integration/system tests if ENV['RUBOCOP_FIRST'] is set
|
27
|
+
def rubocop_first
|
28
|
+
return Rake::Task[:rubocop].invoke if ENV['RUBOCOP_FIRST']
|
29
|
+
puts "Note: Set ENV['RUBOCOP_FIRST'] to run RuboCop before any integration or system tests\n\n"
|
30
|
+
end
|
31
|
+
|
32
|
+
RuboCop::RakeTask.new do |task|
|
33
|
+
task.options << '--display-cop-names'
|
34
|
+
end
|
35
|
+
|
23
36
|
desc 'Run unit tests only'
|
24
|
-
RSpec::Core::RakeTask.new(:
|
37
|
+
RSpec::Core::RakeTask.new(:unit) do |spec|
|
25
38
|
spec.pattern = spec_pattern
|
26
39
|
spec.rspec_opts = def_spec_options
|
27
40
|
spec.rspec_opts << ' --tag ~integration'
|
@@ -29,228 +42,85 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
29
42
|
spec.rspec_opts << ' --tag ~integration_i3s'
|
30
43
|
end
|
31
44
|
|
32
|
-
desc '
|
33
|
-
|
34
|
-
spec.pattern = spec_pattern
|
35
|
-
spec.rspec_opts = def_int_spec_options
|
36
|
-
spec.rspec_opts << ' --tag integration'
|
37
|
-
end
|
38
|
-
|
39
|
-
desc 'Run integration creation tests only'
|
40
|
-
RSpec::Core::RakeTask.new('spec:integration:create') do |spec|
|
41
|
-
spec.pattern = 'spec/**/*create_spec.rb'
|
42
|
-
spec.rspec_opts = def_int_spec_options
|
43
|
-
spec.rspec_opts << ' --tag integration'
|
44
|
-
end
|
45
|
-
|
46
|
-
desc 'Run integration update tests only'
|
47
|
-
RSpec::Core::RakeTask.new('spec:integration:update') do |spec|
|
48
|
-
spec.pattern = 'spec/**/*update_spec.rb'
|
49
|
-
spec.rspec_opts = def_int_spec_options
|
50
|
-
spec.rspec_opts << ' --tag integration'
|
51
|
-
end
|
45
|
+
desc 'Alias for "unit"'
|
46
|
+
task spec: [:unit]
|
52
47
|
|
53
|
-
desc 'Run integration
|
54
|
-
RSpec::Core::RakeTask.new(
|
55
|
-
spec.pattern =
|
48
|
+
desc 'Run integration tests only'
|
49
|
+
RSpec::Core::RakeTask.new(:integration) do |spec|
|
50
|
+
spec.pattern = integration_pattern
|
56
51
|
spec.rspec_opts = def_int_spec_options
|
57
52
|
spec.rspec_opts << ' --tag integration'
|
53
|
+
rubocop_first
|
58
54
|
end
|
59
55
|
|
60
|
-
desc 'Run
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
desc 'Run System tests for specified model & API. Defaults to model C7000 and API 300.'
|
68
|
-
task 'spec:system:api_version_model', [:api, :model] do |_t, spec|
|
69
|
-
args = {}
|
70
|
-
args['model'] = spec['model'] || 'c7000'
|
71
|
-
args['api'] = spec['api'] || 300
|
72
|
-
spec_pattern = "spec/system/**/api#{args['api']}/#{args['model']}/*_spec.rb"
|
73
|
-
spec_pattern = 'spec/system/**/api200/*_spec.rb' if args['api'] == '200'
|
74
|
-
Rake::Task['spec:system'].invoke
|
56
|
+
desc 'Run integration tests (filtered). Default: [*,**,*]'
|
57
|
+
task 'integration:only', [:action, :type, :api_ver, :variant] do |_t, args|
|
58
|
+
args.with_defaults(action: '*', type: '**', api_ver: '*', variant: '**')
|
59
|
+
pattern = "#{args['api_ver']}/#{args['type']}/#{args['action']}" if args['api_ver'] == '200'
|
60
|
+
pattern ||= "#{args['api_ver']}/#{args['variant']}/#{args['type']}/#{args['action']}"
|
61
|
+
integration_pattern = "spec/integration/resource/api#{pattern}_spec.rb"
|
62
|
+
Rake::Task[:integration].invoke
|
75
63
|
end
|
76
64
|
|
77
|
-
desc '
|
78
|
-
task '
|
79
|
-
|
80
|
-
|
81
|
-
spec_pattern = 'spec/system/**/api200/*_spec.rb' if args == '200'
|
82
|
-
Rake::Task['spec:system'].invoke
|
65
|
+
desc 'Integration tests for the specified path'
|
66
|
+
task 'integration:path', [:path] do |_t, args|
|
67
|
+
integration_pattern = args['path']
|
68
|
+
Rake::Task[:integration].invoke
|
83
69
|
end
|
84
70
|
|
85
|
-
desc 'Run
|
86
|
-
RSpec::Core::RakeTask.new('
|
87
|
-
spec.pattern =
|
71
|
+
desc 'Run Image Streamer integration tests'
|
72
|
+
RSpec::Core::RakeTask.new('integration_i3s') do |spec|
|
73
|
+
spec.pattern = integration_i3s_pattern
|
88
74
|
spec.rspec_opts = def_int_spec_options
|
89
|
-
spec.rspec_opts << ' --tag
|
90
|
-
|
91
|
-
|
92
|
-
desc 'Run System tests Light Profile for specified model & API. Defaults to model C7000 and API 300.'
|
93
|
-
task 'spec:system:light:api_version_model', [:api, :model] do |_t, spec|
|
94
|
-
args = {}
|
95
|
-
args['model'] = spec['model'] || 'c7000'
|
96
|
-
args['api'] = spec['api'] || 300
|
97
|
-
spec_pattern = "spec/system/light_profile/api#{args['api']}/#{args['model']}/*_spec.rb"
|
98
|
-
spec_pattern = 'spec/system/light_profile/api200/*_spec.rb' if args['api'] == '200'
|
99
|
-
Rake::Task['spec:system'].invoke
|
100
|
-
end
|
101
|
-
|
102
|
-
desc 'Run System tests Light Profile for specified API. Defaults to API 300.'
|
103
|
-
task 'spec:system:light:api_version', [:api] do |_t, spec|
|
104
|
-
args = spec['api'] || 300
|
105
|
-
spec_pattern = "spec/system/light_profile/api#{args}/**/*_spec.rb"
|
106
|
-
spec_pattern = 'spec/system/light_profile/api200/*_spec.rb' if args == '200'
|
107
|
-
Rake::Task['spec:system'].invoke
|
108
|
-
end
|
109
|
-
|
110
|
-
desc 'Run System tests Medium Profile'
|
111
|
-
RSpec::Core::RakeTask.new('spec:system:medium') do |spec|
|
112
|
-
spec.pattern = 'spec/system/medium_profile/**/*_spec.rb'
|
113
|
-
spec.rspec_opts = def_int_spec_options
|
114
|
-
spec.rspec_opts << ' --tag system'
|
75
|
+
spec.rspec_opts << ' --tag integration_i3s'
|
76
|
+
rubocop_first
|
115
77
|
end
|
116
78
|
|
117
|
-
desc 'Run
|
118
|
-
task '
|
119
|
-
args
|
120
|
-
|
121
|
-
args['
|
122
|
-
|
123
|
-
spec_pattern = 'spec/system/medium_profile/api200/*_spec.rb' if args['api'] == '200'
|
124
|
-
Rake::Task['spec:system'].invoke
|
79
|
+
desc 'Run Image Streamer integration tests (filtered). Default: [,**,*]'
|
80
|
+
task 'integration_i3s:only', [:action, :type, :api_ver] do |_t, args|
|
81
|
+
args.with_defaults(action: '', type: '**', api_ver: '*')
|
82
|
+
Rake::Task[:rubocop].invoke if ENV['RUBOCOP_FIRST']
|
83
|
+
integration_i3s_pattern = "spec/integration/image-streamer/api#{args['api_ver']}/#{args['type']}/*#{args['action']}_spec.rb"
|
84
|
+
Rake::Task['integration_i3s'].invoke
|
125
85
|
end
|
126
86
|
|
127
|
-
desc 'Run
|
128
|
-
task '
|
129
|
-
|
130
|
-
|
131
|
-
spec_pattern = 'spec/system/medium_profile/api200/*_spec.rb' if args == '200'
|
132
|
-
Rake::Task['spec:system'].invoke
|
87
|
+
desc 'Run Image Streamer integration tests for the specified path'
|
88
|
+
task 'integration_i3s:path', [:path] do |_t, args|
|
89
|
+
integration_i3s_pattern = args['path']
|
90
|
+
Rake::Task['integration_i3s'].invoke
|
133
91
|
end
|
134
92
|
|
135
|
-
desc 'Run
|
136
|
-
RSpec::Core::RakeTask.new(
|
137
|
-
spec.pattern =
|
93
|
+
desc 'Run system integration tests'
|
94
|
+
RSpec::Core::RakeTask.new(:system) do |spec|
|
95
|
+
spec.pattern = system_pattern
|
138
96
|
spec.rspec_opts = def_int_spec_options
|
139
97
|
spec.rspec_opts << ' --tag system'
|
98
|
+
rubocop_first
|
140
99
|
end
|
141
100
|
|
142
|
-
desc 'Run
|
143
|
-
task '
|
144
|
-
args
|
145
|
-
args['
|
146
|
-
|
147
|
-
spec_pattern = "spec/system/heavy_profile/api#{args['api']}/#{args['model']}/*_spec.rb"
|
148
|
-
spec_pattern = 'spec/system/heavy_profile/api200/*_spec.rb' if args['api'] == '200'
|
149
|
-
Rake::Task['spec:system'].invoke
|
150
|
-
end
|
151
|
-
|
152
|
-
desc 'Run System tests Heavy Profile for specified API. Defaults to API 300.'
|
153
|
-
task 'spec:system:heavy:api_version', [:api] do |_t, spec|
|
154
|
-
args = spec['api'] || 300
|
155
|
-
spec_pattern = "spec/system/heavy_profile/api#{args}/**/*_spec.rb"
|
156
|
-
spec_pattern = 'spec/system/heavy_profile/api200/*_spec.rb' if args == '200'
|
157
|
-
Rake::Task['spec:system'].invoke
|
101
|
+
desc 'Run system integration tests (filtered) Default: [*,**,*]'
|
102
|
+
task 'system:only', [:api_ver, :variant, :profile] do |_t, args|
|
103
|
+
args.with_defaults(api_ver: '*', variant: '**', profile: '*')
|
104
|
+
system_pattern = "spec/system/#{args['profile']}_profile/api#{args['api_ver']}/#{args['variant']}/*_spec.rb"
|
105
|
+
Rake::Task[:system].invoke
|
158
106
|
end
|
159
107
|
|
160
|
-
|
161
|
-
|
108
|
+
desc 'Run system integration tests for the specified path'
|
109
|
+
task 'system:path', [:path] do |_t, args|
|
110
|
+
system_pattern = args['path']
|
111
|
+
Rake::Task[:system].invoke
|
162
112
|
end
|
163
113
|
|
164
|
-
desc 'Runs
|
114
|
+
desc 'Runs RuboCop and unit tests'
|
165
115
|
task :test do
|
166
116
|
Rake::Task[:rubocop].invoke
|
167
|
-
Rake::Task[:
|
117
|
+
Rake::Task[:unit].invoke
|
168
118
|
end
|
169
119
|
|
170
|
-
desc 'Run
|
120
|
+
desc 'Run RuboCop, unit, integration & system tests'
|
171
121
|
task 'test:all' do
|
172
122
|
Rake::Task[:rubocop].invoke
|
173
|
-
Rake::Task[:
|
174
|
-
Rake::Task[
|
175
|
-
Rake::Task[
|
176
|
-
end
|
177
|
-
|
178
|
-
desc 'Run rubocop & integration tests for specified path'
|
179
|
-
task 'test:path', [:path] do |_t, spec|
|
180
|
-
spec_pattern = spec['path']
|
181
|
-
Rake::Task[:rubocop].invoke
|
182
|
-
Rake::Task['spec:integration'].invoke
|
183
|
-
end
|
184
|
-
|
185
|
-
desc 'Run rubocop & integration tests for specified API version & model. Default: [300,c7000]'
|
186
|
-
task 'spec:integration:api', [:version, :model] do |_t, spec|
|
187
|
-
version = spec['version'] || 300
|
188
|
-
model = spec['model'] || 'c7000'
|
189
|
-
spec_pattern = "spec/integration/resource/api#{version}/#{model}/**/*_spec.rb"
|
190
|
-
spec_pattern = 'spec/integration/resource/api200/**/*_spec.rb' if version.to_s == '200'
|
191
|
-
Rake::Task[:rubocop].invoke
|
192
|
-
Rake::Task['spec:integration'].invoke
|
193
|
-
end
|
194
|
-
|
195
|
-
desc 'Run rubocop & integration tests for specified API version. Default: 300'
|
196
|
-
task 'spec:integration:api_version', [:ver] do |_t, spec|
|
197
|
-
version = spec['ver'] || 300
|
198
|
-
spec_pattern = "spec/integration/resource/api#{version}/**/**/*_spec.rb"
|
199
|
-
spec_pattern = 'spec/integration/resource/api200/**/*_spec.rb' if version.to_s == '200'
|
200
|
-
Rake::Task[:rubocop].invoke
|
201
|
-
Rake::Task['spec:integration'].invoke
|
202
|
-
end
|
203
|
-
|
204
|
-
desc 'Run rubocop & integration deletion tests for specified API version. Default: 300'
|
205
|
-
task 'spec:integration:delete:api_version', [:ver] do |_t, spec|
|
206
|
-
version = spec['ver'] || 300
|
207
|
-
spec_pattern = "spec/integration/resource/api#{version}/**/**/*delete_spec.rb"
|
208
|
-
spec_pattern = 'spec/integration/resource/api200/**/*delete_spec.rb' if version.to_s == '200'
|
209
|
-
Rake::Task[:rubocop].invoke
|
210
|
-
Rake::Task['spec:integration'].invoke
|
211
|
-
end
|
212
|
-
|
213
|
-
desc 'Run rubocop & integration tests for Image Streamer.'
|
214
|
-
RSpec::Core::RakeTask.new('spec:integration:i3s') do |spec|
|
215
|
-
Rake::Task[:rubocop].invoke
|
216
|
-
spec.pattern = spec_pattern
|
217
|
-
spec.rspec_opts = def_int_spec_options
|
218
|
-
spec.rspec_opts << ' --tag integration_i3s'
|
219
|
-
end
|
220
|
-
|
221
|
-
desc 'Run rubocop & integration creation tests for Image Streamer only'
|
222
|
-
RSpec::Core::RakeTask.new('spec:integration:i3s:create') do |spec|
|
223
|
-
Rake::Task[:rubocop].invoke
|
224
|
-
spec.pattern = 'spec/**/*create_spec.rb'
|
225
|
-
spec.rspec_opts = def_int_spec_options
|
226
|
-
spec.rspec_opts << ' --tag integration_i3s'
|
227
|
-
end
|
228
|
-
|
229
|
-
desc 'Run rubocop & integration update tests for Image Streamer only'
|
230
|
-
RSpec::Core::RakeTask.new('spec:integration:i3s:update') do |spec|
|
231
|
-
Rake::Task[:rubocop].invoke
|
232
|
-
spec.pattern = 'spec/**/*update_spec.rb'
|
233
|
-
spec.rspec_opts = def_int_spec_options
|
234
|
-
spec.rspec_opts << ' --tag integration_i3s'
|
235
|
-
end
|
236
|
-
|
237
|
-
desc 'Run rubocop & integration deletion tests for Image Streamer only'
|
238
|
-
RSpec::Core::RakeTask.new('spec:integration:i3s:delete') do |spec|
|
239
|
-
Rake::Task[:rubocop].invoke
|
240
|
-
spec.pattern = 'spec/**/*delete_spec.rb'
|
241
|
-
spec.rspec_opts = def_int_spec_options
|
242
|
-
spec.rspec_opts << ' --tag integration_i3s'
|
243
|
-
end
|
244
|
-
|
245
|
-
desc 'Run rubocop & integration tests for specified API version of Image Streamer. Default: 300'
|
246
|
-
task 'spec:integration:i3s:api_version', [:ver] do |_t, spec|
|
247
|
-
version = spec['ver'] || 300
|
248
|
-
spec_pattern = "spec/integration/image-streamer/api#{version}/**/*_spec.rb"
|
249
|
-
Rake::Task['spec:integration:i3s'].invoke
|
250
|
-
end
|
251
|
-
|
252
|
-
desc 'Run rubocop & integration tests for Image Streamer & specified path'
|
253
|
-
task 'test:i3s:path', [:path] do |_t, spec|
|
254
|
-
spec_pattern = spec['path']
|
255
|
-
Rake::Task['spec:integration:i3s'].invoke
|
123
|
+
Rake::Task[:unit].invoke
|
124
|
+
Rake::Task[:integration].invoke
|
125
|
+
Rake::Task[:system].invoke
|
256
126
|
end
|
data/lib/oneview-sdk.rb
CHANGED
@@ -14,8 +14,9 @@ require_relative 'oneview-sdk/exceptions'
|
|
14
14
|
require_relative 'oneview-sdk/client'
|
15
15
|
require_relative 'oneview-sdk/resource'
|
16
16
|
Dir[File.dirname(__FILE__) + '/oneview-sdk/resource/*.rb'].each { |file| require file }
|
17
|
-
require_relative 'oneview-sdk/
|
17
|
+
require_relative 'oneview-sdk/scmb'
|
18
18
|
require_relative 'oneview-sdk/image_streamer'
|
19
|
+
require_relative 'oneview-sdk/cli'
|
19
20
|
|
20
21
|
# Module for interacting with the HPE OneView API
|
21
22
|
module OneviewSDK
|
data/lib/oneview-sdk/cli.rb
CHANGED
@@ -54,7 +54,7 @@ module OneviewSDK
|
|
54
54
|
|
55
55
|
class_option :ssl_verify,
|
56
56
|
type: :boolean,
|
57
|
-
desc: 'Enable/Disable SSL verification for requests.
|
57
|
+
desc: 'Enable/Disable SSL verification for requests. Uses ENV[\'ONEVIEWSDK_SSL_ENABLED\']',
|
58
58
|
default: nil
|
59
59
|
|
60
60
|
class_option :url,
|
@@ -428,6 +428,33 @@ module OneviewSDK
|
|
428
428
|
fail_nice e.message
|
429
429
|
end
|
430
430
|
|
431
|
+
method_option :route,
|
432
|
+
desc: 'Routing key to filter messages',
|
433
|
+
type: :string,
|
434
|
+
aliases: '-r',
|
435
|
+
default: OneviewSDK::SCMB::DEFAULT_ROUTING_KEY
|
436
|
+
method_option :format,
|
437
|
+
desc: 'Output format',
|
438
|
+
aliases: '-f',
|
439
|
+
enum: %w(json yaml raw),
|
440
|
+
default: 'json'
|
441
|
+
scmb_examples = "\n oneview-sdk-ruby scmb -r 'scmb.ethernet-networks.#'"
|
442
|
+
scmb_examples << "\n oneview-sdk-ruby scmb -r 'scmb.ethernet-networks.Created'"
|
443
|
+
scmb_examples << "\n oneview-sdk-ruby scmb -r 'scmb.ethernet-networks.Updated.<resource_uri>'"
|
444
|
+
desc 'scmb', "Subscribe to the OneView State Change Message Bus. Examples:#{scmb_examples}"
|
445
|
+
# Subscribe to the OneView SCMB
|
446
|
+
def scmb
|
447
|
+
client_setup
|
448
|
+
connection = OneviewSDK::SCMB.new_connection(@client)
|
449
|
+
q = OneviewSDK::SCMB.new_queue(connection, @options['route'])
|
450
|
+
puts 'Subscribing to OneView messages. To exit, press Ctrl + c'
|
451
|
+
q.subscribe(block: true) do |_delivery_info, _properties, payload|
|
452
|
+
data = JSON.parse(payload) rescue payload
|
453
|
+
puts "\n#{'=' * 50}\n\nReceived message with payload:"
|
454
|
+
@options['format'] == 'raw' ? puts(payload) : output(data)
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
431
458
|
private
|
432
459
|
|
433
460
|
def fail_nice(msg = nil, exit_code = 1)
|
@@ -16,7 +16,7 @@ module OneviewSDK
|
|
16
16
|
module Synergy
|
17
17
|
# Network set resource implementation for API300 Synergy
|
18
18
|
class OSDeploymentPlan < OneviewSDK::API300::Synergy::Resource
|
19
|
-
BASE_URI = '/rest/os-deployment-plans'.freeze
|
19
|
+
BASE_URI = '/rest/os-deployment-plans/'.freeze
|
20
20
|
|
21
21
|
# Method is not available
|
22
22
|
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# (c) Copyright 2017 Hewlett Packard Enterprise Development LP
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# Unless required by applicable law or agreed to in writing, software distributed
|
8
|
+
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
9
|
+
# CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
10
|
+
# language governing permissions and limitations under the License.
|
11
|
+
|
12
|
+
require_relative 'client'
|
13
|
+
require 'bunny'
|
14
|
+
|
15
|
+
module OneviewSDK
|
16
|
+
# State Schange Message Bus (SCMB) helper
|
17
|
+
module SCMB
|
18
|
+
DEFAULT_ROUTING_KEY = 'scmb.#'.freeze
|
19
|
+
|
20
|
+
# Create a new connection to the message bus
|
21
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
22
|
+
# @param [Hash] opts Connection options (passed to Bunny.new). Defaults:
|
23
|
+
# port: 5671
|
24
|
+
# auth_mechanism: 'EXTERNAL'
|
25
|
+
# tls: true
|
26
|
+
# verify_peer: client.ssl_enabled
|
27
|
+
# tls_cert: (retrieved automatically from OneView)
|
28
|
+
# tls_key: (retrieved automatically from OneView)
|
29
|
+
# tls_ca_certificates: System default CA (unless verify_peer is false)
|
30
|
+
# See http://rubybunny.info/articles/connecting.html for more details & options
|
31
|
+
# @return [Bunny::Session] Connection to the message bus
|
32
|
+
def self.new_connection(client, opts = {})
|
33
|
+
con_opts = {
|
34
|
+
port: 5671,
|
35
|
+
auth_mechanism: 'EXTERNAL',
|
36
|
+
tls: true,
|
37
|
+
verify_peer: client.ssl_enabled,
|
38
|
+
logger: client.logger
|
39
|
+
}
|
40
|
+
con_opts.merge!(opts)
|
41
|
+
con_opts[:host] = URI.parse(client.url).host
|
42
|
+
unless con_opts[:tls_cert] && con_opts[:tls_key]
|
43
|
+
kp = get_or_create_keypair(client)
|
44
|
+
con_opts[:tls_cert] = kp['base64SSLCertData']
|
45
|
+
con_opts[:tls_key] = kp['base64SSLKeyData']
|
46
|
+
end
|
47
|
+
Bunny.new(con_opts).start
|
48
|
+
end
|
49
|
+
|
50
|
+
# Retrieve or create the default RabbitMQ keypair
|
51
|
+
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
52
|
+
# @return [Hash] Keypair details
|
53
|
+
def self.get_or_create_keypair(client)
|
54
|
+
client.response_handler(client.rest_get('/rest/certificates/client/rabbitmq/keypair/default'))
|
55
|
+
rescue OneviewSDK::NotFound # Create the keypair if it doesn't exist
|
56
|
+
client.logger.info('RabbitMQ default keypair not found. Creating it now.')
|
57
|
+
opts = { commonName: 'default', type: 'RabbitMqClientCertV2' }
|
58
|
+
client.response_handler(client.rest_post('/rest/certificates/client/rabbitmq', body: opts))
|
59
|
+
# Retrieve the created key
|
60
|
+
client.response_handler(client.rest_get('/rest/certificates/client/rabbitmq/keypair/default'))
|
61
|
+
end
|
62
|
+
|
63
|
+
# @param [Bunny::Session] Connection to the message bus. See ::new_connection
|
64
|
+
# @return [Bunny::Queue] Queue listening to the specified routing key
|
65
|
+
def self.new_queue(connection, routing_key = DEFAULT_ROUTING_KEY)
|
66
|
+
ch = connection.create_channel
|
67
|
+
q = ch.queue('')
|
68
|
+
q.bind('scmb', routing_key: routing_key)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/lib/oneview-sdk/version.rb
CHANGED
data/oneview-sdk.gemspec
CHANGED
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_runtime_dependency 'highline'
|
34
34
|
spec.add_runtime_dependency 'pry'
|
35
35
|
spec.add_runtime_dependency 'multipart-post'
|
36
|
+
spec.add_runtime_dependency 'bunny'
|
36
37
|
|
37
38
|
spec.add_development_dependency 'coveralls'
|
38
39
|
spec.add_development_dependency 'bundler'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oneview-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrique Diomede
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: thor
|
@@ -69,6 +69,20 @@ dependencies:
|
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: bunny
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
72
86
|
- !ruby/object:Gem::Dependency
|
73
87
|
name: coveralls
|
74
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -411,6 +425,7 @@ files:
|
|
411
425
|
- lib/oneview-sdk/resource/api500/synergy/volume_snapshot.rb
|
412
426
|
- lib/oneview-sdk/resource/api500/synergy/volume_template.rb
|
413
427
|
- lib/oneview-sdk/rest.rb
|
428
|
+
- lib/oneview-sdk/scmb.rb
|
414
429
|
- lib/oneview-sdk/ssl_helper.rb
|
415
430
|
- lib/oneview-sdk/version.rb
|
416
431
|
- oneview-sdk.gemspec
|
@@ -434,7 +449,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
434
449
|
version: '0'
|
435
450
|
requirements: []
|
436
451
|
rubyforge_project:
|
437
|
-
rubygems_version: 2.6.
|
452
|
+
rubygems_version: 2.6.11
|
438
453
|
signing_key:
|
439
454
|
specification_version: 4
|
440
455
|
summary: Gem to interact with the HPE OneView API
|