CiscoDevNet / ansible-dcnm

Apache License 2.0
47 stars 37 forks source link

modify network created from dcnm_rest failed #169

Closed dsx1123 closed 2 years ago

dsx1123 commented 2 years ago

Community Note

Ansible Version and collection version

ansible [core 2.12.2]
  config file = /root/.ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110]
  jinja version = 3.0.3
  libyaml = True

DCNM version

Affected module(s)

Ansible Playbook

# Copy-paste your anisble playbook here
    - name: create newtork with parameters
      vars:
        payload:
          fabric: "fabric_n9kv"
          vrf: "vrf_red"
          networkName: "trm_test"
          networkId: "311000"
          networkTemplateConfig:
            vlanId: "1000"
            gatewayIpAddress: "10.1.1.1/24"
            vlanName: "trm_test"
            mcastGroup: "239.1.1.1"
            trmEnabled: true
            tag: "12345"
          networkTemplate: "Default_Network_Universal"
          networkExtensionTemplate: "Default_Network_Extension_Universal"
      dcnm_rest:
        path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/top-down/v2/fabrics/{{ fabric.name }}/networks"
        method: POST
        json_data: "{{ payload | to_json }}"
      ignore_errors: true
      tags:
        - network
        - overlay

    - name: attach network trm_test
      dcnm_network:
        fabric: "{{ fabric.name }}"
        config:
          - net_name: trm_test
            vrf_name: vrf_red
            attach:
              - ip_address: 192.168.123.10
                ports: []
              - ip_address: 192.168.123.11
                ports: []
      tags:
        - network
        - overlay

Debug Output

TASK [attach network trm_test] *****************************************************************************************************************************************************************************************************************************
Monday 03 October 2022  17:36:47 -0700 (0:00:01.954)       0:00:01.996 ********
[WARNING]: Persistent connection logging is enabled for 172.25.74.47. This will log ALL interactions to /tmp/ansible.log and WILL NOT redact sensitive configuration like passwords. USE WITH CAUTION!
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'bool' object has no attribute 'lower'
fatal: [172.25.74.47]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-local-376075orfxctv/ansible-tmp-1664843807.6366975-37639-163353454128467/AnsiballZ_dcnm_network.py\", line 10
7, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-local-376075orfxctv/ansible-tmp-1664843807.6366975-37639-163353454128467/AnsiballZ_dcnm_network.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIB
ALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-local-376075orfxctv/ansible-tmp-1664843807.6366975-37639-163353454128467/AnsiballZ_dcnm_network.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.cisco.dcnm.plugins.mod
ules.dcnm_network', init_globals=dict(_module_fqn='ansible_collections.cisco.dcnm.plugins.modules.dcnm_network', _modlib_path=modlib_path),\n  File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals
, run_name, mod_spec)\n  File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansib
le_dcnm_network_payload_e832xs2s/ansible_dcnm_network_payload.zip/ansible_collections/cisco/dcnm/plugins/modules/dcnm_network.py\", line 2580, in <module>\n  File \"/tmp/ansible_dcnm_network_payload_e832xs2s/ansible_dcnm_network_payload.zip/ansible_col
lections/cisco/dcnm/plugins/modules/dcnm_network.py\", line 2533, in main\n  File \"/tmp/ansible_dcnm_network_payload_e832xs2s/ansible_dcnm_network_payload.zip/ansible_collections/cisco/dcnm/plugins/modules/dcnm_network.py\", line 2496, in update_want\
n  File \"/tmp/ansible_dcnm_network_payload_e832xs2s/ansible_dcnm_network_payload.zip/ansible_collections/cisco/dcnm/plugins/modules/dcnm_network.py\", line 2409, in dcnm_update_network_information\nAttributeError: 'bool' object has no attribute 'lower
'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

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

Monday 03 October 2022  17:36:51 -0700 (0:00:04.016)       0:00:06.013 ********
===============================================================================
attach network trm_test ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4.02s
create newtork with parameters ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1.95s

Expected Behavior

network should be attached to selected switches

Actual Behavior

error as above

Steps to Reproduce

References

mikewiebe commented 2 years ago

@dsx1123 this should be resolved now in the develop branch. Can you confirm?

dsx1123 commented 2 years ago

yes, tested in develop branch, and it is working

mikewiebe commented 2 years ago

Fixed in release https://github.com/CiscoDevNet/ansible-dcnm/releases/tag/2.2.0