class OneviewSDK::API200::LIGUplinkSet

Uplink sets resource implementation to be used in logical interconnect groups

Constants

BASE_URI

Public Class Methods

new(client, params = {}, api_ver = nil) click to toggle source

Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.

Calls superclass method OneviewSDK::Resource::new
# 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

Public Instance Methods

add_network(network) click to toggle source

Add an existing network to the network list. Ethernet and FibreChannel networks are allowed. @param [OneviewSDK::Resource] network The resource to be added to the list

# 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
set_all(params = {}) click to toggle source

Sets all params @overload sets networkType first

# 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

Private Instance Methods

fetch_relative_value_of(port, type) click to toggle source
# File lib/oneview-sdk/resource/api200/lig_uplink_set.rb, line 93
def fetch_relative_value_of(port, type)
  port_formats = [port.sub('.', ':'), port.sub(':', '.')].uniq
  interconnect_type = OneviewSDK::Interconnect.get_type(@client, type)
  unless interconnect_type
    list = OneviewSDK::Interconnect.get_types(@client).map { |t| t['name'] }
    raise OneviewSDK::NotFound, "Interconnect type #{type} not found! Supported types: #{list}"
  end
  type_port = interconnect_type['portInfos'].find { |p| port_formats.include? p['portName'] }
  raise OneviewSDK::NotFound, "Port #{port} not found!" unless type_port
  type_port['portNumber']
end
relative_value_of(port) click to toggle source

Relative values:

Downlink Ports: D1 is 1, D2 is 2, ....,D15 is 15, D16 is 16;
Uplink Ports: X1 is 17, X2 is 18, ....,X9 is 25, X10 is 26.
# File lib/oneview-sdk/resource/api200/lig_uplink_set.rb, line 83
def relative_value_of(port)
  identifier = port.slice!(0)
  offset = case identifier
           when 'D' then 0
           when 'X' then 16
           else raise InvalidResource, "Port not supported: #{identifier} type not found"
           end
  port.to_i + offset
end