oneview-sdk 2.2.1 → 3.0.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 +50 -0
- data/README.md +61 -15
- data/Rakefile +39 -1
- data/lib/oneview-sdk.rb +38 -3
- data/lib/oneview-sdk/cli.rb +85 -30
- data/lib/oneview-sdk/client.rb +21 -18
- data/lib/oneview-sdk/config_loader.rb +1 -1
- data/lib/oneview-sdk/resource.rb +44 -36
- data/lib/oneview-sdk/resource/api200.rb +34 -0
- data/lib/oneview-sdk/resource/api200/connection_template.rb +52 -0
- data/lib/oneview-sdk/resource/api200/datacenter.rb +81 -0
- data/lib/oneview-sdk/resource/api200/enclosure.rb +203 -0
- data/lib/oneview-sdk/resource/api200/enclosure_group.rb +86 -0
- data/lib/oneview-sdk/resource/api200/ethernet_network.rb +60 -0
- data/lib/oneview-sdk/resource/api200/fabric.rb +45 -0
- data/lib/oneview-sdk/resource/api200/fc_network.rb +34 -0
- data/lib/oneview-sdk/resource/api200/fcoe_network.rb +32 -0
- data/lib/oneview-sdk/resource/api200/firmware_bundle.rb +56 -0
- data/lib/oneview-sdk/resource/{fcoe_network.rb → api200/firmware_driver.rb} +21 -12
- data/lib/oneview-sdk/resource/api200/interconnect.rb +112 -0
- data/lib/oneview-sdk/resource/api200/lig_uplink_set.rb +84 -0
- data/lib/oneview-sdk/resource/api200/logical_downlink.rb +57 -0
- data/lib/oneview-sdk/resource/api200/logical_enclosure.rb +88 -0
- data/lib/oneview-sdk/resource/api200/logical_interconnect.rb +251 -0
- data/lib/oneview-sdk/resource/api200/logical_interconnect_group.rb +116 -0
- data/lib/oneview-sdk/resource/api200/logical_switch.rb +188 -0
- data/lib/oneview-sdk/resource/api200/logical_switch_group.rb +70 -0
- data/lib/oneview-sdk/resource/api200/managed_san.rb +83 -0
- data/lib/oneview-sdk/resource/api200/network_set.rb +68 -0
- data/lib/oneview-sdk/resource/api200/power_device.rb +178 -0
- data/lib/oneview-sdk/resource/api200/rack.rb +88 -0
- data/lib/oneview-sdk/resource/api200/resource.rb +18 -0
- data/lib/oneview-sdk/resource/api200/san_manager.rb +92 -0
- data/lib/oneview-sdk/resource/api200/server_hardware.rb +244 -0
- data/lib/oneview-sdk/resource/api200/server_hardware_type.rb +61 -0
- data/lib/oneview-sdk/resource/api200/server_profile.rb +385 -0
- data/lib/oneview-sdk/resource/api200/server_profile_template.rb +217 -0
- data/lib/oneview-sdk/resource/api200/storage_pool.rb +92 -0
- data/lib/oneview-sdk/resource/api200/storage_system.rb +157 -0
- data/lib/oneview-sdk/resource/api200/switch.rb +91 -0
- data/lib/oneview-sdk/resource/api200/unmanaged_device.rb +59 -0
- data/lib/oneview-sdk/resource/api200/uplink_set.rb +83 -0
- data/lib/oneview-sdk/resource/api200/volume.rb +192 -0
- data/lib/oneview-sdk/resource/api200/volume_attachment.rb +83 -0
- data/lib/oneview-sdk/resource/api200/volume_snapshot.rb +50 -0
- data/lib/oneview-sdk/resource/api200/volume_template.rb +99 -0
- data/lib/oneview-sdk/resource/api300.rb +66 -0
- data/lib/oneview-sdk/resource/api300/c7000.rb +27 -0
- data/lib/oneview-sdk/resource/api300/c7000/connection_template.rb +30 -0
- data/lib/oneview-sdk/resource/api300/c7000/datacenter.rb +22 -0
- data/lib/oneview-sdk/resource/api300/c7000/enclosure.rb +48 -0
- data/lib/oneview-sdk/resource/api300/c7000/enclosure_group.rb +37 -0
- data/lib/oneview-sdk/resource/api300/c7000/ethernet_network.rb +35 -0
- data/lib/oneview-sdk/resource/api300/c7000/fabric.rb +22 -0
- data/lib/oneview-sdk/resource/api300/c7000/fc_network.rb +37 -0
- data/lib/oneview-sdk/resource/api300/c7000/fcoe_network.rb +35 -0
- data/lib/oneview-sdk/resource/api300/c7000/firmware_bundle.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/firmware_driver.rb +22 -0
- data/lib/oneview-sdk/resource/api300/c7000/interconnect.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/lig_uplink_set.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/logical_downlink.rb +34 -0
- data/lib/oneview-sdk/resource/api300/c7000/logical_enclosure.rb +35 -0
- data/lib/oneview-sdk/resource/api300/c7000/logical_interconnect.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/logical_interconnect_group.rb +33 -0
- data/lib/oneview-sdk/resource/api300/c7000/logical_switch.rb +51 -0
- data/lib/oneview-sdk/resource/api300/c7000/logical_switch_group.rb +33 -0
- data/lib/oneview-sdk/resource/api300/c7000/managed_san.rb +36 -0
- data/lib/oneview-sdk/resource/api300/c7000/network_set.rb +37 -0
- data/lib/oneview-sdk/resource/api300/c7000/power_device.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/rack.rb +22 -0
- data/lib/oneview-sdk/resource/api300/c7000/resource.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/san_manager.rb +22 -0
- data/lib/oneview-sdk/resource/api300/c7000/server_hardware.rb +93 -0
- data/lib/oneview-sdk/resource/api300/c7000/server_hardware_type.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/server_profile.rb +33 -0
- data/lib/oneview-sdk/resource/api300/c7000/server_profile_template.rb +50 -0
- data/lib/oneview-sdk/resource/api300/c7000/storage_pool.rb +29 -0
- data/lib/oneview-sdk/resource/api300/c7000/storage_system.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/switch.rb +31 -0
- data/lib/oneview-sdk/resource/api300/c7000/unmanaged_device.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/uplink_set.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/volume.rb +22 -0
- data/lib/oneview-sdk/resource/api300/c7000/volume_attachment.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/volume_snapshot.rb +21 -0
- data/lib/oneview-sdk/resource/api300/c7000/volume_template.rb +32 -0
- data/lib/oneview-sdk/resource/api300/synergy.rb +27 -0
- data/lib/oneview-sdk/resource/api300/synergy/connection_template.rb +30 -0
- data/lib/oneview-sdk/resource/api300/synergy/datacenter.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/drive_enclosure.rb +71 -0
- data/lib/oneview-sdk/resource/api300/synergy/enclosure.rb +110 -0
- data/lib/oneview-sdk/resource/api300/synergy/enclosure_group.rb +43 -0
- data/lib/oneview-sdk/resource/api300/synergy/ethernet_network.rb +35 -0
- data/lib/oneview-sdk/resource/api300/synergy/fabric.rb +46 -0
- data/lib/oneview-sdk/resource/api300/synergy/fc_network.rb +37 -0
- data/lib/oneview-sdk/resource/api300/synergy/fcoe_network.rb +35 -0
- data/lib/oneview-sdk/resource/api300/synergy/firmware_bundle.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/firmware_driver.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/interconnect.rb +43 -0
- data/lib/oneview-sdk/resource/api300/synergy/lig_uplink_set.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/logical_downlink.rb +34 -0
- data/lib/oneview-sdk/resource/api300/synergy/logical_enclosure.rb +59 -0
- data/lib/oneview-sdk/resource/api300/synergy/logical_interconnect.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/logical_interconnect_group.rb +119 -0
- data/lib/oneview-sdk/resource/api300/synergy/logical_switch.rb +33 -0
- data/lib/oneview-sdk/resource/api300/synergy/logical_switch_group.rb +45 -0
- data/lib/oneview-sdk/resource/{firmware_driver.rb → api300/synergy/managed_san.rb} +7 -17
- data/lib/oneview-sdk/resource/api300/synergy/network_set.rb +37 -0
- data/lib/oneview-sdk/resource/api300/synergy/power_device.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/rack.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/resource.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/san_manager.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/sas_interconnect.rb +87 -0
- data/lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect.rb +110 -0
- data/lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect_group.rb +87 -0
- data/lib/oneview-sdk/resource/api300/synergy/server_hardware.rb +30 -0
- data/lib/oneview-sdk/resource/api300/synergy/server_hardware_type.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/server_profile.rb +78 -0
- data/lib/oneview-sdk/resource/api300/synergy/server_profile_template.rb +34 -0
- data/lib/oneview-sdk/resource/api300/synergy/storage_pool.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/storage_system.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/switch.rb +37 -0
- data/lib/oneview-sdk/resource/api300/synergy/unmanaged_device.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/uplink_set.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/volume.rb +22 -0
- data/lib/oneview-sdk/resource/api300/synergy/volume_attachment.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/volume_snapshot.rb +21 -0
- data/lib/oneview-sdk/resource/api300/synergy/volume_template.rb +32 -0
- data/lib/oneview-sdk/rest.rb +7 -10
- data/lib/oneview-sdk/ssl_helper.rb +3 -3
- data/lib/oneview-sdk/version.rb +1 -1
- data/oneview-sdk.gemspec +5 -5
- metadata +126 -47
- data/.gitattributes +0 -2
- data/.gitignore +0 -29
- data/.rubocop.yml +0 -80
- data/.travis.yml +0 -12
- data/lib/oneview-sdk/resource/connection_template.rb +0 -48
- data/lib/oneview-sdk/resource/datacenter.rb +0 -77
- data/lib/oneview-sdk/resource/enclosure.rb +0 -191
- data/lib/oneview-sdk/resource/enclosure_group.rb +0 -82
- data/lib/oneview-sdk/resource/ethernet_network.rb +0 -56
- data/lib/oneview-sdk/resource/fabric.rb +0 -41
- data/lib/oneview-sdk/resource/fc_network.rb +0 -30
- data/lib/oneview-sdk/resource/firmware_bundle.rb +0 -50
- data/lib/oneview-sdk/resource/interconnect.rb +0 -107
- data/lib/oneview-sdk/resource/lig_uplink_set.rb +0 -80
- data/lib/oneview-sdk/resource/logical_downlink.rb +0 -53
- data/lib/oneview-sdk/resource/logical_enclosure.rb +0 -86
- data/lib/oneview-sdk/resource/logical_interconnect.rb +0 -247
- data/lib/oneview-sdk/resource/logical_interconnect_group.rb +0 -112
- data/lib/oneview-sdk/resource/logical_switch.rb +0 -184
- data/lib/oneview-sdk/resource/logical_switch_group.rb +0 -66
- data/lib/oneview-sdk/resource/managed_san.rb +0 -79
- data/lib/oneview-sdk/resource/network_set.rb +0 -64
- data/lib/oneview-sdk/resource/power_device.rb +0 -174
- data/lib/oneview-sdk/resource/rack.rb +0 -83
- data/lib/oneview-sdk/resource/san_manager.rb +0 -88
- data/lib/oneview-sdk/resource/server_hardware.rb +0 -209
- data/lib/oneview-sdk/resource/server_hardware_type.rb +0 -58
- data/lib/oneview-sdk/resource/server_profile.rb +0 -380
- data/lib/oneview-sdk/resource/server_profile_template.rb +0 -213
- data/lib/oneview-sdk/resource/storage_pool.rb +0 -63
- data/lib/oneview-sdk/resource/storage_system.rb +0 -113
- data/lib/oneview-sdk/resource/switch.rb +0 -86
- data/lib/oneview-sdk/resource/unmanaged_device.rb +0 -55
- data/lib/oneview-sdk/resource/uplink_set.rb +0 -79
- data/lib/oneview-sdk/resource/volume.rb +0 -188
- data/lib/oneview-sdk/resource/volume_attachment.rb +0 -79
- data/lib/oneview-sdk/resource/volume_snapshot.rb +0 -46
- data/lib/oneview-sdk/resource/volume_template.rb +0 -95
@@ -1,77 +0,0 @@
|
|
1
|
-
# (C) Copyright 2016 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
|
10
|
-
# specific language governing permissions and limitations under the License.
|
11
|
-
|
12
|
-
module OneviewSDK
|
13
|
-
# Datacenter resource implementation
|
14
|
-
class Datacenter < Resource
|
15
|
-
BASE_URI = '/rest/datacenters'.freeze
|
16
|
-
|
17
|
-
# Add the resource on OneView using the current data
|
18
|
-
# @note Calls the refresh method to set additional data
|
19
|
-
# @raise [OneviewSDK::IncompleteResource] if the client is not set
|
20
|
-
# @raise [StandardError] if the resource creation fails
|
21
|
-
# @return [OneviewSDK::Datacenter] self
|
22
|
-
alias add create
|
23
|
-
|
24
|
-
# Remove resource from OneView
|
25
|
-
# @return [true] if resource was removed successfully
|
26
|
-
alias remove delete
|
27
|
-
|
28
|
-
# Create a resource object, associate it with a client, and set its properties.
|
29
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
30
|
-
# @param [Hash] params The options for this resource (key-value pairs)
|
31
|
-
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
32
|
-
def initialize(client, params = {}, api_ver = nil)
|
33
|
-
super
|
34
|
-
# Default values:
|
35
|
-
@data['contents'] ||= []
|
36
|
-
end
|
37
|
-
|
38
|
-
# Method is not available
|
39
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
40
|
-
def create
|
41
|
-
unavailable_method
|
42
|
-
end
|
43
|
-
|
44
|
-
# Method is not available
|
45
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
46
|
-
def delete
|
47
|
-
unavailable_method
|
48
|
-
end
|
49
|
-
|
50
|
-
# Adds an existing rack to the datacenter
|
51
|
-
# @param [OneviewSDK::Rack] rack rack
|
52
|
-
# @param [Decimal] pos_x x position
|
53
|
-
# @param [Decimal] pos_y y position
|
54
|
-
# @param [Decimal] rotation Rotation degrees (0-359) around the center of the resource
|
55
|
-
def add_rack(rack, pos_x, pos_y, rotation = 0)
|
56
|
-
@data['contents'] << {
|
57
|
-
'resourceUri' => rack['uri'],
|
58
|
-
'x' => pos_x,
|
59
|
-
'y' => pos_y,
|
60
|
-
'rotation' => rotation
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
# Removes a rack from the datacenter
|
65
|
-
# @param [OneviewSDK::Rack] rack rack
|
66
|
-
def remove_rack(rack)
|
67
|
-
@data['contents'].reject! { |resource| resource['resourceUri'] == rack['uri'] }
|
68
|
-
end
|
69
|
-
|
70
|
-
# Gets a list of the visual content objects
|
71
|
-
# @return [Hash]
|
72
|
-
def get_visual_content
|
73
|
-
response = @client.rest_get(@data['uri'] + '/visualContent')
|
74
|
-
@client.response_handler(response)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,191 +0,0 @@
|
|
1
|
-
# (C) Copyright 2016 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 'time'
|
13
|
-
require 'date'
|
14
|
-
|
15
|
-
module OneviewSDK
|
16
|
-
# Enclosure resource implementation
|
17
|
-
class Enclosure < Resource
|
18
|
-
BASE_URI = '/rest/enclosures'.freeze
|
19
|
-
|
20
|
-
# Remove resource from OneView
|
21
|
-
# @return [true] if resource was removed successfully
|
22
|
-
alias remove delete
|
23
|
-
|
24
|
-
# Create a resource object, associate it with a client, and set its properties.
|
25
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
26
|
-
# @param [Hash] params The options for this resource (key-value pairs)
|
27
|
-
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
28
|
-
def initialize(client, params = {}, api_ver = nil)
|
29
|
-
super
|
30
|
-
# Default values:
|
31
|
-
@data['type'] ||= 'EnclosureV200'
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
# Method is not available
|
36
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
37
|
-
def create
|
38
|
-
unavailable_method
|
39
|
-
end
|
40
|
-
|
41
|
-
# Method is not available
|
42
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
43
|
-
def delete
|
44
|
-
unavailable_method
|
45
|
-
end
|
46
|
-
|
47
|
-
# Claim/configure the enclosure and its components to the appliance
|
48
|
-
# @note Calls the refresh method to set additional data
|
49
|
-
# @return [OneviewSDK::Enclosure] self
|
50
|
-
def add
|
51
|
-
ensure_client
|
52
|
-
required_attributes = %w(enclosureGroupUri hostname username password licensingIntent)
|
53
|
-
required_attributes.each { |k| fail IncompleteResource, "Missing required attribute: '#{k}'" unless @data.key?(k) }
|
54
|
-
|
55
|
-
optional_attrs = %w(enclosureUri firmwareBaselineUri force forceInstallFirmware state unmanagedEnclosure updateFirmwareOn)
|
56
|
-
temp_data = @data.select { |k, _v| required_attributes.include?(k) || optional_attrs.include?(k) }
|
57
|
-
response = @client.rest_post(self.class::BASE_URI, { 'body' => temp_data }, @api_version)
|
58
|
-
new_data = @client.response_handler(response)
|
59
|
-
old_name = @data.select { |k, _v| %w(name rackName).include?(k) } # Save name (if given)
|
60
|
-
%w(username password hostname).each { |k| @data.delete(k) } # These are no longer needed
|
61
|
-
set_all(new_data)
|
62
|
-
set_all(old_name)
|
63
|
-
update
|
64
|
-
self
|
65
|
-
end
|
66
|
-
|
67
|
-
# Overrides the update operation because only the name and rackName can be updated (and it uses PATCH).
|
68
|
-
# @param [Hash] attributes attributes to be updated
|
69
|
-
# @return [OneviewSDK::Enclosure] self
|
70
|
-
def update(attributes = {})
|
71
|
-
set_all(attributes)
|
72
|
-
ensure_client && ensure_uri
|
73
|
-
cur_state = self.class.find_by(@client, uri: @data['uri']).first
|
74
|
-
unless cur_state[:name] == @data['name']
|
75
|
-
temp_data = [{ op: 'replace', path: '/name', value: @data['name'] }]
|
76
|
-
response = @client.rest_patch(@data['uri'], { 'body' => temp_data }, @api_version)
|
77
|
-
@client.response_handler(response)
|
78
|
-
end
|
79
|
-
unless cur_state[:rackName] == @data['rackName']
|
80
|
-
temp_data = [{ op: 'replace', path: '/rackName', value: @data['rackName'] }]
|
81
|
-
response = @client.rest_patch(@data['uri'], { 'body' => temp_data }, @api_version)
|
82
|
-
@client.response_handler(response)
|
83
|
-
end
|
84
|
-
self
|
85
|
-
end
|
86
|
-
|
87
|
-
# Reapplies the enclosure configuration
|
88
|
-
def configuration
|
89
|
-
ensure_client && ensure_uri
|
90
|
-
response = @client.rest_put(@data['uri'] + '/configuration', {}, @api_version)
|
91
|
-
new_data = @client.response_handler(response)
|
92
|
-
set_all(new_data)
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
# Refreshes the enclosure along with all of its components
|
97
|
-
# @param [String] state NotRefreshing, RefreshFailed, RefreshPending, Refreshing
|
98
|
-
# @param [Hash] options Optional force fields for refreshing the enclosure
|
99
|
-
def set_refresh_state(state, options = {})
|
100
|
-
ensure_client && ensure_uri
|
101
|
-
s = state.to_s rescue state
|
102
|
-
requestBody = {
|
103
|
-
'body' => {
|
104
|
-
refreshState: s,
|
105
|
-
refreshForceOptions: options
|
106
|
-
}
|
107
|
-
}
|
108
|
-
response = @client.rest_put(@data['uri'] + '/refreshState', requestBody, @api_version)
|
109
|
-
new_data = @client.response_handler(response)
|
110
|
-
set_all(new_data)
|
111
|
-
end
|
112
|
-
|
113
|
-
# Gets the enclosure script content
|
114
|
-
# @return [String] Script content
|
115
|
-
def script
|
116
|
-
ensure_client && ensure_uri
|
117
|
-
response = @client.rest_get(@data['uri'] + '/script', @api_version)
|
118
|
-
@client.response_handler(response)
|
119
|
-
end
|
120
|
-
|
121
|
-
# Gets the enclosure settings that describe the environmental configuration
|
122
|
-
# @return [Hash] The enclosure envirnomental configuration
|
123
|
-
def environmental_configuration
|
124
|
-
ensure_client && ensure_uri
|
125
|
-
response = @client.rest_get(@data['uri'] + '/environmentalConfiguration', @api_version)
|
126
|
-
@client.response_handler(response)
|
127
|
-
end
|
128
|
-
|
129
|
-
# Retrieves historical utilization
|
130
|
-
# @param [Hash] queryParameters query parameters (ie :startDate, :endDate, :fields, :view, etc.)
|
131
|
-
# @option queryParameters [Array] :fields
|
132
|
-
# @option queryParameters [Time, Date, String] :startDate
|
133
|
-
# @option queryParameters [Time, Date, String] :endDate
|
134
|
-
def utilization(queryParameters = {})
|
135
|
-
ensure_client && ensure_uri
|
136
|
-
uri = "#{@data['uri']}/utilization?"
|
137
|
-
|
138
|
-
queryParameters[:endDate] = convert_time(queryParameters[:endDate])
|
139
|
-
queryParameters[:startDate] = convert_time(queryParameters[:startDate])
|
140
|
-
|
141
|
-
queryParameters.each do |key, value|
|
142
|
-
next if value.nil?
|
143
|
-
uri += case key.to_sym
|
144
|
-
when :fields
|
145
|
-
"fields=#{value.join(',')}"
|
146
|
-
when :startDate, :endDate
|
147
|
-
"filter=#{key}=#{value}"
|
148
|
-
else
|
149
|
-
"#{key}=#{value}"
|
150
|
-
end
|
151
|
-
uri += '&'
|
152
|
-
end
|
153
|
-
uri.chop! # Get rid of trailing '&' or '?'
|
154
|
-
response = @client.rest_get(uri, @api_version)
|
155
|
-
@client.response_handler(response)
|
156
|
-
end
|
157
|
-
|
158
|
-
# Updates specific attributes of a given enclosure resource
|
159
|
-
# @param [String] operation operation to be performed
|
160
|
-
# @param [String] path path
|
161
|
-
# @param [String] value value
|
162
|
-
def patch(operation, path, value)
|
163
|
-
ensure_client && ensure_uri
|
164
|
-
response = @client.rest_patch(@data['uri'], { 'body' => [{ op: operation, path: path, value: value }] }, @api_version)
|
165
|
-
@client.response_handler(response)
|
166
|
-
end
|
167
|
-
|
168
|
-
# Associates an enclosure group to the enclosure
|
169
|
-
# @param [OneviewSDK<Resource>] eg Enclosure Group associated
|
170
|
-
def set_enclosure_group(eg)
|
171
|
-
eg.retrieve! unless eg['uri']
|
172
|
-
@data['enclosureGroupUri'] = eg['uri']
|
173
|
-
end
|
174
|
-
|
175
|
-
private
|
176
|
-
|
177
|
-
# Converts Date, Time, or String objects to iso8601 string
|
178
|
-
# @raise [InvalidResource] if time is not formatted correctly
|
179
|
-
def convert_time(t)
|
180
|
-
case t
|
181
|
-
when nil then nil
|
182
|
-
when Date then t.to_time.utc.iso8601(3)
|
183
|
-
when Time then t.utc.iso8601(3)
|
184
|
-
when String then Time.parse(t).utc.iso8601(3)
|
185
|
-
else fail InvalidResource, "Invalid time format '#{t.class}'. Valid options are Time, Date, or String"
|
186
|
-
end
|
187
|
-
rescue StandardError => e
|
188
|
-
raise InvalidResource, "Failed to parse time value '#{t}'. #{e.message}"
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
# (C) Copyright 2016 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
|
-
module OneviewSDK
|
13
|
-
# Enclosure group resource implementation
|
14
|
-
class EnclosureGroup < Resource
|
15
|
-
BASE_URI = '/rest/enclosure-groups'.freeze
|
16
|
-
|
17
|
-
# Create a resource object, associate it with a client, and set its properties.
|
18
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
19
|
-
# @param [Hash] params The options for this resource (key-value pairs)
|
20
|
-
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
21
|
-
def initialize(client, params = {}, api_ver = nil)
|
22
|
-
super
|
23
|
-
# Default values:
|
24
|
-
@data['type'] ||= 'EnclosureGroupV200'
|
25
|
-
@data['interconnectBayMappingCount'] ||= 8
|
26
|
-
create_interconnect_bay_mapping unless @data['interconnectBayMappings']
|
27
|
-
end
|
28
|
-
|
29
|
-
# Get the script executed by enclosures in this enclosure group
|
30
|
-
# @return [String] The script for this enclosure group
|
31
|
-
def get_script
|
32
|
-
ensure_client && ensure_uri
|
33
|
-
response = @client.rest_get(@data['uri'] + '/script', @api_version)
|
34
|
-
@client.response_handler(response)
|
35
|
-
end
|
36
|
-
|
37
|
-
# Changes the script executed by the enclosures in this enclosure group
|
38
|
-
# @param [String] body The script to be executed
|
39
|
-
# @return true if set successfully
|
40
|
-
def set_script(body)
|
41
|
-
ensure_client && ensure_uri
|
42
|
-
response = @client.rest_put(@data['uri'] + '/script', { 'body' => body }, @api_version)
|
43
|
-
@client.response_handler(response)
|
44
|
-
true
|
45
|
-
end
|
46
|
-
|
47
|
-
# Adds the logical interconnect group
|
48
|
-
# @param [OneviewSDK::LogicalInterconnectGroup] lig Logical Interconnect Group
|
49
|
-
def add_logical_interconnect_group(lig)
|
50
|
-
lig.retrieve! unless lig['uri']
|
51
|
-
lig['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
|
52
|
-
entry['logicalLocation']['locationEntries'].each do |location|
|
53
|
-
add_lig_to_bay(location['relativeValue'], lig) if location['type'] == 'Bay' && entry['permittedInterconnectTypeUri']
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
# Creates the interconnect bay mapping
|
59
|
-
def create_interconnect_bay_mapping
|
60
|
-
@data['interconnectBayMappings'] = []
|
61
|
-
1.upto(@data['interconnectBayMappingCount']) do |bay_number|
|
62
|
-
entry = {
|
63
|
-
'interconnectBay' => bay_number,
|
64
|
-
'logicalInterconnectGroupUri' => nil
|
65
|
-
}
|
66
|
-
@data['interconnectBayMappings'] << entry
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
# Add logical interconnect group to bay
|
73
|
-
# @param [Integer] bay Bay number
|
74
|
-
# @param [OneviewSDK::LogicalInterconnectGroup] lig Logical Interconnect Group
|
75
|
-
def add_lig_to_bay(bay, lig)
|
76
|
-
@data['interconnectBayMappings'].each do |location|
|
77
|
-
return location['logicalInterconnectGroupUri'] = lig['uri'] if location['interconnectBay'] == bay
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
# (C) Copyright 2016 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
|
-
module OneviewSDK
|
13
|
-
# Ethernet network resource implementation
|
14
|
-
class EthernetNetwork < Resource
|
15
|
-
BASE_URI = '/rest/ethernet-networks'.freeze
|
16
|
-
|
17
|
-
# Create a resource object, associate it with a client, and set its properties.
|
18
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
19
|
-
# @param [Hash] params The options for this resource (key-value pairs)
|
20
|
-
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
21
|
-
def initialize(client, params = {}, api_ver = nil)
|
22
|
-
super
|
23
|
-
# Default values:
|
24
|
-
@data['ethernetNetworkType'] ||= 'Tagged'
|
25
|
-
@data['type'] ||= 'ethernet-networkV3'
|
26
|
-
end
|
27
|
-
|
28
|
-
# Bulk create the ethernet networks
|
29
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
30
|
-
# @param [Hash] options information necessary to create networks
|
31
|
-
# @return [Array] list of ethernet networks created
|
32
|
-
def self.bulk_create(client, options)
|
33
|
-
range = options[:vlanIdRange].split('-').map(&:to_i)
|
34
|
-
options[:type] = 'bulk-ethernet-network'
|
35
|
-
response = client.rest_post(BASE_URI + '/bulk', { 'body' => options }, client.api_version)
|
36
|
-
client.response_handler(response)
|
37
|
-
network_names = []
|
38
|
-
range[0].upto(range[1]) { |i| network_names << "#{options[:namePrefix]}_#{i}" }
|
39
|
-
OneviewSDK::EthernetNetwork.get_all(client).select { |network| network_names.include?(network['name']) }
|
40
|
-
end
|
41
|
-
|
42
|
-
# Gets the associated profiles
|
43
|
-
def get_associated_profiles
|
44
|
-
ensure_client && ensure_uri
|
45
|
-
response = @client.rest_get("#{@data['uri']}/associatedProfiles", @api_version)
|
46
|
-
response.body
|
47
|
-
end
|
48
|
-
|
49
|
-
# Gets the associated uplink groups
|
50
|
-
def get_associated_uplink_groups
|
51
|
-
ensure_client && ensure_uri
|
52
|
-
response = @client.rest_get("#{@data['uri']}/associatedUplinkGroups", @api_version)
|
53
|
-
response.body
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
# (C) Copyright 2016 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
|
-
module OneviewSDK
|
13
|
-
# FC network resource implementation
|
14
|
-
class Fabric < Resource
|
15
|
-
BASE_URI = '/rest/fabrics'.freeze
|
16
|
-
|
17
|
-
# Method is not available
|
18
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
19
|
-
def create
|
20
|
-
unavailable_method
|
21
|
-
end
|
22
|
-
|
23
|
-
# Method is not available
|
24
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
25
|
-
def update
|
26
|
-
unavailable_method
|
27
|
-
end
|
28
|
-
|
29
|
-
# Method is not available
|
30
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
31
|
-
def delete
|
32
|
-
unavailable_method
|
33
|
-
end
|
34
|
-
|
35
|
-
# Method is not available
|
36
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
37
|
-
def refresh
|
38
|
-
unavailable_method
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|