HewlettPackard / oneview-puppet

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://forge.puppet.com/hewlettpackard/oneview
Apache License 2.0
8 stars 17 forks source link

Failing to create a oneview logical interconnect group with real networkUris #304

Closed riconem closed 3 years ago

riconem commented 3 years ago

Scenario/Intent

Creating a oneview_logical_interconnect_group resource with networkUris without their network names.

Environment Details

Steps to Reproduce

Create a oneview_logical_interconnect_group resource with the following parameters. Its important to have real uris in the networkUris parameter.

oneviewconf::oneview::ethernet_networks:
  VLAN0002:
    ensure: present
    data:
      name: VLAN0002
      vlanId: 2
      purpose: General
      smartLink: false
      privateNetwork: false
  VLAN0003:
    ensure: present
    data:
      name: VLAN0003
      vlanId: 2
      purpose: General
      smartLink: false
    privateNetwork: false
  VLAN0141:
    ensure: present
    data:
      name: VLAN0141
      vlanId: 2
      purpose: General
      smartLink: false
      privateNetwork: false
  VLAN0023:
    ensure: present
    data:
      name: VLAN0023
      vlanId: 2
      purpose: General
      smartLink: false
      privateNetwork: false
  VLAN0142:
    ensure: present
    data:
      name: VLAN0142
      vlanId: 2
      purpose: General
      smartLink: false
      privateNetwork: false
  VLAN0143:
    ensure: present
    data:
      name: VLAN0143
      vlanId: 2
      purpose: General
      smartLink: false
      privateNetwork: false

oneviewconf::oneview::logical_interconnect_groups:
  LIG_TEST_NET_2:
    require: Oneview_ethernet_network[VLAN0002, VLAN0003, VLAN0141, VLAN0023, VLAN0142, VLAN0143]
    ensure: present
    data:
      name: LIG_TEST_NET_2
      enclosureType: SY12000
      enclosureIndexes:
      - 1
      - 2
      - 3
      interconnectBaySet: 3
      redundancyType: HighlyAvailable
      name: LIG_TEST_NET_2
      interconnects:
      - bay: 6
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 1
      - bay: 3
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 2
      - bay: 6
        type: Virtual Connect SE 40Gb F8 Module for Synergy
        enclosure_index: 2
      - bay: 3
        type: Virtual Connect SE 40Gb F8 Module for Synergy
        enclosure_index: 1
      - bay: 3
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 3
      - bay: 6
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 3
      uplinkSets:
      - networkType: Ethernet
        networkUris:
        - VLAN0003
        - VLAN0002
        mode: Auto
        name: Uplink_Set_Sync
        ethernetNetworkType: Tagged
        lacpTimer: Short
        uplink_ports:
        - bay: 3
          port: Q1:4
          enclosure_index: 1
          type: Virtual Connect SE 40Gb F8 Module for Synergy
        - bay: 6
          port: Q1:4
          enclosure_index: 2
          type: Virtual Connect SE 40Gb F8 Module for Synergy
      - networkType: Ethernet
        networkUris:
        - VLAN0141
        - VLAN0023
        - VLAN0142
        - VLAN0143
        mode: Auto
        name: Uplink_Set_Mgmt
        ethernetNetworkType: Tagged
        lacpTimer: Short
        uplink_ports:
        - bay: 3
          port: Q1:1
          enclosure_index: 1
          type: Virtual Connect SE 40Gb F8 Module for Synergy
        - bay: 6
          port: Q1:1
          enclosure_index: 2
          type: Virtual Connect SE 40Gb F8 Module for Synergy
  LIG_TEST_NET:
    require: Oneview_ethernet_network[VLAN0002, VLAN0003, VLAN0141, VLAN0023, VLAN0142, VLAN0143]
    ensure: present
    data:
      name: LIG_TEST_NET_2
      enclosureType: SY12000
      enclosureIndexes:
      - 1
      - 2
      - 3
      interconnectBaySet: 3
      redundancyType: HighlyAvailable
      name: LIG_TEST_NET
      interconnects:
      - bay: 6
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 1
      - bay: 3
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 2
      - bay: 6
        type: Virtual Connect SE 40Gb F8 Module for Synergy
        enclosure_index: 2
      - bay: 3
        type: Virtual Connect SE 40Gb F8 Module for Synergy
        enclosure_index: 1
      - bay: 3
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 3
      - bay: 6
        type: Synergy 20Gb Interconnect Link Module
        enclosure_index: 3
      uplinkSets:
      - networkType: Ethernet
        networkUris:
        - "/rest/ethernet-networks/991083c7-be11-44bc-94bc-a4d285ff1b78"
        - "/rest/ethernet-networks/6207cf55-e15d-4cd3-a10d-b649ec2b4fac"
        mode: Auto
        name: Uplink_Set_Sync
        ethernetNetworkType: Tagged
        lacpTimer: Short
        uplink_ports:
        - bay: 3
          port: Q1:4
          enclosure_index: 1
          type: Virtual Connect SE 40Gb F8 Module for Synergy
        - bay: 6
          port: Q1:4
          enclosure_index: 2
          type: Virtual Connect SE 40Gb F8 Module for Synergy
      - networkType: Ethernet
        networkUris:
        - "/rest/ethernet-networks/20e9c7bb-7384-4556-8dcc-e3d4842ed211"
        - "/rest/ethernet-networks/f7b7ef24-0a7f-42e6-950a-a599e4ad3184"
        - "/rest/ethernet-networks/812ca27c-4394-4b38-b47f-4b1b79f6095c"
        - "/rest/ethernet-networks/3aacc7b5-e1eb-4b71-b1d9-06e6394a42a6"
        mode: Auto
        name: Uplink_Set_Mgmt
        ethernetNetworkType: Tagged
        lacpTimer: Short
        uplink_ports:
        - bay: 3
          port: Q1:1
          enclosure_index: 1
          type: Virtual Connect SE 40Gb F8 Module for Synergy
        - bay: 6
          port: Q1:1
          enclosure_index: 2
          type: Virtual Connect SE 40Gb F8 Module for Synergy

Expected Result

Creating two oneview_logical_interconnect_group resource with networkUris.

Actual Result

The oneview_logical_interconnect_group named LIG_TEST_NET_2 with network names in the networkUris parameter will create normally. See the following picture. name_uris

But the oneview_logical_interconnect_group named LIG_TEST_NET with network uris in the networkUris parameter will create without any network. See the following picture. real_uris

Quickfix and Guess

When you look in the oneview_logical_interconnect_group provider you can see that everytime a real uri is used it will skip that element in the array of the networkUris parameter and all uris are deleted. https://github.com/HewlettPackard/oneview-puppet/blob/6eedd764f39ca8fdc4fbf27606e36167f4289d82/lib/puppet/provider/oneview_logical_interconnect_group/c7000.rb#L112 To get it also working with uris you can replace the above line with the following. Here it adds the uri element first and skips after that.

      if network_uri.to_s[0..6].include?('/rest/')
        net = net_class.new(@client, uri: network_uri)
        uplink_set.add_network(net)
        next
      end
VenkateshRavula commented 3 years ago

Hi @riconem , Thanks for pointing us to this issue by adding your analysis and also providing the solution helps us a lot. We will add these changes and raise a PR soon.