Class: OneviewSDK::API300::Synergy::SASLogicalInterconnectGroup

Inherits:
Resource
  • Object
show all
Defined in:
lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect_group.rb

Overview

SAS Logical interconnect group resource implementation

Constant Summary collapse

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

Constants inherited from Resource

Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary collapse

Attributes inherited from Resource

#api_version, #client, #data, #logger

Instance Method Summary collapse

Methods inherited from Resource

#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file, #update

Constructor Details

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

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.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect_group.rb', line 27

def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['enclosureType'] ||= 'SY12000'
  @data['enclosureIndexes'] ||= [1]
  @data['state'] ||= 'Active'
  @data['type'] ||= 'sas-logical-interconnect-group'
  @data['interconnectBaySet'] ||= 1
  @data['interconnectMapTemplate'] ||= {}
  @data['interconnectMapTemplate']['interconnectMapEntryTemplates'] ||= []
end

Instance Attribute Details

#bay_countObject (readonly)

Returns the value of attribute bay_count.



21
22
23
# File 'lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect_group.rb', line 21

def bay_count
  @bay_count
end

Instance Method Details

#add_interconnect(bay, type, enclosure_index = 1) ⇒ Object

Adds an interconnect

Parameters:

  • bay (Fixnum)

    Bay number

  • type (String)

    Interconnect type

Raises:

  • (StandardError)

    if a invalid type is given then raises an error



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/oneview-sdk/resource/api300/synergy/sas_logical_interconnect_group.rb', line 43

def add_interconnect(bay, type, enclosure_index = 1)
  parse_interconnect_map_template(bay, enclosure_index)
  @data['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
    entry['logicalLocation']['locationEntries'].each do |location|
      if location['type'] == 'Bay' && location['relativeValue'] == bay
        entry['permittedInterconnectTypeUri'] = OneviewSDK::API300::Synergy::SASInterconnect.get_type(@client, type)['uri']
      end
    end
  end
rescue StandardError
  list = OneviewSDK::API300::Synergy::SASInterconnect.get_types(@client).map { |t| t['name'] }
  raise "SAS Interconnect type '#{type}' not found! Supported types: #{list}"
end