chef-provisioning-oneview 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +119 -65
- data/chef-provisioning-oneview.gemspec +39 -0
- data/lib/chef/provisioning/create_machine.rb +43 -46
- data/lib/chef/provisioning/customize_machine.rb +50 -48
- data/lib/chef/provisioning/helpers.rb +18 -0
- data/lib/chef/provisioning/icsp/api_v104.rb +3 -2
- data/lib/chef/provisioning/icsp/icsp_helper.rb +288 -0
- data/lib/chef/provisioning/icsp/rest.rb +50 -0
- data/lib/chef/provisioning/oneview/oneview_helper.rb +53 -0
- data/lib/chef/provisioning/oneview/san_storage.rb +69 -69
- data/lib/chef/provisioning/oneview_driver.rb +124 -105
- data/lib/chef/provisioning/version.rb +1 -1
- metadata +23 -61
- data/Rakefile +0 -19
- data/lib/chef/provisioning/icsp/icsp_api.rb +0 -284
- data/lib/chef/provisioning/oneview/oneview_api.rb +0 -186
- data/lib/chef/provisioning/oneview/v1.2/api.rb +0 -3
- data/lib/chef/provisioning/oneview/v2.0/api.rb +0 -3
- data/lib/chef/provisioning/rest.rb +0 -52
- data/spec/shared_context.rb +0 -78
- data/spec/spec_helper.rb +0 -23
- data/spec/support/fake_action_handler.rb +0 -6
- data/spec/support/fake_icsp.rb +0 -73
- data/spec/support/fake_machine_spec.rb +0 -18
- data/spec/support/fake_oneview.rb +0 -148
- data/spec/support/fixtures/icsp/v102/error_404.json +0 -14
- data/spec/support/fixtures/icsp/v102/login.json +0 -5
- data/spec/support/fixtures/icsp/v102/os-deployment-build-plans.json +0 -99
- data/spec/support/fixtures/icsp/v102/os-deployment-servers.json +0 -179
- data/spec/support/fixtures/icsp/v102/os-deployment-servers_1670001.json +0 -83
- data/spec/support/fixtures/icsp/v102/os-deployment-servers_fakesn.json +0 -9
- data/spec/support/fixtures/icsp/v102/server_by_sn_VCGE9KB041.json +0 -45
- data/spec/support/fixtures/icsp/v102/server_by_sn_empty.json +0 -16
- data/spec/support/fixtures/icsp/v102/version.json +0 -4
- data/spec/support/fixtures/oneview/v120/error_404.json +0 -14
- data/spec/support/fixtures/oneview/v120/login.json +0 -5
- data/spec/support/fixtures/oneview/v120/server-hardware.json +0 -1476
- data/spec/support/fixtures/oneview/v120/server-hardware_Template-WebServer.json +0 -468
- data/spec/support/fixtures/oneview/v120/server-hardware_specific.json +0 -151
- data/spec/support/fixtures/oneview/v120/server-profiles.json +0 -369
- data/spec/support/fixtures/oneview/v120/server-profiles_invalid_filter.json +0 -14
- data/spec/support/fixtures/oneview/v120/server-profiles_name_Template-WebServer.json +0 -133
- data/spec/support/fixtures/oneview/v120/server-profiles_name_Template-WebServerWithSAN.json +0 -200
- data/spec/support/fixtures/oneview/v120/server-profiles_name_chef-web01.json +0 -133
- data/spec/support/fixtures/oneview/v120/server-profiles_name_chef-web03.json +0 -133
- data/spec/support/fixtures/oneview/v120/server-profiles_name_empty.json +0 -15
- data/spec/support/fixtures/oneview/v120/server-profiles_sn_VCGE9KB041.json +0 -133
- data/spec/support/fixtures/oneview/v120/server-profiles_sn_VCGE9KB042.json +0 -206
- data/spec/support/fixtures/oneview/v120/server-profiles_sn_empty.json +0 -15
- data/spec/support/fixtures/oneview/v120/storage-volumes_1B5D3CA2-6C5B-41C2-8B97-1821F1883F22.json +0 -26
- data/spec/support/fixtures/oneview/v120/tasks_fake_active.json +0 -5
- data/spec/support/fixtures/oneview/v120/tasks_fake_complete.json +0 -5
- data/spec/support/fixtures/oneview/v120/version.json +0 -4
- data/spec/support/fixtures/oneview/v200/server-profile-templates_WebServerTemplate.json +0 -109
- data/spec/support/fixtures/oneview/v200/server-profile-templates_WebServerTemplateWithSAN.json +0 -144
- data/spec/support/fixtures/oneview/v200/server-profile-templates_invalid.json +0 -16
- data/spec/support/fixtures/oneview/v200/server-profile-templates_new-profile_WebServerTemplate.json +0 -125
- data/spec/support/fixtures/oneview/v200/server-profile-templates_new-profile_WebServerTemplateWithSAN.json +0 -178
- data/spec/support/fixtures/oneview/v200/version.json +0 -4
- data/spec/unit/create_machine_spec.rb +0 -78
- data/spec/unit/destroy_spec.rb +0 -26
- data/spec/unit/icsp_nic_teams_spec.rb +0 -38
- data/spec/unit/icsp_search_spec.rb +0 -25
- data/spec/unit/oneview_driver_spec.rb +0 -79
- data/spec/unit/oneview_login_spec.rb +0 -17
- data/spec/unit/oneview_power_spec.rb +0 -51
- data/spec/unit/oneview_san_spec.rb +0 -86
- data/spec/unit/oneview_search_spec.rb +0 -63
- data/spec/unit/rest_api_spec.rb +0 -115
@@ -1,52 +0,0 @@
|
|
1
|
-
module RestAPI
|
2
|
-
# API calls for OneView and ICsp
|
3
|
-
def rest_api(host, type, path, options = {})
|
4
|
-
disable_ssl = false
|
5
|
-
case host
|
6
|
-
when 'icsp', :icsp
|
7
|
-
uri = URI.parse(URI.escape(@icsp_base_url + path))
|
8
|
-
options['X-API-Version'] ||= @icsp_api_version unless [:put, 'put'].include?(type.downcase)
|
9
|
-
options['auth'] ||= @icsp_key
|
10
|
-
disable_ssl = true if @icsp_disable_ssl
|
11
|
-
when 'oneview', :oneview
|
12
|
-
uri = URI.parse(URI.escape(@oneview_base_url + path))
|
13
|
-
options['X-API-Version'] ||= @oneview_api_version
|
14
|
-
options['auth'] ||= @oneview_key
|
15
|
-
disable_ssl = true if @oneview_disable_ssl
|
16
|
-
else
|
17
|
-
raise "Invalid rest host: #{host}"
|
18
|
-
end
|
19
|
-
|
20
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
21
|
-
http.read_timeout = @api_timeout # timeout for a request
|
22
|
-
http.open_timeout = @api_timeout # timeout for a connection
|
23
|
-
http.use_ssl = true if uri.scheme == 'https'
|
24
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if disable_ssl
|
25
|
-
case type.downcase
|
26
|
-
when 'get', :get
|
27
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
28
|
-
when 'post', :post
|
29
|
-
request = Net::HTTP::Post.new(uri.request_uri)
|
30
|
-
when 'put', :put
|
31
|
-
request = Net::HTTP::Put.new(uri.request_uri)
|
32
|
-
when 'delete', :delete
|
33
|
-
request = Net::HTTP::Delete.new(uri.request_uri)
|
34
|
-
else
|
35
|
-
raise "Invalid rest call: #{type}"
|
36
|
-
end
|
37
|
-
options['Content-Type'] ||= 'application/json'
|
38
|
-
options.delete('Content-Type') if [:none, 'none', nil].include?(options['Content-Type'])
|
39
|
-
options.delete('X-API-Version') if [:none, 'none', nil].include?(options['X-API-Version'])
|
40
|
-
options.delete('auth') if [:none, 'none', nil].include?(options['auth'])
|
41
|
-
options.each do |key, val|
|
42
|
-
if key.casecmp('body') == 0
|
43
|
-
request.body = val.to_json rescue val
|
44
|
-
else
|
45
|
-
request[key] = val
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
response = http.request(request)
|
50
|
-
JSON.parse(response.body) rescue response
|
51
|
-
end
|
52
|
-
end # End module
|
data/spec/shared_context.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
RSpec.shared_context 'shared context', a: :b do
|
2
|
-
|
3
|
-
domain = 'my-domain.com'
|
4
|
-
chef_server = "https://my-chef-server.#{domain}/organizations/oneview"
|
5
|
-
oneview = "https://my-oneview.#{domain}"
|
6
|
-
icsp = "https://my-icsp.#{domain}"
|
7
|
-
|
8
|
-
let(:knife_config) do
|
9
|
-
{ knife: {
|
10
|
-
oneview_url: oneview,
|
11
|
-
oneview_username: 'Administrator',
|
12
|
-
oneview_password: 'password12',
|
13
|
-
oneview_ignore_ssl: true,
|
14
|
-
oneview_timeout: 15,
|
15
|
-
|
16
|
-
icsp_url: icsp,
|
17
|
-
icsp_username: 'administrator',
|
18
|
-
icsp_password: 'password123'
|
19
|
-
} }
|
20
|
-
end
|
21
|
-
|
22
|
-
let(:valid_machine_options) do
|
23
|
-
{
|
24
|
-
convergence_options: {
|
25
|
-
ssl_verify_mode: :verify_none,
|
26
|
-
bootstrap_proxy: "http://proxy.#{domain}:8080",
|
27
|
-
chef_server: {
|
28
|
-
chef_server_url: chef_server,
|
29
|
-
options: {
|
30
|
-
client_name: 'user',
|
31
|
-
signing_key_filename: 'spec/fixtures/.chef/user.pem'
|
32
|
-
}
|
33
|
-
}
|
34
|
-
},
|
35
|
-
driver_options: {
|
36
|
-
server_template: 'Template - Web Server',
|
37
|
-
os_build: 'CHEF-RHEL-6.5-x64',
|
38
|
-
host_name: 'chef-web01',
|
39
|
-
ip_address: '192.168.1.2',
|
40
|
-
domainType: 'workgroup',
|
41
|
-
domainName: domain,
|
42
|
-
gateway: '192.168.1.1',
|
43
|
-
dns: '192.168.1.1,10.1.1.1',
|
44
|
-
connections: {
|
45
|
-
1 => { dhcp: true, team: 'team1' },
|
46
|
-
2 => { ip4Address: '192.168.1.2', mask: '255.255.254.0', dhcp: false, team: 'team1' }
|
47
|
-
}
|
48
|
-
},
|
49
|
-
custom_attributes: {
|
50
|
-
|
51
|
-
},
|
52
|
-
transport_options: {
|
53
|
-
ssh_options: { password: 'password1234' }
|
54
|
-
}
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
let(:action_handler) do
|
59
|
-
ChefProvisioningOneviewHelpers::FakeActionHandler.new
|
60
|
-
end
|
61
|
-
|
62
|
-
let(:machine_spec) do
|
63
|
-
ChefProvisioningOneviewHelpers::FakeMachineSpec.new('server-1', 'VCGE9KB041')
|
64
|
-
end
|
65
|
-
|
66
|
-
let(:machine_spec2) do
|
67
|
-
ChefProvisioningOneviewHelpers::FakeMachineSpec.new('server-2', '789123')
|
68
|
-
end
|
69
|
-
|
70
|
-
before :each do
|
71
|
-
@oneview_key = 'A954A2A6Psy7Alg3HApAcEbAcAwa-ftA'
|
72
|
-
@icsp_key = 'AA_aaAaa3AA3Aa0_aAaAA4AAAA3AAAAA'
|
73
|
-
@url = oneview
|
74
|
-
@canonical_url = "oneview:#{@url}"
|
75
|
-
@instance = Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config)
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'pry'
|
2
|
-
require 'webmock/rspec'
|
3
|
-
require 'simplecov'
|
4
|
-
SimpleCov.start
|
5
|
-
|
6
|
-
require_relative './../lib/chef/provisioning/driver_init/oneview'
|
7
|
-
require_relative 'support/fake_oneview'
|
8
|
-
require_relative 'support/fake_icsp'
|
9
|
-
require_relative 'support/fake_machine_spec'
|
10
|
-
require_relative 'support/fake_action_handler'
|
11
|
-
require_relative 'shared_context'
|
12
|
-
# WebMock.disable_net_connect!(allow_localhost: true)
|
13
|
-
|
14
|
-
RSpec.configure do |config|
|
15
|
-
config.before(:each) do
|
16
|
-
stub_request(:any, /my-oneview.my-domain.com/).to_rack(FakeOneView)
|
17
|
-
stub_request(:any, /my-icsp.my-domain.com/).to_rack(FakeIcsp)
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
# Chef::Log.level = :debug
|
23
|
-
Chef::Config[:log_level] = :warn
|
data/spec/support/fake_icsp.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
class FakeIcsp < Sinatra::Base
|
5
|
-
|
6
|
-
get '/rest/version' do
|
7
|
-
json_response(200, 'version.json', '102')
|
8
|
-
end
|
9
|
-
|
10
|
-
get '/rest/index/resources' do
|
11
|
-
version = env['HTTP_X_API_VERSION']
|
12
|
-
category = params['category']
|
13
|
-
return json_response(404, 'error_404.json', version) if category.nil?
|
14
|
-
if category == 'osdserver' && params['query'].match(/osdServerSerialNumber:"VCGE9KB041"/)
|
15
|
-
return json_response(200, 'server_by_sn_VCGE9KB041.json', version)
|
16
|
-
elsif category == 'osdserver' && params['query'].match(/osdServerSerialNumber:"FAKESN"/)
|
17
|
-
return json_response(200, 'server_by_sn_empty.json', version)
|
18
|
-
else
|
19
|
-
return json_response(404, 'error_404.json', version)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
get '/rest/os-deployment-servers' do
|
24
|
-
version = env['HTTP_X_API_VERSION']
|
25
|
-
json_response(200, 'os-deployment-servers.json', version)
|
26
|
-
end
|
27
|
-
|
28
|
-
get '/rest/os-deployment-servers/:id' do
|
29
|
-
version = env['HTTP_X_API_VERSION']
|
30
|
-
if params[:id] == '1670001'
|
31
|
-
return json_response(200, 'os-deployment-servers_1670001.json', version)
|
32
|
-
else
|
33
|
-
return json_response(200, 'os-deployment-servers_fakesn.json', version)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
post '/rest/login-sessions' do
|
38
|
-
version = env['HTTP_X_API_VERSION']
|
39
|
-
json_response(200, 'login.json', version)
|
40
|
-
end
|
41
|
-
|
42
|
-
get '/' do
|
43
|
-
{ message: 'Fake ICsp works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
44
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
45
|
-
end
|
46
|
-
|
47
|
-
post '/' do
|
48
|
-
{ message: 'Fake ICsp works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
49
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
50
|
-
end
|
51
|
-
|
52
|
-
put '/' do
|
53
|
-
{ message: 'Fake ICsp works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
54
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
55
|
-
end
|
56
|
-
|
57
|
-
delete '/' do
|
58
|
-
{ message: 'Fake ICsp works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
59
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
60
|
-
end
|
61
|
-
|
62
|
-
get '/*' do # All other paths should return a 404 error
|
63
|
-
json_response(404, 'error_404.json', '102')
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def json_response(response_code, file_name, version = 102)
|
69
|
-
content_type :json
|
70
|
-
status response_code
|
71
|
-
File.open(File.dirname(__FILE__) + "/fixtures/icsp/v#{version}/" + file_name, 'rb').read
|
72
|
-
end
|
73
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module ChefProvisioningOneviewHelpers
|
2
|
-
class FakeMachineSpec
|
3
|
-
attr_reader :name
|
4
|
-
|
5
|
-
def initialize(name, sn)
|
6
|
-
@name = name
|
7
|
-
@sn = sn
|
8
|
-
end
|
9
|
-
|
10
|
-
def reference
|
11
|
-
ver = Chef::Provisioning::ONEVIEW_DRIVER_VERSION
|
12
|
-
{
|
13
|
-
'serial_number' => @sn, serial_number: @sn,
|
14
|
-
'driver_version' => ver, driver_version: ver
|
15
|
-
}
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,148 +0,0 @@
|
|
1
|
-
require 'sinatra/base'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
class FakeOneView < Sinatra::Base
|
5
|
-
|
6
|
-
get '/rest/version' do
|
7
|
-
json_response(200, 'version.json', '120')
|
8
|
-
end
|
9
|
-
|
10
|
-
post '/rest/login-sessions' do
|
11
|
-
version = env['HTTP_X_API_VERSION']
|
12
|
-
json_response(200, 'login.json', version)
|
13
|
-
end
|
14
|
-
|
15
|
-
get '/rest/server-profile-templates' do
|
16
|
-
version = env['HTTP_X_API_VERSION']
|
17
|
-
file_name = 'server-profile-templates_invalid.json'
|
18
|
-
if params['filter'] && params['filter'] =~ /name matches/
|
19
|
-
if params['filter'] =~ /Web Server Template with SAN/
|
20
|
-
file_name = 'server-profile-templates_WebServerTemplateWithSAN.json'
|
21
|
-
elsif params['filter'] =~ /Web Server Template/
|
22
|
-
file_name = 'server-profile-templates_WebServerTemplate.json'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
json_response(200, file_name, version)
|
26
|
-
end
|
27
|
-
|
28
|
-
get '/rest/server-profile-templates/:id/new-profile' do |id|
|
29
|
-
version = env['HTTP_X_API_VERSION']
|
30
|
-
if id == 'd64da635-f08a-41d4-b6eb-6517206a8bae'
|
31
|
-
json_response(200, 'server-profile-templates_new-profile_WebServerTemplate.json', version)
|
32
|
-
elsif id == 'd64da635-f08a-41d4-b6eb-6517206a8baf'
|
33
|
-
json_response(200, 'server-profile-templates_new-profile_WebServerTemplateWithSAN.json', version)
|
34
|
-
else
|
35
|
-
json_response(404, 'error_404.json', '120')
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
get '/rest/server-profiles' do
|
40
|
-
version = env['HTTP_X_API_VERSION']
|
41
|
-
file_name = 'server-profiles.json'
|
42
|
-
if params['filter']
|
43
|
-
if params['filter'].match('matches \'\'') || params['filter'] =~ /INVALIDFILTER/
|
44
|
-
file_name = 'server-profiles_invalid_filter.json'
|
45
|
-
elsif params['filter'] =~ /serialNumber matches/
|
46
|
-
file_name = if params['filter'] =~ /VCGE9KB041/
|
47
|
-
'server-profiles_sn_VCGE9KB041.json'
|
48
|
-
elsif params['filter'] =~ /VCGE9KB042/
|
49
|
-
'server-profiles_sn_VCGE9KB042.json'
|
50
|
-
else
|
51
|
-
'server-profiles_sn_empty.json'
|
52
|
-
end
|
53
|
-
elsif params['filter'] =~ /name matches/
|
54
|
-
file_name = if params['filter'] =~ /Template - Web Server with SAN/
|
55
|
-
'server-profiles_name_Template-WebServerWithSAN.json'
|
56
|
-
elsif params['filter'] =~ /Template - Web Server/
|
57
|
-
'server-profiles_name_Template-WebServer.json'
|
58
|
-
elsif params['filter'] =~ /chef-web01/
|
59
|
-
'server-profiles_name_chef-web01.json'
|
60
|
-
elsif $server_created == 'chef-web03'
|
61
|
-
'server-profiles_name_chef-web03.json'
|
62
|
-
else
|
63
|
-
'server-profiles_name_empty.json'
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
json_response(200, file_name, version)
|
68
|
-
end
|
69
|
-
|
70
|
-
post '/rest/server-profiles' do
|
71
|
-
body = JSON.parse(request.body.read.to_s)
|
72
|
-
$server_created = body['name']
|
73
|
-
{ 'uri' => '/rest/tasks/FAKETASK' }.to_json
|
74
|
-
end
|
75
|
-
|
76
|
-
delete '/rest/server-profiles/:id' do |_id|
|
77
|
-
{ 'uri' => '/rest/tasks/FAKETASK' }.to_json
|
78
|
-
end
|
79
|
-
|
80
|
-
get '/rest/server-hardware' do
|
81
|
-
version = env['HTTP_X_API_VERSION']
|
82
|
-
file_name = 'server-hardware.json'
|
83
|
-
if params['filter'] =~ %r{enclosure-groups/3a11ccdd-b352-4046-a568-a8b0faa6cc39}
|
84
|
-
file_name = 'server-hardware_Template-WebServer.json'
|
85
|
-
end
|
86
|
-
json_response(200, file_name, version)
|
87
|
-
end
|
88
|
-
|
89
|
-
get '/rest/server-hardware/:id' do |id|
|
90
|
-
version = env['HTTP_X_API_VERSION']
|
91
|
-
if id == '31363636-3136-584D-5132-333230314D38' || id == '37333036-3831-584D-5131-303030323037'
|
92
|
-
json_response(200, 'server-hardware_specific.json', version)
|
93
|
-
else
|
94
|
-
json_response(404, 'error_404.json', '120')
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
get '/rest/storage-volumes/:id' do |id|
|
99
|
-
version = env['HTTP_X_API_VERSION']
|
100
|
-
json_response(200, "storage-volumes_#{id}.json", version)
|
101
|
-
end
|
102
|
-
|
103
|
-
put '/rest/server-hardware/:id/powerState' do |_id|
|
104
|
-
{ 'uri' => '/rest/tasks/FAKETASK' }.to_json
|
105
|
-
end
|
106
|
-
|
107
|
-
get '/rest/tasks/FAKETASK' do
|
108
|
-
version = env['HTTP_X_API_VERSION']
|
109
|
-
json_response(200, 'tasks_fake_complete.json', version)
|
110
|
-
end
|
111
|
-
|
112
|
-
get '/' do
|
113
|
-
{ message: 'Fake OneView works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
114
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
115
|
-
end
|
116
|
-
|
117
|
-
post '/' do
|
118
|
-
{ message: 'Fake OneView works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
119
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
120
|
-
end
|
121
|
-
|
122
|
-
put '/' do
|
123
|
-
{ message: 'Fake OneView works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
124
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
125
|
-
end
|
126
|
-
|
127
|
-
delete '/' do
|
128
|
-
{ message: 'Fake OneView works!', method: env['REQUEST_METHOD'], content_type: env['CONTENT_TYPE'], query: env['QUERY_STRING'],
|
129
|
-
api_version: env['HTTP_X_API_VERSION'], auth: env['HTTP_AUTH'], params: params }.to_json
|
130
|
-
end
|
131
|
-
|
132
|
-
get '/*' do # All other paths should return a 404 error
|
133
|
-
json_response(404, 'error_404.json', '120')
|
134
|
-
end
|
135
|
-
|
136
|
-
private
|
137
|
-
|
138
|
-
def json_response(response_code, file_name, version = 120)
|
139
|
-
content_type :json
|
140
|
-
status response_code
|
141
|
-
File.open(File.dirname(__FILE__) + "/fixtures/oneview/v#{version}/" + file_name, 'rb').read
|
142
|
-
rescue Errno::ENOENT
|
143
|
-
puts "ERROR: FakeOneView: File not found:\n '#{File.dirname(__FILE__) + "/fixtures/oneview/v#{version}/" + file_name}'"
|
144
|
-
content_type :json
|
145
|
-
status 404
|
146
|
-
File.open(File.dirname(__FILE__) + '/fixtures/oneview/v120/error_404.json', 'rb').read
|
147
|
-
end
|
148
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"errorSource": null,
|
3
|
-
"nestedErrors": [
|
4
|
-
|
5
|
-
],
|
6
|
-
"errorCode": "GENERIC_HTTP_404",
|
7
|
-
"data": {
|
8
|
-
},
|
9
|
-
"recommendedActions": [
|
10
|
-
"Check the request URI, then resend the request."
|
11
|
-
],
|
12
|
-
"details": "The requested resource could not be found.",
|
13
|
-
"message": "Not Found"
|
14
|
-
}
|
@@ -1,99 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "OsdPaginatedCollection",
|
3
|
-
"members": [
|
4
|
-
{
|
5
|
-
"modifiedBy": "applianceserviceaccount",
|
6
|
-
"createdBy": "applianceserviceaccount",
|
7
|
-
"buildPlanHistory": [],
|
8
|
-
"buildPlanStepType": null,
|
9
|
-
"isCustomerContent": true,
|
10
|
-
"buildPlanCustAttrs": [],
|
11
|
-
"buildPlanItems": [],
|
12
|
-
"os": "OS - Red Hat Enterprise Linux Server 6",
|
13
|
-
"arch": "x64",
|
14
|
-
"lifeCycle": "AVAILABLE",
|
15
|
-
"description": "Performs a scripted install of Red Hat Enterprise Linux 6.5 using a generic kickstart file.\n(c) Copyright 2014 Hewlett-Packard Development Company, L.P.\n\nRequirements:\n* HP ProLiant server with iLO\n* IC server provisioning Media Server must contain the OS distribution\n\nRequired Custom Attribute: None\n\nOptional Custom Attributes:\n* encrypted_root_password (must be encrypted)\n* boot_disk\n* kernel_arguments",
|
16
|
-
"status": "",
|
17
|
-
"name": "CHEF-RHEL-6.5-x64",
|
18
|
-
"state": "",
|
19
|
-
"modified": "2015-07-14T03:51:30.000Z",
|
20
|
-
"eTag": "2015-07-14T03:51:30.000Z",
|
21
|
-
"created": "2015-05-19T19:05:37.000Z",
|
22
|
-
"category": "os-deployment-build-plans",
|
23
|
-
"uri": "/rest/os-deployment-build-plans/1280001"
|
24
|
-
},
|
25
|
-
{
|
26
|
-
"modifiedBy": "applianceserviceaccount",
|
27
|
-
"createdBy": "applianceserviceaccount",
|
28
|
-
"buildPlanHistory": [],
|
29
|
-
"buildPlanStepType": null,
|
30
|
-
"isCustomerContent": true,
|
31
|
-
"buildPlanCustAttrs": [],
|
32
|
-
"buildPlanItems": [],
|
33
|
-
"os": "Other",
|
34
|
-
"arch": "x64",
|
35
|
-
"lifeCycle": "AVAILABLE",
|
36
|
-
"description": "Reboots a target server in maintenance mode to the local disk. \n(c) Copyright 2013 Hewlett-Packard Development Company, L.P.\n\nRequirements:\n* HP ProLiant server with iLO\n\nCustom Attributes: None",
|
37
|
-
"status": "",
|
38
|
-
"name": "CHEF - RHEL 6.6 x64",
|
39
|
-
"state": "",
|
40
|
-
"modified": "2015-05-21T17:23:58.000Z",
|
41
|
-
"eTag": "2015-05-21T17:23:58.000Z",
|
42
|
-
"created": "2015-05-21T17:23:58.000Z",
|
43
|
-
"category": "os-deployment-build-plans",
|
44
|
-
"uri": "/rest/os-deployment-build-plans/1300001"
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"modifiedBy": "applianceserviceaccount",
|
48
|
-
"createdBy": "applianceserviceaccount",
|
49
|
-
"buildPlanHistory": [],
|
50
|
-
"buildPlanStepType": null,
|
51
|
-
"isCustomerContent": true,
|
52
|
-
"buildPlanCustAttrs": [],
|
53
|
-
"buildPlanItems": [],
|
54
|
-
"os": "OS - Red Hat Enterprise Linux Server 7",
|
55
|
-
"arch": "x64",
|
56
|
-
"lifeCycle": "AVAILABLE",
|
57
|
-
"description": "Performs a scripted install of Red Hat Enterprise Linux 7.0 using a generic kickstart file.\n(c) Copyright 2014 Hewlett-Packard Development Company, L.P.\n\nRequirements:\n* HP ProLiant server with iLO\n* IC server provisioning Media Server must contain the OS distribution\n\nRequired Custom Attribute: None\n\nOptional Custom Attributes:\n* encrypted_root_password (must be encrypted)\n* boot_disk\n* kernel_arguments",
|
58
|
-
"status": "",
|
59
|
-
"name": "CHEF - RHEL 7.0 x64",
|
60
|
-
"state": "",
|
61
|
-
"modified": "2015-07-24T09:32:52.000Z",
|
62
|
-
"eTag": "2015-07-24T09:32:52.000Z",
|
63
|
-
"created": "2015-07-15T17:46:32.000Z",
|
64
|
-
"category": "os-deployment-build-plans",
|
65
|
-
"uri": "/rest/os-deployment-build-plans/1340001"
|
66
|
-
},
|
67
|
-
{
|
68
|
-
"modifiedBy": "detuser",
|
69
|
-
"createdBy": "opsware",
|
70
|
-
"buildPlanHistory": [],
|
71
|
-
"buildPlanStepType": null,
|
72
|
-
"isCustomerContent": false,
|
73
|
-
"buildPlanCustAttrs": [],
|
74
|
-
"buildPlanItems": [],
|
75
|
-
"os": "OS - Windows Server 2008 R2",
|
76
|
-
"arch": "x64",
|
77
|
-
"lifeCycle": "AVAILABLE",
|
78
|
-
"description": "Performs a scripted install of Windows 2008 R2 SP1 Standard using a generic unattend file.\n(c) Copyright 2013, 2014 Hewlett-Packard Development Company, L.P.\n\nRequirements:\n* HP ProLiant server with iLO\n* IC server provisioning Media Server must contain the OS distribution\n\nRequired Custom Attribute:\n* ProductKey_Win2008R2-Std-x64 - Set using the Settings -> Product Key page.\n\nOptional Custom Attributes:\n* ComputerName\n* EncryptedAdminPassword (must be encrypted)\n* SystemDisk\n* SystemDiskNumber",
|
79
|
-
"status": "",
|
80
|
-
"name": "ProLiant OS - Windows 2008 R2 SP1 Standard x64 Scripted Install",
|
81
|
-
"state": "",
|
82
|
-
"modified": "2014-09-15T02:30:17.000Z",
|
83
|
-
"eTag": "2014-09-15T02:30:17.000Z",
|
84
|
-
"created": "2014-09-15T02:30:17.000Z",
|
85
|
-
"category": "os-deployment-build-plans",
|
86
|
-
"uri": "/rest/os-deployment-build-plans/1040001"
|
87
|
-
}
|
88
|
-
],
|
89
|
-
"start": 0,
|
90
|
-
"prevPageUri": null,
|
91
|
-
"nextPageUri": null,
|
92
|
-
"total": 0,
|
93
|
-
"count": 71,
|
94
|
-
"modified": null,
|
95
|
-
"eTag": null,
|
96
|
-
"created": null,
|
97
|
-
"category": null,
|
98
|
-
"uri": null
|
99
|
-
}
|