Class: OneviewSDK::LogicalInterconnect
- Defined in:
- lib/oneview-sdk/resource/logical_interconnect.rb
Overview
Logical interconnect resource implementation
Constant Summary collapse
- BASE_URI =
'/rest/logical-interconnects'.freeze
- LOCATION_URI =
'/rest/logical-interconnects/locations/interconnects'.freeze
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#add_snmp_trap_destination(trap_destination, trap_format = 'SNMPv1', community_string = 'public', trap_options = {}) ⇒ Object
It will add one trap destination to the Logical Interconnect SNMP configuration.
-
#compliance ⇒ Object
Returns logical interconnects to a consistent state.
-
#configuration ⇒ Object
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
-
#create(bay_number, enclosure) ⇒ Object
Creates an Interconnect in the desired bay in a specified enclosure WARN: It does not create the LOGICAL INTERCONNECT itself.
-
#delete(bay_number, enclosure) ⇒ OneviewSDK::LogicalInterconnect
Deletes an INTERCONNECT WARN: This will not delete the LOGICAL INTERCONNECT itself, and may cause inconsistency between the enclosure and LIG.
-
#firmware_update(command, firmware_driver, firmware_options) ⇒ Object
Update firmware.
-
#generate_trap_options(enet_trap_categories = [], fc_trap_categories = [], vcm_trap_categories = [], trap_severities = []) ⇒ Hash
Generates trap options to be used in add_snmp_trap_destination method.
-
#get_firmware ⇒ Hash
Gets the installed firmware for a logical interconnect.
-
#list_vlan_networks ⇒ OneviewSDK::Resource
Lists internal networks on the logical interconnect.
-
#update_ethernet_settings ⇒ Object
Updates ethernet settings of the logical interconnect.
-
#update_internal_networks(*networks) ⇒ Object
Updates internal networks on the logical interconnect.
-
#update_port_monitor ⇒ Object
Updates port monitor settings of the Logical Interconnect.
-
#update_qos_configuration ⇒ Object
Updates QoS aggregated configuration of the Logical Interconnect.
-
#update_settings(options = {}) ⇒ Object
Updates settings of the logical interconnect.
-
#update_snmp_configuration ⇒ Object
Updates snmp configuration of the Logical Interconnect.
-
#update_telemetry_configuration ⇒ Object
Updates telemetry configuration of the Logical Interconnect.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create!, #each, #eql?, #exists?, find_by, from_file, get_all, #initialize, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update
Constructor Details
This class inherits a constructor from OneviewSDK::Resource
Instance Method Details
#add_snmp_trap_destination(trap_destination, trap_format = 'SNMPv1', community_string = 'public', trap_options = {}) ⇒ Object
It will add one trap destination to the Logical Interconnect SNMP configuration
195 196 197 198 199 200 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 195 def add_snmp_trap_destination(trap_destination, trap_format = 'SNMPv1', community_string = 'public', = {}) ['communityString'] = community_string ['trapDestination'] = trap_destination ['trapFormat'] = trap_format @data['snmpConfiguration']['trapDestinations'].push() end |
#compliance ⇒ Object
Returns logical interconnects to a consistent state. The current logical interconnect state is compared to the associated logical interconnect group.
117 118 119 120 121 122 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 117 def compliance ensure_client && ensure_uri response = @client.rest_put(@data['uri'] + '/compliance', {}, @api_version) body = client.response_handler(response) set_all(body) end |
#configuration ⇒ Object
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects
126 127 128 129 130 131 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 126 def configuration ensure_client && ensure_uri response = @client.rest_put(@data['uri'] + '/configuration', {}, @api_version) body = client.response_handler(response) set_all(body) end |
#create(bay_number, enclosure) ⇒ Object
Creates an Interconnect in the desired bay in a specified enclosure WARN: It does not create the LOGICAL INTERCONNECT itself. It will fail if no interconnect is already present on the specified position
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 23 def create(bay_number, enclosure) enclosure.ensure_uri entry = { 'locationEntries' => [ { 'value' => bay_number, 'type' => 'Bay' }, { 'value' => enclosure['uri'], 'type' => 'Enclosure' } ] } response = @client.rest_post(self.class::LOCATION_URI, { 'body' => entry }, @api_version) @client.response_handler(response) end |
#delete(bay_number, enclosure) ⇒ OneviewSDK::LogicalInterconnect
Deletes an INTERCONNECT WARN: This will not delete the LOGICAL INTERCONNECT itself, and may cause inconsistency between the enclosure and LIG
40 41 42 43 44 45 46 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 40 def delete(bay_number, enclosure) enclosure.ensure_uri delete_uri = self.class::LOCATION_URI + "?location=Enclosure:#{enclosure['uri']},Bay:#{bay_number}" response = @client.rest_delete(delete_uri, {}, @api_version) @client.response_handler(response) self end |
#firmware_update(command, firmware_driver, firmware_options) ⇒ Object
Update firmware
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 234 def firmware_update(command, firmware_driver, ) ensure_client && ensure_uri ['command'] = command ['sppUri'] = firmware_driver['uri'] ['sppName'] = firmware_driver['name'] update_json = { 'If-Match' => '*', 'body' => } response = @client.rest_put(@data['uri'] + '/firmware', update_json) @client.response_handler(response) end |
#generate_trap_options(enet_trap_categories = [], fc_trap_categories = [], vcm_trap_categories = [], trap_severities = []) ⇒ Hash
Generates trap options to be used in add_snmp_trap_destination method
211 212 213 214 215 216 217 218 219 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 211 def (enet_trap_categories = [], fc_trap_categories = [], vcm_trap_categories = [], trap_severities = []) = { 'enetTrapCategories' => enet_trap_categories, 'vcmTrapCategories' => vcm_trap_categories, 'fcTrapCategories' => fc_trap_categories, 'trapSeverities' => trap_severities } end |
#get_firmware ⇒ Hash
Gets the installed firmware for a logical interconnect.
223 224 225 226 227 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 223 def get_firmware ensure_client && ensure_uri response = @client.rest_get(@data['uri'] + '/firmware') @client.response_handler(response) end |
#list_vlan_networks ⇒ OneviewSDK::Resource
Lists internal networks on the logical interconnect
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 64 def list_vlan_networks ensure_client && ensure_uri results = OneviewSDK::Resource.find_by(@client, {}, @data['uri'] + '/internalVlans') internal_networks = [] results.each do |vlan| net = if vlan['generalNetworkUri'].include? 'ethernet-network' OneviewSDK::EthernetNetwork.new(@client, uri: vlan['generalNetworkUri']) elsif vlan['generalNetworkUri'].include? 'fc-network' OneviewSDK::FCNetwork.new(@client, uri: vlan['generalNetworkUri']) else OneviewSDK::FCoENetwork.new(@client, uri: vlan['generalNetworkUri']) end net.retrieve! internal_networks.push(net) end internal_networks end |
#update_ethernet_settings ⇒ Object
The attribute is defined inside the instance of the Logical Interconnect
Updates ethernet settings of the logical interconnect
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 85 def update_ethernet_settings ensure_client && ensure_uri fail IncompleteResource, 'Please retrieve the Logical Interconnect before trying to update' unless @data['ethernetSettings'] = { 'If-Match' => @data['ethernetSettings'].delete('eTag'), 'body' => @data['ethernetSettings'] } response = @client.rest_put(@data['uri'] + '/ethernetSettings', , @api_version) body = @client.response_handler(response) set_all(body) end |
#update_internal_networks(*networks) ⇒ Object
Updates internal networks on the logical interconnect
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 50 def update_internal_networks(*networks) uris = [] return @client.response_handler(@client.rest_put(@data['uri'] + '/internalNetworks', 'body' => [])) unless networks networks.each do |net| net.retrieve! unless net['uri'] uris.push(net['uri']) end response = @client.rest_put(@data['uri'] + '/internalNetworks', 'body' => uris) body = @client.response_handler(response) set_all(body) end |
#update_port_monitor ⇒ Object
The attribute is defined inside the instance of the Logical Interconnect
Updates port monitor settings of the Logical Interconnect
136 137 138 139 140 141 142 143 144 145 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 136 def update_port_monitor fail IncompleteResource, 'Please retrieve the Logical Interconnect before trying to update' unless @data['portMonitor'] = { 'If-Match' => @data['portMonitor'].delete('eTag'), 'body' => @data['portMonitor'] } response = @client.rest_put(@data['portMonitor']['uri'], , @api_version) body = @client.response_handler(response) set_all(body) end |
#update_qos_configuration ⇒ Object
The attribute is defined inside the instance of the Logical Interconnect
Updates QoS aggregated configuration of the Logical Interconnect
150 151 152 153 154 155 156 157 158 159 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 150 def update_qos_configuration fail IncompleteResource, 'Please retrieve the Logical Interconnect before trying to update' unless @data['qosConfiguration'] = { 'If-Match' => @data['qosConfiguration'].delete('eTag'), 'body' => @data['qosConfiguration'] } response = @client.rest_put(@data['uri'] + '/qos-aggregated-configuration', , @api_version) body = @client.response_handler(response) set_all(body) end |
#update_settings(options = {}) ⇒ Object
Updates settings of the logical interconnect
100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 100 def update_settings( = {}) ensure_client && ensure_uri ['type'] ||= 'InterconnectSettingsV3' ['ethernetSettings'] ||= {} ['ethernetSettings']['type'] ||= 'EthernetInterconnectSettingsV3' = { 'If-Match' => @data['eTag'], 'body' => } response = @client.rest_put(@data['uri'] + '/settings', , @api_version) body = @client.response_handler(response) set_all(body) end |
#update_snmp_configuration ⇒ Object
The attribute is defined inside the instance of the Logical Interconnect. Use helper methods to add the trap destination values: #add_snmp_trap_destination and #generate_trap_options
Updates snmp configuration of the Logical Interconnect
179 180 181 182 183 184 185 186 187 188 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 179 def update_snmp_configuration fail IncompleteResource, 'Please retrieve the Logical Interconnect before trying to update' unless @data['snmpConfiguration'] = { 'If-Match' => @data['snmpConfiguration'].delete('eTag'), 'body' => @data['snmpConfiguration'] } response = @client.rest_put(@data['uri'] + '/snmp-configuration', , @api_version) body = @client.response_handler(response) set_all(body) end |
#update_telemetry_configuration ⇒ Object
The attribute is defined inside the instance of the Logical Interconnect
Updates telemetry configuration of the Logical Interconnect
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/oneview-sdk/resource/logical_interconnect.rb', line 164 def update_telemetry_configuration fail IncompleteResource, 'Please retrieve the Logical Interconnect before trying to update' unless @data['telemetryConfiguration'] = { 'If-Match' => @data['telemetryConfiguration'].delete('eTag'), 'body' => @data['telemetryConfiguration'] } response = @client.rest_put(@data['telemetryConfiguration']['uri'], , @api_version) body = @client.response_handler(response) set_all(body) end |