oneview-sdk 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +2 -0
- data/.gitignore +29 -0
- data/.rubocop.yml +73 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +39 -0
- data/Gemfile +2 -0
- data/LICENSE +201 -0
- data/README.md +317 -0
- data/Rakefile +90 -0
- data/bin/oneview-sdk-ruby +4 -0
- data/lib/oneview-sdk.rb +9 -0
- data/lib/oneview-sdk/cli.rb +407 -0
- data/lib/oneview-sdk/client.rb +163 -0
- data/lib/oneview-sdk/config_loader.rb +20 -0
- data/lib/oneview-sdk/resource.rb +313 -0
- data/lib/oneview-sdk/resource/enclosure.rb +169 -0
- data/lib/oneview-sdk/resource/enclosure_group.rb +98 -0
- data/lib/oneview-sdk/resource/ethernet_network.rb +60 -0
- data/lib/oneview-sdk/resource/fc_network.rb +31 -0
- data/lib/oneview-sdk/resource/fcoe_network.rb +25 -0
- data/lib/oneview-sdk/resource/firmware_bundle.rb +37 -0
- data/lib/oneview-sdk/resource/firmware_driver.rb +21 -0
- data/lib/oneview-sdk/resource/interconnect.rb +87 -0
- data/lib/oneview-sdk/resource/lig_uplink_set.rb +86 -0
- data/lib/oneview-sdk/resource/logical_enclosure.rb +84 -0
- data/lib/oneview-sdk/resource/logical_interconnect.rb +283 -0
- data/lib/oneview-sdk/resource/logical_interconnect_group.rb +92 -0
- data/lib/oneview-sdk/resource/server_hardware.rb +88 -0
- data/lib/oneview-sdk/resource/server_hardware_type.rb +27 -0
- data/lib/oneview-sdk/resource/server_profile.rb +37 -0
- data/lib/oneview-sdk/resource/server_profile_template.rb +24 -0
- data/lib/oneview-sdk/resource/storage_pool.rb +41 -0
- data/lib/oneview-sdk/resource/storage_system.rb +63 -0
- data/lib/oneview-sdk/resource/uplink_set.rb +119 -0
- data/lib/oneview-sdk/resource/volume.rb +188 -0
- data/lib/oneview-sdk/resource/volume_snapshot.rb +27 -0
- data/lib/oneview-sdk/resource/volume_template.rb +106 -0
- data/lib/oneview-sdk/rest.rb +163 -0
- data/lib/oneview-sdk/ssl_helper.rb +75 -0
- data/lib/oneview-sdk/version.rb +4 -0
- data/oneview-sdk.gemspec +31 -0
- metadata +204 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Interconnect resource implementation
|
3
|
+
class Interconnect < Resource
|
4
|
+
BASE_URI = '/rest/interconnects'.freeze
|
5
|
+
TYPE_URI = '/rest/interconnect-types'.freeze
|
6
|
+
|
7
|
+
def initialize(client, params = {}, api_ver = nil)
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def create
|
12
|
+
unavailable_method
|
13
|
+
end
|
14
|
+
|
15
|
+
def update
|
16
|
+
unavailable_method
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete
|
20
|
+
unavailable_method
|
21
|
+
end
|
22
|
+
|
23
|
+
# Retrieve interconnect types
|
24
|
+
# @param [Client] client http client
|
25
|
+
def self.get_types(client)
|
26
|
+
response = client.rest_get(TYPE_URI)
|
27
|
+
response = client.response_handler(response)
|
28
|
+
response['members']
|
29
|
+
end
|
30
|
+
|
31
|
+
# Retrieve interconnect ype with name
|
32
|
+
# @param [Client] client http client
|
33
|
+
# @param [String] name Interconnect type name
|
34
|
+
# @return [Array] Interconnect type
|
35
|
+
def self.get_type(client, name)
|
36
|
+
results = get_types(client)
|
37
|
+
results.find { |interconnect_type| interconnect_type['name'] == name }
|
38
|
+
end
|
39
|
+
|
40
|
+
# Retrieve named servers for this interconnect
|
41
|
+
def name_servers
|
42
|
+
response = @client.rest_get(@data['uri'] + '/nameServers')
|
43
|
+
response.body
|
44
|
+
end
|
45
|
+
|
46
|
+
# Updates an interconnect port
|
47
|
+
# @param [String] portName port name
|
48
|
+
# @param [Hash] attributes hash with attributes and values to be changed
|
49
|
+
def update_port(portName, attributes)
|
50
|
+
@data['ports'].each do |port|
|
51
|
+
next unless port['name'] == portName
|
52
|
+
attributes.each { |key, value| port[key.to_s] = value }
|
53
|
+
response = @client.rest_put(@data['uri'] + '/ports', 'body' => port)
|
54
|
+
@client.response_handler(response)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Get statistics for an interconnect, for the specified port or subport
|
59
|
+
# @param [String] portName port to retrieve statistics
|
60
|
+
# @param [String] subportNumber subport to retrieve statistics
|
61
|
+
def statistics(portName = nil, subportNumber = nil)
|
62
|
+
uri = if subportNumber.nil?
|
63
|
+
"#{@data['uri']}/statistics/#{portName}"
|
64
|
+
else
|
65
|
+
"#{@data['uri']}/statistics/#{portName}/subport/#{subportNumber}"
|
66
|
+
end
|
67
|
+
response = @client.rest_get(uri)
|
68
|
+
response.body
|
69
|
+
end
|
70
|
+
|
71
|
+
# Triggers a reset of port protection
|
72
|
+
def reset_port_protection
|
73
|
+
response = @client.rest_put(@data['uri'] + '/resetportprotection')
|
74
|
+
@client.response_handler(response)
|
75
|
+
end
|
76
|
+
|
77
|
+
# Update specific attributes of a given interconnect resource
|
78
|
+
# @param [String] operation operation to be performed
|
79
|
+
# @param [String] path path
|
80
|
+
# @param [String] value value
|
81
|
+
def update_attribute(operation, path, value)
|
82
|
+
response = @client.rest_patch(@data['uri'], 'body' => [{ op: operation, path: path, value: value }])
|
83
|
+
@client.response_handler(response)
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Uplink Sets resource implementation to be used in Logical interconnect groups
|
3
|
+
class LIGUplinkSet < Resource
|
4
|
+
BASE_URI = '/rest/logical-interconnect-groups'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values:
|
9
|
+
@data['logicalPortConfigInfos'] ||= []
|
10
|
+
@data['lacpTimer'] ||= 'Short'
|
11
|
+
@data['mode'] ||= 'Auto'
|
12
|
+
@data['networkUris'] ||= []
|
13
|
+
end
|
14
|
+
|
15
|
+
# @!group Validates
|
16
|
+
|
17
|
+
VALID_NETWORK_TYPES = %w(FibreChannel Ethernet).freeze
|
18
|
+
# Validate ethernetNetworkType request
|
19
|
+
# @param [String] value FibreChannel, Ethernet
|
20
|
+
def validate_networkType(value)
|
21
|
+
fail 'Invalid network type' unless VALID_NETWORK_TYPES.include?(value)
|
22
|
+
fail 'Attribute missing' if value == 'Ethernet' && !@data['ethernetNetworkType']
|
23
|
+
fail 'Attribute not supported' if value == 'FibreChannel' && @data['ethernetNetworkType']
|
24
|
+
end
|
25
|
+
|
26
|
+
VALID_ETHERNET_NETWORK_TYPES = %w(NotApplicable Tagged Tunnel Unknown Untagged).freeze
|
27
|
+
# Validate ethernetNetworkType request
|
28
|
+
# @param [String] value Notapplicable, Tagged, Tunnel, Unknown, Untagged. Must exist if networkType is 'Ethernet', otherwise shouldn't.
|
29
|
+
def validate_ethernetNetworkType(value)
|
30
|
+
fail 'Invalid ethernetNetworkType' unless VALID_ETHERNET_NETWORK_TYPES.include?(value)
|
31
|
+
end
|
32
|
+
|
33
|
+
# @!endgroup
|
34
|
+
|
35
|
+
# Add existing network to the network list.
|
36
|
+
# Ethernet and FibreChannel networks are allowed.
|
37
|
+
# @param [OneviewSDK::Resource] network resource to be added to the list
|
38
|
+
def add_network(network)
|
39
|
+
fail 'Resource not retrieved from server' unless network['uri']
|
40
|
+
@data['networkUris'] << network['uri']
|
41
|
+
end
|
42
|
+
|
43
|
+
# Specify one uplink passing the VC Bay and the port to be attached.
|
44
|
+
# @param [Fixnum] bay number to identify the VC
|
45
|
+
# @param [String] port to attach the uplink. Allowed D1..D16 and X1..X10
|
46
|
+
def add_uplink(bay, port)
|
47
|
+
entry = {
|
48
|
+
'desiredSpeed' => 'Auto',
|
49
|
+
'logicalLocation' => {
|
50
|
+
'locationEntries' => [
|
51
|
+
{ 'relativeValue' => bay, 'type' => 'Bay' },
|
52
|
+
{ 'relativeValue' => 1, 'type' => 'Enclosure' },
|
53
|
+
{ 'relativeValue' => relative_value_of(port), 'type' => 'Port' }
|
54
|
+
]
|
55
|
+
}
|
56
|
+
}
|
57
|
+
@data['logicalPortConfigInfos'] << entry
|
58
|
+
end
|
59
|
+
|
60
|
+
# Set all params
|
61
|
+
# @overload sets networkType first
|
62
|
+
def set_all(params = {})
|
63
|
+
params = params.data if params.class <= Resource
|
64
|
+
params = Hash[params.map { |(k, v)| [k.to_s, v] }]
|
65
|
+
network_type = params.delete('networkType')
|
66
|
+
params.each { |key, value| set(key.to_s, value) }
|
67
|
+
set('networkType', network_type) if network_type
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
|
72
|
+
# Relative values:
|
73
|
+
# Downlink Ports: D1 is 1, D2 is 2, ....,D15 is 15, D16 is 16;
|
74
|
+
# Uplink Ports: X1 is 17, X2 is 18, ....,X9 is 25, X10 is 26.
|
75
|
+
def relative_value_of(port)
|
76
|
+
identifier = port.slice!(0)
|
77
|
+
offset = case identifier
|
78
|
+
when 'D' then 0
|
79
|
+
when 'X' then 16
|
80
|
+
else fail "Port not supported: #{identifier} type not found"
|
81
|
+
end
|
82
|
+
port.to_i + offset
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Logical enclosure resource implementation
|
3
|
+
class LogicalEnclosure < Resource
|
4
|
+
BASE_URI = '/rest/logical-enclosures'.freeze
|
5
|
+
|
6
|
+
def initialize(client, params = {}, api_ver = nil)
|
7
|
+
super
|
8
|
+
# Default values
|
9
|
+
@data['type'] ||= 'LogicalEnclosure'
|
10
|
+
end
|
11
|
+
|
12
|
+
# @!group Validates
|
13
|
+
|
14
|
+
VALID_FABRIC_TYPES = %w(DirectAttach FabricAttach).freeze
|
15
|
+
# Validate fabricType
|
16
|
+
# @param [String] value DirectAttach, FabricAttach
|
17
|
+
# @raise [RuntimeError] if value is not 'DirectAttach' or 'FabricAttach'
|
18
|
+
def validate_fabricType(value)
|
19
|
+
fail 'Invalid fabric type' unless VALID_FABRIC_TYPES.include?(value)
|
20
|
+
end
|
21
|
+
|
22
|
+
# @!endgroup
|
23
|
+
|
24
|
+
# Reapplies the appliance's configuration on enclosures
|
25
|
+
# @raise [RuntimeError] if the client is not set
|
26
|
+
# @raise [RuntimeError] if the uri is not set
|
27
|
+
# @raise [RuntimeError] if the reapply fails
|
28
|
+
# @return [LogicalEnclosure] self
|
29
|
+
def reconfigure
|
30
|
+
ensure_client && ensure_uri
|
31
|
+
response = @client.rest_put("#{@data['uri']}/configuration", {}, @api_version)
|
32
|
+
@client.response_handler(response)
|
33
|
+
self
|
34
|
+
end
|
35
|
+
|
36
|
+
# Makes this logical enclosure consistent with the enclosure group
|
37
|
+
# @raise [RuntimeError] if the client is not set
|
38
|
+
# @raise [RuntimeError] if the uri is not set
|
39
|
+
# @raise [RuntimeError] if the process fails
|
40
|
+
# @return [Resource] self
|
41
|
+
def update_from_group
|
42
|
+
ensure_client && ensure_uri
|
43
|
+
response = @client.rest_put("#{@data['uri']}/updateFromGroup", {}, @api_version)
|
44
|
+
@client.response_handler(response)
|
45
|
+
self
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get the configuration script
|
49
|
+
# @raise [RuntimeError] if the client is not set
|
50
|
+
# @raise [RuntimeError] if the uri is not set
|
51
|
+
# @raise [RuntimeError] if retrieving fails
|
52
|
+
# @return [String] script
|
53
|
+
def get_script
|
54
|
+
ensure_client && ensure_uri
|
55
|
+
response = @client.rest_get("#{@data['uri']}/script", @api_version)
|
56
|
+
response.body
|
57
|
+
end
|
58
|
+
|
59
|
+
# Updates the configuration script for the logical enclosure
|
60
|
+
# @raise [RuntimeError] if the client is not set
|
61
|
+
# @raise [RuntimeError] if the uri is not set
|
62
|
+
# @raise [RuntimeError] if the reapply fails
|
63
|
+
# @return [Resource] self
|
64
|
+
def set_script(script)
|
65
|
+
ensure_client && ensure_uri
|
66
|
+
response = @client.rest_put("#{@data['uri']}/script", { 'body' => script }, @api_version)
|
67
|
+
@client.response_handler(response)
|
68
|
+
self
|
69
|
+
end
|
70
|
+
|
71
|
+
# Generates a support dump for the logical enclosure
|
72
|
+
# @raise [RuntimeError] if the client is not set
|
73
|
+
# @raise [RuntimeError] if the uri is not set
|
74
|
+
# @raise [RuntimeError] if the process fails when generating the support dump
|
75
|
+
# @return [Resource] self
|
76
|
+
def support_dump(options)
|
77
|
+
ensure_client && ensure_uri
|
78
|
+
response = @client.rest_post("#{@data['uri']}/support-dumps", { 'body' => options }, @api_version)
|
79
|
+
@client.wait_for(response.header['location'])
|
80
|
+
self
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,283 @@
|
|
1
|
+
module OneviewSDK
|
2
|
+
# Logical interconnect resource implementation
|
3
|
+
class LogicalInterconnect < Resource
|
4
|
+
BASE_URI = '/rest/logical-interconnects'.freeze
|
5
|
+
LOCATION_URI = '/rest/logical-interconnects/locations/interconnects'.freeze
|
6
|
+
|
7
|
+
# @!group Validates
|
8
|
+
|
9
|
+
# Validate ethernet trap categories
|
10
|
+
VALID_ENET_TRAP_CATEGORIES = %w(Other PortStatus PortThresholds).freeze
|
11
|
+
def validate_enet_trap_categories(enet_trap_categories)
|
12
|
+
enet_trap_categories.uniq!
|
13
|
+
enet_trap_categories.each do |cat|
|
14
|
+
fail "Ethernet Trap Category #{cat} is not one of the allowed values: #{VALID_ENET_TRAP_CATEGORIES}" unless
|
15
|
+
VALID_ENET_TRAP_CATEGORIES.include?(cat)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Validate fc trap categories
|
20
|
+
VALID_FC_TRAP_CATEGORIES = %w(Other PortStatus).freeze
|
21
|
+
def validate_fc_trap_categories(fc_trap_categories)
|
22
|
+
fc_trap_categories.uniq!
|
23
|
+
fc_trap_categories.each do |cat|
|
24
|
+
fail "FC Trap Category #{cat} is not one of the allowed values: #{VALID_FC_TRAP_CATEGORIES}" unless VALID_FC_TRAP_CATEGORIES.include?(cat)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Validate vcm trap categories
|
29
|
+
VALID_VCM_TRAP_CATEGORIES = %w(Legacy).freeze
|
30
|
+
def validate_vcm_trap_categories(vcm_trap_categories)
|
31
|
+
vcm_trap_categories.uniq!
|
32
|
+
vcm_trap_categories.each do |cat|
|
33
|
+
fail "VCM Trap Category #{cat} is not one of the allowed values: #{VALID_VCM_TRAP_CATEGORIES}" unless VALID_VCM_TRAP_CATEGORIES.include?(cat)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Validate trap severities
|
38
|
+
VALID_TRAP_SEVERITIES = %w(Critical Info Major Minor Normal Unknown Warning).freeze
|
39
|
+
def validate_trap_severities(trap_severities)
|
40
|
+
trap_severities.uniq!
|
41
|
+
trap_severities.each do |cat|
|
42
|
+
fail "Trap Severities #{cat} is not one of the allowed values: #{VALID_TRAP_SEVERITIES}" unless VALID_TRAP_SEVERITIES.include?(cat)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Validate snmp trap format
|
47
|
+
VALID_TRAP_FORMATS = %w(SNMPv1 SNMPv2 SNMPv3).freeze
|
48
|
+
def validate_trap_format(trap_format)
|
49
|
+
fail "Trap Format #{trap_format} is not one of the allowed values: #{VALID_TRAP_FORMATS}" unless VALID_TRAP_FORMATS.include?(trap_format)
|
50
|
+
end
|
51
|
+
|
52
|
+
# @!endgroup
|
53
|
+
|
54
|
+
# Create an Interconnect in the desired Bay in a specified enclosure
|
55
|
+
# WARN: It does not create the LOGICAL INTERCONNECT itself.
|
56
|
+
# It will fail if no interconnect is already present on the specified position
|
57
|
+
# @param [Fixnum] bay_number Number of the bay to put the interconnect
|
58
|
+
# @param [OneviewSDK::Resource] enclosure Enclosure to insert the interconnect
|
59
|
+
def create(bay_number, enclosure)
|
60
|
+
enclosure.ensure_uri
|
61
|
+
entry = {
|
62
|
+
'locationEntries' => [
|
63
|
+
{ 'value' => bay_number, 'type' => 'Bay' },
|
64
|
+
{ 'value' => enclosure['uri'], 'type' => 'Enclosure' }
|
65
|
+
]
|
66
|
+
}
|
67
|
+
response = @client.rest_post(self.class::LOCATION_URI, { 'body' => entry }, @api_version)
|
68
|
+
@client.response_handler(response)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Deletes an INTERCONNECT
|
72
|
+
# WARN: This won't delete the LOGICAL INTERCONNECT itself, and may cause inconsistency between the enclosure and LIG
|
73
|
+
# @param [Fixnum] bay_number Number of the bay to locate the logical interconnect
|
74
|
+
# @param [OneviewSDK::Resource] enclosure Enclosure to remove the logical interconnect
|
75
|
+
def delete(bay_number, enclosure)
|
76
|
+
enclosure.ensure_uri
|
77
|
+
delete_uri = self.class::LOCATION_URI + "?location=Enclosure:#{enclosure['uri']},Bay:#{bay_number}"
|
78
|
+
response = @client.rest_delete(delete_uri, {}, @api_version)
|
79
|
+
@client.response_handler(response)
|
80
|
+
self
|
81
|
+
end
|
82
|
+
|
83
|
+
# Updates internal networks on the logical interconnect
|
84
|
+
# @param [OneviewSDK::EthernetNetworks] networks List of networks to update the Logical Interconnect
|
85
|
+
def update_internal_networks(*networks)
|
86
|
+
uris = []
|
87
|
+
return @client.response_handler(@client.rest_put(@data['uri'] + '/internalNetworks', 'body' => [])) unless networks
|
88
|
+
networks.each do |net|
|
89
|
+
net.retrieve! unless net['uri']
|
90
|
+
uris.push(net['uri'])
|
91
|
+
end
|
92
|
+
response = @client.rest_put(@data['uri'] + '/internalNetworks', 'body' => uris)
|
93
|
+
body = @client.response_handler(response)
|
94
|
+
set_all(body)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Lists internal networks on the logical interconnect
|
98
|
+
# @return [OneviewSDK::Resource] List of networks
|
99
|
+
def list_vlan_networks
|
100
|
+
ensure_client && ensure_uri
|
101
|
+
results = OneviewSDK::Resource.find_by(@client, {}, @data['uri'] + '/internalVlans')
|
102
|
+
internal_networks = []
|
103
|
+
results.each do |vlan|
|
104
|
+
net = if vlan['generalNetworkUri'].include? 'ethernet-network'
|
105
|
+
OneviewSDK::EthernetNetwork.new(@client, uri: vlan['generalNetworkUri'])
|
106
|
+
elsif vlan['generalNetworkUri'].include? 'fc-network'
|
107
|
+
OneviewSDK::FCNetwork.new(@client, uri: vlan['generalNetworkUri'])
|
108
|
+
else
|
109
|
+
OneviewSDK::FCoENetwork.new(@client, uri: vlan['generalNetworkUri'])
|
110
|
+
end
|
111
|
+
net.retrieve!
|
112
|
+
internal_networks.push(net)
|
113
|
+
end
|
114
|
+
internal_networks
|
115
|
+
end
|
116
|
+
|
117
|
+
# Updates ethernet settings of the Logical Interconnect
|
118
|
+
# @note The attribute is defined inside the instance of the Logical Interconnect
|
119
|
+
# @return Updated instance of the Logical Interconnect
|
120
|
+
def update_ethernet_settings
|
121
|
+
ensure_client && ensure_uri
|
122
|
+
fail 'Please retrieve the Logical Interconnect before trying to update' unless @data['ethernetSettings']
|
123
|
+
update_options = {
|
124
|
+
'If-Match' => @data['ethernetSettings'].delete('eTag'),
|
125
|
+
'body' => @data['ethernetSettings']
|
126
|
+
}
|
127
|
+
response = @client.rest_put(@data['uri'] + '/ethernetSettings', update_options, @api_version)
|
128
|
+
body = @client.response_handler(response)
|
129
|
+
set_all(body)
|
130
|
+
end
|
131
|
+
|
132
|
+
# Updates settings of the Logical Interconnect
|
133
|
+
# @param options Options to update the Logical Interconnect
|
134
|
+
# @return Updated instance of the Logical Interconnect
|
135
|
+
def update_settings(options = {})
|
136
|
+
ensure_client && ensure_uri
|
137
|
+
options['type'] ||= 'InterconnectSettingsV3'
|
138
|
+
options['ethernetSettings'] ||= {}
|
139
|
+
options['ethernetSettings']['type'] ||= 'EthernetInterconnectSettingsV3'
|
140
|
+
update_options = {
|
141
|
+
'If-Match' => @data['eTag'],
|
142
|
+
'body' => options
|
143
|
+
}
|
144
|
+
response = @client.rest_put(@data['uri'] + '/settings', update_options, @api_version)
|
145
|
+
body = @client.response_handler(response)
|
146
|
+
set_all(body)
|
147
|
+
end
|
148
|
+
|
149
|
+
# Returns logical interconnects to a consistent state.
|
150
|
+
# The current logical interconnect state is compared to the associated logical interconnect group.
|
151
|
+
# @return returns the updated object
|
152
|
+
def compliance
|
153
|
+
ensure_client && ensure_uri
|
154
|
+
response = @client.rest_put(@data['uri'] + '/compliance', {}, @api_version)
|
155
|
+
body = client.response_handler(response)
|
156
|
+
set_all(body)
|
157
|
+
end
|
158
|
+
|
159
|
+
# Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects
|
160
|
+
# @return returns the updated object
|
161
|
+
def configuration
|
162
|
+
ensure_client && ensure_uri
|
163
|
+
response = @client.rest_put(@data['uri'] + '/configuration', {}, @api_version)
|
164
|
+
body = client.response_handler(response)
|
165
|
+
set_all(body)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Updates port monitor settings of the Logical Interconnect
|
169
|
+
# @note The attribute is defined inside the instance of the Logical Interconnect
|
170
|
+
# @return Updated instance of the Logical Interconnect
|
171
|
+
def update_port_monitor
|
172
|
+
fail 'Please retrieve the Logical Interconnect before trying to update' unless @data['portMonitor']
|
173
|
+
update_options = {
|
174
|
+
'If-Match' => @data['portMonitor'].delete('eTag'),
|
175
|
+
'body' => @data['portMonitor']
|
176
|
+
}
|
177
|
+
response = @client.rest_put(@data['portMonitor']['uri'], update_options, @api_version)
|
178
|
+
body = @client.response_handler(response)
|
179
|
+
set_all(body)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Updates QoS aggregated configuration of the Logical Interconnect
|
183
|
+
# @note The attribute is defined inside the instance of the Logical Interconnect
|
184
|
+
# @return Updated instance of the Logical Interconnect
|
185
|
+
def update_qos_configuration
|
186
|
+
fail 'Please retrieve the Logical Interconnect before trying to update' unless @data['qosConfiguration']
|
187
|
+
update_options = {
|
188
|
+
'If-Match' => @data['qosConfiguration'].delete('eTag'),
|
189
|
+
'body' => @data['qosConfiguration']
|
190
|
+
}
|
191
|
+
response = @client.rest_put(@data['uri'] + '/qos-aggregated-configuration', update_options, @api_version)
|
192
|
+
body = @client.response_handler(response)
|
193
|
+
set_all(body)
|
194
|
+
end
|
195
|
+
|
196
|
+
# Updates telemetry configuration of the Logical Interconnect
|
197
|
+
# @note The attribute is defined inside the instance of the Logical Interconnect
|
198
|
+
# @return Updated instance of the Logical Interconnect
|
199
|
+
def update_telemetry_configuration
|
200
|
+
fail 'Please retrieve the Logical Interconnect before trying to update' unless @data['telemetryConfiguration']
|
201
|
+
update_options = {
|
202
|
+
'If-Match' => @data['telemetryConfiguration'].delete('eTag'),
|
203
|
+
'body' => @data['telemetryConfiguration']
|
204
|
+
}
|
205
|
+
response = @client.rest_put(@data['telemetryConfiguration']['uri'], update_options, @api_version)
|
206
|
+
body = @client.response_handler(response)
|
207
|
+
set_all(body)
|
208
|
+
end
|
209
|
+
|
210
|
+
# Updates snmp configuration of the Logical Interconnect
|
211
|
+
# @note The attribute is defined inside the instance of the Logical Interconnect.
|
212
|
+
# Use helper methods to add the trap destination values: #add_snmp_trap_destination and #generate_trap_options
|
213
|
+
# @return Updated instance of the Logical Interconnect
|
214
|
+
def update_snmp_configuration
|
215
|
+
fail 'Please retrieve the Logical Interconnect before trying to update' unless @data['snmpConfiguration']
|
216
|
+
update_options = {
|
217
|
+
'If-Match' => @data['snmpConfiguration'].delete('eTag'),
|
218
|
+
'body' => @data['snmpConfiguration']
|
219
|
+
}
|
220
|
+
response = @client.rest_put(@data['uri'] + '/snmp-configuration', update_options, @api_version)
|
221
|
+
body = @client.response_handler(response)
|
222
|
+
set_all(body)
|
223
|
+
end
|
224
|
+
|
225
|
+
# It will add one trap destination to the Logical Interconnect SNMP configuration
|
226
|
+
# @param trap_format [String] SNMP version for this trap destination, `'SNMPv1'` or `'SNMPv2'` or `'SNMPv3'`
|
227
|
+
# @param trap_destination [String] The trap destination IP address or host name
|
228
|
+
# @param community_string [String] Authentication string for the trap destination
|
229
|
+
# @param trap_options [Hash] Hash with the options of the trap. Create it using generate_trap_options method
|
230
|
+
def add_snmp_trap_destination(trap_destination, trap_format = 'SNMPv1', community_string = 'public', trap_options = {})
|
231
|
+
validate_trap_format(trap_format)
|
232
|
+
trap_options['communityString'] = community_string
|
233
|
+
trap_options['trapDestination'] = trap_destination
|
234
|
+
trap_options['trapFormat'] = trap_format
|
235
|
+
@data['snmpConfiguration']['trapDestinations'].push(trap_options)
|
236
|
+
end
|
237
|
+
|
238
|
+
# Generates trap options to be used in add_snmp_trap_destination method
|
239
|
+
# @param enet_trap_categories [Array] Filter the traps for this trap destination by the list of configured Ethernet traps
|
240
|
+
# can contain, `'Other'` or `'PortStatus'` or `'PortThresholds'`
|
241
|
+
# @param fc_trap_categories [Array] Filter the traps for this trap destination by the list of configured Fibre Channel traps
|
242
|
+
# can contain, `'Other'` or `'PortStatus'`
|
243
|
+
# @param vcm_trap_categories [Array] Filter the traps for this trap destination by the list of configured VCM trap, `'Legacy'`
|
244
|
+
# @param trap_severities [Array] Filter the traps for this trap destination by the list of configured severities
|
245
|
+
# can contain, `'Critical'` or `'Info'` or `'Major'` or `'Minor'` or `'Normal'` or `'Unknown'` or `'Warning'`
|
246
|
+
# @return [Hash] Contains all trap options for one SNMP destination
|
247
|
+
def generate_trap_options(enet_trap_categories = [], fc_trap_categories = [], vcm_trap_categories = [], trap_severities = [])
|
248
|
+
validate_enet_trap_categories(enet_trap_categories)
|
249
|
+
validate_fc_trap_categories(fc_trap_categories)
|
250
|
+
validate_vcm_trap_categories(vcm_trap_categories)
|
251
|
+
validate_trap_severities(trap_severities)
|
252
|
+
options = {
|
253
|
+
'enetTrapCategories' => enet_trap_categories,
|
254
|
+
'vcmTrapCategories' => vcm_trap_categories,
|
255
|
+
'fcTrapCategories' => fc_trap_categories,
|
256
|
+
'trapSeverities' => trap_severities
|
257
|
+
}
|
258
|
+
options
|
259
|
+
end
|
260
|
+
|
261
|
+
# Gets the installed firmware for a logical interconnect.
|
262
|
+
# @return [Hash] Contains all firmware information
|
263
|
+
def get_firmware
|
264
|
+
ensure_client && ensure_uri
|
265
|
+
response = @client.rest_get(@data['uri'] + '/firmware')
|
266
|
+
@client.response_handler(response)
|
267
|
+
end
|
268
|
+
|
269
|
+
def firmware_update(command, firmware_driver, firmware_options)
|
270
|
+
ensure_client && ensure_uri
|
271
|
+
firmware_options['command'] = command
|
272
|
+
firmware_options['sppUri'] = firmware_driver['uri']
|
273
|
+
firmware_options['sppName'] = firmware_driver['name']
|
274
|
+
update_json = {
|
275
|
+
'If-Match' => '*',
|
276
|
+
'body' => firmware_options
|
277
|
+
}
|
278
|
+
response = @client.rest_put(@data['uri'] + '/firmware', update_json)
|
279
|
+
@client.response_handler(response)
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|
283
|
+
end
|