chef-provisioning-oneview 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,133 @@
1
+ {
2
+ "type": "ServerProfileListV4",
3
+ "members": [
4
+ {
5
+ "type": "ServerProfileV4",
6
+ "uri": "/rest/server-profiles/a16654c6-d12d-4e42-aa04-8868cf3dc31a",
7
+ "name": "Template - Web Server",
8
+ "description": "Web server machine template",
9
+ "serialNumber": "VCGE9KB035",
10
+ "uuid": "a16654c6-d12d-4e42-aa04-8868cf3dc31a",
11
+ "serverHardwareUri": null,
12
+ "serverHardwareTypeUri": "/rest/server-hardware-types/2947DC35-BE48-4075-A3FD-254A9B42F5BD",
13
+ "enclosureGroupUri": "/rest/enclosure-groups/3a11ccdd-b352-4046-a568-a8b0faa6cc39",
14
+ "enclosureUri": null,
15
+ "enclosureBay": null,
16
+ "affinity": "Bay",
17
+ "associatedServer": null,
18
+ "hideUnusedFlexNics": true,
19
+ "firmware": {
20
+ "forceInstallFirmware": false,
21
+ "manageFirmware": true,
22
+ "firmwareBaselineUri": "/rest/firmware-drivers/bp-hp-service-pack-for-proliant-oneview-2014-11-30-05"
23
+ },
24
+ "macType": "Virtual",
25
+ "wwnType": "Virtual",
26
+ "serialNumberType": "Virtual",
27
+ "category": "server-profiles",
28
+ "created": "20150730T115836.727Z",
29
+ "modified": "20150807T051446.275Z",
30
+ "status": "OK",
31
+ "state": "Normal",
32
+ "inProgress": false,
33
+ "taskUri": "/rest/tasks/26235118-827A-445D-9E5D-F2BBCAC8E9E8",
34
+ "connections": [
35
+ {
36
+ "id": 1,
37
+ "name": "Altair PXE 1133",
38
+ "functionType": "Ethernet",
39
+ "deploymentStatus": "Reserved",
40
+ "networkUri": "/rest/ethernet-networks/02b0b5c3-1a0a-4d5f-b5c9-0c7532cb1e5e",
41
+ "portId": "Flb 1:1-a",
42
+ "interconnectUri": null,
43
+ "macType": "Virtual",
44
+ "wwpnType": "Virtual",
45
+ "mac": "AE:B2:F8:20:00:D8",
46
+ "wwnn": null,
47
+ "wwpn": null,
48
+ "requestedMbps": "2500",
49
+ "allocatedMbps": 2500,
50
+ "maximumMbps": 10000,
51
+ "boot": {
52
+ "priority": "Primary"
53
+ }
54
+ },
55
+ {
56
+ "id": 2,
57
+ "name": "corpnet 10",
58
+ "functionType": "Ethernet",
59
+ "deploymentStatus": "Reserved",
60
+ "networkUri": "/rest/ethernet-networks/7a4698ae-5933-4e2e-8af3-57893c23a2d2",
61
+ "portId": "Flb 1:2-a",
62
+ "interconnectUri": null,
63
+ "macType": "Virtual",
64
+ "wwpnType": "Virtual",
65
+ "mac": "AE:B2:F8:20:00:D9",
66
+ "wwnn": null,
67
+ "wwpn": null,
68
+ "requestedMbps": "2500",
69
+ "allocatedMbps": 2500,
70
+ "maximumMbps": 10000,
71
+ "boot": {
72
+ "priority": "NotBootable"
73
+ }
74
+ }
75
+ ],
76
+ "bootMode": null,
77
+ "boot": {
78
+ "manageBoot": true,
79
+ "order": [
80
+ "HardDisk",
81
+ "PXE",
82
+ "CD",
83
+ "Floppy",
84
+ "USB"
85
+ ]
86
+ },
87
+ "bios": {
88
+ "manageBios": true,
89
+ "overriddenSettings": [
90
+ {
91
+ "id": "176",
92
+ "value": "1"
93
+ },
94
+ {
95
+ "id": "181",
96
+ "value": "1"
97
+ },
98
+ {
99
+ "id": "158",
100
+ "value": "2"
101
+ }
102
+ ]
103
+ },
104
+ "localStorage": {
105
+ "logicalDrives": [
106
+ {
107
+ "raidLevel": "RAID0",
108
+ "bootable": true
109
+ }
110
+ ],
111
+ "manageLocalStorage": true,
112
+ "initialize": true
113
+ },
114
+ "sanStorage": {
115
+ "volumeAttachments": [
116
+
117
+ ],
118
+ "manageSanStorage": false
119
+ },
120
+ "eTag": "1438924486161/12"
121
+ }
122
+ ],
123
+ "total": 1,
124
+ "start": 0,
125
+ "prevPageUri": null,
126
+ "nextPageUri": null,
127
+ "count": 1,
128
+ "category": "server-profiles",
129
+ "created": "20150810T223058.112Z",
130
+ "eTag": "20150810T223058.112Z",
131
+ "modified": "20150810T223058.112Z",
132
+ "uri": "/rest/server-profiles?filter=name%20matches%20'Template%20-%20Web%20Server'&sort=name:asc"
133
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "minimumVersion": 1,
3
+ "currentVersion": 120
4
+ }
@@ -0,0 +1,98 @@
1
+ require_relative './../spec_helper'
2
+ require_relative 'support/fake_action_handler'
3
+
4
+ RSpec.describe Chef::Provisioning::OneViewDriver do
5
+ let(:knife_config) do
6
+ { knife: {
7
+ oneview_url: 'https://my-oneview.my-domain.com',
8
+ oneview_username: 'Administrator',
9
+ oneview_password: 'password12',
10
+ oneview_ignore_ssl: true,
11
+
12
+ icsp_url: 'https://my-icsp.my-domain.com',
13
+ icsp_username: 'administrator',
14
+ icsp_password: 'password123'
15
+ } }
16
+ end
17
+
18
+ let(:valid_machine_options) do
19
+ {
20
+ convergence_options: {
21
+ ssl_verify_mode: :verify_none,
22
+ bootstrap_proxy: 'http://proxy.my-domain.com:8080',
23
+ chef_server: {
24
+ chef_server_url: 'https://my-chef-server.my-domain.com/organizations/oneview',
25
+ options: {
26
+ client_name: 'user',
27
+ signing_key_filename: 'spec/fixtures/.chef/user.pem'
28
+ }
29
+ }
30
+ },
31
+ driver_options: {
32
+ server_template: 'Template - Web Server',
33
+ os_build: 'CHEF-RHEL-6.5-x64',
34
+ host_name: 'chef-web03',
35
+ ip_address: '192.168.1.2',
36
+ domainType: 'workgroup',
37
+ domainName: 'my-domain.com',
38
+ gateway: '192.168.1.1',
39
+ dns: '192.168.1.1,10.1.1.1',
40
+ connections: {
41
+ 2 => { ip4Address: '192.168.1.2', mask: '255.255.254.0', dhcp: false }
42
+ }
43
+ },
44
+ custom_attributes: {
45
+
46
+ },
47
+ transport_options: {
48
+ ssh_options: { password: 'password1234' }
49
+ }
50
+ }
51
+ end
52
+
53
+ let(:action_handler) do
54
+ @handler ||= ChefProvisioningOneviewHelpers::FakeActionHandler.new
55
+ end
56
+
57
+ let(:machine_spec) do
58
+ # TODO
59
+ end
60
+
61
+ describe '#canonicalize_url' do
62
+ it 'canonicalizes the url' do
63
+ url = 'https://oneview.domain.com'
64
+ config = {}
65
+ expect(Chef::Provisioning::OneViewDriver.canonicalize_url("oneview:#{url}", config)).to eq("oneview:#{url}")
66
+ end
67
+
68
+ it 'canonicalizes the url from the config' do
69
+ url = 'https://oneview.domain.com'
70
+ config = { knife: { oneview_url: url } }
71
+ expect(Chef::Provisioning::OneViewDriver.canonicalize_url('oneview:', config)).to eq("oneview:#{url}")
72
+ end
73
+ end
74
+
75
+ describe '#initialize' do
76
+ before :each do
77
+ @url = 'https://oneview.domain.com'
78
+ canonical_url = "oneview:#{@url}"
79
+ @instance = Chef::Provisioning::OneViewDriver.new(canonical_url, knife_config)
80
+ end
81
+
82
+ it 'reads all necessary values from knife config during initialization' do
83
+ expect(@instance.instance_variable_get('@oneview_base_url')).to eq('https://my-oneview.my-domain.com')
84
+ expect(@instance.instance_variable_get('@oneview_username')).to eq('Administrator')
85
+ expect(@instance.instance_variable_get('@oneview_password')).to eq('password12')
86
+ expect(@instance.instance_variable_get('@oneview_disable_ssl')).to eq(true)
87
+ expect(@instance.instance_variable_get('@oneview_api_version')).to eq(120)
88
+ expect(@instance.instance_variable_get('@oneview_key')).to eq('long_oneview_key')
89
+
90
+ expect(@instance.instance_variable_get('@icsp_base_url')).to eq('https://my-icsp.my-domain.com')
91
+ expect(@instance.instance_variable_get('@icsp_username')).to eq('administrator')
92
+ expect(@instance.instance_variable_get('@icsp_password')).to eq('password123')
93
+ expect(@instance.instance_variable_get('@icsp_disable_ssl')).to eq(nil)
94
+ expect(@instance.instance_variable_get('@icsp_api_version')).to eq(102)
95
+ expect(@instance.instance_variable_get('@icsp_key')).to eq('long_icsp_key')
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,6 @@
1
+ module ChefProvisioningOneviewHelpers
2
+ class FakeActionHandler < Chef::Provisioning::ActionHandler
3
+ def puts(*)
4
+ end
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef-provisioning-oneview
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Hewlett Packard Enterprise
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chef
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '12.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '12.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: chef-provisioning
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ridley
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: sinatra
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Chef Provisioning driver for creating and managing OneView infrastructure.
98
+ email:
99
+ - jared.smartt@hp.com
100
+ - gunjan.kamle@hp.com
101
+ - matthew.frahry@hp.com
102
+ executables: []
103
+ extensions: []
104
+ extra_rdoc_files:
105
+ - README.md
106
+ - LICENSE
107
+ files:
108
+ - LICENSE
109
+ - README.md
110
+ - Rakefile
111
+ - lib/chef/provisioning/driver_init/oneview.rb
112
+ - lib/chef/provisioning/oneview/oneview_api.rb
113
+ - lib/chef/provisioning/oneview/v1.20/api.rb
114
+ - lib/chef/provisioning/oneview/v2.0/api.rb
115
+ - lib/chef/provisioning/oneview/version.rb
116
+ - lib/chef/provisioning/oneview_driver.rb
117
+ - spec/spec_helper.rb
118
+ - spec/support/fake_icsp.rb
119
+ - spec/support/fake_oneview.rb
120
+ - spec/support/fixtures/icsp/v102/error_404.json
121
+ - spec/support/fixtures/icsp/v102/login.json
122
+ - spec/support/fixtures/icsp/v102/os-deployment-build-plans.json
123
+ - spec/support/fixtures/icsp/v102/os-deployment-servers_managed.json
124
+ - spec/support/fixtures/icsp/v102/server_by_sn.json
125
+ - spec/support/fixtures/icsp/v102/version.json
126
+ - spec/support/fixtures/oneview/v120/error_404.json
127
+ - spec/support/fixtures/oneview/v120/login.json
128
+ - spec/support/fixtures/oneview/v120/server-hardware.json
129
+ - spec/support/fixtures/oneview/v120/server-profiles.json
130
+ - spec/support/fixtures/oneview/v120/server-profiles_specific.json
131
+ - spec/support/fixtures/oneview/v120/version.json
132
+ - spec/unit/oneview_driver_spec.rb
133
+ - spec/unit/support/fake_action_handler.rb
134
+ homepage: https://github.com/HewlettPackard/chef-provisioning-oneview
135
+ licenses:
136
+ - Apache-2.0
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.4.8
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Chef Provisioning driver for OneView
158
+ test_files: []
159
+ has_rdoc: