HewlettPackard / oneview-ansible

This project is no longer being developed and has limited support. Please use the newer Ansible Collection project: https://github.com/HewlettPackard/oneview-ansible-collection
Apache License 2.0
104 stars 65 forks source link

oneview_logical_interconnect_group module exception when assigning new networkuris to existing uplinkset #572

Closed jullienl closed 4 years ago

jullienl commented 4 years ago

Scenario/Intent

Add a new network to an existing Logical Interconnect group uplink set using a modified list of URIs (existing network URIs + new network URI) using the networkuris parameter of uplinksets

Environment Details

Steps to Reproduce

- name: Modify the Logical Interconnect Group with new uplinkSet URIs definition
  oneview_logical_interconnect_group:
    config: "{{ config }}"
    state: present
    data:
      name: "{{ LIG }}"
      uplinkSets:
        - name: "{{ Uplinkset }}"
          networkUris: "{{ new_uplinkset_uris }} "
          networkType: "Ethernet"

Expected Result

New network should be added to the LIG Uplink set

Actual Result

TASK [debug] *** ok: [localhost] => { "new_uplinkset_uris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b", "/rest/ethernet-networks/3d398b27-ef6b-4ee9-8391-28c82770b691" ] }

TASK [Modify the Logical Interconnect Group with new uplinkSet URIs definition] **** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: hpeOneView.exceptions.HPEOneViewException: ('Internal error', {'errorCode': 'CRM_DEFAULT_INTERNAL_SERVER_EXCEPTION', 'message': 'Internal error', 'details': 'An unexpected problem occurred while attempting the operation', 'messageParameters': ['Internal error'], 'recommendedActions': ['If the problem persists, contact your authorized support representative and provide a support dump.'], 'errorSource': None, 'nestedErrors': [], 'data': {}}) fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1598619563.8795404-90624-181588911849148/AnsiballZ_oneview_logical_interconnect_group.py\", line 102, in \n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1598619563.8795404-90624-181588911849148/AnsiballZ_oneview_logical_interconnect_group.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1598619563.8795404-90624-181588911849148/AnsiballZ_oneview_logical_interconnect_group.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.oneview_logical_interconnect_group', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 223, in \n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 219, in main\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py\", line 475, in run\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 170, in execute_module\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 178, in __present\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py\", line 538, in resource_present\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_xcu9wixm/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py\", line 555, in _update_resource\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 67, in wrap\n return obj(*args, **kwargs)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 222, in update\n self.data = self._helper.update(resource, uri, force, timeout, custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 479, in update\n return self.do_put(uri, resource, timeout, custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 780, in do_put\n task, body = self._connection.put(uri, resource, custom_headers=custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/connection.py\", line 383, in put\n return self.do_rest_call('PUT', uri, body, custom_headers=custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/connection.py\", line 413, in do_rest_call\n raise HPEOneViewException(body)\nhpeOneView.exceptions.HPEOneViewException: ('Internal error', {'errorCode': 'CRM_DEFAULT_INTERNAL_SERVER_EXCEPTION', 'message': 'Internal error', 'details': 'An unexpected problem occurred while attempting the operation', 'messageParameters': ['Internal error'], 'recommendedActions': ['If the problem persists, contact your authorized support representative and provide a support dump.'], 'errorSource': None, 'nestedErrors': [], 'data': {}})\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP ***** localhost : ok=10 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

VenkateshRavula commented 4 years ago

@jullienl , It seems like the error is as per Oneview design. Usually, each uplinkset in oneview accepts only one networkUri and if we try to add a list of networkUris to one uplinkset, it will fail with CRM Exception which is expected. You can also confirm this behavior through UI. In UI, each uplinkset allows to add only one network.

Please confirm us if we understand the issue properly.

jullienl commented 4 years ago

I don't agree sorry, OneView supports up to 3966 Ethernet networks per uplink set and in my current configuration, my uplink set is defined with 4 networks, and I am just trying to add an additional one!

