Class: OneviewSDK::UplinkSet

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

Overview

Uplink set resource implementation

Constant Summary collapse

BASE_URI =
'/rest/uplink-sets'.freeze

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, from_file, get_all, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update

Constructor Details

#initialize(client, params = {}, api_ver = nil) ⇒ UplinkSet

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.



21
22
23
24
25
26
27
28
29
30
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 21

def initialize(client, params = {}, api_ver = nil)
  super
  # Default values
  @data['fcNetworkUris'] ||= []
  @data['fcoeNetworkUris'] ||= []
  @data['networkUris'] ||= []
  @data['portConfigInfos'] ||= []
  @data['primaryPortLocation'] = nil
  @data['type'] ||= 'uplink-setV3'
end

Instance Method Details

#add_fcnetwork(network) ⇒ Object

Adds an fc network to the uplink set

Parameters:



65
66
67
68
69
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 65

def add_fcnetwork(network)
  uri = network[:uri] || network['uri']
  fail IncompleteResource, 'Must set network uri attribute' unless uri
  @data['fcNetworkUris'].push(uri)
end

#add_fcoenetwork(network) ⇒ Object

Adds an fcoe network to the uplink set

Parameters:



73
74
75
76
77
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 73

def add_fcoenetwork(network)
  uri = network[:uri] || network['uri']
  fail IncompleteResource, 'Must set network uri attribute' unless uri
  @data['fcoeNetworkUris'].push(uri)
end

#add_network(network) ⇒ Object

Adds an ethernet network to the uplink set

Parameters:



57
58
59
60
61
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 57

def add_network(network)
  uri = network[:uri] || network['uri']
  fail IncompleteResource, 'Must set network uri attribute' unless uri
  @data['networkUris'].push(uri)
end

#add_port_config(portUri, speed, locationEntries) ⇒ Object

Adds the portConfigInfos to the array

Parameters:

  • portUri (String)
  • speed (String)
  • locationEntries (Hash)


36
37
38
39
40
41
42
43
44
45
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 36

def add_port_config(portUri, speed, locationEntries)
  entry = {
    'portUri' => portUri,
    'desiredSpeed' => speed,
    'location' => {
      'locationEntries' => locationEntries
    }
  }
  @data['portConfigInfos'] << entry
end

#set_logical_interconnect(logical_interconnect) ⇒ Object

Sets the logical interconnect uri

Parameters:



49
50
51
52
53
# File 'lib/oneview-sdk/resource/uplink_set.rb', line 49

def set_logical_interconnect(logical_interconnect)
  uri = logical_interconnect[:uri] || logical_interconnect['uri']
  fail IncompleteResource, 'Invalid object' unless uri
  @data['logicalInterconnectUri'] = uri
end