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,112 +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
|
-
# Logical interconnect group resource implementation
|
14
|
-
class LogicalInterconnectGroup < Resource
|
15
|
-
BASE_URI = '/rest/logical-interconnect-groups'.freeze
|
16
|
-
|
17
|
-
attr_reader :bay_count
|
18
|
-
|
19
|
-
# Create a resource object, associate it with a client, and set its properties.
|
20
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
21
|
-
# @param [Hash] params The options for this resource (key-value pairs)
|
22
|
-
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
23
|
-
def initialize(client, params = {}, api_ver = nil)
|
24
|
-
super
|
25
|
-
# Default values:
|
26
|
-
@data['enclosureType'] ||= 'C7000'
|
27
|
-
@data['state'] ||= 'Active'
|
28
|
-
@data['uplinkSets'] ||= []
|
29
|
-
@data['type'] ||= 'logical-interconnect-groupV3'
|
30
|
-
@data['interconnectMapTemplate'] ||= {}
|
31
|
-
@data['interconnectMapTemplate']['interconnectMapEntryTemplates'] ||= []
|
32
|
-
|
33
|
-
# User friendly values:
|
34
|
-
@bay_count = 8
|
35
|
-
|
36
|
-
# Create all entries if empty
|
37
|
-
parse_interconnect_map_template if @data['interconnectMapTemplate']['interconnectMapEntryTemplates'] == []
|
38
|
-
end
|
39
|
-
|
40
|
-
# Adds an interconnect
|
41
|
-
# @param [Fixnum] bay Bay number
|
42
|
-
# @param [String] type Interconnect type
|
43
|
-
# @raise [StandardError] if a invalid type is given then raises an error
|
44
|
-
def add_interconnect(bay, type)
|
45
|
-
@data['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
|
46
|
-
entry['logicalLocation']['locationEntries'].each do |location|
|
47
|
-
if location['type'] == 'Bay' && location['relativeValue'] == bay
|
48
|
-
entry['permittedInterconnectTypeUri'] = OneviewSDK::Interconnect.get_type(@client, type)['uri']
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
rescue StandardError
|
53
|
-
list = OneviewSDK::Interconnect.get_types(@client).map { |t| t['name'] }
|
54
|
-
raise "Interconnect type #{type} not found! Supported types: #{list}"
|
55
|
-
end
|
56
|
-
|
57
|
-
# Adds an uplink set
|
58
|
-
# @param [OneviewSDK::LIGUplinkSet] uplink_set
|
59
|
-
def add_uplink_set(uplink_set)
|
60
|
-
@data['uplinkSets'] << uplink_set.data
|
61
|
-
end
|
62
|
-
|
63
|
-
# Get the logical interconnect group default settings
|
64
|
-
# @return [Hash] The logical interconnect group settings
|
65
|
-
def get_default_settings
|
66
|
-
get_uri = self.class::BASE_URI + '/defaultSettings'
|
67
|
-
response = @client.rest_get(get_uri, @api_version)
|
68
|
-
@client.response_handler(response)
|
69
|
-
end
|
70
|
-
|
71
|
-
# Gets the logical interconnect group settings
|
72
|
-
# @return [Hash] The logical interconnect group settings
|
73
|
-
def get_settings
|
74
|
-
get_uri = @data['uri'] + '/settings'
|
75
|
-
response = @client.rest_get(get_uri, @api_version)
|
76
|
-
@client.response_handler(response)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Saves the current data attributes to the Logical Interconnect Group
|
80
|
-
# @param [Hash] attributes attributes to be updated
|
81
|
-
# @return Updated instance of the Logical Interconnect Group
|
82
|
-
def update(attributes = {})
|
83
|
-
set_all(attributes)
|
84
|
-
update_options = {
|
85
|
-
'If-Match' => @data.delete('eTag'),
|
86
|
-
'Body' => @data
|
87
|
-
}
|
88
|
-
response = @client.rest_put(@data['uri'], update_options, @api_version)
|
89
|
-
body = @client.response_handler(response)
|
90
|
-
set_all(body)
|
91
|
-
end
|
92
|
-
|
93
|
-
private
|
94
|
-
|
95
|
-
# Parse interconnect map template structure
|
96
|
-
def parse_interconnect_map_template
|
97
|
-
1.upto(@bay_count) do |bay_number|
|
98
|
-
entry = {
|
99
|
-
'logicalDownlinkUri' => nil,
|
100
|
-
'logicalLocation' => {
|
101
|
-
'locationEntries' => [
|
102
|
-
{ 'relativeValue' => bay_number, 'type' => 'Bay' },
|
103
|
-
{ 'relativeValue' => 1, 'type' => 'Enclosure' }
|
104
|
-
]
|
105
|
-
},
|
106
|
-
'permittedInterconnectTypeUri' => nil
|
107
|
-
}
|
108
|
-
@data['interconnectMapTemplate']['interconnectMapEntryTemplates'] << entry
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
@@ -1,184 +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
|
-
# Logical switch resource implementation
|
14
|
-
class LogicalSwitch < Resource
|
15
|
-
BASE_URI = '/rest/logical-switches'.freeze
|
16
|
-
|
17
|
-
attr_accessor :logical_switch_credentials
|
18
|
-
|
19
|
-
# Create a resource object, associate it with a client, and set its properties.
|
20
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
21
|
-
# @param [Hash] params The options for this resource (key-value pairs)
|
22
|
-
# @param [Integer] api_ver The api version to use when interracting with this resource.
|
23
|
-
def initialize(client, params = {}, api_ver = nil)
|
24
|
-
super
|
25
|
-
# Default values
|
26
|
-
@data['type'] ||= 'logical-switch'
|
27
|
-
@logical_switch_credentials = {}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Create method
|
31
|
-
# @raise [OneviewSDK::IncompleteResource] if the client is not set
|
32
|
-
# @raise [StandardError] if the resource creation fails
|
33
|
-
# @return [OneviewSDK::LogicalSwitch] self
|
34
|
-
def create
|
35
|
-
ensure_client
|
36
|
-
request_body = {}
|
37
|
-
request_body['logicalSwitchCredentials'] = generate_logical_switch_credentials
|
38
|
-
request_body['logicalSwitch'] = @data.clone
|
39
|
-
request_body['logicalSwitch']['switchCredentialConfiguration'] = generate_logical_switch_credential_configuration
|
40
|
-
response = @client.rest_post(self.class::BASE_URI, { 'body' => request_body }, @api_version)
|
41
|
-
body = @client.response_handler(response)
|
42
|
-
set_all(body)
|
43
|
-
self
|
44
|
-
end
|
45
|
-
|
46
|
-
# Updates this object using the data that exists on OneView
|
47
|
-
# @note Will overwrite any data that differs from OneView
|
48
|
-
# @return [Resource] self
|
49
|
-
def refresh
|
50
|
-
response = @client.rest_put(@data['uri'] + '/refresh')
|
51
|
-
@client.response_handler(response)
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
# @!group Credentials
|
56
|
-
CredentialsSSH = Struct.new(:user, :password)
|
57
|
-
|
58
|
-
CredentialsSNMPV1 = Struct.new(:port, :community_string, :version) do
|
59
|
-
# @return [String] Returns SNMPv1
|
60
|
-
def version
|
61
|
-
'SNMPv1'
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
CredentialsSNMPV3 = Struct.new(:port, :user, :auth_protocol, :auth_password, :privacy_protocol, :privacy_password, :version) do
|
66
|
-
# @return [String] Returns SNMPv3
|
67
|
-
def version
|
68
|
-
'SNMPv3'
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
# Sets switch credentials
|
73
|
-
# @param [String] host IP address or host name
|
74
|
-
# @param [CredentialsSSH] ssh_credentials SSH credentials
|
75
|
-
# @param [CredentialsSNMP] snmp_credentials SNMP credentials
|
76
|
-
# @return [Array] An Array containing the SSH and SNMP credentials
|
77
|
-
def set_switch_credentials(host, ssh_credentials, snmp_credentials)
|
78
|
-
fail TypeError, 'Use struct<OneviewSDK::LogicalSwitch::CredentialsSSH>' if ssh_credentials.class != OneviewSDK::LogicalSwitch::CredentialsSSH
|
79
|
-
fail TypeError, 'Use struct<OneviewSDK::LogicalSwitch::CredentialsSNMP>' unless snmp_credentials.respond_to?('version')
|
80
|
-
fail TypeError, 'Use struct<OneviewSDK::LogicalSwitch::CredentialsSNMP>' if snmp_credentials.version != 'SNMPv1' &&
|
81
|
-
snmp_credentials.version != 'SNMPv3'
|
82
|
-
@logical_switch_credentials[host] = [ssh_credentials.clone, snmp_credentials.clone]
|
83
|
-
@logical_switch_credentials[host]
|
84
|
-
end
|
85
|
-
|
86
|
-
# @!endgroup
|
87
|
-
|
88
|
-
|
89
|
-
# Sets the logical switch group
|
90
|
-
# @param [OneviewSDK::logicalSwitchGroup] logical_switch_group Logical switch group
|
91
|
-
def set_logical_switch_group(logical_switch_group)
|
92
|
-
@data['logicalSwitchGroupUri'] = logical_switch_group['uri']
|
93
|
-
end
|
94
|
-
|
95
|
-
private
|
96
|
-
|
97
|
-
# Generates the logical switch credentials for POST and PUT requests
|
98
|
-
# @return [Array] List of connection properties for each logical switch
|
99
|
-
def generate_logical_switch_credentials
|
100
|
-
credentials = []
|
101
|
-
@logical_switch_credentials.each do |_, switch|
|
102
|
-
switch_credentials = []
|
103
|
-
switch_credentials << {
|
104
|
-
'valueFormat' => 'Unknown',
|
105
|
-
'propertyName' => 'SshBasicAuthCredentialUser',
|
106
|
-
'valueType' => 'String',
|
107
|
-
'value' => switch[0].user
|
108
|
-
}
|
109
|
-
|
110
|
-
switch_credentials << {
|
111
|
-
'valueFormat' => 'SecuritySensitive',
|
112
|
-
'propertyName' => 'SshBasicAuthCredentialPassword',
|
113
|
-
'valueType' => 'String',
|
114
|
-
'value' => switch[0].password
|
115
|
-
}
|
116
|
-
|
117
|
-
if switch[1].version == 'SNMPv3'
|
118
|
-
switch_credentials << {
|
119
|
-
'valueFormat' => 'SecuritySensitive',
|
120
|
-
'propertyName' => 'SnmpV3AuthorizationPassword',
|
121
|
-
'valueType' => 'String',
|
122
|
-
'value' => switch[1].auth_password
|
123
|
-
}
|
124
|
-
|
125
|
-
switch_credentials << {
|
126
|
-
'valueFormat' => 'Unknown',
|
127
|
-
'propertyName' => 'SnmpV3User',
|
128
|
-
'valueType' => 'String',
|
129
|
-
'value' => switch[1].user
|
130
|
-
}
|
131
|
-
|
132
|
-
if switch[1].privacy_password
|
133
|
-
switch_credentials << {
|
134
|
-
'valueFormat' => 'SecuritySensitive',
|
135
|
-
'propertyName' => 'SnmpV3PrivacyPassword',
|
136
|
-
'valueType' => 'String',
|
137
|
-
'value' => switch[1].privacy_password
|
138
|
-
}
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
credentials << { 'connectionProperties' => switch_credentials }
|
143
|
-
end
|
144
|
-
credentials
|
145
|
-
end
|
146
|
-
|
147
|
-
# Generates the logical switch credential configuration for POST and PUT requests
|
148
|
-
# @return [Array] List of logical switch credential configuration for each switch
|
149
|
-
def generate_logical_switch_credential_configuration
|
150
|
-
configuration = []
|
151
|
-
@logical_switch_credentials.each do |host, switch|
|
152
|
-
switch_configuration = {
|
153
|
-
'snmpPort' => switch[1].port,
|
154
|
-
'snmpV3Configuration' => nil,
|
155
|
-
'snmpV1Configuration' => nil,
|
156
|
-
'logicalSwitchManagementHost' => host,
|
157
|
-
'snmpVersion' => switch[1].version
|
158
|
-
}
|
159
|
-
|
160
|
-
if switch[1].version == 'SNMPv3'
|
161
|
-
switch_configuration['snmpV1Configuration'] = nil
|
162
|
-
switch_configuration['snmpV3Configuration'] = {
|
163
|
-
'authorizationProtocol' => switch[1].auth_protocol
|
164
|
-
}
|
165
|
-
|
166
|
-
if switch[1].privacy_protocol
|
167
|
-
switch_configuration['snmpV3Configuration']['securityLevel'] = 'AuthPrivacy'
|
168
|
-
switch_configuration['snmpV3Configuration']['privacyProtocol'] = switch[1].privacy_protocol
|
169
|
-
else
|
170
|
-
switch_configuration['snmpV3Configuration']['securityLevel'] = 'Auth'
|
171
|
-
end
|
172
|
-
|
173
|
-
elsif switch[1].version == 'SNMPv1'
|
174
|
-
switch_configuration['snmpV3Configuration'] = nil
|
175
|
-
switch_configuration['snmpV1Configuration'] = {
|
176
|
-
'communityString' => switch[1].community_string
|
177
|
-
}
|
178
|
-
end
|
179
|
-
configuration << switch_configuration
|
180
|
-
end
|
181
|
-
configuration
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
@@ -1,66 +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
|
-
# Logical switch group resource implementation
|
14
|
-
class LogicalSwitchGroup < Resource
|
15
|
-
BASE_URI = '/rest/logical-switch-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['category'] ||= 'logical-switch-groups'
|
25
|
-
@data['state'] ||= 'Active'
|
26
|
-
@data['type'] ||= 'logical-switch-group'
|
27
|
-
@data['switchMapTemplate'] ||= {}
|
28
|
-
end
|
29
|
-
|
30
|
-
# Define how the switches will be grouped, setting the number and the type of the switches
|
31
|
-
# @param [Fixnum] number_of_switches The number of the switch inside the group [1,2]
|
32
|
-
# @param [String] type Switch type name
|
33
|
-
# @raise [StandardError]
|
34
|
-
def set_grouping_parameters(number_of_switches, type)
|
35
|
-
@data['switchMapTemplate']['switchMapEntryTemplates'] = []
|
36
|
-
parse_switch_map_template(number_of_switches)
|
37
|
-
switch_type_uri = OneviewSDK::Switch.get_type(@client, type)['uri']
|
38
|
-
@data['switchMapTemplate']['switchMapEntryTemplates'].each do |entry|
|
39
|
-
entry['logicalLocation']['locationEntries'].each do |location|
|
40
|
-
entry['permittedSwitchTypeUri'] = switch_type_uri if location['type'] == 'StackingMemberId'
|
41
|
-
end
|
42
|
-
end
|
43
|
-
rescue StandardError
|
44
|
-
list = OneviewSDK::Switch.get_types(@client).map { |t| t['name'] }
|
45
|
-
raise "Switch type #{type} not found! Supported types: #{list}"
|
46
|
-
end
|
47
|
-
|
48
|
-
private
|
49
|
-
|
50
|
-
# Parse switch map template structure
|
51
|
-
# @param [Integer] number_of_switches number of switches
|
52
|
-
def parse_switch_map_template(number_of_switches)
|
53
|
-
1.upto(number_of_switches) do |stacking_member_id|
|
54
|
-
entry = {
|
55
|
-
'logicalLocation' => {
|
56
|
-
'locationEntries' => [
|
57
|
-
{ 'relativeValue' => stacking_member_id, 'type' => 'StackingMemberId' }
|
58
|
-
]
|
59
|
-
},
|
60
|
-
'permittedSwitchTypeUri' => nil
|
61
|
-
}
|
62
|
-
@data['switchMapTemplate']['switchMapEntryTemplates'] << entry
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,79 +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
|
-
# Power device resource implementation
|
14
|
-
class ManagedSAN < Resource
|
15
|
-
BASE_URI = '/rest/fc-sans/managed-sans'.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 delete
|
26
|
-
unavailable_method
|
27
|
-
end
|
28
|
-
|
29
|
-
# Method is not available
|
30
|
-
# @raise [OneviewSDK::MethodUnavailable] method is not available
|
31
|
-
def update
|
32
|
-
unavailable_method
|
33
|
-
end
|
34
|
-
|
35
|
-
# Retrieves a list of endpoints
|
36
|
-
# @return [Array] List of endpoints
|
37
|
-
def get_endpoints
|
38
|
-
response = @client.rest_get(@data['uri'] + '/endpoints')
|
39
|
-
@client.response_handler(response)['members']
|
40
|
-
end
|
41
|
-
|
42
|
-
# Set refresh state for managed SAN
|
43
|
-
# @param [String] state Desired refresh state
|
44
|
-
def set_refresh_state(state)
|
45
|
-
response = @client.rest_put(@data['uri'], 'body' => { refreshState: state })
|
46
|
-
@client.response_handler(response)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Set public attributes
|
50
|
-
# @param [Hash] attributes Public attributes
|
51
|
-
# @option attributes [String] :name
|
52
|
-
# @option attributes [String] :value
|
53
|
-
# @option attributes [String] :valueType
|
54
|
-
# @option attributes [String] :valueFormat
|
55
|
-
def set_public_attributes(attributes)
|
56
|
-
response = @client.rest_put(@data['uri'], 'body' => { publicAttributes: attributes })
|
57
|
-
@client.response_handler(response)
|
58
|
-
end
|
59
|
-
|
60
|
-
# Set public attributes
|
61
|
-
# @param [Hash] policy SAN policy
|
62
|
-
# @option attributes [String] :zoningPolicy
|
63
|
-
# @option attributes [String] :zoneNameFormat
|
64
|
-
# @option attributes [String] :enableAliasing
|
65
|
-
# @option attributes [String] :initiatorNameFormat
|
66
|
-
# @option attributes [String] :targetNameFormat
|
67
|
-
# @option attributes [String] :targetGroupNameFormat
|
68
|
-
def set_san_policy(policy)
|
69
|
-
response = @client.rest_put(@data['uri'], 'body' => { sanPolicy: policy })
|
70
|
-
@client.response_handler(response)
|
71
|
-
end
|
72
|
-
|
73
|
-
# Creates unexpected zoning report for a SAN
|
74
|
-
def get_zoning_report
|
75
|
-
response = @client.rest_post(@data['uri'] + '/issues', 'body' => {})
|
76
|
-
@client.response_handler(response)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,64 +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
|
-
# Network set resource implementation
|
14
|
-
class NetworkSet < Resource
|
15
|
-
BASE_URI = '/rest/network-sets'.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['connectionTemplateUri'] ||= nil
|
25
|
-
@data['nativeNetworkUri'] ||= nil
|
26
|
-
@data['networkUris'] ||= []
|
27
|
-
@data['type'] ||= 'network-set'
|
28
|
-
end
|
29
|
-
|
30
|
-
# Sets the native network for the network set
|
31
|
-
# @param [OneviewSDK::EthernetNetwork] ethernet_network Ethernet Network
|
32
|
-
def set_native_network(ethernet_network)
|
33
|
-
@data['nativeNetworkUri'] = ethernet_network['uri']
|
34
|
-
@data['networkUris'] << ethernet_network['uri'] unless @data['networkUris'].include?(ethernet_network['uri'])
|
35
|
-
end
|
36
|
-
|
37
|
-
# Adds an ethernet network to the network set
|
38
|
-
# @param [OneviewSDK::EthernetNetwork] ethernet_network Ethernet Network
|
39
|
-
def add_ethernet_network(ethernet_network)
|
40
|
-
@data['networkUris'] << ethernet_network['uri'] unless @data['networkUris'].include?(ethernet_network['uri'])
|
41
|
-
end
|
42
|
-
|
43
|
-
# Removes an ethernet network from the network set
|
44
|
-
# @param [OneviewSDK::EthernetNetwork] ethernet_network Ethernet Network
|
45
|
-
def remove_ethernet_network(ethernet_network)
|
46
|
-
@data['networkUris'].delete(ethernet_network['uri']) if @data['networkUris'].include?(ethernet_network['uri'])
|
47
|
-
end
|
48
|
-
|
49
|
-
# Lists network sets excluding ethernet networks
|
50
|
-
# @param [OneviewSDK::Client] client The client object for the OneView appliance
|
51
|
-
# @return [Array] List of network sets
|
52
|
-
def self.get_without_ethernet(client)
|
53
|
-
response = client.rest_get(BASE_URI + '/withoutEthernet')
|
54
|
-
client.response_handler(response)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Lists network set excluding ethernet networks
|
58
|
-
# @return [OneviewSDK::NetworkSet] Network set
|
59
|
-
def get_without_ethernet
|
60
|
-
response = @client.rest_get(@data['uri'] + '/withoutEthernet')
|
61
|
-
@client.response_handler(response)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|