HewlettPackard / oneview-chef

This project is no longer being developed and has limited support. In the near future this repository will be fully deprecated. Please consider using other OneView projects, such as Terraform and Ansible Collection
https://supermarket.chef.io/cookbooks/oneview
Apache License 2.0
17 stars 15 forks source link

Support additional uplink port types in the LogicalInterconnectGroupProvider #225

Closed jsmartt closed 7 years ago

jsmartt commented 7 years ago

Scenario/Intent

After SDK issue #216 gets implemented/fixed, we'll need to add the same support for our cookbooks.

Related resource:

Environment Details

Expected Result

Support Q ports, etc., where we need to specify an enclosure_index to calculate the offset value.

Actual Result

Not currently supported

vranystepan commented 7 years ago

I know that oneview-sdk with these enhancements ( HewlettPackard/oneview-sdk-ruby#230 ) needs to be released first but i will preliminary look at it ;)

vranystepan commented 7 years ago

Theoretically we can get interconnect module type from already loaded interconnects as they always have type and bay number and enclosure_index

  1. compile some easily readable list from @item.data['interconnectMapTemplate']['interconnectMapEntryTemplates']
    • ['logicalLocation']['locationEntries'].find { |entry| entry['type'] == 'Bay' }
    • ['logicalLocation']['locationEntries'].find { |entry| entry['type'] == 'Enclosure' }
    • ['permittedInterconnectTypeUri'] (and fetch the type or name from OneView)
  2. edit method load_uplink_sets so this part will be finding needed values in compiled structure

I can see a few challenges here ... for example these 16Gb Synergy FC switches and their enclosure_index = -1 . I need to create some mockup and test in the real environment :)

vranystepan commented 7 years ago

Ahhh, I've just realized that API300::Synergy contains @data['enclosureIndexes'] by default so we have to do following:

  1. check whether @item.data['enclosureIndexes'] exists (otherwise enclosure_index is 1 or nil, does not matter)
  2. check the length of @item.data['enclosureIndexes'], when the length is 1 - enclosure_index will be @item.data['enclosureIndexes'].first
  3. if length > 1 - uplinks connections info has to contain enclosure_index, example below
uplink_connections = [
  { bay: 3, port: 'Q1', enclosure_index: 1 },
  { bay: 6, port: 'Q1', enclosure_index: 2 }
]
vranystepan commented 7 years ago

hmmm .... I can see how it has been solved in Puppet library, that's actually great and straightforward solution.

parsed_uplink_info[:connections].each do |link|
  link[:type] ||= nil
  link[:enclosure_index] ||= 1
  up.add_uplink(link[:bay], link[:port], link[:type], link[:enclosure_index]) 
end

I will try to implement & test this week.