The UI, the API, the Python and PowerShell libraries allow this action, not the Ansible module...

This is my current uplink set settings, notice the 4 entries for networkUris :

TASK [debug] *********************************************************************************************************************************************************************** ok: [localhost] => { "uplink_sets": [ { "category": "logical-interconnects", "connectionMode": "Auto", "created": null, "description": null, "eTag": "2af359af-552f-42dd-921c-dcbf7da65a65", "ethernetNetworkType": "Tagged", "failoverActiveMemberThreshold": 4, "failoverBandwidthThreshold": 50, "failoverType": "AllActiveUplinksOffline", "fcMode": "NA", "fcNetworkUris": [], "fcoeNetworkUris": [], "lacpTimer": "Short", "lagPortBalance": "Disabled", "loadBalancingMode": "SourceAndDestinationMac", "logicalInterconnectUri": "/rest/logical-interconnects/a25bd5c8-d39b-4578-b7d5-9017ef65377a", "manualLoginRedistributionState": "NotSupported", "modified": null, "name": "M-LAG-Comware", "nativeNetworkUri": "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "networkSetUris": [], "networkType": "Ethernet", "networkUris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b" ], "portConfigInfos": [ { "desiredFecMode": "Auto", "desiredSpeed": "Auto", "expectedNeighbor": null, "location": { "locationEntries": [ { "type": "Port", "value": "Q1" }, { "type": "Enclosure", "value": "/rest/enclosures/000000CN7515049L" }, { "type": "Bay", "value": "6" } ] }, "portUri": "/rest/interconnects/4b94ebc4-5bc3-447b-9b6b-66b3f9761bb7/ports/4b94ebc4-5bc3-447b-9b6b-66b3f9761bb7:Q1" }, { "desiredFecMode": "Auto", "desiredSpeed": "Auto", "expectedNeighbor": null, "location": { "locationEntries": [ { "type": "Enclosure", "value": "/rest/enclosures/000000CN7516060D" }, { "type": "Port", "value": "Q1" }, { "type": "Bay", "value": "3" } ] }, "portUri": "/rest/interconnects/19c01938-6414-4705-9e4e-075cb3e8f433/ports/19c01938-6414-4705-9e4e-075cb3e8f433:Q1" } ], "primaryPortLocation": null, "privateVlanDomains": [], "reachability": "RedundantlyReachable", "state": "Active", "status": "OK", "type": "uplink-setV7", "uri": "/rest/uplink-sets/27a05303-33da-4580-827f-cb7fd076aac6" } ] }

VenkateshRavula commented 4 years ago

@jullienl , Thanks for correcting me. I have just now verified that when the "networkType" of uplinkSet is "ethernet", then it accepts to add more networkUris.

For updating the networkUris for uplinkset of a lig, we have 2 scenarios.

  1. Add new networkUris to existing networkUris of uplinkSet.
  2. Remove the existing networkUris and add new networkUris. It is the responsibility of the user to maintain the playbook as per the requirement.

Now, coming the above mentioned use case, it comes under scenario-1 where user have to provide {{ existing networkUris + new networkUris }} since he wants to add new networks to existing networks. So please modify the playbook accordingly.

If you run the playbook provided in the description, it will remove the existing networks in uplinkSet and add the newly provided network. Hope this clarifies your point.

jullienl commented 4 years ago

Well, I do exactly what you describe, my playbook modifies my LIG using {{ existing networkUris + new networkUris }} but the module returns an exception when I do that.

VenkateshRavula commented 4 years ago

Hi @jullienl , I am not able to hit that issue which you mentioned. Can you please provide us some extra info which helps us to debug further.

  1. Is this the first time you perform such operation(add new networks to existing LIG) in ansible..?
  2. If it worked earlier, then can you please provide that SDK version with which it worked before..?
  3. Can you please share your oneview environment details (or) please provide your LIG configuration and the type of networks you are trying to add to uplinkset.
  4. Run the playbook in verbose mode (add -vvv in last of command) and provide us the output. It will help us to confirm if the data structure is handled properly or not.
jullienl commented 4 years ago
  1. Yes

  2. Never worked earlier

  3. LIG: VC SE 40Gb F8 - 3 frame - Bay Set 3 - Redundant. Adding a new Ethernet tagged network to Ethernet uplink set with 4 existing networks

    Content of the full playbook:

    
    ---
    - hosts: localhost
    vars:
    config: "{{ playbook_dir }}/oneview_config.json"
    network_name: 'Ansible-Network'
    LIG: 'LIG-MLAG' 
    Uplinkset: 'M-LAG-Comware'
    NetworkSet: 'Production Networks'
    new_uplinkset_uris: []
    
    tasks:
    - name: Create an Ethernet Network
      oneview_ethernet_network:
        config: "{{ config }}"
        state: present
        data:
          name: '{{ network_name }}'
          vlanId: 200
          ethernetNetworkType: Tagged
          purpose: General
          smartLink: false
          privateNetwork: false
          bandwidth:
              maximumBandwidth: 2000
              typicalBandwidth: 1000
    
    - name: Store network URI
      set_fact:
        network_uri: "{{ ethernet_network.uri  }}"
    
    - debug: var=network_uri   
    
    - name: Gather facts about a Uplink Set by name
      oneview_uplink_set_facts:
        config: "{{ config }}"
        name: '{{ Uplinkset }}'
    
    - debug: var=uplink_sets
    
    - name: Store uplink set URIs
      set_fact:
        uplinkset_uris: "{{ (uplink_sets | map(attribute='networkUris') | list)[0] }}"
    
    - debug: var=uplinkset_uris
    
    - name: Set a new variable for the new uplink set uris
      set_fact:
        new_uplinkset_uris: "{{uplinkset_uris}}"
    
    - name: Append new network uri to new uplink set uris list
      set_fact:
        new_uplinkset_uris: "{{ new_uplinkset_uris + [ network_uri ] }}"
    
    - debug: var=new_uplinkset_uris
    
    - name: Modify the Logical Interconnect Group with new uplinkSet URIs definition
      oneview_logical_interconnect_group:
        config: "{{ config }}"
        state: present
        data:
          name: "{{ LIG }}"
          uplinkSets:
            - name: "{{ Uplinkset }}"
              networkUris: "{{ new_uplinkset_uris }} "
              networkType: "Ethernet"

4. Execution in verbose mode :

[root@Ansible-CentOS ~]# ansible-playbook network_add.yml -vvv ansible-playbook 2.9.10 config file = /etc/ansible/ansible.cfg configured module search path = ['/root/oneview-ansible/library'] ansible python module location = /usr/lib/python3.6/site-packages/ansible executable location = /usr/bin/ansible-playbook python version = 3.6.8 (default, Apr 16 2020, 01:36:27) [GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] Using /etc/ansible/ansible.cfg as config file host_list declined parsing /root/hosts/hosts as it did not pass its verify_file() method script declined parsing /root/hosts/hosts as it did not pass its verify_file() method auto declined parsing /root/hosts/hosts as it did not pass its verify_file() method Parsed /root/hosts/hosts inventory source with ini plugin

PLAYBOOK: network_add.yml **** 1 plays in network_add.yml

PLAY [localhost] *****

TASK [Gathering Facts] *** task path: /root/network_add.yml:2 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp"&& mkdir /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944 && echo ansible-tmp-1601383598.2161882-126585-62533209284944="echo /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944" ) && sleep 0' Using module file /usr/lib/python3.6/site-packages/ansible/modules/system/setup.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-126578ak8vmaqh/tmp36aw9fwf TO /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944/AnsiballZ_setup.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944/ /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944/AnsiballZ_setup.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944/AnsiballZ_setup.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1601383598.2161882-126585-62533209284944/ > /dev/null 2>&1 && sleep 0' ok: [localhost] META: ran handlers

TASK [Create an Ethernet Network] **** task path: /root/network_add.yml:15 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp"&& mkdir /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239 && echo ansible-tmp-1601383599.585023-126633-184490164364239="echo /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239" ) && sleep 0' Using module file /root/oneview-ansible/library/oneview_ethernet_network.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-126578ak8vmaqh/tmpaojf9q TO /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239/AnsiballZ_oneview_ethernet_network.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239/ /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239/AnsiballZ_oneview_ethernet_network.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239/AnsiballZ_oneview_ethernet_network.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1601383599.585023-126633-184490164364239/ > /dev/null 2>&1 && sleep 0' ok: [localhost] => { "ansible_facts": { "ethernet_network": { "category": "ethernet-networks", "connectionTemplateUri": "/rest/connection-templates/b312b05f-a126-4fcc-bf63-833d77f7f230", "created": "2020-09-29T12:41:05.809Z", "description": null, "eTag": "e931182d-0be0-4461-ba20-e991907647f2", "ethernetNetworkType": "Tagged", "fabricUri": "/rest/fabrics/d3e64cd6-f176-44ab-929f-d8069e960533", "ipv6SubnetUri": null, "modified": "2020-09-29T12:41:05.828Z", "name": "Ansible-Network", "privateNetwork": false, "purpose": "General", "scopesUri": "/rest/scopes/resources/rest/ethernet-networks/4da5ac9b-81c3-407b-8952-dbfbb6f190fe", "smartLink": false, "state": "Active", "status": "OK", "subnetUri": null, "type": "ethernet-networkV4", "uri": "/rest/ethernet-networks/4da5ac9b-81c3-407b-8952-dbfbb6f190fe", "vlanId": 200 } }, "changed": false, "invocation": { "module_args": { "api_version": null, "auth_login_domain": null, "config": "/root/oneview_config.json", "data": { "ethernetNetworkType": "Tagged", "name": "Ansible-Network", "privateNetwork": false, "purpose": "General", "smartLink": false, "vlanId": 200 }, "hostname": null, "image_streamer_hostname": null, "password": null, "state": "present", "username": null, "validate_etag": true } }, "msg": "Ethernet Network is already present." }

TASK [Store network URI] ***** task path: /root/network_add.yml:33 ok: [localhost] => { "ansible_facts": { "network_uri": "/rest/ethernet-networks/4da5ac9b-81c3-407b-8952-dbfbb6f190fe" }, "changed": false }

TASK [debug] ***** task path: /root/network_add.yml:37 ok: [localhost] => { "network_uri": "/rest/ethernet-networks/4da5ac9b-81c3-407b-8952-dbfbb6f190fe" }

TASK [Gather facts about a Uplink Set by name] *** task path: /root/network_add.yml:39 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp"&& mkdir /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745 && echo ansible-tmp-1601383600.6948638-126652-18252435981745="echo /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745" ) && sleep 0' Using module file /root/oneview-ansible/library/oneview_uplink_set_facts.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-126578ak8vmaqh/tmpqqfzs7wf TO /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745/AnsiballZ_oneview_uplink_set_facts.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745/ /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745/AnsiballZ_oneview_uplink_set_facts.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745/AnsiballZ_oneview_uplink_set_facts.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1601383600.6948638-126652-18252435981745/ > /dev/null 2>&1 && sleep 0' ok: [localhost] => { "ansible_facts": { "uplink_sets": [ { "category": "logical-interconnects", "connectionMode": "Auto", "created": null, "description": null, "eTag": "2af359af-552f-42dd-921c-dcbf7da65a65", "ethernetNetworkType": "Tagged", "failoverActiveMemberThreshold": 4, "failoverBandwidthThreshold": 50, "failoverType": "AllActiveUplinksOffline", "fcMode": "NA", "fcNetworkUris": [], "fcoeNetworkUris": [], "lacpTimer": "Short", "lagPortBalance": "Disabled", "loadBalancingMode": "SourceAndDestinationMac", "logicalInterconnectUri": "/rest/logical-interconnects/a25bd5c8-d39b-4578-b7d5-9017ef65377a", "manualLoginRedistributionState": "NotSupported", "modified": null, "name": "M-LAG-Comware", "nativeNetworkUri": "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "networkSetUris": [], "networkType": "Ethernet", "networkUris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b" ], "portConfigInfos": [ { "desiredFecMode": "Auto", "desiredSpeed": "Auto", "expectedNeighbor": null, "location": { "locationEntries": [ { "type": "Bay", "value": "6" }, { "type": "Enclosure", "value": "/rest/enclosures/000000CN7515049L" }, { "type": "Port", "value": "Q1" } ] }, "portUri": "/rest/interconnects/4b94ebc4-5bc3-447b-9b6b-66b3f9761bb7/ports/4b94ebc4-5bc3-447b-9b6b-66b3f9761bb7:Q1" }, { "desiredFecMode": "Auto", "desiredSpeed": "Auto", "expectedNeighbor": null, "location": { "locationEntries": [ { "type": "Bay", "value": "3" }, { "type": "Enclosure", "value": "/rest/enclosures/000000CN7516060D" }, { "type": "Port", "value": "Q1" } ] }, "portUri": "/rest/interconnects/19c01938-6414-4705-9e4e-075cb3e8f433/ports/19c01938-6414-4705-9e4e-075cb3e8f433:Q1" } ], "primaryPortLocation": null, "privateVlanDomains": [], "reachability": "RedundantlyReachable", "state": "Active", "status": "OK", "type": "uplink-setV7", "uri": "/rest/uplink-sets/27a05303-33da-4580-827f-cb7fd076aac6" } ] }, "changed": false, "invocation": { "module_args": { "api_version": null, "auth_login_domain": null, "config": "/root/oneview_config.json", "hostname": null, "image_streamer_hostname": null, "name": "M-LAG-Comware", "params": null, "password": null, "username": null } } }

TASK [debug] ***** task path: /root/network_add.yml:45 ok: [localhost] => { "uplink_sets": [ { "category": "logical-interconnects", "connectionMode": "Auto", "created": null, "description": null, "eTag": "2af359af-552f-42dd-921c-dcbf7da65a65", "ethernetNetworkType": "Tagged", "failoverActiveMemberThreshold": 4, "failoverBandwidthThreshold": 50, "failoverType": "AllActiveUplinksOffline", "fcMode": "NA", "fcNetworkUris": [], "fcoeNetworkUris": [], "lacpTimer": "Short", "lagPortBalance": "Disabled", "loadBalancingMode": "SourceAndDestinationMac", "logicalInterconnectUri": "/rest/logical-interconnects/a25bd5c8-d39b-4578-b7d5-9017ef65377a", "manualLoginRedistributionState": "NotSupported", "modified": null, "name": "M-LAG-Comware", "nativeNetworkUri": "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "networkSetUris": [], "networkType": "Ethernet", "networkUris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b" ], "portConfigInfos": [ { "desiredFecMode": "Auto", "desiredSpeed": "Auto", "expectedNeighbor": null, "location": { "locationEntries": [ { "type": "Bay", "value": "6" }, { "type": "Enclosure", "value": "/rest/enclosures/000000CN7515049L" }, { "type": "Port", "value": "Q1" } ] }, "portUri": "/rest/interconnects/4b94ebc4-5bc3-447b-9b6b-66b3f9761bb7/ports/4b94ebc4-5bc3-447b-9b6b-66b3f9761bb7:Q1" }, { "desiredFecMode": "Auto", "desiredSpeed": "Auto", "expectedNeighbor": null, "location": { "locationEntries": [ { "type": "Bay", "value": "3" }, { "type": "Enclosure", "value": "/rest/enclosures/000000CN7516060D" }, { "type": "Port", "value": "Q1" } ] }, "portUri": "/rest/interconnects/19c01938-6414-4705-9e4e-075cb3e8f433/ports/19c01938-6414-4705-9e4e-075cb3e8f433:Q1" } ], "primaryPortLocation": null, "privateVlanDomains": [], "reachability": "RedundantlyReachable", "state": "Active", "status": "OK", "type": "uplink-setV7", "uri": "/rest/uplink-sets/27a05303-33da-4580-827f-cb7fd076aac6" } ] }

TASK [Store uplink set URIs] ***** task path: /root/network_add.yml:47 ok: [localhost] => { "ansible_facts": { "uplinkset_uris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b" ] }, "changed": false }

TASK [debug] ***** task path: /root/network_add.yml:51 ok: [localhost] => { "uplinkset_uris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b" ] }

TASK [Set a new variable for the new uplink set uris] **** task path: /root/network_add.yml:53 ok: [localhost] => { "ansible_facts": { "new_uplinkset_uris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b" ] }, "changed": false }

