Class: OneviewSDK::API300::C7000::EnclosureGroup

Inherits:
OneviewSDK::API200::EnclosureGroup show all
Defined in:
lib/oneview-sdk/resource/api300/c7000/enclosure_group.rb

Overview

Enclosure group resource implementation on API300 C7000

Direct Known Subclasses

Synergy::EnclosureGroup

Constant Summary

Constants inherited from OneviewSDK::API200::EnclosureGroup

OneviewSDK::API200::EnclosureGroup::BASE_URI

Constants inherited from Resource

Resource::BASE_URI, Resource::UNIQUE_IDENTIFIERS

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Instance Method Summary collapse

Methods inherited from OneviewSDK::API200::EnclosureGroup

#get_script, #set_script

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) ⇒ EnclosureGroup

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
32
# File 'lib/oneview-sdk/resource/api300/c7000/enclosure_group.rb', line 24

def initialize(client, params = {}, api_ver = nil)
  @data ||= {}
  # Default values:
  @data['type'] ||= 'EnclosureGroupV300'
  @data['stackingMode'] ||= 'Enclosure'
  @data['enclosureCount'] ||= 1
  @data['interconnectBayMappingCount'] ||= 8
  super
end

Instance Method Details

#add_logical_interconnect_group(lig, enclosureIndex = nil) ⇒ OneviewSDK::API300::C7000::EnclosureGroup

Adds the logical interconnect group

Parameters:

  • lig (OneviewSDK::LogicalInterconnectGroup)

    Logical Interconnect Group

  • enclosureIndex (Integer) (defaults to: nil)

    Enclosure index of bay to add LIG to. If nil, interconnects will be added for all enclosures

Returns:

Raises:


39
40
41
42
43
44
45
46
47
48
49
# File 'lib/oneview-sdk/resource/api300/c7000/enclosure_group.rb', line 39

def add_logical_interconnect_group(lig, enclosureIndex = nil)
  lig.retrieve! unless lig['uri']
  raise(NotFound, "The logical interconnect group #{lig['name']} was not found") unless lig['uri']
  lig['interconnectMapTemplate']['interconnectMapEntryTemplates'].each do |entry|
    entry['logicalLocation']['locationEntries'].each do |location|
      next unless location['type'] == 'Bay' && entry['permittedInterconnectTypeUri']
      add_lig_to_bay(location['relativeValue'], lig, enclosureIndex)
    end
  end
  self
end

#create_interconnect_bay_mappingOneviewSDK::API300::C7000::EnclosureGroup

Creates the interconnect bay mapping


53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oneview-sdk/resource/api300/c7000/enclosure_group.rb', line 53

def create_interconnect_bay_mapping
  @data['interconnectBayMappings'] = []
  1.upto(@data['enclosureCount']) do |enclosureIndex|
    1.upto(@data['interconnectBayMappingCount']) do |bay_number|
      entry = {
        'enclosureIndex' => enclosureIndex,
        'interconnectBay' => bay_number,
        'logicalInterconnectGroupUri' => nil
      }
      @data['interconnectBayMappings'] << entry
    end
  end
  self
end