Class: OneviewSDK::API200::LIGUplinkSet
- Defined in:
- lib/oneview-sdk/resource/api200/lig_uplink_set.rb
Overview
Uplink sets resource implementation to be used in logical interconnect groups
Direct Known Subclasses
OneviewSDK::API300::C7000::LIGUplinkSet, OneviewSDK::API300::Synergy::LIGUplinkSet
Constant Summary collapse
- BASE_URI =
'/rest/logical-interconnect-groups'.freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#add_network(network) ⇒ Object
Add an existing network to the network list.
-
#add_uplink(bay, port, type = nil, enclosure_index = 1) ⇒ Object
Specify one uplink passing the virtual connect bay and the port to be attached.
-
#initialize(client, params = {}, api_ver = nil) ⇒ LIGUplinkSet
constructor
Create a resource object, associate it with a client, and set its properties.
-
#sets(networkTypefirst) ⇒ Object
Sets all params.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, #like?, #refresh, #retrieve!, #schema, schema, #set, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ LIGUplinkSet
Create a resource object, associate it with a client, and set its properties.
24 25 26 27 28 29 30 31 |
# File 'lib/oneview-sdk/resource/api200/lig_uplink_set.rb', line 24 def initialize(client, params = {}, api_ver = nil) super # Default values: @data['logicalPortConfigInfos'] ||= [] @data['lacpTimer'] ||= 'Short' unless @data['networkType'] == 'FibreChannel' # FibreChannel does not need set up lacpTimer @data['mode'] ||= 'Auto' @data['networkUris'] ||= [] end |
Instance Method Details
#add_network(network) ⇒ Object
Add an existing network to the network list. Ethernet and FibreChannel networks are allowed.
36 37 38 39 |
# File 'lib/oneview-sdk/resource/api200/lig_uplink_set.rb', line 36 def add_network(network) network.retrieve! unless network['uri'] @data['networkUris'] << network['uri'] end |
#add_uplink(bay, port, type = nil, enclosure_index = 1) ⇒ Object
Specify one uplink passing the virtual connect bay and the port to be attached.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/oneview-sdk/resource/api200/lig_uplink_set.rb', line 46 def add_uplink(bay, port, type = nil, enclosure_index = 1) enclosure_index = type && type.include?('Virtual Connect SE 16Gb FC Module for Synergy') ? -1 : enclosure_index port = if type fetch_relative_value_of(port, type) else # Detect Integer port: for example 67 or '67' port.to_s == port.to_i.to_s ? port.to_i : relative_value_of(port) end entry = { 'desiredSpeed' => 'Auto', 'logicalLocation' => { 'locationEntries' => [ { 'relativeValue' => bay, 'type' => 'Bay' }, { 'relativeValue' => enclosure_index, 'type' => 'Enclosure' }, { 'relativeValue' => port, 'type' => 'Port' } ] } } @data['logicalPortConfigInfos'] << entry end |
#sets(networkTypefirst) ⇒ Object
Sets all params
70 71 72 73 74 75 76 |
# File 'lib/oneview-sdk/resource/api200/lig_uplink_set.rb', line 70 def set_all(params = {}) params = params.data if params.class <= Resource params = Hash[params.map { |(k, v)| [k.to_s, v] }] network_type = params.delete('networkType') params.each { |key, value| set(key.to_s, value) } set('networkType', network_type) if network_type end |