TASK [Append new network uri to new uplink set uris list] **** task path: /root/network_add.yml:57 ok: [localhost] => { "ansible_facts": { "new_uplinkset_uris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b", "/rest/ethernet-networks/4da5ac9b-81c3-407b-8952-dbfbb6f190fe" ] }, "changed": false }

TASK [debug] ***** task path: /root/network_add.yml:61 ok: [localhost] => { "new_uplinkset_uris": [ "/rest/ethernet-networks/9737a2d8-602c-4924-ac4e-aa514aecd6d2", "/rest/ethernet-networks/718179dd-f0f8-409d-a4ab-a19e9f08e4a7", "/rest/ethernet-networks/89ad8bd5-718c-4f5c-be57-33acb49ff8d5", "/rest/ethernet-networks/a6a78dc2-4a1e-422d-8617-11f1bf9ee80b", "/rest/ethernet-networks/4da5ac9b-81c3-407b-8952-dbfbb6f190fe" ] }

TASK [Modify the Logical Interconnect Group with new uplinkSet URIs definition] ** task path: /root/network_add.yml:64 <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0' <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp"&& mkdir /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988 && echo ansible-tmp-1601383602.0673223-126679-19490503170988="echo /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988" ) && sleep 0' Using module file /root/oneview-ansible/library/oneview_logical_interconnect_group.py <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-126578ak8vmaqh/tmpsdl3ijlr TO /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/ /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3.6 /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py && sleep 0' <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/ > /dev/null 2>&1 && sleep 0' The full traceback is: Traceback (most recent call last): File "/root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py", line 102, in _ansiballz_main() File "/root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py", line 94, in _ansiballz_main invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS) File "/root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py", line 40, in invoke_module runpy.run_module(mod_name='ansible.modules.oneview_logical_interconnect_group', init_globals=None, run_name='main', alter_sys=True) File "/usr/lib64/python3.6/runpy.py", line 205, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py", line 223, in File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py", line 219, in main File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py", line 475, in run File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py", line 170, in execute_module File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py", line 178, in present File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py", line 538, in resource_present File "/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py", line 555, in _update_resource File "/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py", line 67, in wrap return obj(*args, **kwargs) File "/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py", line 222, in update self.data = self._helper.update(resource, uri, force, timeout, custom_headers) File "/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py", line 479, in update return self.do_put(uri, resource, timeout, custom_headers) File "/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py", line 780, in do_put task, body = self._connection.put(uri, resource, custom_headers=custom_headers) File "/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/connection.py", line 383, in put return self.do_rest_call('PUT', uri, body, custom_headers=custom_headers) File "/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/connection.py", line 413, in do_rest_call raise HPEOneViewException(body) hpeOneView.exceptions.HPEOneViewException: ('Internal error', {'errorCode': 'CRM_DEFAULT_INTERNAL_SERVER_EXCEPTION', 'message': 'Internal error', 'details': 'An unexpected problem occurred while attempting the operation', 'messageParameters': ['Internal error'], 'recommendedActions': ['If the problem persists, contact your authorized support representative and provide a support dump.'], 'errorSource': None, 'nestedErrors': [], 'data': {}}) fatal: [localhost]: FAILED! => { "changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py\", line 102, in \n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py\", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1601383602.0673223-126679-19490503170988/AnsiballZ_oneview_logical_interconnect_group.py\", line 40, in invoke_module\n runpy.run_module(mod_name='ansible.modules.oneview_logical_interconnect_group', init_globals=None, run_name='main', alter_sys=True)\n File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\n return _run_module_code(code, init_globals, run_name, mod_spec)\n File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\n mod_name, mod_spec, pkg_name, script_name)\n File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\n exec(code, run_globals)\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 223, in \n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 219, in main\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py\", line 475, in run\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 170, in execute_module\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/modules/oneview_logical_interconnect_group.py\", line 178, in __present\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py\", line 538, in resource_present\n File \"/tmp/ansible_oneview_logical_interconnect_group_payload_pcyq4abg/ansible_oneview_logical_interconnect_group_payload.zip/ansible/module_utils/oneview.py\", line 555, in _update_resource\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 67, in wrap\n return obj(*args, **kwargs)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 222, in update\n self.data = self._helper.update(resource, uri, force, timeout, custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 479, in update\n return self.do_put(uri, resource, timeout, custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/resources/resource.py\", line 780, in do_put\n task, body = self._connection.put(uri, resource, custom_headers=custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/connection.py\", line 383, in put\n return self.do_rest_call('PUT', uri, body, custom_headers=custom_headers)\n File \"/root/.local/lib/python3.6/site-packages/hpeOneView-5.3.0-py3.6.egg/hpeOneView/connection.py\", line 413, in __do_rest_call\n raise HPEOneViewException(body)\nhpeOneView.exceptions.HPEOneViewException: ('Internal error', {'errorCode': 'CRM_DEFAULT_INTERNAL_SERVER_EXCEPTION', 'message': 'Internal error', 'details': 'An unexpected problem occurred while attempting the operation', 'messageParameters': ['Internal error'], 'recommendedActions': ['If the problem persists, contact your authorized support representative and provide a support dump.'], 'errorSource': None, 'nestedErrors': [], 'data': {}})\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }

PLAY RECAP *** localhost : ok=11 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0

yuvirani commented 4 years ago

Hi @jullienl,

I could reproduce the error with the given playbook, the issue here is we have missed the field "logicalPortConfogInfos". Since we are trying to modify the existing uplinkset, we must provide port details to update the networkUris of an uplinkset. I'm sharing the working playbook below and if you are still facing the same issue, please do let us know.


 - name: Modify the Logical Interconnect Group with new uplinkSet URIs definition
      oneview_logical_interconnect_group:
        config: "{{ config }}"
        state: present
        data:
          name: "{{ LIG }}"
          uplinkSets:
            - name: "{{ Uplinkset }}"
              networkUris: "{{ new_uplinkset_uris }} "
              networkType: "Ethernet"
              ethernetNetworkType: "Tagged"
              logicalPortConfigInfos:
               - desiredSpeed: 'Auto'
                 logicalLocation:
                      locationEntries:
                        - relativeValue: 1
                          type: 'Enclosure'
                        - relativeValue: 61
                          type: 'Port'
                        - relativeValue: 3
                          type: 'Bay'
yuvirani commented 4 years ago

@jullienl,

As we discussed, keep all the existing uplinkSet configuration in the playbook as it is and modify the uplinkSet you would like to update. This is to avoid removing the uplinksets from LIG since the code considers only the specified uplinkSet can be added/updated to LIG(Remove everything else if not mentioned).

We will be taking care of this in the future release.