Class: OneviewSDK::API200::LIGUplinkSet

Inherits:
Resource show all
Defined in:
lib/oneview-sdk/resource/api200/lig_uplink_set.rb

Overview

Uplink sets resource implementation to be used in logical interconnect groups

Constant Summary collapse

BASE_URI =
'/rest/logical-interconnect-groups'.freeze

Constants inherited from Resource

Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Instance Method Summary collapse

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.

Parameters:

  • client (OneviewSDK::Client)

    The client object for the OneView appliance

  • params (Hash) (defaults to: {})

    The options for this resource (key-value pairs)

  • api_ver (Integer) (defaults to: nil)

    The api version to use when interracting with this resource.



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.

Parameters:



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

Specify one uplink passing the virtual connect bay and the port to be attached.

Parameters:

  • bay (Fixnum)

    number to identify the VC

  • port (String)

    to attach the uplink. Allowed D1..D16 and X1..X10



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