chef-provisioning-oneview 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,178 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"type": "ServerProfileV5",
|
3
|
-
"uri": null,
|
4
|
-
"name": null,
|
5
|
-
"description": "Web server template with SAN",
|
6
|
-
"serialNumber": null,
|
7
|
-
"uuid": null,
|
8
|
-
"serverProfileTemplateUri": "/rest/server-profile-templates/d64da635-f08a-41d4-b6eb-6517206a8baf",
|
9
|
-
"templateCompliance": "Unknown",
|
10
|
-
"serverHardwareUri": null,
|
11
|
-
"serverHardwareTypeUri": "/rest/server-hardware-types/5B42EABE-5140-4E38-91F0-68367B529DE9",
|
12
|
-
"enclosureGroupUri": "/rest/enclosure-groups/c0f86584-5a82-4480-ad13-8ed6544d6c98",
|
13
|
-
"enclosureUri": null,
|
14
|
-
"enclosureBay": null,
|
15
|
-
"affinity": "Bay",
|
16
|
-
"associatedServer": null,
|
17
|
-
"hideUnusedFlexNics": true,
|
18
|
-
"firmware": {
|
19
|
-
"firmwareInstallType": null,
|
20
|
-
"forceInstallFirmware": false,
|
21
|
-
"manageFirmware": false,
|
22
|
-
"firmwareBaselineUri": null
|
23
|
-
},
|
24
|
-
"macType": "Virtual",
|
25
|
-
"wwnType": "Virtual",
|
26
|
-
"serialNumberType": "Virtual",
|
27
|
-
"category": "server-profiles",
|
28
|
-
"created": null,
|
29
|
-
"modified": null,
|
30
|
-
"status": "OK",
|
31
|
-
"state": "Creating",
|
32
|
-
"inProgress": false,
|
33
|
-
"taskUri": null,
|
34
|
-
"connections": [
|
35
|
-
{
|
36
|
-
"id": 7,
|
37
|
-
"name": "Altair PXE",
|
38
|
-
"functionType": "Ethernet",
|
39
|
-
"deploymentStatus": null,
|
40
|
-
"networkUri": "/rest/ethernet-networks/7984a764-69ae-48c0-aec2-780d4f0366f8",
|
41
|
-
"portId": "Flb 1:1-a",
|
42
|
-
"requestedVFs": "Auto",
|
43
|
-
"allocatedVFs": null,
|
44
|
-
"interconnectUri": null,
|
45
|
-
"macType": null,
|
46
|
-
"wwpnType": null,
|
47
|
-
"mac": null,
|
48
|
-
"wwnn": null,
|
49
|
-
"wwpn": null,
|
50
|
-
"requestedMbps": "1000",
|
51
|
-
"allocatedMbps": 0,
|
52
|
-
"maximumMbps": 0,
|
53
|
-
"boot": {
|
54
|
-
"priority": "Primary"
|
55
|
-
}
|
56
|
-
},
|
57
|
-
{
|
58
|
-
"id": 8,
|
59
|
-
"name": "Corpnet",
|
60
|
-
"functionType": "Ethernet",
|
61
|
-
"deploymentStatus": null,
|
62
|
-
"networkUri": "/rest/ethernet-networks/52b6f044-f51b-4d4c-8d59-497c14c4681c",
|
63
|
-
"portId": "Flb 1:1-c",
|
64
|
-
"requestedVFs": "Auto",
|
65
|
-
"allocatedVFs": null,
|
66
|
-
"interconnectUri": null,
|
67
|
-
"macType": null,
|
68
|
-
"wwpnType": null,
|
69
|
-
"mac": null,
|
70
|
-
"wwnn": null,
|
71
|
-
"wwpn": null,
|
72
|
-
"requestedMbps": "2500",
|
73
|
-
"allocatedMbps": 0,
|
74
|
-
"maximumMbps": 0,
|
75
|
-
"boot": {
|
76
|
-
"priority": "NotBootable"
|
77
|
-
}
|
78
|
-
},
|
79
|
-
{
|
80
|
-
"id": 9,
|
81
|
-
"name": "san1",
|
82
|
-
"functionType": "FibreChannel",
|
83
|
-
"deploymentStatus": null,
|
84
|
-
"networkUri": "/rest/fc-networks/2c04a682-66b4-4a64-8c2d-3095937a8e7e",
|
85
|
-
"portId": "Flb 1:1-b",
|
86
|
-
"requestedVFs": null,
|
87
|
-
"allocatedVFs": null,
|
88
|
-
"interconnectUri": null,
|
89
|
-
"macType": null,
|
90
|
-
"wwpnType": null,
|
91
|
-
"mac": null,
|
92
|
-
"wwnn": null,
|
93
|
-
"wwpn": null,
|
94
|
-
"requestedMbps": "4000",
|
95
|
-
"allocatedMbps": 0,
|
96
|
-
"maximumMbps": 0,
|
97
|
-
"boot": {
|
98
|
-
"priority": "Primary"
|
99
|
-
}
|
100
|
-
},
|
101
|
-
{
|
102
|
-
"id": 10,
|
103
|
-
"name": "san2",
|
104
|
-
"functionType": "FibreChannel",
|
105
|
-
"deploymentStatus": null,
|
106
|
-
"networkUri": "/rest/fc-networks/93c97ad9-3e6d-4cc4-8b37-3ef3a6a9cf77",
|
107
|
-
"portId": "Flb 1:2-b",
|
108
|
-
"requestedVFs": null,
|
109
|
-
"allocatedVFs": null,
|
110
|
-
"interconnectUri": null,
|
111
|
-
"macType": null,
|
112
|
-
"wwpnType": null,
|
113
|
-
"mac": null,
|
114
|
-
"wwnn": null,
|
115
|
-
"wwpn": null,
|
116
|
-
"requestedMbps": "4000",
|
117
|
-
"allocatedMbps": 0,
|
118
|
-
"maximumMbps": 0,
|
119
|
-
"boot": {
|
120
|
-
"priority": "Secondary"
|
121
|
-
}
|
122
|
-
}
|
123
|
-
],
|
124
|
-
"bootMode": null,
|
125
|
-
"boot": {
|
126
|
-
"order": [
|
127
|
-
"HardDisk",
|
128
|
-
"PXE",
|
129
|
-
"CD",
|
130
|
-
"Floppy",
|
131
|
-
"USB"
|
132
|
-
],
|
133
|
-
"manageBoot": true
|
134
|
-
},
|
135
|
-
"bios": {
|
136
|
-
"overriddenSettings": [
|
137
|
-
|
138
|
-
],
|
139
|
-
"manageBios": false
|
140
|
-
},
|
141
|
-
"localStorage": {
|
142
|
-
"controllers": []
|
143
|
-
},
|
144
|
-
"sanStorage": {
|
145
|
-
"volumeAttachments": [
|
146
|
-
{
|
147
|
-
"permanent": false,
|
148
|
-
"storagePaths": [
|
149
|
-
{
|
150
|
-
"storageTargets": [],
|
151
|
-
"storageTargetType": "Auto",
|
152
|
-
"connectionId": 3,
|
153
|
-
"isEnabled": true
|
154
|
-
},
|
155
|
-
{
|
156
|
-
"storageTargets": [],
|
157
|
-
"storageTargetType": "Auto",
|
158
|
-
"connectionId": 4,
|
159
|
-
"isEnabled": true
|
160
|
-
}
|
161
|
-
],
|
162
|
-
"volumeStoragePoolUri": "/rest/storage-pools/707E383B-56F6-48A1-BFF1-782BB2AC6BA7",
|
163
|
-
"volumeStorageSystemUri": "/rest/storage-systems/1405534",
|
164
|
-
"volumeDescription": "",
|
165
|
-
"volumeShareable": false,
|
166
|
-
"volumeProvisionType": "Thin",
|
167
|
-
"volumeProvisionedCapacityBytes": "53687091200",
|
168
|
-
"lun": "0",
|
169
|
-
"lunType": "Manual",
|
170
|
-
"volumeName": "bootVol",
|
171
|
-
"id": 1
|
172
|
-
}
|
173
|
-
],
|
174
|
-
"hostOSType": "RHE Linux (5.x, 6.x)",
|
175
|
-
"manageSanStorage": true
|
176
|
-
},
|
177
|
-
"eTag": null
|
178
|
-
}
|
@@ -1,78 +0,0 @@
|
|
1
|
-
require_relative './../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Chef::Provisioning::OneViewDriver do
|
4
|
-
include_context 'shared context'
|
5
|
-
|
6
|
-
describe '#create_machine' do
|
7
|
-
before :each do
|
8
|
-
$server_created = nil
|
9
|
-
end
|
10
|
-
|
11
|
-
context 'OneView 120' do
|
12
|
-
it 'skips creating machines that already exist' do
|
13
|
-
a = action_handler
|
14
|
-
m = machine_spec
|
15
|
-
o = valid_machine_options
|
16
|
-
ret_val = @instance.instance_eval { create_machine(a, m, o) }
|
17
|
-
expect(a_request(:post, %r{/rest/server-profiles})).to_not have_been_made
|
18
|
-
expect(ret_val['name']).to eq('chef-web01')
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'creates a machine from a Profile Template if it does not exist' do
|
22
|
-
a = action_handler
|
23
|
-
m = machine_spec
|
24
|
-
o = valid_machine_options
|
25
|
-
o[:driver_options][:host_name] = 'chef-web03'
|
26
|
-
@instance.instance_eval { create_machine(a, m, o) }
|
27
|
-
expect(a_request(:post, %r{/rest/server-profiles})).to have_been_made.times(1)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'sets the correct HW uri to create a machine if it does not exist' do
|
31
|
-
a = action_handler
|
32
|
-
m = machine_spec
|
33
|
-
o = valid_machine_options
|
34
|
-
o[:driver_options][:host_name] = 'chef-web03'
|
35
|
-
@instance.instance_eval { create_machine(a, m, o) }
|
36
|
-
expect(a_request(:post, %r{/rest/server-profiles}).with do |req|
|
37
|
-
req.body.match('"serverHardwareUri":"/rest/server-hardware/31363636-3136-584D-5132-333230314D38"') &&
|
38
|
-
req.body.match('"serverHardwareTypeUri":"/rest/server-hardware-types/2947DC35-BE48-4075-A3FD-254A9B42F5BD"') &&
|
39
|
-
req.body.match('"enclosureGroupUri":"/rest/enclosure-groups/3a11ccdd-b352-4046-a568-a8b0faa6cc39"') &&
|
40
|
-
!req.body.match('"enclosureUri":"') &&
|
41
|
-
!req.body.match('"enclosureBay":"')
|
42
|
-
end).to have_been_made
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context 'OneView 200' do
|
47
|
-
before :each do
|
48
|
-
@instance.instance_variable_set('@current_oneview_api_version', 200)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'creates a machine from a Template if it does not exist' do
|
52
|
-
a = action_handler
|
53
|
-
m = machine_spec
|
54
|
-
o = valid_machine_options
|
55
|
-
o[:driver_options][:host_name] = 'chef-web03'
|
56
|
-
o[:driver_options][:server_template] = 'Web Server Template'
|
57
|
-
@instance.instance_eval { create_machine(a, m, o) }
|
58
|
-
expect(a_request(:post, %r{/rest/server-profiles})).to have_been_made.times(1)
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'sets the correct HW uri from a Template to create a machine if it does not exist' do
|
62
|
-
a = action_handler
|
63
|
-
m = machine_spec
|
64
|
-
o = valid_machine_options
|
65
|
-
o[:driver_options][:host_name] = 'chef-web03'
|
66
|
-
o[:driver_options][:server_template] = 'Web Server Template'
|
67
|
-
@instance.instance_eval { create_machine(a, m, o) }
|
68
|
-
expect(a_request(:post, %r{/rest/server-profiles}).with do |req|
|
69
|
-
req.body.match('"serverHardwareUri":"/rest/server-hardware/37333036-3831-584D-5131-303030323037"') &&
|
70
|
-
req.body.match('"serverHardwareTypeUri":"/rest/server-hardware-types/5B42EABE-5140-4E38-91F0-68367B529DE9"') &&
|
71
|
-
req.body.match('"enclosureGroupUri":"/rest/enclosure-groups/c0f86584-5a82-4480-ad13-8ed6544d6c98"') &&
|
72
|
-
!req.body.match('"enclosureUri":"') &&
|
73
|
-
!req.body.match('"enclosureBay":"')
|
74
|
-
end).to have_been_made
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
data/spec/unit/destroy_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require_relative './../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Chef::Provisioning::OneViewDriver do
|
4
|
-
include_context 'shared context'
|
5
|
-
|
6
|
-
describe '#destroy_oneview_profile' do
|
7
|
-
it 'destroys the profile' do
|
8
|
-
a = action_handler
|
9
|
-
m = machine_spec
|
10
|
-
@instance.instance_eval { destroy_oneview_profile(a, m) }
|
11
|
-
expect(a_request(:get, %r{/rest/server-hardware/.*})).to have_been_made
|
12
|
-
expect(a_request(:get, %r{/rest/tasks/.*})).to have_been_made
|
13
|
-
expect(a_request(:delete, %r{/rest/server-profiles/.*})).to have_been_made
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe '#destroy_icsp_server' do
|
18
|
-
it 'destroys the server' do
|
19
|
-
a = action_handler
|
20
|
-
m = machine_spec
|
21
|
-
@instance.instance_eval { destroy_icsp_server(a, m) }
|
22
|
-
expect(a_request(:delete, %r{/rest/os-deployment-servers/.*})).to have_been_made
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require_relative './../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Chef::Provisioning::OneViewDriver do
|
4
|
-
include_context 'shared context'
|
5
|
-
|
6
|
-
describe '#icsp_configure_nic_teams' do
|
7
|
-
|
8
|
-
it 'configures nic teams properly' do
|
9
|
-
machine_options = valid_machine_options
|
10
|
-
profile = @instance.instance_eval { get_oneview_profile_by_sn('VCGE9KB041') }
|
11
|
-
ret_val = @instance.instance_eval { icsp_configure_nic_teams(machine_options, profile) }
|
12
|
-
expect(ret_val).to eq('team1-11:11:11:11:01:14,11:11:11:11:01:15')
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'requires connection IDs to map to valid OneView connection IDs' do
|
16
|
-
machine_options = valid_machine_options
|
17
|
-
profile = @instance.instance_eval { get_oneview_profile_by_sn('VCGE9KB041') }
|
18
|
-
machine_options[:driver_options][:connections][3] = { team: 'team2' }
|
19
|
-
expect { @instance.instance_eval { icsp_configure_nic_teams(machine_options, profile) } }.to raise_error(/make sure the connection ids map to those on OneView/)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'does not allow nic teams with hyphens' do
|
23
|
-
machine_options = valid_machine_options
|
24
|
-
profile = @instance.instance_eval { get_oneview_profile_by_sn('VCGE9KB041') }
|
25
|
-
machine_options[:driver_options][:connections][1][:team] = 'team-1'
|
26
|
-
expect { @instance.instance_eval { icsp_configure_nic_teams(machine_options, profile) } }.to raise_error(/must not include hyphens/)
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'requires at least 2 connections per team' do
|
30
|
-
machine_options = valid_machine_options
|
31
|
-
profile = @instance.instance_eval { get_oneview_profile_by_sn('VCGE9KB041') }
|
32
|
-
machine_options[:driver_options][:connections].delete(2)
|
33
|
-
expect { @instance.instance_eval { icsp_configure_nic_teams(machine_options, profile) } }.to raise_error(/must have at least 2 associated connections/)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require_relative './../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Chef::Provisioning::OneViewDriver do
|
4
|
-
include_context 'shared context'
|
5
|
-
|
6
|
-
describe '#get_icsp_server_by_sn' do
|
7
|
-
|
8
|
-
it 'gets info for a valid SN' do
|
9
|
-
ret_val = @instance.instance_eval { get_icsp_server_by_sn('VCGE9KB041') }
|
10
|
-
expect(ret_val['serialNumber']).to eq('VCGE9KB041')
|
11
|
-
expect(ret_val['uri']).to match(%r{\/rest\/os-deployment-servers\/.+})
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns nil for fake SN' do
|
15
|
-
ret_val = @instance.instance_eval { get_icsp_server_by_sn('FAKESN') }
|
16
|
-
expect(ret_val).to be_nil
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'fails when an empty SN is given' do
|
20
|
-
expect { @instance.instance_eval { get_icsp_server_by_sn('') } }.to raise_error('Must specify a serialNumber!')
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
@@ -1,79 +0,0 @@
|
|
1
|
-
require_relative './../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Chef::Provisioning::OneViewDriver do
|
4
|
-
include_context 'shared context'
|
5
|
-
|
6
|
-
describe '#canonicalize_url' do
|
7
|
-
it 'canonicalizes the url' do
|
8
|
-
url = 'https://oneview.domain.com'
|
9
|
-
config = {}
|
10
|
-
expect(Chef::Provisioning::OneViewDriver.canonicalize_url("oneview:#{url}", config)).to eq("oneview:#{url}")
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'canonicalizes the url from the config' do
|
14
|
-
url = 'https://oneview.domain.com'
|
15
|
-
config = { knife: { oneview_url: url } }
|
16
|
-
expect(Chef::Provisioning::OneViewDriver.canonicalize_url('oneview:', config)).to eq("oneview:#{url}")
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
describe '#initialize' do
|
21
|
-
|
22
|
-
it 'reads all necessary values from knife config during initialization' do
|
23
|
-
expect(@instance.instance_variable_get('@oneview_base_url')).to eq('https://my-oneview.my-domain.com')
|
24
|
-
expect(@instance.instance_variable_get('@oneview_username')).to eq('Administrator')
|
25
|
-
expect(@instance.instance_variable_get('@oneview_password')).to eq('password12')
|
26
|
-
expect(@instance.instance_variable_get('@oneview_disable_ssl')).to eq(true)
|
27
|
-
expect(@instance.instance_variable_get('@api_timeout')).to eq(15)
|
28
|
-
|
29
|
-
expect(@instance.instance_variable_get('@icsp_base_url')).to eq('https://my-icsp.my-domain.com')
|
30
|
-
expect(@instance.instance_variable_get('@icsp_username')).to eq('administrator')
|
31
|
-
expect(@instance.instance_variable_get('@icsp_password')).to eq('password123')
|
32
|
-
expect(@instance.instance_variable_get('@icsp_disable_ssl')).to eq(nil)
|
33
|
-
expect(@instance.instance_variable_get('@icsp_ignore')).to eq(false)
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'uses the correct api versions' do
|
37
|
-
expect(@instance.instance_variable_get('@oneview_api_version')).to eq(120)
|
38
|
-
expect(@instance.instance_variable_get('@icsp_api_version')).to eq(102)
|
39
|
-
expect(@instance.instance_variable_get('@current_oneview_api_version')).to eq(120)
|
40
|
-
expect(@instance.instance_variable_get('@current_icsp_api_version')).to eq(102)
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'requires the oneview_url knife param' do
|
44
|
-
knife_config[:knife].delete(:oneview_url)
|
45
|
-
expect { Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config) }.to raise_error('Must set knife[:oneview_url] attribute!')
|
46
|
-
end
|
47
|
-
|
48
|
-
it 'requires the oneview_username knife param' do
|
49
|
-
knife_config[:knife].delete(:oneview_username)
|
50
|
-
expect { Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config) }.to raise_error('Must set knife[:oneview_username] attribute!')
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'requires the oneview_password knife param' do
|
54
|
-
knife_config[:knife].delete(:oneview_password)
|
55
|
-
expect { Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config) }.to raise_error('Must set knife[:oneview_password] attribute!')
|
56
|
-
end
|
57
|
-
|
58
|
-
it 'gives a warning if the knife[:icsp_url] is not set' do
|
59
|
-
knife_config[:knife].delete(:icsp_url)
|
60
|
-
expect(Chef::Log).to receive(:warn).with('knife[:icsp_url] not set in knife.rb!')
|
61
|
-
driver = Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config)
|
62
|
-
expect(driver.instance_variable_get('@icsp_ignore')).to eq(true)
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'gives a warning if the knife[:icsp_username] is not set' do
|
66
|
-
knife_config[:knife].delete(:icsp_username)
|
67
|
-
expect(Chef::Log).to receive(:warn).with('knife[:icsp_username] not set in knife.rb!')
|
68
|
-
driver = Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config)
|
69
|
-
expect(driver.instance_variable_get('@icsp_ignore')).to eq(true)
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'gives a warning if the knife[:icsp_password] is not set' do
|
73
|
-
knife_config[:knife].delete(:icsp_password)
|
74
|
-
expect(Chef::Log).to receive(:warn).with('knife[:icsp_password] not set in knife.rb!')
|
75
|
-
driver = Chef::Provisioning::OneViewDriver.new(@canonical_url, knife_config)
|
76
|
-
expect(driver.instance_variable_get('@icsp_ignore')).to eq(true)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_relative './../spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe Chef::Provisioning::OneViewDriver do
|
4
|
-
include_context 'shared context'
|
5
|
-
|
6
|
-
describe 'login functions' do
|
7
|
-
|
8
|
-
it 'can parse the oneview sessionID' do
|
9
|
-
expect(@instance.instance_eval { login_to_oneview }).to match(@oneview_key)
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'can parse the icsp sessionID' do
|
13
|
-
expect(@instance.instance_eval { login_to_icsp }).to match(@icsp_key)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|