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
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) ⇒ 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!, #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) ⇒ Object
Specify one uplink passing the virtual connect bay and the port to be attached.
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/oneview-sdk/resource/api200/lig_uplink_set.rb', line 44 def add_uplink(bay, port) entry = { 'desiredSpeed' => 'Auto', 'logicalLocation' => { 'locationEntries' => [ { 'relativeValue' => bay, 'type' => 'Bay' }, { 'relativeValue' => 1, 'type' => 'Enclosure' }, { 'relativeValue' => relative_value_of(port), 'type' => 'Port' } ] } } @data['logicalPortConfigInfos'] << entry end |
#sets(networkTypefirst) ⇒ Object
Sets all params
60 61 62 63 64 65 66 |
# File 'lib/oneview-sdk/resource/api200/lig_uplink_set.rb', line 60 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 |