diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 000000000..7c175ddc7 --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,9 @@ +--- +# Ansible-lint configuration file +# See https://ansible.readthedocs.io/projects/lint/configuring/ + +profile: production + +# Exclude paths from linting - GitHub workflows should not be linted +exclude_paths: + - .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2eff9614f..f957ac371 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,9 +6,9 @@ name: CI on: # Triggers the workflow on push or pull request events but only for the develop branch push: - branches: [ develop, main ] + branches: [develop, main] pull_request: - branches: [ develop, main ] + branches: [develop, main] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -23,32 +23,32 @@ jobs: matrix: ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6] steps: - - name: Check out code - uses: actions/checkout@v2 - - - name: Set up Python "3.11" - uses: actions/setup-python@v1 - with: - python-version: "3.11" + - name: Check out code + uses: actions/checkout@v2 - - name: Install ansible-base (v${{ matrix.ansible }}) - run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + - name: Set up Python "3.11" + uses: actions/setup-python@v1 + with: + python-version: "3.11" - - name: Build a DCNM collection tarball - run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/v${{ matrix.ansible }}/collection-tarballs" + - name: Install ansible-base (v${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Store migrated collection artifacts - uses: actions/upload-artifact@v4.4.0 - with: - name: collection_v${{ matrix.ansible }} - path: .cache/v${{ matrix.ansible }}/collection-tarballs - overwrite: true + - name: Build a DCNM collection tarball + run: ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/v${{ matrix.ansible }}/collection-tarballs" + + - name: Store migrated collection artifacts + uses: actions/upload-artifact@v4.4.0 + with: + name: collection_v${{ matrix.ansible }} + path: .cache/v${{ matrix.ansible }}/collection-tarballs + overwrite: true sanity: name: Run ansible-sanity tests needs: - - build + - build runs-on: ubuntu-latest strategy: matrix: @@ -64,75 +64,84 @@ jobs: - ansible: 2.18.6 python: "3.10" steps: - - name: Set up Python (v${{ matrix.python }}) - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python }} + - name: Set up Python (v${{ matrix.python }}) + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} - - name: Install ansible-base (v${{ matrix.ansible }}) - run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + - name: Install ansible-base (v${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - name: Download migrated collection artifacts - uses: actions/download-artifact@v4.1.7 - with: - name: collection_v${{ matrix.ansible }} - path: .cache/v${{ matrix.ansible }}/collection-tarballs + - name: Download migrated collection artifacts + uses: actions/download-artifact@v4.1.7 + with: + name: collection_v${{ matrix.ansible }} + path: .cache/v${{ matrix.ansible }}/collection-tarballs - - name: Install the collection tarball - run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz + - name: Install the collection tarball + run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz - - name: Run sanity tests - run: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0 - working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm + - name: Run sanity tests + run: ansible-test sanity --docker --python ${{matrix.python}} -v --color --truncate 0 + working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm unit-tests: name: Run DCNM Unit Tests needs: - - build + - build runs-on: ubuntu-latest strategy: matrix: ansible: [2.15.13, 2.16.14, 2.17.12, 2.18.6] steps: - - name: Set up Python "3.11" - uses: actions/setup-python@v1 - with: - python-version: "3.11" - - - name: Install ansible-base (v${{ matrix.ansible }}) - run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check - - - name: Install Pydantic (v2) - run: pip install pydantic==2.11.10 - - - name: Install Requests - run: pip install requests==2.32.5 - - - name: Install DeepDiff (v8.5.0) - run: pip install deepdiff==8.5.0 - - - name: Install coverage (v7.3.4) - run: pip install coverage==7.3.4 - - - name: Install pytest (v7.4.4) - run: pip install pytest==7.4.4 - - - name: Download migrated collection artifacts - uses: actions/download-artifact@v4.1.7 - with: - name: collection_v${{ matrix.ansible }} - path: .cache/v${{ matrix.ansible }}/collection-tarballs - - - name: Install the collection tarball - run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz - - - name: Run DCNM Unit tests - run: coverage run --source=. -m pytest tests/unit/. -vvvv - working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm - env: - PYTHONPATH: /home/runner/.ansible/collections - - - name: Generate coverage report - run: coverage report - working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm + - name: Set up Python "3.11" + uses: actions/setup-python@v1 + with: + python-version: "3.11" + + - name: Install ansible-base (v${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - name: Install Pydantic (v2) + run: pip install pydantic==2.11.10 + - name: Install ansible-base (v${{ matrix.ansible }}) + run: pip install https://github.com/ansible/ansible/archive/v${{ matrix.ansible }}.tar.gz --disable-pip-version-check + + - name: Install Pydantic (v2) + run: pip install pydantic==2.11.10 + + - name: Install Requests + run: pip install requests==2.32.5 + - name: Install Requests + run: pip install requests==2.32.5 + + - name: Install DeepDiff (v8.5.0) + run: pip install deepdiff==8.5.0 + - name: Install DeepDiff (v8.5.0) + run: pip install deepdiff==8.5.0 + + - name: Install coverage (v7.3.4) + run: pip install coverage==7.3.4 + + - name: Install pytest (v7.4.4) + run: pip install pytest==7.4.4 + + - name: Download migrated collection artifacts + uses: actions/download-artifact@v4.1.7 + with: + name: collection_v${{ matrix.ansible }} + path: .cache/v${{ matrix.ansible }}/collection-tarballs + + - name: Install the collection tarball + run: ansible-galaxy collection install .cache/v${{ matrix.ansible }}/collection-tarballs/*.tar.gz + + - name: Run DCNM Unit tests + run: coverage run --source=. -m pytest tests/unit/. -vvvv + working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm + env: + PYTHONPATH: /home/runner/.ansible/collections + + - name: Generate coverage report + run: coverage report + working-directory: /home/runner/.ansible/collections/ansible_collections/cisco/dcnm diff --git a/.gitignore b/.gitignore index 083439dda..5093a79ed 100644 --- a/.gitignore +++ b/.gitignore @@ -79,4 +79,4 @@ venv.bak/ .mypy_cache/ # Ignore Integration Tests Files Directories -tests/integration/targets/*/files \ No newline at end of file +tests/integration/targets/*/files diff --git a/.vscode/settings.json b/.vscode/settings.json index d969f962b..28c87aef1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "python.testing.pytestArgs": ["tests"], "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true + "python.testing.pytestEnabled": true, } diff --git a/galaxy.yml b/galaxy.yml index 3ab9b53f1..8b9980fa1 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -15,7 +15,7 @@ authors: - Neil John - Sivakami Sivaraman description: Ansible collection for the Cisco Nexus® Dashboard Fabric Controller (NDFC) - formerly DCNM -license: Apache-2.0 +license: [Apache-2.0] tags: [cisco, ndfc, dcnm, nxos, networking, vxlan] dependencies: "ansible.netcommon": ">=4.1.0" diff --git a/meta/runtime.yml b/meta/runtime.yml index 639e2ce9e..2667104ad 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -2,9 +2,9 @@ # The example below demonstrates how running the dcnm_inventory module # will redirect to a common action plugin called cisco.dcnm.dcnm # -#--- +# --- requires_ansible: ">=2.15.0" -#plugin_routing: +# plugin_routing: # action: # dcnm_inventory: # redirect: cisco.dcnm.dcnm diff --git a/playbooks/roles/dcnm_bootflash/create_files.yaml b/playbooks/roles/dcnm_bootflash/create_files.yaml index 5eca022e6..d1d776d40 100644 --- a/playbooks/roles/dcnm_bootflash/create_files.yaml +++ b/playbooks/roles/dcnm_bootflash/create_files.yaml @@ -1,5 +1,6 @@ --- -- gather_facts: false +- name: Create bootflash files on switch1 + gather_facts: false hosts: - switch1 tasks: @@ -13,7 +14,8 @@ - echo 1 > bootflash:/{{ nxos_vars.switch1_file3 }} - echo 1 > bootflash:/{{ nxos_vars.switch1_file4 }} -- gather_facts: false +- name: Create bootflash files on switch2 + gather_facts: false hosts: - switch2 tasks: diff --git a/playbooks/roles/dcnm_bootflash/dcnm_hosts.yaml b/playbooks/roles/dcnm_bootflash/dcnm_hosts.yaml index c00d2f8ec..2ea5ff3e3 100644 --- a/playbooks/roles/dcnm_bootflash/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_bootflash/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password-secret" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -15,7 +15,7 @@ all: nxos: vars: ansible_connection: ansible.netcommon.network_cli - ansible_network_os: cisco.nxos.nxos + ansible_network_os: cisco.nxos.nxos ansible_become: true ansible_become_method: enable children: diff --git a/playbooks/roles/dcnm_bootflash/dcnm_tests.yaml b/playbooks/roles/dcnm_bootflash/dcnm_tests.yaml index ed2a3167a..cf027115c 100644 --- a/playbooks/roles/dcnm_bootflash/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_bootflash/dcnm_tests.yaml @@ -7,8 +7,9 @@ # Modify the hosts and vars sections with details for your testing # setup and uncomment the testcase you want to run. # -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/playbooks/roles/dcnm_bootflash/nxos_vars.yaml b/playbooks/roles/dcnm_bootflash/nxos_vars.yaml index 69fd5eb94..5f69dae0b 100644 --- a/playbooks/roles/dcnm_bootflash/nxos_vars.yaml +++ b/playbooks/roles/dcnm_bootflash/nxos_vars.yaml @@ -1,9 +1,9 @@ nxos_vars: - switch1_file1: air.ndfc_ut - switch1_file2: earth.ndfc_ut - switch1_file3: fire.ndfc_ut - switch1_file4: water.ndfc_ut - switch2_file1: black.ndfc_ut - switch2_file2: blue.ndfc_ut - switch2_file3: green.ndfc_ut - switch2_file4: red.ndfc_ut + switch1_file1: air.ndfc_ut + switch1_file2: earth.ndfc_ut + switch1_file3: fire.ndfc_ut + switch1_file4: water.ndfc_ut + switch2_file1: black.ndfc_ut + switch2_file2: blue.ndfc_ut + switch2_file3: green.ndfc_ut + switch2_file4: red.ndfc_ut diff --git a/playbooks/roles/dcnm_fabric/dcnm_hosts.yaml b/playbooks/roles/dcnm_fabric/dcnm_hosts.yaml index f22bf9dd7..00495a74c 100644 --- a/playbooks/roles/dcnm_fabric/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_fabric/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password-secret" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -15,6 +15,6 @@ all: nxos: hosts: n9k-hosta.example.com: - ansible_connection: ansible.netcommon.network_cli - ansible_network_os: cisco.nxos.nxos - ansible_ssh_port: 22 + ansible_connection: ansible.netcommon.network_cli + ansible_network_os: cisco.nxos.nxos + ansible_ssh_port: 22 diff --git a/playbooks/roles/dcnm_fabric/dcnm_tests.yaml b/playbooks/roles/dcnm_fabric/dcnm_tests.yaml index a944d71ab..7dd7c67d3 100644 --- a/playbooks/roles/dcnm_fabric/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_fabric/dcnm_tests.yaml @@ -8,14 +8,15 @@ # # NOTES: # 1. For the IPFM test cases (dcnm_*_ipfm), ensure that the controller -# is running in IPFM mode. i.e. Ensure that +# is running in IPFM mode. i.e. Ensure that # Fabric Controller -> Admin -> System Settings -> Feature Management # "IP Fabric for Media" is checked. # 2. For all other test cases, ensure that # Fabric Controller -> Admin -> System Settings -> Feature Management # "Fabric Builder" is checked. -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/playbooks/roles/dcnm_image_policy/dcnm_hosts.yaml b/playbooks/roles/dcnm_image_policy/dcnm_hosts.yaml index f22bf9dd7..00495a74c 100644 --- a/playbooks/roles/dcnm_image_policy/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_image_policy/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password-secret" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -15,6 +15,6 @@ all: nxos: hosts: n9k-hosta.example.com: - ansible_connection: ansible.netcommon.network_cli - ansible_network_os: cisco.nxos.nxos - ansible_ssh_port: 22 + ansible_connection: ansible.netcommon.network_cli + ansible_network_os: cisco.nxos.nxos + ansible_ssh_port: 22 diff --git a/playbooks/roles/dcnm_image_policy/dcnm_tests.yaml b/playbooks/roles/dcnm_image_policy/dcnm_tests.yaml index 206b68e2c..f796a4f33 100644 --- a/playbooks/roles/dcnm_image_policy/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_image_policy/dcnm_tests.yaml @@ -7,8 +7,9 @@ # Modify the hosts and vars sections with details for your testing # setup and uncomment the testcase you want to run. # -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/playbooks/roles/dcnm_image_upgrade/dcnm_hosts.yaml b/playbooks/roles/dcnm_image_upgrade/dcnm_hosts.yaml index 109612797..cd917f0c7 100644 --- a/playbooks/roles/dcnm_image_upgrade/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_image_upgrade/dcnm_hosts.yaml @@ -4,8 +4,8 @@ all: ansible_password: "password-ndfc" switch_password: "password-switch" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: ndfc: vars: diff --git a/playbooks/roles/dcnm_image_upgrade/dcnm_tests.yaml b/playbooks/roles/dcnm_image_upgrade/dcnm_tests.yaml index 47baf696c..3e701ada1 100644 --- a/playbooks/roles/dcnm_image_upgrade/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_image_upgrade/dcnm_tests.yaml @@ -7,8 +7,9 @@ # Modify the hosts and vars sections with details for your testing # setup and uncomment the testcase you want to run. # -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/playbooks/roles/dcnm_interface/ansible.cfg b/playbooks/roles/dcnm_interface/ansible.cfg index 7cdd2e0ea..9d813324a 100644 --- a/playbooks/roles/dcnm_interface/ansible.cfg +++ b/playbooks/roles/dcnm_interface/ansible.cfg @@ -1,3 +1,4 @@ [defaults] # This ansible.cfg file is only used for testing purposes in this directory. roles_path = /collections/ansible_collections/cisco/dcnm/tests/integration/targetslh + diff --git a/playbooks/roles/dcnm_interface/dcnm_hosts.yaml b/playbooks/roles/dcnm_interface/dcnm_hosts.yaml index 314d00f35..3b29258c4 100644 --- a/playbooks/roles/dcnm_interface/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_interface/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -12,4 +12,4 @@ all: ansible_network_os: cisco.dcnm.dcnm hosts: nac-ndfc1: - ansible_host: 1.1.1.1 \ No newline at end of file + ansible_host: 1.1.1.1 diff --git a/playbooks/roles/dcnm_interface/dcnm_tests.yaml b/playbooks/roles/dcnm_interface/dcnm_tests.yaml index c0e9c7c4d..0ca9c3c4b 100644 --- a/playbooks/roles/dcnm_interface/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_interface/dcnm_tests.yaml @@ -6,14 +6,15 @@ # # Modify the vars section with details for your testing setup. # -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: # Uncomment testcase to run a specific test # testcase: dcnm_intf_sani* - # IT_CONTEXT: true + # it_context: true test_data_common: fabric: fabric_name # svi_fabric: svi_fabric_name # Define this for dcnm_svi_* tests @@ -52,4 +53,4 @@ parent_intf3: Ethernet1/27 sub_intf3: Ethernet1/27.100 roles: - - dcnm_interface \ No newline at end of file + - dcnm_interface diff --git a/playbooks/roles/dcnm_inventory/dcnm_hosts.yml b/playbooks/roles/dcnm_inventory/dcnm_hosts.yml index 602b4274f..e3962c0e9 100644 --- a/playbooks/roles/dcnm_inventory/dcnm_hosts.yml +++ b/playbooks/roles/dcnm_inventory/dcnm_hosts.yml @@ -9,4 +9,4 @@ ndfc: ansible_python_interpreter: auto_silent ansible_network_os: cisco.dcnm.dcnm ansible_user: admin - ansible_password: password \ No newline at end of file + ansible_password: password diff --git a/playbooks/roles/dcnm_inventory/dcnm_tests.yml b/playbooks/roles/dcnm_inventory/dcnm_tests.yml index 3de830f89..4b09647ce 100644 --- a/playbooks/roles/dcnm_inventory/dcnm_tests.yml +++ b/playbooks/roles/dcnm_inventory/dcnm_tests.yml @@ -1,6 +1,7 @@ --- -- hosts: ndfc - gather_facts: no +- name: Play for ndfc + hosts: ndfc + gather_facts: false connection: ansible.netcommon.httpapi vars: @@ -14,4 +15,4 @@ roles: - dcnm_inventory - tags: always \ No newline at end of file + tags: always diff --git a/playbooks/roles/dcnm_maintenance_mode/dcnm_hosts.yaml b/playbooks/roles/dcnm_maintenance_mode/dcnm_hosts.yaml index f22bf9dd7..00495a74c 100644 --- a/playbooks/roles/dcnm_maintenance_mode/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_maintenance_mode/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password-secret" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -15,6 +15,6 @@ all: nxos: hosts: n9k-hosta.example.com: - ansible_connection: ansible.netcommon.network_cli - ansible_network_os: cisco.nxos.nxos - ansible_ssh_port: 22 + ansible_connection: ansible.netcommon.network_cli + ansible_network_os: cisco.nxos.nxos + ansible_ssh_port: 22 diff --git a/playbooks/roles/dcnm_maintenance_mode/dcnm_tests.yaml b/playbooks/roles/dcnm_maintenance_mode/dcnm_tests.yaml index 4c83185f9..a5b9fd8eb 100644 --- a/playbooks/roles/dcnm_maintenance_mode/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_maintenance_mode/dcnm_tests.yaml @@ -8,14 +8,15 @@ # # NOTES: # 1. For the IPFM test cases (dcnm_*_ipfm), ensure that the controller -# is running in IPFM mode. i.e. Ensure that +# is running in IPFM mode. i.e. Ensure that # Fabric Controller -> Admin -> System Settings -> Feature Management # "IP Fabric for Media" is checked. # 2. For all other test cases, ensure that # Fabric Controller -> Admin -> System Settings -> Feature Management # "Fabric Builder" is checked. -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/playbooks/roles/dcnm_network/ansible.cfg b/playbooks/roles/dcnm_network/ansible.cfg index 3d447f4cf..a6e5198dc 100644 --- a/playbooks/roles/dcnm_network/ansible.cfg +++ b/playbooks/roles/dcnm_network/ansible.cfg @@ -1,3 +1,4 @@ [defaults] # This ansible.cfg file is only used for testing purposes in this directory. -roles_path = /collections/ansible_collections/cisco/dcnm/tests/integration/targets \ No newline at end of file +roles_path = /collections/ansible_collections/cisco/dcnm/tests/integration/targets + diff --git a/playbooks/roles/dcnm_network/dcnm_hosts.yaml b/playbooks/roles/dcnm_network/dcnm_hosts.yaml index d3798d647..c49fd1175 100644 --- a/playbooks/roles/dcnm_network/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_network/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password-secret" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -12,4 +12,4 @@ all: ansible_network_os: cisco.dcnm.dcnm hosts: nac-ndfc1: - ansible_host: 10.10.5.1 \ No newline at end of file + ansible_host: 10.10.5.1 diff --git a/playbooks/roles/dcnm_network/dcnm_tests.yaml b/playbooks/roles/dcnm_network/dcnm_tests.yaml index bae7aceaa..b9a59683d 100644 --- a/playbooks/roles/dcnm_network/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_network/dcnm_tests.yaml @@ -9,69 +9,70 @@ # NOTES: # 1. Ensure that the switches defined by switch1 and switch2 are # not vPC Pairs. -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: - #---------------------------------- + # ---------------------------------- # Uncomment testcase to run a specific test # testcase: replaced_net_all test_data_common: - #--- + # --- fabric: fabric-stage deploy: false - #--- + # --- # Resources - #--- + # --- sw1: 192.168.1.1 sw2: 192.168.1.2 - #--- + # --- # Common VRF setup - #--- + # --- vrf_1: ansible-vrf-int1 vrf_1_id: 9008011 vrf_1_vlan_id: 500 - #--- + # --- vrf_2: Tenant-1 vrf_2_id: 9008012 vrf_2_vlan_id: 501 - #--- + # --- vrf_3: Tenant-2 vrf_3_id: 9008013 vrf_3_vlan_id: 502 - #--- + # --- # Interfaces - #--- + # --- sw1_int1: Ethernet1/15 sw1_int2: Ethernet1/16 sw1_int3: Ethernet1/17 sw1_int4: Ethernet1/18 - #--- + # --- sw2_int1: Ethernet1/15 sw2_int2: Ethernet1/16 sw2_int3: Ethernet1/17 sw2_int4: Ethernet1/18 sw2_int5: Ethernet1/19 sw2_int6: Ethernet1/20 - #--- + # --- net1: ansible-net13 net1_net_id: 7005 net1_default_net_template: Default_Network_Universal net1_net_extension_template: Default_Network_Extension_Universal net1_vlan_id: 1500 net1_gw_ip_subnet: '192.168.30.1/24' - #--- + # --- net2: ansible-net12 net2_net_id: 7002 net2_default_net_template: Default_Network_Universal net2_net_extension_template: Default_Network_Extension_Universal net2_vlan_id: 151 net2_gw_ip_subnet: '192.168.40.1/24' - #--- + # --- net1_vrf: Tenant-1 net2_vrf: Tenant-2 - + roles: - dcnm_network diff --git a/playbooks/roles/dcnm_policy/dcnm_hosts.yaml b/playbooks/roles/dcnm_policy/dcnm_hosts.yaml index 2620e2cbb..8f3be6fff 100644 --- a/playbooks/roles/dcnm_policy/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_policy/dcnm_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: @@ -12,4 +12,4 @@ all: ansible_network_os: cisco.dcnm.dcnm hosts: nac-ndfc1: - ansible_host: 10.15.0.5 \ No newline at end of file + ansible_host: 10.15.0.5 diff --git a/playbooks/roles/dcnm_policy/dcnm_tests.yaml b/playbooks/roles/dcnm_policy/dcnm_tests.yaml index 4049af1b2..17fa87a7c 100644 --- a/playbooks/roles/dcnm_policy/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_policy/dcnm_tests.yaml @@ -6,8 +6,9 @@ # # Modify the vars section with details for your testing setup. # -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/playbooks/roles/dcnm_vpc_pair/dcnm_hosts.yaml b/playbooks/roles/dcnm_vpc_pair/dcnm_hosts.yaml index 54206198b..28eaf5aa7 100644 --- a/playbooks/roles/dcnm_vpc_pair/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_vpc_pair/dcnm_hosts.yaml @@ -3,15 +3,14 @@ all: ansible_user: "admin" ansible_password: "password-secret" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: dcnm: vars: ansible_connection: ansible.netcommon.httpapi ansible_network_os: cisco.dcnm.dcnm - ansible_httpapi_validate_certs: no + ansible_httpapi_validate_certs: false hosts: nac-ndfc1: ansible_host: 10.10.5.1 - diff --git a/playbooks/roles/dcnm_vpc_pair/dcnm_tests.yaml b/playbooks/roles/dcnm_vpc_pair/dcnm_tests.yaml index b88d24f75..882165068 100644 --- a/playbooks/roles/dcnm_vpc_pair/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_vpc_pair/dcnm_tests.yaml @@ -7,13 +7,14 @@ # Modify the hosts and vars sections with details for your testing # setup and uncomment the testcase you want to run. # -- hosts: dcnm - gather_facts: no +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi vars: # testcase: "*merge*" - IT_CONTEXT: true + it_context: true test_data_common: switch_username: admin switch_password: "password" diff --git a/playbooks/roles/dcnm_vrf/dcnm_hosts.yaml b/playbooks/roles/dcnm_vrf/dcnm_hosts.yaml index 109612797..cd917f0c7 100644 --- a/playbooks/roles/dcnm_vrf/dcnm_hosts.yaml +++ b/playbooks/roles/dcnm_vrf/dcnm_hosts.yaml @@ -4,8 +4,8 @@ all: ansible_password: "password-ndfc" switch_password: "password-switch" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: ndfc: vars: diff --git a/playbooks/roles/dcnm_vrf/dcnm_tests.yaml b/playbooks/roles/dcnm_vrf/dcnm_tests.yaml index e4e9c90aa..4eae8bc11 100644 --- a/playbooks/roles/dcnm_vrf/dcnm_tests.yaml +++ b/playbooks/roles/dcnm_vrf/dcnm_tests.yaml @@ -26,26 +26,27 @@ # # ansible-playbook dcnm_tests.yaml -i ../../files/dynamic_inventory.py # -# -- hosts: dcnm - gather_facts: no +# +- name: Play for dcnm + hosts: dcnm + gather_facts: false connection: ansible.netcommon.httpapi -# Uncomment and modify if not using dynamic_inventory.py -# See the individual test yaml files for a description of -# how each var below is used in each test. Some tests, -# for example, do not use interface_1. -# vars: - # fabric_1: f1 - # switch_1: 10.1.1.2 - # switch_2: 10.1.1.3 - # switch_3: 10.1.1.4 - # interface_1: Ethernet1/1 - # interface_2: Ethernet1/2 - # interface_3: Ethernet1/3 - ## Uncomment ONE of the following testcases - # testcase: deleted - # testcase: merged - # testcase: query + # Uncomment and modify if not using dynamic_inventory.py + # See the individual test yaml files for a description of + # how each var below is used in each test. Some tests, + # for example, do not use interface_1. + # vars: + # fabric_1: f1 + # switch_1: 10.1.1.2 + # switch_2: 10.1.1.3 + # switch_3: 10.1.1.4 + # interface_1: Ethernet1/1 + # interface_2: Ethernet1/2 + # interface_3: Ethernet1/3 + ## Uncomment ONE of the following testcases + # testcase: deleted + # testcase: merged + # testcase: query roles: - dcnm_vrf diff --git a/playbooks/roles/ndfc_interface/ansible.cfg b/playbooks/roles/ndfc_interface/ansible.cfg index 3d447f4cf..0bd1c0671 100644 --- a/playbooks/roles/ndfc_interface/ansible.cfg +++ b/playbooks/roles/ndfc_interface/ansible.cfg @@ -1,3 +1,5 @@ + [defaults] # This ansible.cfg file is only used for testing purposes in this directory. -roles_path = /collections/ansible_collections/cisco/dcnm/tests/integration/targets \ No newline at end of file +roles_path = /collections/ansible_collections/cisco/dcnm/tests/integration/targets + diff --git a/playbooks/roles/ndfc_interface/ndfc_hosts.yaml b/playbooks/roles/ndfc_interface/ndfc_hosts.yaml index aa38dad2e..c2889aa0e 100644 --- a/playbooks/roles/ndfc_interface/ndfc_hosts.yaml +++ b/playbooks/roles/ndfc_interface/ndfc_hosts.yaml @@ -3,8 +3,8 @@ all: ansible_user: "admin" ansible_password: "password" ansible_python_interpreter: python - ansible_httpapi_validate_certs: False - ansible_httpapi_use_ssl: True + ansible_httpapi_validate_certs: false + ansible_httpapi_use_ssl: true children: ndfc: vars: diff --git a/playbooks/roles/ndfc_interface/ndfc_tests.yaml b/playbooks/roles/ndfc_interface/ndfc_tests.yaml index e6c99396a..cf0a7b729 100644 --- a/playbooks/roles/ndfc_interface/ndfc_tests.yaml +++ b/playbooks/roles/ndfc_interface/ndfc_tests.yaml @@ -6,8 +6,9 @@ # # Modify the vars section with details for your testing setup. # -- hosts: ndfc - gather_facts: no +- name: Play for ndfc + hosts: ndfc + gather_facts: false connection: ansible.netcommon.httpapi vars: diff --git a/plugins/modules/dcnm_bootflash.py b/plugins/modules/dcnm_bootflash.py index e3deac445..332ee5299 100644 --- a/plugins/modules/dcnm_bootflash.py +++ b/plugins/modules/dcnm_bootflash.py @@ -182,7 +182,6 @@ - name: print result ansible.builtin.debug: var: result - """ import copy diff --git a/plugins/modules/dcnm_fabric.py b/plugins/modules/dcnm_fabric.py index ac3c2d93c..21b2c93af 100644 --- a/plugins/modules/dcnm_fabric.py +++ b/plugins/modules/dcnm_fabric.py @@ -3574,15 +3574,15 @@ cisco.dcnm.dcnm_fabric: state: merged config: - - FABRIC_NAME: VXLAN_Fabric + - FABRIC_NAME: VXLAN_Fabric FABRIC_TYPE: VXLAN_EVPN BGP_AS: 65000 - - FABRIC_NAME: BGP_Fabric + - FABRIC_NAME: BGP_Fabric FABRIC_TYPE: BGP BGP_AS: 65001 - - FABRIC_NAME: MSD_Fabric + - FABRIC_NAME: MSD_Fabric FABRIC_TYPE: VXLAN_EVPN_MSD - - FABRIC_NAME: LAN_Fabric + - FABRIC_NAME: LAN_Fabric FABRIC_TYPE: LAN_CLASSIC register: result - debug: @@ -3594,7 +3594,7 @@ cisco.dcnm.dcnm_fabric: state: merged config: - - FABRIC_NAME: VXLAN_Fabric + - FABRIC_NAME: VXLAN_Fabric FABRIC_TYPE: VXLAN_EVPN BGP_AS: 65000 ANYCAST_GW_MAC: 0001.aabb.ccdd @@ -3603,16 +3603,16 @@ interface Ethernet1/1-16 description managed by NDFC DEPLOY: false - - FABRIC_NAME: BGP_Fabric + - FABRIC_NAME: BGP_Fabric FABRIC_TYPE: BGP BGP_AS: 65001 SUPER_SPINE_BGP_AS: 65002 DEPLOY: false - - FABRIC_NAME: MSD_Fabric + - FABRIC_NAME: MSD_Fabric FABRIC_TYPE: VXLAN_EVPN_MSD LOOPBACK100_IP_RANGE: 10.22.0.0/24 DEPLOY: false - - FABRIC_NAME: LAN_Fabric + - FABRIC_NAME: LAN_Fabric FABRIC_TYPE: LAN_CLASSIC BOOTSTRAP_ENABLE: false IS_READ_ONLY: false @@ -3630,9 +3630,9 @@ - name: Update fabrics cisco.dcnm.dcnm_fabric: state: merged - skip_validation: True + skip_validation: true config: - - FABRIC_NAME: VXLAN_Fabric + - FABRIC_NAME: VXLAN_Fabric FABRIC_TYPE: VXLAN_EVPN BGP_AS: 65000 ANYCAST_GW_MAC: 0001.aabb.ccdd @@ -3648,18 +3648,18 @@ cisco.dcnm.dcnm_fabric: state: replaced config: - - FABRIC_NAME: VXLAN_Fabric + - FABRIC_NAME: VXLAN_Fabric FABRIC_TYPE: VXLAN_EVPN BGP_AS: 65000 DEPLOY: false - - FABRIC_NAME: BGP_Fabric + - FABRIC_NAME: BGP_Fabric FABRIC_TYPE: BGP BGP_AS: 65001 DEPLOY: false - - FABRIC_NAME: MSD_Fabric + - FABRIC_NAME: MSD_Fabric FABRIC_TYPE: VXLAN_EVPN_MSD DEPLOY: false - - FABRIC_NAME: LAN_Fabric + - FABRIC_NAME: LAN_Fabric FABRIC_TYPE: LAN_CLASSIC DEPLOY: false register: result @@ -3672,9 +3672,9 @@ cisco.dcnm.dcnm_fabric: state: query config: - - FABRIC_NAME: VXLAN_Fabric - - FABRIC_NAME: MSD_Fabric - - FABRIC_NAME: LAN_Fabric + - FABRIC_NAME: VXLAN_Fabric + - FABRIC_NAME: MSD_Fabric + - FABRIC_NAME: LAN_Fabric register: result - debug: var: result @@ -3685,9 +3685,9 @@ cisco.dcnm.dcnm_fabric: state: deleted config: - - FABRIC_NAME: VXLAN_Fabric - - FABRIC_NAME: MSD_Fabric - - FABRIC_NAME: LAN_Fabric + - FABRIC_NAME: VXLAN_Fabric + - FABRIC_NAME: MSD_Fabric + - FABRIC_NAME: LAN_Fabric register: result - debug: var: result @@ -3700,20 +3700,20 @@ # the ability to modify the PVLAN option. Hence, even a valid value for # ENABLE_PVLAN in the playbook will generate an error. -- name: merge fabric MyFabric - cisco.dcnm.dcnm_fabric: - state: merged - skip_validation: false - config: - - FABRIC_NAME: MyFabric - FABRIC_TYPE: VXLAN_EVPN - BGP_AS: 65001 - ENABLE_SGT: true - ENABLE_PVLAN: false +- name: merge fabric MyFabric + cisco.dcnm.dcnm_fabric: + state: merged + skip_validation: false + config: + - FABRIC_NAME: MyFabric + FABRIC_TYPE: VXLAN_EVPN + BGP_AS: 65001 + ENABLE_SGT: true + ENABLE_PVLAN: false # Resulting error message (edited for brevity) -# "The following parameter(value) combination(s) are invalid and need to be reviewed: Fabric: f3, ENABLE_PVLAN(False) requires ENABLE_SGT != True." - +# "The following parameter(value) combination(s) are invalid and need to be reviewed: +# Fabric: f3, ENABLE_PVLAN(False) requires ENABLE_SGT != True." """ # pylint: disable=wrong-import-position import copy diff --git a/plugins/modules/dcnm_fabric_group.py b/plugins/modules/dcnm_fabric_group.py index 13060b974..9e693907e 100644 --- a/plugins/modules/dcnm_fabric_group.py +++ b/plugins/modules/dcnm_fabric_group.py @@ -325,7 +325,7 @@ cisco.dcnm.dcnm_fabric_group: state: merged config: - - FABRIC_NAME: MCFG + - FABRIC_NAME: MCFG register: result - debug: var: result @@ -336,7 +336,7 @@ cisco.dcnm.dcnm_fabric_group: state: merged config: - - FABRIC_NAME: MCFG + - FABRIC_NAME: MCFG FABRIC_TYPE: MCFG ANYCAST_GW_MAC: 0001.aabb.ccdd BGP_RP_ASN: 65002 @@ -355,9 +355,9 @@ - name: Update fabrics cisco.dcnm.dcnm_fabric: state: merged - skip_validation: True + skip_validation: true config: - - FABRIC_NAME: MCFG + - FABRIC_NAME: MCFG FABRIC_TYPE: MCFG ANYCAST_GW_MAC: 0001.aabb.ccdd DEPLOY: false @@ -368,7 +368,7 @@ cisco.dcnm.dcnm_fabric: state: query config: - - FABRIC_NAME: MCFG + - FABRIC_NAME: MCFG register: result - debug: var: result @@ -379,7 +379,7 @@ cisco.dcnm.dcnm_fabric_group: state: deleted config: - - FABRIC_NAME: MCFG + - FABRIC_NAME: MCFG register: result - debug: var: result @@ -392,19 +392,17 @@ # the ability to modify the PVLAN option. Hence, even a valid value for # ENABLE_PVLAN in the playbook will generate an error. -- name: merge fabric MyFabric - cisco.dcnm.dcnm_fabric_group: - state: merged - skip_validation: false - config: - - FABRIC_NAME: MCFG - FABRIC_TYPE: MCFG - ENABLE_SGT: true - ENABLE_PVLAN: false - +- name: merge fabric MyFabric + cisco.dcnm.dcnm_fabric_group: + state: merged + skip_validation: false + config: + - FABRIC_NAME: MCFG + FABRIC_TYPE: MCFG + ENABLE_SGT: true + ENABLE_PVLAN: false # Resulting error message (edited for brevity) # "The following parameter(value) combination(s) are invalid and need to be reviewed: Fabric: f3, ENABLE_PVLAN(False) requires ENABLE_SGT != True." - """ # pylint: disable=wrong-import-position, too-many-lines, too-many-instance-attributes, too-many-statements import copy diff --git a/plugins/modules/dcnm_image_policy.py b/plugins/modules/dcnm_image_policy.py index e56364c71..3bd035fd3 100644 --- a/plugins/modules/dcnm_image_policy.py +++ b/plugins/modules/dcnm_image_policy.py @@ -149,107 +149,107 @@ # # Delete two image policies from the controller. - - name: Delete Image policies - cisco.dcnm.dcnm_image_policy: - state: deleted - config: - - name: KR5M - - name: NR3F - register: result - - name: print result - ansible.builtin.debug: - var: result +- name: Delete Image policies + cisco.dcnm.dcnm_image_policy: + state: deleted + config: + - name: KR5M + - name: NR3F + register: result +- name: print result + ansible.builtin.debug: + var: result # Merge two image policies into the controller. - - name: Merge Image policies - cisco.dcnm.dcnm_image_policy: - state: merged - config: - - name: KR5M - agnostic: false - description: KR5M - epld_image: n9000-epld.10.2.5.M.img - packages: - install: - - mtx-openconfig-all-2.0.0.0-10.4.1.src.rpm - uninstall: - - mtx-grpctunnel-2.1.0.0-10.4.1.lib32_64_n9000 - platform: N9K - release: 10.2.5_nxos64-cs_64bit - type: PLATFORM - - name: NR3F - description: NR3F - platform: N9K - epld_image: n9000-epld.10.3.1.F.img - release: 10.3.1_nxos64-cs_64bit - register: result - - name: print result - ansible.builtin.debug: - var: result +- name: Merge Image policies + cisco.dcnm.dcnm_image_policy: + state: merged + config: + - name: KR5M + agnostic: false + description: KR5M + epld_image: n9000-epld.10.2.5.M.img + packages: + install: + - mtx-openconfig-all-2.0.0.0-10.4.1.src.rpm + uninstall: + - mtx-grpctunnel-2.1.0.0-10.4.1.lib32_64_n9000 + platform: N9K + release: 10.2.5_nxos64-cs_64bit + type: PLATFORM + - name: NR3F + description: NR3F + platform: N9K + epld_image: n9000-epld.10.3.1.F.img + release: 10.3.1_nxos64-cs_64bit + register: result +- name: print result + ansible.builtin.debug: + var: result # Override all policies on the controller and replace them with # the policies in the playbook task. Any policies other than # KR5M and NR3F are deleted from the controller. - - name: Override Image policies - cisco.dcnm.dcnm_image_policy: - state: overridden - config: - - name: KR5M - agnostic: false - description: KR5M - epld_image: n9000-epld.10.2.5.M.img - platform: N9K - release: 10.2.5_nxos64-cs_64bit - type: PLATFORM - - name: NR3F - description: NR3F - platform: N9K - epld_image: n9000-epld.10.2.5.M.img - release: 10.3.1_nxos64-cs_64bit - register: result - - name: print result - ansible.builtin.debug: - var: result +- name: Override Image policies + cisco.dcnm.dcnm_image_policy: + state: overridden + config: + - name: KR5M + agnostic: false + description: KR5M + epld_image: n9000-epld.10.2.5.M.img + platform: N9K + release: 10.2.5_nxos64-cs_64bit + type: PLATFORM + - name: NR3F + description: NR3F + platform: N9K + epld_image: n9000-epld.10.2.5.M.img + release: 10.3.1_nxos64-cs_64bit + register: result +- name: print result + ansible.builtin.debug: + var: result # Query the controller for the policies in the playbook task. - - name: Query Image policies - cisco.dcnm.dcnm_image_policy: - state: query - config: - - name: NR3F - - name: KR5M - register: result - - name: print result - ansible.builtin.debug: - var: result +- name: Query Image policies + cisco.dcnm.dcnm_image_policy: + state: query + config: + - name: NR3F + - name: KR5M + register: result +- name: print result + ansible.builtin.debug: + var: result # Replace any policies on the controller that are in the playbook task with # the configuration given in the playbook task. Policies not listed in the # playbook task are not modified and are not deleted. - - name: Replace Image policies - cisco.dcnm.dcnm_image_policy: - state: replaced - config: - - name: KR5M - agnostic: false - description: KR5M - epld_image: n9000-epld.10.2.5.M.img - platform: N9K - release: 10.2.5_nxos64-cs_64bit - type: PLATFORM - - name: NR3F - description: Replaced NR3F - platform: N9K - epld_image: n9000-epld.10.3.1.F.img - release: 10.3.1_nxos64-cs_64bit - register: result - - name: print result - ansible.builtin.debug: - var: result +- name: Replace Image policies + cisco.dcnm.dcnm_image_policy: + state: replaced + config: + - name: KR5M + agnostic: false + description: KR5M + epld_image: n9000-epld.10.2.5.M.img + platform: N9K + release: 10.2.5_nxos64-cs_64bit + type: PLATFORM + - name: NR3F + description: Replaced NR3F + platform: N9K + epld_image: n9000-epld.10.3.1.F.img + release: 10.3.1_nxos64-cs_64bit + register: result +- name: print result + ansible.builtin.debug: + var: result """ import copy diff --git a/plugins/modules/dcnm_image_upgrade.py b/plugins/modules/dcnm_image_upgrade.py index d8c7a739f..6e71eeabc 100644 --- a/plugins/modules/dcnm_image_upgrade.py +++ b/plugins/modules/dcnm_image_upgrade.py @@ -316,88 +316,87 @@ # Attach image policy NR3F to two devices # Stage and validate the image on two devices but do not upgrade - - name: stage/validate images - cisco.dcnm.dcnm_image_upgrade: - state: merged - config: - policy: NR3F - stage: true - validate: true - upgrade: - nxos: false - epld: false - switches: - - ip_address: 192.168.1.1 - - ip_address: 192.168.1.2 +- name: stage/validate images + cisco.dcnm.dcnm_image_upgrade: + state: merged + config: + policy: NR3F + stage: true + validate: true + upgrade: + nxos: false + epld: false + switches: + - ip_address: 192.168.1.1 + - ip_address: 192.168.1.2 # Attach image policy NR1F to device 192.168.1.1 # Attach image policy NR2F to device 192.168.1.2 # Stage the image on device 192.168.1.1, but do not upgrade # Stage the image and upgrade device 192.168.1.2 - - name: stage/upgrade devices - cisco.dcnm.dcnm_image_upgrade: - state: merged - config: - validate: false - stage: false - upgrade: - nxos: false - epld: false - options: - nxos: - mode: disruptive - epld: - module: ALL - golden: false - switches: - - ip_address: 192.168.1.1 - policy: NR1F - stage: true - validate: true - upgrade: - nxos: true - epld: false - - ip_address: 192.168.1.2 - policy: NR2F - stage: true - validate: true - upgrade: - nxos: true - epld: true - options: - nxos: - mode: disruptive - epld: - module: ALL - golden: false +- name: stage/upgrade devices + cisco.dcnm.dcnm_image_upgrade: + state: merged + config: + validate: false + stage: false + upgrade: + nxos: false + epld: false + options: + nxos: + mode: disruptive + epld: + module: ALL + golden: false + switches: + - ip_address: 192.168.1.1 + policy: NR1F + stage: true + validate: true + upgrade: + nxos: true + epld: false + - ip_address: 192.168.1.2 + policy: NR2F + stage: true + validate: true + upgrade: + nxos: true + epld: true + options: + nxos: + mode: disruptive + epld: + module: ALL + golden: false # Detach image policy NR3F from two devices - - name: stage/upgrade devices - cisco.dcnm.dcnm_image_upgrade: - state: deleted - config: - policy: NR3F - switches: - - ip_address: 192.168.1.1 - - ip_address: 192.168.1.2 +- name: stage/upgrade devices + cisco.dcnm.dcnm_image_upgrade: + state: deleted + config: + policy: NR3F + switches: + - ip_address: 192.168.1.1 + - ip_address: 192.168.1.2 # Query ISSU details for three devices - - name: query switch ISSU status - cisco.dcnm.dcnm_image_upgrade: - state: query - config: - policy: KMR5 - switches: - - ip_address: 192.168.1.1 - policy: OR1F - - ip_address: 192.168.1.2 - policy: NR2F - - ip_address: 192.168.1.3 # will query policy KMR5 - register: result - - name: print result - ansible.builtin.debug: - var: result - +- name: query switch ISSU status + cisco.dcnm.dcnm_image_upgrade: + state: query + config: + policy: KMR5 + switches: + - ip_address: 192.168.1.1 + policy: OR1F + - ip_address: 192.168.1.2 + policy: NR2F + - ip_address: 192.168.1.3 # will query policy KMR5 + register: result +- name: print result + ansible.builtin.debug: + var: result """ diff --git a/plugins/modules/dcnm_interface.py b/plugins/modules/dcnm_interface.py index 09984b35c..52ba3a524 100644 --- a/plugins/modules/dcnm_interface.py +++ b/plugins/modules/dcnm_interface.py @@ -1375,9 +1375,9 @@ peer1_description: "VPC acting as trunk peer1 - modified" peer2_description: "VPC acting as trunk peer2 - modified" peer1_cmds: # Freeform config - - no shutdown + - no shutdown peer2_cmds: # Freeform config - - no shutdown + - no shutdown # To delete or reset a particular interface on a specific switch in the fabric - name: Delete vPC interfaces @@ -1405,7 +1405,7 @@ admin_state: true # choose from [true, false] mode: trunk # choose from [trunk, access] peer1_pcid: 752 # choose between [Min:1, Max:4096], if not given, will be VPC port-id - #peer2_pcid: 1 # choose between [Min:1, Max:4096], if not given, will be VPC port-id + # peer2_pcid: 1 # choose between [Min:1, Max:4096], if not given, will be VPC port-id peer1_members: # member interfaces on peer 1 - e1/26 peer2_members: # member interfaces on peer 2 @@ -1419,10 +1419,10 @@ peer1_description: "VPC acting as trunk peer1" peer2_description: "VPC acting as trunk peer2" peer1_cmds: # Freeform config - - no shutdown + - no shutdown - no shutdown peer2_cmds: # Freeform config - - no shutdown + - no shutdown - no shutdown # SVI INTERFACES @@ -1509,7 +1509,7 @@ - name: Delete SVI interfaces cisco.dcnm.dcnm_interface: - check_deploy: True + check_deploy: true fabric: "{{ ansible_svi_fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: @@ -1542,7 +1542,7 @@ - name: Create AA FEX interfaces including optional parameters cisco.dcnm.dcnm_interface: - check_deploy: True + check_deploy: true fabric: "{{ ansible_svi_fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: @@ -1598,7 +1598,7 @@ - name: Delete AA FEX interfaces cisco.dcnm.dcnm_interface: - check_deploy: True + check_deploy: true fabric: "{{ ansible_svi_fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: @@ -1685,7 +1685,7 @@ - name: Delete ST FEX interfaces cisco.dcnm.dcnm_interface: - check_deploy: True + check_deploy: true fabric: "{{ ansible_svi_fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: @@ -1806,7 +1806,6 @@ - name: vpc750 switch: - "192.172.1.1" - """ import copy diff --git a/plugins/modules/dcnm_inventory.py b/plugins/modules/dcnm_inventory.py index 3e82687ab..8ed387a4f 100644 --- a/plugins/modules/dcnm_inventory.py +++ b/plugins/modules/dcnm_inventory.py @@ -266,20 +266,20 @@ fabric: vxlan-fabric state: merged # merged / deleted / overridden / query config: - - seed_ip: 192.168.0.1 - auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] - user_name: switch_username - password: switch_password - max_hops: 0 - role: spine - preserve_config: False # boolean, default is true - - seed_ip: 192.168.0.2 - auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] - user_name: switch_username - password: switch_password - max_hops: 0 - role: leaf - preserve_config: False # boolean, default is true + - seed_ip: 192.168.0.1 + auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] + user_name: switch_username + password: switch_password + max_hops: 0 + role: spine + preserve_config: false # boolean, default is true + - seed_ip: 192.168.0.2 + auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] + user_name: switch_username + password: switch_password + max_hops: 0 + role: leaf + preserve_config: false # boolean, default is true # The following two switches will be added or updated in the existing fabric and all other # switches will be removed from the fabric @@ -288,20 +288,20 @@ fabric: vxlan-fabric state: overridden # merged / deleted / overridden / query config: - - seed_ip: 192.168.0.1 - auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] - user_name: switch_username - password: switch_password - max_hops: 0 - role: spine - preserve_config: False # boolean, default is true - - seed_ip: 192.168.0.2 - auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] - user_name: switch_username - password: switch_password - max_hops: 0 - role: leaf - preserve_config: False # boolean, default is true + - seed_ip: 192.168.0.1 + auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] + user_name: switch_username + password: switch_password + max_hops: 0 + role: spine + preserve_config: false # boolean, default is true + - seed_ip: 192.168.0.2 + auth_proto: MD5 # choose from [MD5, SHA, MD5_DES, MD5_AES, SHA_DES, SHA_AES] + user_name: switch_username + password: switch_password + max_hops: 0 + role: leaf + preserve_config: false # boolean, default is true # The following two switches will be deleted in the existing fabric - name: Delete selected switches @@ -309,8 +309,8 @@ fabric: vxlan-fabric state: deleted # merged / deleted / overridden / query config: - - seed_ip: 192.168.0.1 - - seed_ip: 192.168.0.2 + - seed_ip: 192.168.0.1 + - seed_ip: 192.168.0.2 # All the switches will be deleted in the existing fabric - name: Delete all the switches @@ -324,10 +324,10 @@ fabric: vxlan-fabric state: query # merged / deleted / overridden / query config: - - seed_ip: 192.168.0.1 - role: spine - - seed_ip: 192.168.0.2 - role: leaf + - seed_ip: 192.168.0.1 + role: spine + - seed_ip: 192.168.0.2 + role: leaf # All the existing switches will be queried in the existing fabric - name: Query all the switches in the fabric @@ -342,7 +342,12 @@ cisco.dcnm.dcnm_rest: method: PUT path: /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/vxlan-fabric - json_data: '{"fabricId": "FABRIC-7","fabricName": "vxlan-fabric","id": 7,"nvPairs":{...,"BOOTSTRAP_ENABLE": true,"DHCP_ENABLE": true,"DHCP_IPV6_ENABLE": "DHCPv4","DHCP_START": "192.168.1.10", "DHCP_END": "192.168.1.20","MGMT_GW": "192.168.123.1","MGMT_PREFIX": "24",...},"templateName": "Easy_Fabric"}' # noqa + json_data: > + {"fabricId":"FABRIC-7","fabricName":"vxlan-fabric","id":7, + "nvPairs":{...,"BOOTSTRAP_ENABLE":true,"DHCP_ENABLE":true, + "DHCP_IPV6_ENABLE":"DHCPv4","DHCP_START":"192.168.1.10", + "DHCP_END":"192.168.1.20","MGMT_GW":"192.168.123.1", + "MGMT_PREFIX":"24",...},"templateName":"Easy_Fabric"} # The following switch will be Bootstrapped and merged into the existing fabric - name: Poap switch Configuration @@ -350,19 +355,21 @@ fabric: vxlan-fabric state: merged # Only 2 options supported merged/query for poap config config: - # All the values below are mandatory if poap configuration is being done - state is merged - - seed_ip: 192.168.0.5 - user_name: switch_username - password: switch_password - role: border_gateway - poap: - - serial_number: 2A3BCDEFJKL - model: 'N9K-C9300v' - version: '9.3(7)' - hostname: 'POAP_SWITCH' - image_policy: "poap_image_policy" - config_data: - modulesModel: [N9K-X9364v, N9K-vSUP] + # All the values below are mandatory if poap configuration is being done - state is merged + - seed_ip: 192.168.0.5 + user_name: switch_username + password: switch_password + role: border_gateway + poap: + - serial_number: 2A3BCDEFJKL + model: 'N9K-C9300v' + version: '9.3(7)' + hostname: 'POAP_SWITCH' + image_policy: "poap_image_policy" + config_data: + modulesModel: + - N9K-X9364v + - N9K-vSUP gateway: 192.168.0.1/24 # The following switch will be Pre-provisioned and merged into the existing fabric @@ -371,19 +378,21 @@ fabric: vxlan-fabric state: merged # Only 2 options supported merged/query for poap config config: - # All the values below are mandatory if poap configuration is being done - state is merged - - seed_ip: 192.168.0.4 - user_name: switch_username - password: switch_password - role: border - poap: - - preprovision_serial: 1A2BCDEFGHI - model: 'N9K-C9300v' - version: '9.3(7)' - hostname: 'PREPRO_SWITCH' - image_policy: "prepro_image_policy" - config_data: - modulesModel: [N9K-X9364v, N9K-vSUP] + # All the values below are mandatory if poap configuration is being done - state is merged + - seed_ip: 192.168.0.4 + user_name: switch_username + password: switch_password + role: border + poap: + - preprovision_serial: 1A2BCDEFGHI + model: 'N9K-C9300v' + version: '9.3(7)' + hostname: 'PREPRO_SWITCH' + image_policy: "prepro_image_policy" + config_data: + modulesModel: + - N9K-X9364v + - N9K-vSUP gateway: 192.168.0.1/24 - name: Poap, Pre-provision and existing switch Configuration @@ -391,38 +400,42 @@ fabric: vxlan-fabric state: merged # Only 2 options supported merged/query for poap config config: - - seed_ip: 192.168.0.2 - user_name: switch_username - password: switch_password - role: border_gateway - poap: - - serial_number: 2A3BCDEFGHI - model: 'N9K-C9300v' - version: '9.3(7)' - hostname: 'POAP_SWITCH' - image_policy: "poap_image_policy" - config_data: - modulesModel: [N9K-X9364v, N9K-vSUP] + - seed_ip: 192.168.0.2 + user_name: switch_username + password: switch_password + role: border_gateway + poap: + - serial_number: 2A3BCDEFGHI + model: 'N9K-C9300v' + version: '9.3(7)' + hostname: 'POAP_SWITCH' + image_policy: "poap_image_policy" + config_data: + modulesModel: + - N9K-X9364v + - N9K-vSUP gateway: 192.168.0.1/24 - - seed_ip: 192.168.0.3 - user_name: switch_username - password: switch_password - auth_proto: MD5 - max_hops: 0 - preserve_config: False - role: spine - - seed_ip: 192.168.0.4 - user_name: switch_username - password: switch_password - role: border - poap: - - preprovision_serial: 1A2BCDEFGHI - model: 'N9K-C9300v' - version: '9.3(7)' - hostname: 'PREPRO_SWITCH' - image_policy: "prepro_image_policy" - config_data: - modulesModel: [N9K-X9364v, N9K-vSUP] + - seed_ip: 192.168.0.3 + user_name: switch_username + password: switch_password + auth_proto: MD5 + max_hops: 0 + preserve_config: false + role: spine + - seed_ip: 192.168.0.4 + user_name: switch_username + password: switch_password + role: border + poap: + - preprovision_serial: 1A2BCDEFGHI + model: 'N9K-C9300v' + version: '9.3(7)' + hostname: 'PREPRO_SWITCH' + image_policy: "prepro_image_policy" + config_data: + modulesModel: + - N9K-X9364v + - N9K-vSUP gateway: 192.168.0.1/24 # The following pre-provisioned switch will be swapped with actual switch in the existing fabric @@ -434,14 +447,14 @@ fabric: vxlan-fabric state: merged # Only 2 options supported merged/query for poap config config: - # All the values below are mandatory if poap configuration is being done - state is merged - - seed_ip: 192.168.0.4 - user_name: switch_username - password: switch_password - role: border - poap: - - preprovision_serial: 1A2BCDEFGHI - serial_number: 2A3BCDEFGHI + # All the values below are mandatory if poap configuration is being done - state is merged + - seed_ip: 192.168.0.4 + user_name: switch_username + password: switch_password + role: border + poap: + - preprovision_serial: 1A2BCDEFGHI + serial_number: 2A3BCDEFGHI # All the existing switches along with available Bootstrap(POAP) # will be queried in the existing fabric @@ -449,7 +462,7 @@ cisco.dcnm.dcnm_inventory: fabric: vxlan-fabric state: query # merged / query - query_poap: True + query_poap: true # The following switch which is part of fabric will be replaced with a new switch # with same configurations through RMA. @@ -459,17 +472,17 @@ fabric: vxlan-fabric state: merged # Only merged is supported for rma config config: - - seed_ip: 192.168.0.4 - user_name: switch_username - password: switch_password - rma: - - serial_number: 2A3BCDEFJKL - old_serial: 2A3BCDEFGHI - model: 'N9K-C9300v' - version: '9.3(7)' - image_policy: "rma_image_policy" - config_data: - modulesModel: [N9K-X9364v, N9K-vSUP] + - seed_ip: 192.168.0.4 + user_name: switch_username + password: switch_password + rma: + - serial_number: 2A3BCDEFJKL + old_serial: 2A3BCDEFGHI + model: 'N9K-C9300v' + version: '9.3(7)' + image_policy: "rma_image_policy" + config_data: + modulesModel: [N9K-X9364v, N9K-vSUP] gateway: 192.168.0.1/24 """ diff --git a/plugins/modules/dcnm_links.py b/plugins/modules/dcnm_links.py index 6f5b26683..7821aa64f 100644 --- a/plugins/modules/dcnm_links.py +++ b/plugins/modules/dcnm_links.py @@ -427,422 +427,421 @@ # # INTRA-FABRIC - - name: Create Links - cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # Destination fabric - src_interface: "Ethernet1/1" # Interface on the Source fabric - dst_interface: "Ethernet1/1" # Interface on the Destination fabric - src_device: 193.168.1.1 # Device on the Source fabric - dst_device: 193.168.1.2 # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - profile: - peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface - peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface - admin_state: true # choose from [true, false] - mtu: 9216 # - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_bfd_echo_disable: false # optional, choose from [true, false] - peer2_bfd_echo_disable: false # optional, choose from [true, false] - enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination device - - no shutdown # optional, default is "" - - - dst_fabric: "ansible_num_fabric" # Destination fabric - src_interface: "Ethernet1/2" # Interface on the Source fabric - dst_interface: "Ethernet1/2" # Interface on the Destination fabric - src_device: 193.168.1.1 # Device on the Source fabric - dst_device: 193.168.1.2 # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - dst_fabric: "ansible_num_fabric" # Destination fabric - src_interface: "Ethernet1/3" # Interface on the Source fabric - dst_interface: "Ethernet1/3" # Interface on the Destination fabric - src_device: 193.168.1.1 # Device on the Source fabric - dst_device: 193.168.1.2 # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - profile: - peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface - peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface - peer1_ipv6_addr: fe80:01::01 # optional, default is "" - peer2_ipv6_addr: fe80:01::02 # optional, default is "" - admin_state: true # choose from [true, false] - mtu: 1500 # optional, default is 1500 - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_bfd_echo_disable: false # optional, choose from [true, false] - peer2_bfd_echo_disable: false # optional, choose from [true, false] - enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination device - - no shutdown # optional, default is "" +- name: Create Links + cisco.dcnm.dcnm_links: + state: merged # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # Destination fabric + src_interface: "Ethernet1/1" # Interface on the Source fabric + dst_interface: "Ethernet1/1" # Interface on the Destination fabric + src_device: 193.168.1.1 # Device on the Source fabric + dst_device: 193.168.1.2 # Device on the Destination fabric + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + + profile: + peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface + peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface + admin_state: true # choose from [true, false] + mtu: 9216 # + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + peer1_bfd_echo_disable: false # optional, choose from [true, false] + peer2_bfd_echo_disable: false # optional, choose from [true, false] + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination device + - no shutdown # optional, default is "" + + - dst_fabric: "ansible_num_fabric" # Destination fabric + src_interface: "Ethernet1/2" # Interface on the Source fabric + dst_interface: "Ethernet1/2" # Interface on the Destination fabric + src_device: 193.168.1.1 # Device on the Source fabric + dst_device: 193.168.1.2 # Device on the Destination fabric + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + - dst_fabric: "ansible_num_fabric" # Destination fabric + src_interface: "Ethernet1/3" # Interface on the Source fabric + dst_interface: "Ethernet1/3" # Interface on the Destination fabric + src_device: 193.168.1.1 # Device on the Source fabric + dst_device: 193.168.1.2 # Device on the Destination fabric + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + + profile: + peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface + peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface + peer1_ipv6_addr: fe80:01::01 # optional, default is "" + peer2_ipv6_addr: fe80:01::02 # optional, default is "" + admin_state: true # choose from [true, false] + mtu: 1500 # optional, default is 1500 + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + peer1_bfd_echo_disable: false # optional, choose from [true, false] + peer2_bfd_echo_disable: false # optional, choose from [true, false] + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination device + - no shutdown # optional, default is "" # # INTER-FABRIC - - name: Create Links including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt - state: merged # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_num_fabric }}" - config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: 1000 # BGP ASN in source fabric - dst_asn: 1001 # BGP ASN in destination fabric - mtu: 9216 # - auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_cmds: # Freeform config for source interface - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination interface - - no shutdown # optional, default is "" - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - profile: - ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric - src_asn: 1200 # BGP ASN in source fabric - dst_asn: 1201 # BGP ASN in destination fabric - mtu: 9216 # - deploy_dci_tracking: false # optional, default is false - max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true - ebgp_password: 0102030405 # optional, required only if ebgp_password_enable flag is true, and inherit_from_msd - # is false. - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true, and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_cmds: # Freeform config for source interface - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination interface - - no shutdown # optional, default is "" - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - profile: - ipv4_addr: 193.168.3.1 # IP address of interface in src fabric - neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric - src_asn: 1300 # BGP ASN in source fabric - dst_asn: 1301 # BGP ASN in destination fabric - trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true - ebgp_password: 0102030405 # optional, required only if ebgp_password_enable flag is true, and inherit_from_msd - # is false. Default is 3 - inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false - ebpg_auth_key_type: 3 # optional, required only if ebpg_password_enable is true, and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_vxlan_mpls_underlay_setup # Template of MPLS handoff underlay link - profile: - ipv4_subnet: 193.168.3.1/30 # IP address of interface in src fabric with the mask - neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric - mpls_fabric: LDP # MPLS handoff protocol, choose from [LDP, SR] - dci_routing_proto: isis # Routing protocol used on the DCI MPLS link, choose from [is-is, ospf] - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: Loopback101 # Loopback interface on the Source fabric - dst_interface: Loopback1 # Loopback interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_vxlan_mpls_overlay_setup #Template of MPLS handoff overlay link - profile: - neighbor_ip: 2.2.2.2 . # IP address of the loopback interface of destination device - src_asn: 498278384 # BGP ASN in source fabric - dst_asn: 498278384 # BGP ASN in destination fabric - - +- name: Create Links including optional parameters + cisco.dcnm.dcnm_links: &links_merge_with_opt + state: merged # choose from [merged, replaced, deleted, query] + src_fabric: "{{ ansible_num_fabric }}" + config: + - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric + src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric + dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] + profile: + ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask + neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric + src_asn: 1000 # BGP ASN in source fabric + dst_asn: 1001 # BGP ASN in destination fabric + mtu: 9216 # + auto_deploy: false # optional, default is false + # Flag that controls auto generation of neighbor VRF Lite configuration + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + peer1_cmds: # Freeform config for source interface + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination interface + - no shutdown # optional, default is "" + + - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric + src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric + dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] + profile: + ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask + neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric + src_asn: 1200 # BGP ASN in source fabric + dst_asn: 1201 # BGP ASN in destination fabric + mtu: 9216 # + deploy_dci_tracking: false # optional, default is false + max_paths: 1 # optional, default is 1 + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true + ebgp_password: "0102030405" # optional, required only if ebgp_password_enable flag is true, and inherit_from_msd + # is false. + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false + ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true, and inherit_from_msd + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + peer1_cmds: # Freeform config for source interface + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination interface + - no shutdown # optional, default is "" + + - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric + src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric + dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] + profile: + ipv4_addr: 193.168.3.1 # IP address of interface in src fabric + neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric + src_asn: 1300 # BGP ASN in source fabric + dst_asn: 1301 # BGP ASN in destination fabric + trm_enabled: false # optional, default is false + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true + ebgp_password: "0102030405" # optional, required only if ebgp_password_enable flag is true, and inherit_from_msd + # is false. Default is 3 + inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false + ebpg_auth_key_type: 3 # optional, required only if ebpg_password_enable is true, and inherit_from_msd + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] + + - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric + src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric + dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric + template: ext_vxlan_mpls_underlay_setup # Template of MPLS handoff underlay link + profile: + ipv4_subnet: 193.168.3.1/30 # IP address of interface in src fabric with the mask + neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric + mpls_fabric: LDP # MPLS handoff protocol, choose from [LDP, SR] + dci_routing_proto: isis # Routing protocol used on the DCI MPLS link, choose from [is-is, ospf] + + - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric + src_interface: Loopback101 # Loopback interface on the Source fabric + dst_interface: Loopback1 # Loopback interface on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric + dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric + template: ext_vxlan_mpls_overlay_setup # Template of MPLS handoff overlay link + profile: + neighbor_ip: 2.2.2.2 # IP address of the loopback interface of destination device + src_asn: 498278384 # BGP ASN in source fabric + dst_asn: 498278384 # BGP ASN in destination fabric # FABRIC WITH VPC PAIRED SWITCHES - - name: Create Links - cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_vpc_fabric" - config: - - dst_fabric: "ansible_vpc_fabric" # Destination fabric - src_interface: "Ethernet1/4" # Interface on the Source fabric - dst_interface: "Ethernet1/4" # Interface on the Destination fabric - src_device: "ansible_vpc_switch1" # Device on the Source fabric - dst_device: "ansible_vpc_switch2" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - profile: - peer1_ipv4_addr: 192.170.1.1 # IPV4 address of the Source interface - peer2_ipv4_addr: 192.170.1.2 # IPV4 address of the Destination interface - peer1_ipv6_addr: fe80:2a::01 # optional, default is "" - peer2_ipv6_addr: fe80:2a::02 # optional, default is "" - admin_state: true # choose from [true, false] - mtu: 9216 # - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination device - - no shutdown # optional, default is "" - intf_vrf: "test_vrf" # optional, default is "" +- name: Create Links + cisco.dcnm.dcnm_links: + state: merged # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_vpc_fabric" + config: + - dst_fabric: "ansible_vpc_fabric" # Destination fabric + src_interface: "Ethernet1/4" # Interface on the Source fabric + dst_interface: "Ethernet1/4" # Interface on the Destination fabric + src_device: "ansible_vpc_switch1" # Device on the Source fabric + dst_device: "ansible_vpc_switch2" # Device on the Destination fabric + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + + profile: + peer1_ipv4_addr: 192.170.1.1 # IPV4 address of the Source interface + peer2_ipv4_addr: 192.170.1.2 # IPV4 address of the Destination interface + peer1_ipv6_addr: fe80:2a::01 # optional, default is "" + peer2_ipv6_addr: fe80:2a::02 # optional, default is "" + admin_state: true # choose from [true, false] + mtu: 9216 # + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination device + - no shutdown # optional, default is "" + intf_vrf: "test_vrf" # optional, default is "" # UNNUMBERED FABRIC - - name: Create Links - cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_unnum_fabric" - config: - - dst_fabric: "ansible_unnum_fabric" # Destination fabric - src_interface: "Ethernet1/1" # Interface on the Source fabric - dst_interface: "Ethernet1/1" # Interface on the Destination fabric - src_device: "ansible_unnum_switch1" # Device on the Source fabric - dst_device: "ansible_unnum_switch2" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - profile: - admin_state: true # choose from [true, false] - mtu: 9216 # - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination device - - no shutdown # optional, default is "" - - - dst_fabric: "ansible_unnum_fabric" # Destination fabric - src_interface: "Ethernet1/2" # Interface on the Source fabric - dst_interface: "Ethernet1/2" # Interface on the Destination fabric - src_device: "ansible_unnum_switch1" # Device on the Source fabric - dst_device: "ansible_unnum_switch2" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] +- name: Create Links + cisco.dcnm.dcnm_links: + state: merged # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_unnum_fabric" + config: + - dst_fabric: "ansible_unnum_fabric" # Destination fabric + src_interface: "Ethernet1/1" # Interface on the Source fabric + dst_interface: "Ethernet1/1" # Interface on the Destination fabric + src_device: "ansible_unnum_switch1" # Device on the Source fabric + dst_device: "ansible_unnum_switch2" # Device on the Destination fabric + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + + profile: + admin_state: true # choose from [true, false] + mtu: 9216 # + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination device + - no shutdown # optional, default is "" + + - dst_fabric: "ansible_unnum_fabric" # Destination fabric + src_interface: "Ethernet1/2" # Interface on the Source fabric + dst_interface: "Ethernet1/2" # Interface on the Destination fabric + src_device: "ansible_unnum_switch1" # Device on the Source fabric + dst_device: "ansible_unnum_switch2" # Device on the Destination fabric + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] # IPV6 UNDERLAY FABRIC - - name: Create Links - cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_ipv6_fabric" - config: - - dst_fabric: "ansible_ipv6_fabric" # Destination fabric - src_interface: "Ethernet1/1" # Interface on the Source fabric - dst_interface: "Ethernet1/1" # Interface on the Destination fabric - src_device: "ansible_ipv6_switch1" # Device on the Source fabric - dst_device: "ansible_ipv6_switch2" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - profile: - peer1_ipv4_addr: 192.169.1.1 # optional, default is "" - peer2_ipv4_addr: 192.169.1.2 # optional, default is "" - peer1_ipv6_addr: fe80:0201::01 # IP address of the Source interface - peer2_ipv6_addr: fe80:0201::02 # IP address of the Source interface - admin_state: true # choose from [true, false] - mtu: 9216 # - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_bfd_echo_disable: false # optional, choose from [true, false] - peer2_bfd_echo_disable: false # optional, choose from [true, false] - enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination device - - no shutdown # optional, default is "" - - - dst_fabric: "ansible_ipv6_fabric" # Destination fabric - src_interface: "Ethernet1/2" # Interface on the Source fabric - dst_interface: "Ethernet1/2" # Interface on the Destination fabric - src_device: "ansible_ipv6_switch1" # Device on the Source fabric - dst_device: "ansible_ipv6_switch2" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - dst_fabric: "ansible_ipv6_fabric" # Destination fabric - src_interface: "Ethernet1/3" # Interface on the Source fabric - dst_interface: "Ethernet1/3" # Interface on the Destination fabric - src_device: "ansible_ipv6_switch1" # Device on the Source fabric - dst_device: "ansible_ipv6_switch2" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - - profile: - peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface - peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface - peer1_ipv6_addr: fe80:0202::01 # IP address of the Source interface - peer2_ipv6_addr: fe80:0202::02 # IP address of the Source interface - admin_state: true # choose from [true, false] - mtu: 1500 # optional, default is 1500 - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_bfd_echo_disable: false # optional, choose from [true, false] - peer2_bfd_echo_disable: false # optional, choose from [true, false] - enable_macsec: false # optional, choose from [true, false] - peer1_cmds: # Freeform config for source device - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination device - - no shutdown # optional, default is "" +- name: Create Links + cisco.dcnm.dcnm_links: + state: merged # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_ipv6_fabric" + config: + - dst_fabric: "ansible_ipv6_fabric" # Destination fabric + src_interface: "Ethernet1/1" # Interface on the Source fabric + dst_interface: "Ethernet1/1" # Interface on the Destination fabric + src_device: "ansible_ipv6_switch1" # Device on the Source fabric + dst_device: "ansible_ipv6_switch2" # Device on the Destination fabric + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + + profile: + peer1_ipv4_addr: 192.169.1.1 # optional, default is "" + peer2_ipv4_addr: 192.169.1.2 # optional, default is "" + peer1_ipv6_addr: fe80:0201::01 # IP address of the Source interface + peer2_ipv6_addr: fe80:0201::02 # IP address of the Source interface + admin_state: true # choose from [true, false] + mtu: 9216 # + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + peer1_bfd_echo_disable: false # optional, choose from [true, false] + peer2_bfd_echo_disable: false # optional, choose from [true, false] + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination device + - no shutdown # optional, default is "" + + - dst_fabric: "ansible_ipv6_fabric" # Destination fabric + src_interface: "Ethernet1/2" # Interface on the Source fabric + dst_interface: "Ethernet1/2" # Interface on the Destination fabric + src_device: "ansible_ipv6_switch1" # Device on the Source fabric + dst_device: "ansible_ipv6_switch2" # Device on the Destination fabric + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + - dst_fabric: "ansible_ipv6_fabric" # Destination fabric + src_interface: "Ethernet1/3" # Interface on the Source fabric + dst_interface: "Ethernet1/3" # Interface on the Destination fabric + src_device: "ansible_ipv6_switch1" # Device on the Source fabric + dst_device: "ansible_ipv6_switch2" # Device on the Destination fabric + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + + profile: + peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface + peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface + peer1_ipv6_addr: fe80:0202::01 # IP address of the Source interface + peer2_ipv6_addr: fe80:0202::02 # IP address of the Source interface + admin_state: true # choose from [true, false] + mtu: 1500 # optional, default is 1500 + peer1_description: "Description of source" # optional, default is "" + peer2_description: "Description of dest" # optional, default is "" + peer1_bfd_echo_disable: false # optional, choose from [true, false] + peer2_bfd_echo_disable: false # optional, choose from [true, false] + enable_macsec: false # optional, choose from [true, false] + peer1_cmds: # Freeform config for source device + - no shutdown # optional, default is "" + peer2_cmds: # Freeform config for destination device + - no shutdown # optional, default is "" # DELETE LINKS - - name: Delete Links - cisco.dcnm.dcnm_links: - state: deleted # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # Destination fabric - src_interface: "Ethernet1/1" # Interface on the Source fabric - dst_interface: "Ethernet1/1" # Interface on the Destination fabric - src_device: 193.168.1.1 # Device on the Source fabric - dst_device: 193.168.1.2 # Device on the Destination fabric +- name: Delete Links + cisco.dcnm.dcnm_links: + state: deleted # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # Destination fabric + src_interface: "Ethernet1/1" # Interface on the Source fabric + dst_interface: "Ethernet1/1" # Interface on the Destination fabric + src_device: 193.168.1.1 # Device on the Source fabric + dst_device: 193.168.1.2 # Device on the Destination fabric # QUERY LINKS - - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - - - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # optional, Destination fabric - - - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # optional, Destination fabric - src_interface: "Ethernet1/1" # optional, Interface on the Source fabric - - - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # optional, Destination fabric - src_interface: "Ethernet1/1" # optional, Interface on the Source fabric - dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric - - - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # optional, Destination fabric - src_interface: "Ethernet1/1" # optional, Interface on the Source fabric - dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric - src_device: 193.168.1.1 # optional, Device on the Source fabric - register: result - - - assert: - that: - '(result["response"] | length) >= 1' - - - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # optional, Destination fabric - src_interface: "Ethernet1/1" # optional, Interface on the Source fabric - dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric - src_device: 193.168.1.1 # optional, Device on the Source fabric - dst_device: 193.168.1.2 # optional, Device on the Destination fabric - # - # INTRA-FABRIC - # - - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "ansible_num_fabric" - config: - - dst_fabric: "ansible_num_fabric" # optional, Destination fabric - src_interface: "Ethernet1/1" # optional, Interface on the Source fabric - dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric - src_device: 193.168.1.1 # optional, Device on the Source fabric - dst_device: 193.168.1.2 # optional, Device on the Destination fabric - template: int_intra_fabric_num_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] +- name: Query Links - with Src Fabric + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + +- name: Query Links - with Src & Dst Fabric + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # optional, Destination fabric + +- name: Query Links - with Src & Dst Fabric, Src Intf + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # optional, Destination fabric + src_interface: "Ethernet1/1" # optional, Interface on the Source fabric + +- name: Query Links - with Src & Dst Fabric, Src & Dst Intf + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # optional, Destination fabric + src_interface: "Ethernet1/1" # optional, Interface on the Source fabric + dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric + +- name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # optional, Destination fabric + src_interface: "Ethernet1/1" # optional, Interface on the Source fabric + dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric + src_device: 193.168.1.1 # optional, Device on the Source fabric + register: result + +- assert: + that: + '(result["response"] | length) >= 1' + +- name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # optional, Destination fabric + src_interface: "Ethernet1/1" # optional, Interface on the Source fabric + dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric + src_device: 193.168.1.1 # optional, Device on the Source fabric + dst_device: 193.168.1.2 # optional, Device on the Destination fabric +# +# INTRA-FABRIC +# +- name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "ansible_num_fabric" + config: + - dst_fabric: "ansible_num_fabric" # optional, Destination fabric + src_interface: "Ethernet1/1" # optional, Interface on the Source fabric + dst_interface: "Ethernet1/1" # optional, Interface on the Destination fabric + src_device: 193.168.1.1 # optional, Device on the Source fabric + dst_device: 193.168.1.2 # optional, Device on the Destination fabric + template: int_intra_fabric_num_link # optional, template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] # # INTER-FABRIC # - - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: - state: query # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_num_fabric }}" - config: - - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric - src_interface: "{{ intf_1_6 }}" # optional, Interface on the Source fabric - dst_interface: "{{ intf_1_6 }}" # optional, Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric - dst_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Destination fabric - template: ext_fabric_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] +- name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template + cisco.dcnm.dcnm_links: + state: query # choose from [merged, replaced, deleted, query] + src_fabric: "{{ ansible_num_fabric }}" + config: + - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric + src_interface: "{{ intf_1_6 }}" # optional, Interface on the Source fabric + dst_interface: "{{ intf_1_6 }}" # optional, Interface on the Destination fabric + src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric + dst_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Destination fabric + template: ext_fabric_setup # optional, template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] """ import time diff --git a/plugins/modules/dcnm_log.py b/plugins/modules/dcnm_log.py index bf2c1cdfd..09665182f 100644 --- a/plugins/modules/dcnm_log.py +++ b/plugins/modules/dcnm_log.py @@ -51,7 +51,7 @@ - name: Log cisco.dcnm.dcnm_log: - msg: dcnm_vrf.merged - Create VRF myVrf + msg: dcnm_vrf.merged - Create VRF myVrf severity: INFO - name: dcnm_vrf.merged - Create VRF myVrf @@ -59,21 +59,20 @@ fabric: vxlan-fabric state: merged config: - - vrf_name: myVrf - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null - attach: - - ip_address: 192.168.1.224 + - vrf_name: myVrf + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null + attach: + - ip_address: 192.168.1.224 - ip_address: 192.168.1.225 - name: Log cisco.dcnm.dcnm_log: - msg: dcnm_vrf.merged - Create VRF myVrf DONE + msg: dcnm_vrf.merged - Create VRF myVrf DONE severity: INFO - """ # noqa RETURN = """ diff --git a/plugins/modules/dcnm_maintenance_mode.py b/plugins/modules/dcnm_maintenance_mode.py index f281904e0..67983cce9 100644 --- a/plugins/modules/dcnm_maintenance_mode.py +++ b/plugins/modules/dcnm_maintenance_mode.py @@ -108,13 +108,13 @@ cisco.dcnm.dcnm_maintenance_mode: state: merged config: - deploy: true - wait_for_mode_change: true - mode: maintenance - switches: - - ip_address: 192.168.1.2 - - ip_address: 192.160.1.3 - - ip_address: 192.160.1.4 + deploy: true + wait_for_mode_change: true + mode: maintenance + switches: + - ip_address: 192.168.1.2 + - ip_address: 192.160.1.3 + - ip_address: 192.160.1.4 register: result - debug: var: result @@ -127,20 +127,18 @@ cisco.dcnm.dcnm_maintenance_mode: state: merged config: - deploy: false - mode: maintenance - switches: - - ip_address: 192.168.1.2 - mode: normal - - ip_address: 192.160.1.3 - deploy: true - wait_for_mode_change: true - - ip_address: 192.160.1.4 + deploy: false + mode: maintenance + switches: + - ip_address: 192.168.1.2 + mode: normal + - ip_address: 192.160.1.3 + deploy: true + wait_for_mode_change: true + - ip_address: 192.160.1.4 register: result - debug: var: result - - """ # pylint: disable=wrong-import-position import copy diff --git a/plugins/modules/dcnm_network.py b/plugins/modules/dcnm_network.py index bb6a8fb4a..40e6992bc 100644 --- a/plugins/modules/dcnm_network.py +++ b/plugins/modules/dcnm_network.py @@ -340,35 +340,35 @@ fabric: vxlan-fabric state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 150 - gw_ip_subnet: '192.168.30.1/24' - attach: - - ip_address: 192.168.1.224 - ports: [Ethernet1/13, Ethernet1/14] - - ip_address: 192.168.1.225 - ports: [Ethernet1/13, Ethernet1/14] - deploy: true - - net_name: ansible-net12 - vrf_name: Tenant-2 - net_id: 7002 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 151 - gw_ip_subnet: '192.168.40.1/24' - attach: - - ip_address: 192.168.1.224 - ports: [Ethernet1/11, Ethernet1/12] - tor_ports: - - ip_address: 192.168.1.120 - ports: [Ethernet1/14, Ethernet1/15] - - ip_address: 192.168.1.225 - ports: [Ethernet1/11, Ethernet1/12] - deploy: false + - net_name: ansible-net13 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 150 + gw_ip_subnet: '192.168.30.1/24' + attach: + - ip_address: 192.168.1.224 + ports: [Ethernet1/13, Ethernet1/14] + - ip_address: 192.168.1.225 + ports: [Ethernet1/13, Ethernet1/14] + deploy: true + - net_name: ansible-net12 + vrf_name: Tenant-2 + net_id: 7002 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 151 + gw_ip_subnet: '192.168.40.1/24' + attach: + - ip_address: 192.168.1.224 + ports: [Ethernet1/11, Ethernet1/12] + tor_ports: + - ip_address: 192.168.1.120 + ports: [Ethernet1/14, Ethernet1/15] + - ip_address: 192.168.1.225 + ports: [Ethernet1/11, Ethernet1/12] + deploy: false - name: Replace networks cisco.dcnm.dcnm_network: @@ -383,32 +383,32 @@ vlan_id: 150 gw_ip_subnet: '192.168.30.1/24' dhcp_servers: - - srvr_ip: 192.168.1.1 - srvr_vrf: vrf_01 - - srvr_ip: 192.168.2.1 - srvr_vrf: vrf_02 - - srvr_ip: 192.168.3.1 - srvr_vrf: vrf_03 - - srvr_ip: 192.168.4.1 - srvr_vrf: vrf_04 - - srvr_ip: 192.168.5.1 - srvr_vrf: vrf_05 - - srvr_ip: 192.168.6.1 - srvr_vrf: vrf_06 - - srvr_ip: 192.168.7.1 - srvr_vrf: vrf_07 - - srvr_ip: 192.168.8.1 - srvr_vrf: vrf_08 - - srvr_ip: 192.168.9.1 - srvr_vrf: vrf_09 - - srvr_ip: 192.168.10.1 - srvr_vrf: vrf_10 + - srvr_ip: 192.168.1.1 + srvr_vrf: vrf_01 + - srvr_ip: 192.168.2.1 + srvr_vrf: vrf_02 + - srvr_ip: 192.168.3.1 + srvr_vrf: vrf_03 + - srvr_ip: 192.168.4.1 + srvr_vrf: vrf_04 + - srvr_ip: 192.168.5.1 + srvr_vrf: vrf_05 + - srvr_ip: 192.168.6.1 + srvr_vrf: vrf_06 + - srvr_ip: 192.168.7.1 + srvr_vrf: vrf_07 + - srvr_ip: 192.168.8.1 + srvr_vrf: vrf_08 + - srvr_ip: 192.168.9.1 + srvr_vrf: vrf_09 + - srvr_ip: 192.168.10.1 + srvr_vrf: vrf_10 attach: - - ip_address: 192.168.1.224 - # Replace the ports with new ports - # ports: [Ethernet1/13, Ethernet1/14] - ports: [Ethernet1/16, Ethernet1/17] - # Delete this attachment + - ip_address: 192.168.1.224 + # Replace the ports with new ports + # ports: [Ethernet1/13, Ethernet1/14] + ports: [Ethernet1/16, Ethernet1/17] + # Delete this attachment # - ip_address: 192.168.1.225 # ports: [Ethernet1/13, Ethernet1/14] deploy: true @@ -432,57 +432,57 @@ fabric: vxlan-fabric state: overridden config: - - net_name: ansible-net13 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 150 - gw_ip_subnet: '192.168.30.1/24' - attach: - - ip_address: 192.168.1.224 - # Replace the ports with new ports - # ports: [Ethernet1/13, Ethernet1/14] - ports: [Ethernet1/16, Ethernet1/17] + - net_name: ansible-net13 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 150 + gw_ip_subnet: '192.168.30.1/24' + attach: + - ip_address: 192.168.1.224 + # Replace the ports with new ports + # ports: [Ethernet1/13, Ethernet1/14] + ports: [Ethernet1/16, Ethernet1/17] # Delete this attachment # - ip_address: 192.168.1.225 # ports: [Ethernet1/13, Ethernet1/14] - deploy: true - # Delete this network - # - net_name: ansible-net12 - # vrf_name: Tenant-2 - # net_id: 7002 - # net_template: Default_Network_Universal - # net_extension_template: Default_Network_Extension_Universal - # vlan_id: 151 - # gw_ip_subnet: '192.168.40.1/24' - # attach: - # - ip_address: 192.168.1.224 - # ports: [Ethernet1/11, Ethernet1/12] - # - ip_address: 192.168.1.225 - # ports: [Ethernet1/11, Ethernet1/12] - # deploy: false + deploy: true +# Delete this network +# - net_name: ansible-net12 +# vrf_name: Tenant-2 +# net_id: 7002 +# net_template: Default_Network_Universal +# net_extension_template: Default_Network_Extension_Universal +# vlan_id: 151 +# gw_ip_subnet: '192.168.40.1/24' +# attach: +# - ip_address: 192.168.1.224 +# ports: [Ethernet1/11, Ethernet1/12] +# - ip_address: 192.168.1.225 +# ports: [Ethernet1/11, Ethernet1/12] +# deploy: false - name: Delete selected networks cisco.dcnm.dcnm_network: fabric: vxlan-fabric state: deleted config: - - net_name: ansible-net13 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 150 - gw_ip_subnet: '192.168.30.1/24' - - net_name: ansible-net12 - vrf_name: Tenant-2 - net_id: 7002 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 151 - gw_ip_subnet: '192.168.40.1/24' - deploy: false + - net_name: ansible-net13 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 150 + gw_ip_subnet: '192.168.30.1/24' + - net_name: ansible-net12 + vrf_name: Tenant-2 + net_id: 7002 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 151 + gw_ip_subnet: '192.168.40.1/24' + deploy: false - name: Delete all the networkss cisco.dcnm.dcnm_network: @@ -494,8 +494,8 @@ fabric: vxlan-fabric state: query config: - - net_name: ansible-net13 - - net_name: ansible-net12 + - net_name: ansible-net13 + - net_name: ansible-net12 """ import copy diff --git a/plugins/modules/dcnm_resource_manager.py b/plugins/modules/dcnm_resource_manager.py index f0b7c5ef1..53a0c0ef0 100644 --- a/plugins/modules/dcnm_resource_manager.py +++ b/plugins/modules/dcnm_resource_manager.py @@ -276,7 +276,6 @@ - pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name switch: # provide the switch information to which the given resource is attached - 192.175.1.1 - """ import json diff --git a/plugins/modules/dcnm_rest.py b/plugins/modules/dcnm_rest.py index 858ad76ab..3a56a4750 100644 --- a/plugins/modules/dcnm_rest.py +++ b/plugins/modules/dcnm_rest.py @@ -70,7 +70,10 @@ dcnm_rest: method: POST path: /rest/top-down/fabrics/fabric1/vrfs/attachments - json_data: '[{"vrfName":"sales66_vrf1","lanAttachList":[{"fabric":"fabric1","vrfName":"sales66_vrf1","serialNumber":"FDO21392QKM","vlan":2000,"freeformConfig":"","deployment":false,"extensionValues":"","instanceValues":"{\"loopbackId\":\"\",\"loopbackIpAddress\":\"\",\"loopbackIpV6Address\":\"\"}"}]}]' + json_data: > + [{"vrfName":"sales66_vrf1","lanAttachList":[{"fabric":"fabric1","vrfName":"sales66_vrf1", + "serialNumber":"FDO21392QKM","vlan":2000,"freeformConfig":"","deployment":false, + "extensionValues":"","instanceValues":"{\"loopbackId\":\"\",\"loopbackIpAddress\":\"\",\"loopbackIpV6Address\":\"\"}"}]}] - name: Save Robot Credentials - (urlencoded) dcnm_rest: @@ -88,7 +91,6 @@ path: /fm/fmrest/config/templates/validate json_data: "{{ data }}" register: result - """ # noqa RETURN = """ diff --git a/plugins/modules/dcnm_service_node.py b/plugins/modules/dcnm_service_node.py index 4d8c360f4..ce839ecb6 100644 --- a/plugins/modules/dcnm_service_node.py +++ b/plugins/modules/dcnm_service_node.py @@ -181,21 +181,21 @@ service_fabric: external state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: Ethernet1/1 - switches: - - 192.168.1.224 - - name: SN-12 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: vPC1 - switches: # up to two switches, if two switches are provided, vpc is only option - - 192.168.1.224 - - 192.168.1.225 + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: Ethernet1/1 + switches: + - 192.168.1.224 + - name: SN-12 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: vPC1 + switches: # up to two switches, if two switches are provided, vpc is only option + - 192.168.1.224 + - 192.168.1.225 - name: Replace Service Nodes form factor/type parameter cisco.dcnm.dcnm_service_node: @@ -203,25 +203,25 @@ service_fabric: external state: replaced config: - - name: SN-11 - type: firewall - # Replace can only modify the form factor - # form_factor: virtual # the virtual will be changed to new physical - # form_factor: physical - svc_int_name: svc1 - attach_interface: Ethernet1/1 - switches: - - 192.168.1.224 - # Nothing will be replaced in the below service node as there is no change - # Dont touch this if its present on DCNM - # - name: SN-12 - # type: firewall - # form_factor: virtual - # svc_int_name: svc1 - # attach_interface: vPC1 - # switches: # up to two switches, if two switches are provided, vpc is only option - # - 192.168.1.224 - # - 192.168.1.225 + - name: SN-11 + type: firewall + # Replace can only modify the form factor + # form_factor: virtual # the virtual will be changed to new physical + # form_factor: physical + svc_int_name: svc1 + attach_interface: Ethernet1/1 + switches: + - 192.168.1.224 +# Nothing will be replaced in the below service node as there is no change +# Dont touch this if its present on DCNM +# - name: SN-12 +# type: firewall +# form_factor: virtual +# svc_int_name: svc1 +# attach_interface: vPC1 +# switches: # up to two switches, if two switches are provided, vpc is only option +# - 192.168.1.224 +# - 192.168.1.225 - name: Override Service Nodes cisco.dcnm.dcnm_service_node: @@ -229,31 +229,31 @@ service_fabric: external state: overridden config: - # Create this service node - - name: SN-13 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: Ethernet1/1 - switches: - - 192.168.1.224 - # Delete this service node from the DCNM - # - name: SN-11 - # type: firewall - # form_factor: virtual - # svc_int_name: svc1 - # attach_interface: Ethernet1/1 - # switches: - # - 192.168.1.224 - # Delete this service node from the DCNM - # - name: SN-12 - # type: firewall - # form_factor: virtual - # svc_int_name: svc1 - # attach_interface: vPC1 - # switches: # up to two switches, if two switches are provided, vpc is only option - # - 192.168.1.224 - # - 192.168.1.225 + # Create this service node + - name: SN-13 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: Ethernet1/1 + switches: + - 192.168.1.224 +# Delete this service node from the DCNM +# - name: SN-11 +# type: firewall +# form_factor: virtual +# svc_int_name: svc1 +# attach_interface: Ethernet1/1 +# switches: +# - 192.168.1.224 +# Delete this service node from the DCNM +# - name: SN-12 +# type: firewall +# form_factor: virtual +# svc_int_name: svc1 +# attach_interface: vPC1 +# switches: # up to two switches, if two switches are provided, vpc is only option +# - 192.168.1.224 +# - 192.168.1.225 - name: Delete selected Service Nodes cisco.dcnm.dcnm_service_node: @@ -261,21 +261,21 @@ service_fabric: external state: deleted config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: Ethernet1/1 - switches: - - 192.168.1.224 - - name: SN-12 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: vPC1 - switches: # up to two switches, if two switches are provided, vpc is only option - - 192.168.1.224 - - 192.168.1.225 + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: Ethernet1/1 + switches: + - 192.168.1.224 + - name: SN-12 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: vPC1 + switches: # up to two switches, if two switches are provided, vpc is only option + - 192.168.1.224 + - 192.168.1.225 - name: Delete all the Service Nodes cisco.dcnm.dcnm_service_node: @@ -289,21 +289,21 @@ service_fabric: external state: query config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: Ethernet1/1 - switches: - - 192.168.1.224 - - name: SN-12 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: vPC1 - switches: # up to two switches, if two switches are provided, vpc is only option - - 192.168.1.224 - - 192.168.1.225 + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: Ethernet1/1 + switches: + - 192.168.1.224 + - name: SN-12 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: vPC1 + switches: # up to two switches, if two switches are provided, vpc is only option + - 192.168.1.224 + - 192.168.1.225 - name: Query all the Service Nodes cisco.dcnm.dcnm_service_node: diff --git a/plugins/modules/dcnm_service_policy.py b/plugins/modules/dcnm_service_policy.py index c44cd4adf..e19647607 100644 --- a/plugins/modules/dcnm_service_policy.py +++ b/plugins/modules/dcnm_service_policy.py @@ -283,7 +283,7 @@ src_port: any dest_port: 22 action: permit - next_hop_option: none + next_hop_option: none acl_name: fwd_acl_10 rev_acl_name: rev_acl_10 route_map_num: 101 @@ -384,7 +384,7 @@ src_port: 555 dest_port: 22 action: permit - next_hop_option: none + next_hop_option: none acl_name: fwd_acl_555 rev_acl_name: rev_acl_555 route_map_num: 555 @@ -436,7 +436,6 @@ state: query config: - node_name: it-sn-1 - """ import time diff --git a/plugins/modules/dcnm_service_route_peering.py b/plugins/modules/dcnm_service_route_peering.py index cdeaf01b6..a259c3fda 100644 --- a/plugins/modules/dcnm_service_route_peering.py +++ b/plugins/modules/dcnm_service_route_peering.py @@ -1155,8 +1155,7 @@ fabric: test-fabric service_fabric: external config: - node_name: IT-SN-1 # mandatory - + - node_name: IT-SN-1 # mandatory """ import re diff --git a/plugins/modules/dcnm_vpc_pair.py b/plugins/modules/dcnm_vpc_pair.py index d6fbfb46d..ce27b2093 100644 --- a/plugins/modules/dcnm_vpc_pair.py +++ b/plugins/modules/dcnm_vpc_pair.py @@ -262,7 +262,7 @@ peerTwoId: 192.168.1.2 templateName: "vpc_pair" profile: - ADMIN_STATE: True + ADMIN_STATE: true ALLOWED_VLANS: "all" DOMAIN_ID: 100 FABRIC_NAME: test-fabric @@ -316,7 +316,7 @@ peerTwoId: 192.168.1.2 templateName: "vpc_pair" profile: - ADMIN_STATE: True + ADMIN_STATE: true ALLOWED_VLANS: "all" DOMAIN_ID: 100 FABRIC_NAME: test-fabric @@ -348,7 +348,7 @@ peerTwoId: 192.168.1.2 templateName: "vpc_pair" profile: - ADMIN_STATE: True + ADMIN_STATE: true ALLOWED_VLANS: "all" DOMAIN_ID: 100 FABRIC_NAME: "test-fabric" diff --git a/plugins/modules/dcnm_vrf.py b/plugins/modules/dcnm_vrf.py index 73f17b132..971c62a94 100644 --- a/plugins/modules/dcnm_vrf.py +++ b/plugins/modules/dcnm_vrf.py @@ -441,23 +441,23 @@ fabric: vxlan-fabric state: merged config: - - vrf_name: ansible-vrf-r1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null - attach: - - ip_address: 192.168.1.224 - - ip_address: 192.168.1.225 - - vrf_name: ansible-vrf-r2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - service_vrf_template: null - attach: - - ip_address: 192.168.1.224 - - ip_address: 192.168.1.225 + - vrf_name: ansible-vrf-r1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null + attach: + - ip_address: 192.168.1.224 + - ip_address: 192.168.1.225 + - vrf_name: ansible-vrf-r2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + service_vrf_template: null + attach: + - ip_address: 192.168.1.224 + - ip_address: 192.168.1.225 # VRF LITE Extension attached - name: Merge vrfs @@ -465,14 +465,14 @@ fabric: vxlan-fabric state: merged config: - - vrf_name: ansible-vrf-r1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null - attach: - - ip_address: 192.168.1.224 + - vrf_name: ansible-vrf-r1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null + attach: + - ip_address: 192.168.1.224 - ip_address: 192.168.1.225 vrf_lite: - peer_vrf: test_vrf_1 # optional @@ -496,26 +496,26 @@ fabric: vxlan-fabric state: replaced config: - - vrf_name: ansible-vrf-r1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null - attach: - - ip_address: 192.168.1.224 + - vrf_name: ansible-vrf-r1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null + attach: + - ip_address: 192.168.1.224 # Delete this attachment # - ip_address: 192.168.1.225 # Create the following attachment - ip_address: 192.168.1.226 - # Dont touch this if its present on DCNM - # - vrf_name: ansible-vrf-r2 - # vrf_id: 9008012 - # vrf_template: Default_VRF_Universal - # vrf_extension_template: Default_VRF_Extension_Universal - # attach: - # - ip_address: 192.168.1.224 - # - ip_address: 192.168.1.225 + # Dont touch this if its present on DCNM + # - vrf_name: ansible-vrf-r2 + # vrf_id: 9008012 + # vrf_template: Default_VRF_Universal + # vrf_extension_template: Default_VRF_Extension_Universal + # attach: + # - ip_address: 192.168.1.224 + # - ip_address: 192.168.1.225 # The two VRFs below will be overridden in the target fabric. - name: Override vrfs @@ -523,46 +523,46 @@ fabric: vxlan-fabric state: overridden config: - - vrf_name: ansible-vrf-r1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null - attach: - - ip_address: 192.168.1.224 + - vrf_name: ansible-vrf-r1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null + attach: + - ip_address: 192.168.1.224 # Delete this attachment # - ip_address: 192.168.1.225 # Create the following attachment - ip_address: 192.168.1.226 - # Delete this vrf - # - vrf_name: ansible-vrf-r2 - # vrf_id: 9008012 - # vrf_template: Default_VRF_Universal - # vrf_extension_template: Default_VRF_Extension_Universal - # vlan_id: 2000 - # service_vrf_template: null - # attach: - # - ip_address: 192.168.1.224 - # - ip_address: 192.168.1.225 + # Delete this vrf + # - vrf_name: ansible-vrf-r2 + # vrf_id: 9008012 + # vrf_template: Default_VRF_Universal + # vrf_extension_template: Default_VRF_Extension_Universal + # vlan_id: 2000 + # service_vrf_template: null + # attach: + # - ip_address: 192.168.1.224 + # - ip_address: 192.168.1.225 - name: Delete selected vrfs cisco.dcnm.dcnm_vrf: fabric: vxlan-fabric state: deleted config: - - vrf_name: ansible-vrf-r1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null - - vrf_name: ansible-vrf-r2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 2000 - service_vrf_template: null + - vrf_name: ansible-vrf-r1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null + - vrf_name: ansible-vrf-r2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 2000 + service_vrf_template: null - name: Delete all the vrfs cisco.dcnm.dcnm_vrf: @@ -574,8 +574,8 @@ fabric: vxlan-fabric state: query config: - - vrf_name: ansible-vrf-r1 - - vrf_name: ansible-vrf-r2 + - vrf_name: ansible-vrf-r1 + - vrf_name: ansible-vrf-r2 """ import ast import copy diff --git a/test-requirements.txt b/test-requirements.txt index 959646138..7da1673a2 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,4 +6,4 @@ pytest-xdist coverage==4.5.4 deepdiff==8.6.1 pydantic==2.11.4 -ansible.netcommon>=4.1.0 \ No newline at end of file +ansible.netcommon>=4.1.0 diff --git a/tests/integration/targets/dcnm_bootflash/tasks/dcnm.yaml b/tests/integration/targets/dcnm_bootflash/tasks/dcnm.yaml index e419fc865..8b35d98d4 100644 --- a/tests/integration/targets/dcnm_bootflash/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_bootflash/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_bootflash/tasks/main.yaml b/tests/integration/targets/dcnm_bootflash/tasks/main.yaml index fbcfa5803..2d33809f3 100644 --- a/tests/integration/targets/dcnm_bootflash/tasks/main.yaml +++ b/tests/integration/targets/dcnm_bootflash/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } +- name: Include dcnm.yaml + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_specific.yaml b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_specific.yaml index 5d72db667..314c700ca 100644 --- a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_specific.yaml +++ b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_specific.yaml @@ -172,10 +172,14 @@ # ], # "response": [ # { -# "DATA": "File(s) Deleted Successfully. \nDeleted files: [air.ndfc_ut, earth.ndfc_ut, water.ndfc_ut, fire.ndfc_ut][green.ndfc_ut, blue.ndfc_ut, black.ndfc_ut, red.ndfc_ut]", +# "DATA": "File(s) Deleted Successfully. \nDeleted files: \ +# [air.ndfc_ut, earth.ndfc_ut, water.ndfc_ut, fire.ndfc_ut]\ +# [green.ndfc_ut, blue.ndfc_ut, black.ndfc_ut, red.ndfc_ut]", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/imagemgnt/bootFlash/bootflash-files", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/imagemgnt/bootFlash/bootflash-files # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -195,36 +199,37 @@ - name: DELETED - TEST - Delete specific ndfc_ut files on active supervisor bootflash. cisco.dcnm.dcnm_bootflash: &delete_files - state: deleted - config: - switches: - - ip_address: "{{ switch1 }}" - targets: - - filepath: "bootflash:/{{ switch1_file1 }}" - supervisor: active - - filepath: "bootflash:/{{ switch1_file2 }}" - supervisor: active - - filepath: "bootflash:/{{ switch1_file3 }}" - supervisor: active - - filepath: "bootflash:/{{ switch1_file4 }}" - supervisor: active - - ip_address: "{{ switch2 }}" - targets: - - filepath: "bootflash:/{{ switch2_file1 }}" - supervisor: active - - filepath: "bootflash:/{{ switch2_file2 }}" - supervisor: active - - filepath: "bootflash:/{{ switch2_file3 }}" - supervisor: active - - filepath: "bootflash:/{{ switch2_file4 }}" - supervisor: active + state: deleted + config: + switches: + - ip_address: "{{ switch1 }}" + targets: + - filepath: "bootflash:/{{ switch1_file1 }}" + supervisor: active + - filepath: "bootflash:/{{ switch1_file2 }}" + supervisor: active + - filepath: "bootflash:/{{ switch1_file3 }}" + supervisor: active + - filepath: "bootflash:/{{ switch1_file4 }}" + supervisor: active + - ip_address: "{{ switch2 }}" + targets: + - filepath: "bootflash:/{{ switch2_file1 }}" + supervisor: active + - filepath: "bootflash:/{{ switch2_file2 }}" + supervisor: active + - filepath: "bootflash:/{{ switch2_file3 }}" + supervisor: active + - filepath: "bootflash:/{{ switch2_file4 }}" + supervisor: active register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result - name: Prepare assert values filepath deletion - set_fact: + ansible.builtin.set_fact: switch1_filepath1: "bootflash:/{{ switch1_file1 }}" switch1_filepath2: "bootflash:/{{ switch1_file2 }}" switch1_filepath3: "bootflash:/{{ switch1_file3 }}" @@ -234,33 +239,34 @@ switch2_filepath3: "bootflash:/{{ switch2_file3 }}" switch2_filepath4: "bootflash:/{{ switch2_file4 }}" -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.diff[0][switch1][0].filepath == switch1_filepath1 - - result.diff[0][switch1][1].filepath == switch1_filepath2 - - result.diff[0][switch1][2].filepath == switch1_filepath3 - - result.diff[0][switch1][3].filepath == switch1_filepath4 - - result.diff[0][switch2][0].filepath == switch2_filepath1 - - result.diff[0][switch2][1].filepath == switch2_filepath2 - - result.diff[0][switch2][2].filepath == switch2_filepath3 - - result.diff[0][switch2][3].filepath == switch2_filepath4 - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - (result.diff[0] | length) == 3 - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.metadata | length) == 1 - - result.metadata[0].action == "bootflash_delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.diff[0][switch1][0].filepath == switch1_filepath1 + - result.diff[0][switch1][1].filepath == switch1_filepath2 + - result.diff[0][switch1][2].filepath == switch1_filepath3 + - result.diff[0][switch1][3].filepath == switch1_filepath4 + - result.diff[0][switch2][0].filepath == switch2_filepath1 + - result.diff[0][switch2][1].filepath == switch2_filepath2 + - result.diff[0][switch2][2].filepath == switch2_filepath3 + - result.diff[0][switch2][3].filepath == switch2_filepath4 + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - (result.diff[0] | length) == 3 + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.metadata | length) == 1 + - result.metadata[0].action == "bootflash_delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true ################################################################################ # DELETED - TEST - Delete files. Idempotence. @@ -304,27 +310,29 @@ cisco.dcnm.dcnm_bootflash: *delete_files register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - switch1 not in result.diff[0] - - switch2 not in result.diff[0] - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0].action == "bootflash_delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "No files to delete." - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == false - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - switch1 not in result.diff[0] + - switch2 not in result.diff[0] + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0].action == "bootflash_delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "No files to delete." + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == false + - result.result[0].success == true + - result.result[0].sequence_number == 1 diff --git a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_wildcard.yaml b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_wildcard.yaml index 6fbb2a3d9..c1afd4231 100644 --- a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_wildcard.yaml +++ b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_deleted_wildcard.yaml @@ -172,10 +172,14 @@ # ], # "response": [ # { -# "DATA": "File(s) Deleted Successfully. \nDeleted files: [air.ndfc_ut, earth.ndfc_ut, water.ndfc_ut, fire.ndfc_ut][green.ndfc_ut, blue.ndfc_ut, black.ndfc_ut, red.ndfc_ut]", +# "DATA": "File(s) Deleted Successfully. \nDeleted files: \ +# [air.ndfc_ut, earth.ndfc_ut, water.ndfc_ut, fire.ndfc_ut]\ +# [green.ndfc_ut, blue.ndfc_ut, black.ndfc_ut, red.ndfc_ut]", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/imagemgnt/bootFlash/bootflash-files", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/imagemgnt/bootFlash/bootflash-files # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -195,21 +199,22 @@ - name: DELETED - TEST - Delete {{ wildcard_filepath }} on active supervisor of switches. cisco.dcnm.dcnm_bootflash: &delete_files - state: deleted - config: - targets: - - filepath: "{{ wildcard_filepath }}" - supervisor: active - switches: - - ip_address: "{{ switch1 }}" - - ip_address: "{{ switch2 }}" + state: deleted + config: + targets: + - filepath: "{{ wildcard_filepath }}" + supervisor: active + switches: + - ip_address: "{{ switch1 }}" + - ip_address: "{{ switch2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result - name: Prepare assert values filepath deletion - set_fact: + ansible.builtin.set_fact: switch1_filepath1: "bootflash:/{{ switch1_file1 }}" switch1_filepath2: "bootflash:/{{ switch1_file2 }}" switch1_filepath3: "bootflash:/{{ switch1_file3 }}" @@ -217,31 +222,32 @@ switch2_filepath2: "bootflash:/{{ switch2_file2 }}" switch2_filepath3: "bootflash:/{{ switch2_file3 }}" -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.diff[0][switch1][0].filepath == switch1_filepath1 - - result.diff[0][switch1][1].filepath == switch1_filepath2 - - result.diff[0][switch1][2].filepath == switch1_filepath3 - - result.diff[0][switch2][0].filepath == switch2_filepath1 - - result.diff[0][switch2][1].filepath == switch2_filepath2 - - result.diff[0][switch2][2].filepath == switch2_filepath3 - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - (result.diff[0] | length) == 3 - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.metadata | length) == 1 - - result.metadata[0].action == "bootflash_delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.diff[0][switch1][0].filepath == switch1_filepath1 + - result.diff[0][switch1][1].filepath == switch1_filepath2 + - result.diff[0][switch1][2].filepath == switch1_filepath3 + - result.diff[0][switch2][0].filepath == switch2_filepath1 + - result.diff[0][switch2][1].filepath == switch2_filepath2 + - result.diff[0][switch2][2].filepath == switch2_filepath3 + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - (result.diff[0] | length) == 3 + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.metadata | length) == 1 + - result.metadata[0].action == "bootflash_delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true ################################################################################ # DELETED - TEST - Delete files. Idempotence. @@ -285,27 +291,29 @@ cisco.dcnm.dcnm_bootflash: *delete_files register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - switch1 not in result.diff[0] - - switch2 not in result.diff[0] - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0].action == "bootflash_delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "No files to delete." - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == false - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - switch1 not in result.diff[0] + - switch2 not in result.diff[0] + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0].action == "bootflash_delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "No files to delete." + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == false + - result.result[0].success == true + - result.result[0].sequence_number == 1 diff --git a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_specific.yaml b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_specific.yaml index 6b750f741..5920b4243 100644 --- a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_specific.yaml +++ b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_specific.yaml @@ -153,7 +153,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "GET", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGCS", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGCS # "RETURN_CODE": 200 # }, # "172.22.150.113": { @@ -192,7 +194,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "GET", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGD0", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGD0 # "RETURN_CODE": 200 # }, # "sequence_number": 1 @@ -214,34 +218,35 @@ # } # } -- name: QUERY - TEST - Query specfic files on specific partitions of active supervisor +- name: QUERY - TEST - Query specific files on specific partitions of active supervisor cisco.dcnm.dcnm_bootflash: - state: query - config: - switches: - - ip_address: "{{ switch1 }}" - targets: - - filepath: "bootflash:/{{ switch1_file2 }}" - supervisor: active - - filepath: "bootflash:/{{ switch1_file3 }}" - supervisor: active - - filepath: "bootflash:/{{ switch1_file4 }}" - supervisor: active - - ip_address: "{{ switch2 }}" - targets: - - filepath: "bootflash:/{{ switch2_file2 }}" - supervisor: active - - filepath: "bootflash:/{{ switch2_file3 }}" - supervisor: active - - filepath: "bootflash:/{{ switch2_file4 }}" - supervisor: active + state: query + config: + switches: + - ip_address: "{{ switch1 }}" + targets: + - filepath: "bootflash:/{{ switch1_file2 }}" + supervisor: active + - filepath: "bootflash:/{{ switch1_file3 }}" + supervisor: active + - filepath: "bootflash:/{{ switch1_file4 }}" + supervisor: active + - ip_address: "{{ switch2 }}" + targets: + - filepath: "bootflash:/{{ switch2_file2 }}" + supervisor: active + - filepath: "bootflash:/{{ switch2_file3 }}" + supervisor: active + - filepath: "bootflash:/{{ switch2_file4 }}" + supervisor: active register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result - name: Prepare assert values for specific query - set_fact: + ansible.builtin.set_fact: switch1_filepath1: "bootflash:/{{ switch1_file2 }}" switch1_filepath2: "bootflash:/{{ switch1_file3 }}" switch1_filepath3: "bootflash:/{{ switch1_file4 }}" @@ -249,31 +254,32 @@ switch2_filepath2: "bootflash:/{{ switch2_file3 }}" switch2_filepath3: "bootflash:/{{ switch2_file4 }}" -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.diff[0][switch1][0].filepath == switch1_filepath1 - - result.diff[0][switch1][1].filepath == switch1_filepath2 - - result.diff[0][switch1][2].filepath == switch1_filepath3 - - result.diff[0][switch2][0].filepath == switch2_filepath1 - - result.diff[0][switch2][1].filepath == switch2_filepath2 - - result.diff[0][switch2][2].filepath == switch2_filepath3 - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - (result.response | length) == 1 - - result.response[0][switch1].RETURN_CODE == 200 - - result.response[0][switch2].RETURN_CODE == 200 - - result.response[0][switch1].MESSAGE == "OK" - - result.response[0][switch2].MESSAGE == "OK" - - result.response[0][switch1].METHOD == "GET" - - result.response[0][switch2].METHOD == "GET" - - (result.metadata | length) == 1 - - result.metadata[0].action == "bootflash_info" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "query" - - (result.result | length) == 1 - - result.result[0][switch1].found == true - - result.result[0][switch2].found == true - - result.result[0][switch1].success == true - - result.result[0][switch2].success == true + - result.diff[0][switch1][0].filepath == switch1_filepath1 + - result.diff[0][switch1][1].filepath == switch1_filepath2 + - result.diff[0][switch1][2].filepath == switch1_filepath3 + - result.diff[0][switch2][0].filepath == switch2_filepath1 + - result.diff[0][switch2][1].filepath == switch2_filepath2 + - result.diff[0][switch2][2].filepath == switch2_filepath3 + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - (result.response | length) == 1 + - result.response[0][switch1].RETURN_CODE == 200 + - result.response[0][switch2].RETURN_CODE == 200 + - result.response[0][switch1].MESSAGE == "OK" + - result.response[0][switch2].MESSAGE == "OK" + - result.response[0][switch1].METHOD == "GET" + - result.response[0][switch2].METHOD == "GET" + - (result.metadata | length) == 1 + - result.metadata[0].action == "bootflash_info" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "query" + - (result.result | length) == 1 + - result.result[0][switch1].found == true + - result.result[0][switch2].found == true + - result.result[0][switch1].success == true + - result.result[0][switch2].success == true diff --git a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_wildcard.yaml b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_wildcard.yaml index 810664763..af3a5990e 100644 --- a/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_wildcard.yaml +++ b/tests/integration/targets/dcnm_bootflash/tests/dcnm_bootflash_query_wildcard.yaml @@ -153,7 +153,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "GET", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGCS", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGCS # "RETURN_CODE": 200 # }, # "172.22.150.113": { @@ -192,7 +194,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "GET", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGD0", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/imagemgnt/bootFlash/bootflash-info?serialNumber=FOX2109PGD0 # "RETURN_CODE": 200 # }, # "sequence_number": 1 @@ -216,21 +220,22 @@ - name: QUERY - TEST - Query {{ wildcard_filepath }} on active supervisor of switches. cisco.dcnm.dcnm_bootflash: - state: query - config: - targets: - - filepath: "{{ wildcard_filepath }}" - supervisor: active - switches: - - ip_address: "{{ switch1 }}" - - ip_address: "{{ switch2 }}" + state: query + config: + targets: + - filepath: "{{ wildcard_filepath }}" + supervisor: active + switches: + - ip_address: "{{ switch1 }}" + - ip_address: "{{ switch2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result - name: Prepare assert values for wildcard query - set_fact: + ansible.builtin.set_fact: switch1_filepath1: "bootflash:/{{ switch1_file1 }}" switch1_filepath2: "bootflash:/{{ switch1_file2 }}" switch1_filepath3: "bootflash:/{{ switch1_file3 }}" @@ -238,32 +243,33 @@ switch2_filepath2: "bootflash:/{{ switch2_file2 }}" switch2_filepath3: "bootflash:/{{ switch2_file3 }}" -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.diff[0][switch1][0].filepath == switch1_filepath1 - - result.diff[0][switch1][1].filepath == switch1_filepath2 - - result.diff[0][switch1][2].filepath == switch1_filepath3 - - result.diff[0][switch2][0].filepath == switch2_filepath1 - - result.diff[0][switch2][1].filepath == switch2_filepath2 - - result.diff[0][switch2][2].filepath == switch2_filepath3 - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - (result.diff[0] | length) == 3 - - (result.response | length) == 1 - - result.response[0][switch1].RETURN_CODE == 200 - - result.response[0][switch2].RETURN_CODE == 200 - - result.response[0][switch1].MESSAGE == "OK" - - result.response[0][switch2].MESSAGE == "OK" - - result.response[0][switch1].METHOD == "GET" - - result.response[0][switch2].METHOD == "GET" - - (result.metadata | length) == 1 - - result.metadata[0].action == "bootflash_info" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "query" - - (result.result | length) == 1 - - result.result[0][switch1].found == true - - result.result[0][switch2].found == true - - result.result[0][switch1].success == true - - result.result[0][switch2].success == true + - result.diff[0][switch1][0].filepath == switch1_filepath1 + - result.diff[0][switch1][1].filepath == switch1_filepath2 + - result.diff[0][switch1][2].filepath == switch1_filepath3 + - result.diff[0][switch2][0].filepath == switch2_filepath1 + - result.diff[0][switch2][1].filepath == switch2_filepath2 + - result.diff[0][switch2][2].filepath == switch2_filepath3 + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - (result.diff[0] | length) == 3 + - (result.response | length) == 1 + - result.response[0][switch1].RETURN_CODE == 200 + - result.response[0][switch2].RETURN_CODE == 200 + - result.response[0][switch1].MESSAGE == "OK" + - result.response[0][switch2].MESSAGE == "OK" + - result.response[0][switch1].METHOD == "GET" + - result.response[0][switch2].METHOD == "GET" + - (result.metadata | length) == 1 + - result.metadata[0].action == "bootflash_info" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "query" + - (result.result | length) == 1 + - result.result[0][switch1].found == true + - result.result[0][switch2].found == true + - result.result[0][switch1].success == true + - result.result[0][switch2].success == true diff --git a/tests/integration/targets/dcnm_fabric/defaults/main.yaml b/tests/integration/targets/dcnm_fabric/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_fabric/defaults/main.yaml +++ b/tests/integration/targets/dcnm_fabric/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_fabric/tasks/dcnm.yaml b/tests/integration/targets/dcnm_fabric/tasks/dcnm.yaml index e419fc865..8b35d98d4 100644 --- a/tests/integration/targets/dcnm_fabric/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_fabric/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_fabric/tasks/main.yaml b/tests/integration/targets/dcnm_fabric/tasks/main.yaml index fbcfa5803..2d33809f3 100644 --- a/tests/integration/targets/dcnm_fabric/tasks/main.yaml +++ b/tests/integration/targets/dcnm_fabric/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } +- name: Include dcnm.yaml + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic.yaml index df600cb30..1660010a1 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic.yaml @@ -5,7 +5,7 @@ # 00:49.83 ################################################################################ # DESCRIPTION - BASIC FABRIC DELETED STATE TEST -# +# # Test basic deletion of fabrics verify results. # - Deletion of populated fabrics not tested here. ################################################################################ @@ -73,7 +73,8 @@ - FABRIC_NAME: "{{ fabric_name_3 }}" - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create all supported fabric types @@ -204,9 +205,11 @@ BGP_AS: "65005" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -343,11 +346,14 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" - FABRIC_NAME: "{{ fabric_name_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- set_fact: +- name: Set fact + ansible.builtin.set_fact: TEST_PHRASE: "is deleted successfully" -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -455,11 +461,14 @@ - FABRIC_NAME: "{{ fabric_name_3 }}" - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- set_fact: +- name: Set fact + ansible.builtin.set_fact: TEST_PHRASE: "is deleted successfully" -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -536,9 +545,11 @@ - name: DELETED - TEST - Delete remaining fabrics (fabric_name_3, fabric_name_5) idempotence cisco.dcnm.dcnm_fabric: *fabric_deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_ipfm.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_ipfm.yaml index 2e0afbb71..102247aa4 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_ipfm.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_ipfm.yaml @@ -5,7 +5,7 @@ # 00:03.60 ################################################################################ # DESCRIPTION - BASIC FABRIC DELETED STATE TEST FOR IPFM -# +# # Test basic deletion of fabrics verify results. # - Deletion of populated fabrics not tested here. ################################################################################ @@ -50,7 +50,8 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create IPFM Fabric @@ -108,9 +109,11 @@ FABRIC_TYPE: "{{ fabric_type_4 }}" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -169,9 +172,11 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -232,9 +237,11 @@ - name: DELETED - TEST - Delete IPFM Fabric (fabric_name_4) and verify idempotence cisco.dcnm.dcnm_fabric: *fabric_deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_isn.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_isn.yaml index 4b682f237..8f40ae82a 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_isn.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_isn.yaml @@ -5,7 +5,7 @@ # 00:03.60 ################################################################################ # DESCRIPTION - BASIC FABRIC DELETED STATE TEST FOR ISN -# +# # Test basic deletion of fabrics and verify results. # - Deletion of populated fabrics not tested here. ################################################################################ @@ -50,7 +50,8 @@ config: - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create ISN Fabric @@ -112,9 +113,11 @@ BGP_AS: 65535 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -176,9 +179,11 @@ config: - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -240,9 +245,11 @@ - name: DELETED - TEST - Delete ISN Fabric (fabric_name_5) and verify idempotence cisco.dcnm.dcnm_fabric: *fabric_deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_lan_classic.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_lan_classic.yaml index 00816ca31..727546add 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_lan_classic.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_lan_classic.yaml @@ -5,7 +5,7 @@ # 00:49.83 ################################################################################ # DESCRIPTION - BASIC FABRIC DELETED STATE TEST -# +# # Test basic deletion of fabrics verify results. # - Deletion of populated fabrics not tested here. ################################################################################ @@ -49,7 +49,8 @@ config: - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create fabric_name_3 and verify @@ -178,9 +179,11 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -240,9 +243,11 @@ config: - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -303,9 +308,11 @@ - name: DELETED - TEST - Delete fabric_name_3 idempotence cisco.dcnm.dcnm_fabric: *fabric_deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_msd.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_msd.yaml index 9a4e21c7e..4f899cd64 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_msd.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_msd.yaml @@ -5,7 +5,7 @@ # 00:49.83 ################################################################################ # DESCRIPTION - BASIC FABRIC DELETED STATE TEST -# +# # Test basic deletion of fabrics verify results. # - Deletion of populated fabrics not tested here. ################################################################################ @@ -50,7 +50,8 @@ config: - FABRIC_NAME: "{{ fabric_name_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create all supported fabric types @@ -155,9 +156,11 @@ FABRIC_TYPE: "{{ fabric_type_2 }}" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -217,9 +220,11 @@ config: - FABRIC_NAME: "{{ fabric_name_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -280,9 +285,11 @@ - name: DELETED - TEST - Delete fabric_name_2 idempotence cisco.dcnm.dcnm_fabric: *fabric_deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_vxlan.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_vxlan.yaml index fbcd25be1..69f6bbbf0 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_vxlan.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_deleted_basic_vxlan.yaml @@ -5,7 +5,7 @@ # 00:49.83 ################################################################################ # DESCRIPTION - BASIC FABRIC DELETED STATE TEST -# +# # Test basic deletion of fabrics verify results. # - Deletion of populated fabrics not tested here. ################################################################################ @@ -50,7 +50,8 @@ config: - FABRIC_NAME: "{{ fabric_name_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create all supported fabric types @@ -111,9 +112,11 @@ BGP_AS: "65535.65534" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -174,9 +177,11 @@ config: - FABRIC_NAME: "{{ fabric_name_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -237,9 +242,11 @@ - name: DELETED - TEST - Delete fabric_name_1 idempotence cisco.dcnm.dcnm_fabric: *fabric_deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic.yaml index 571aa5c7c..3bc58eeb2 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic.yaml @@ -73,7 +73,8 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Create all supported fabric types with basic config @@ -200,9 +201,11 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -409,12 +412,14 @@ DEPLOY: false - FABRIC_NAME: "{{ fabric_name_2 }}" FABRIC_TYPE: "{{ fabric_type_2 }}" - ANYCAST_GW_MAC: aa:aa:bb:bb:cc:cc + ANYCAST_GW_MAC: "aa:aa:bb:bb:cc:cc" DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -597,9 +602,11 @@ SUBINTERFACE_RANGE: 2-101 DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -678,9 +685,11 @@ - name: MERGED - TEST - Merge additional config into fabric_3 - idempotence cisco.dcnm.dcnm_fabric: *merge_fabric_3 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -795,9 +804,11 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_ipfm.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_ipfm.yaml index 9eefa76e7..279fc71e1 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_ipfm.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_ipfm.yaml @@ -56,7 +56,8 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Create IPFM fabric type with basic config @@ -114,9 +115,11 @@ FABRIC_TYPE: "{{ fabric_type_4 }}" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -229,9 +232,11 @@ FABRIC_MTU: 1500 DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -319,9 +324,11 @@ - name: MERGED - TEST - Merge additional config into fabric_4 - idempotence cisco.dcnm.dcnm_fabric: *merge_fabric_4 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -388,9 +395,11 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_isn.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_isn.yaml index dc42832e3..723c995e0 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_isn.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_basic_isn.yaml @@ -56,7 +56,8 @@ config: - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Create ISN fabric type with basic config @@ -120,9 +121,11 @@ BGP_AS: 65535 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -258,9 +261,11 @@ LOOPBACK0_IP_RANGE: "10.2.0.0/22" DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -353,9 +358,11 @@ - name: MERGED - TEST - Merge additional config into fabric_5 - idempotence cisco.dcnm.dcnm_fabric: *merge_fabric_5 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -422,9 +429,11 @@ config: - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy.yaml index ae190a001..e069d3145 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy.yaml @@ -73,7 +73,8 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Create fabric types that support adding switches. @@ -173,9 +174,11 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -228,7 +231,8 @@ role: leaf preserve_config: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result - name: Merge leaf_2 into fabric_3 @@ -245,7 +249,8 @@ # preserve_config must be True for LAN_CLASSIC preserve_config: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Merge additional valid configs into fabric_1 and fabric_3 @@ -385,7 +390,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "POST", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/rest/control/fabrics/VXLAN_EVPN_Fabric/config-deploy?forceShowRun=false", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# rest/control/fabrics/VXLAN_EVPN_Fabric/config-deploy?forceShowRun=false # "RETURN_CODE": 200, # "sequence_number": 5 # }, @@ -395,7 +402,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "POST", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/rest/control/fabrics/LAN_CLASSIC_Fabric/config-deploy?forceShowRun=false", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# rest/control/fabrics/LAN_CLASSIC_Fabric/config-deploy?forceShowRun=false # "RETURN_CODE": 200, # "sequence_number": 6 # } @@ -450,9 +459,11 @@ SUBINTERFACE_RANGE: 2-101 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -584,9 +595,11 @@ - name: MERGED - TEST - Merge additional configs into fabric_1 and fabric_3 - idempotence cisco.dcnm.dcnm_fabric: *merge_fabric_1_3 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -614,9 +627,11 @@ state: deleted config: register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -624,15 +639,17 @@ - result.response[0].MESSAGE == "OK" - result.response[0].METHOD == "DELETE" - result.response[0].RETURN_CODE == 200 -- name: Delete switches from fabric_3 + - name: Delete switches from fabric_3 cisco.dcnm.dcnm_inventory: fabric: "{{ fabric_name_3 }}" state: deleted config: register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -712,9 +729,11 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy_ipfm.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy_ipfm.yaml index eae4f6274..a2f386375 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy_ipfm.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_merged_save_deploy_ipfm.yaml @@ -59,7 +59,8 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Create IPFM fabric type with basic config @@ -117,9 +118,11 @@ FABRIC_TYPE: "{{ fabric_type_4 }}" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -151,7 +154,8 @@ role: leaf preserve_config: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Merge additional valid configs into fabric_4 with DEPLOY true @@ -264,9 +268,11 @@ FABRIC_MTU: 1500 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -360,9 +366,11 @@ - name: MERGED - TEST - Merge additional config into fabric_4 - idempotence cisco.dcnm.dcnm_fabric: *merge_fabric_4 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -390,9 +398,11 @@ state: deleted config: register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -448,9 +458,11 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_query_basic.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_query_basic.yaml index 46577fefc..de53c4c6f 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_query_basic.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_query_basic.yaml @@ -71,7 +71,8 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # QUERY - TEST - Create all supported fabric types with basic config @@ -198,9 +199,11 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -262,7 +265,7 @@ # "ALLOW_NXC_PREV": "true", # "BOOTSTRAP_CONF": "", # "BOOTSTRAP_ENABLE": "false", -# "BOOTSTRAP_MULTISUBNET": "#Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", +# "BOOTSTRAP_MULTISUBNET": "# Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", # "BOOTSTRAP_MULTISUBNET_INTERNAL": "", # "CDP_ENABLE": "false", # "DCI_SUBNET_RANGE": "10.10.1.0/24", @@ -384,7 +387,7 @@ # "BOOTSTRAP_CONF": "", # "BOOTSTRAP_ENABLE": "false", # "BOOTSTRAP_ENABLE_PREV": "false", -# "BOOTSTRAP_MULTISUBNET": "#Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", +# "BOOTSTRAP_MULTISUBNET": "# Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", # "BOOTSTRAP_MULTISUBNET_INTERNAL": "", # "BRFIELD_DEBUG_FLAG": "Disable", # "BROWNFIELD_NETWORK_NAME_FORMAT": "Auto_Net_VNI$$VNI$$_VLAN$$VLAN_ID$$", @@ -809,7 +812,7 @@ # "ALLOW_NXC_PREV": "true", # "BOOTSTRAP_CONF": "", # "BOOTSTRAP_ENABLE": "false", -# "BOOTSTRAP_MULTISUBNET": "#Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", +# "BOOTSTRAP_MULTISUBNET": "# Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", # "BOOTSTRAP_MULTISUBNET_INTERNAL": "", # "CDP_ENABLE": "false", # "DCI_SUBNET_RANGE": "10.10.1.0/24", @@ -931,7 +934,7 @@ # "BOOTSTRAP_CONF": "", # "BOOTSTRAP_ENABLE": "false", # "BOOTSTRAP_ENABLE_PREV": "false", -# "BOOTSTRAP_MULTISUBNET": "#Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", +# "BOOTSTRAP_MULTISUBNET": "# Scope_Start_IP, Scope_End_IP, Scope_Default_Gateway, Scope_Subnet_Prefix", # "BOOTSTRAP_MULTISUBNET_INTERNAL": "", # "BRFIELD_DEBUG_FLAG": "Disable", # "BROWNFIELD_NETWORK_NAME_FORMAT": "Auto_Net_VNI$$VNI$$_VLAN$$VLAN_ID$$", @@ -1209,9 +1212,11 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -1331,9 +1336,11 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic.yaml index 9ccc34109..a5c2ac4f9 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic.yaml @@ -68,7 +68,8 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # REPLACED - TEST - Create all supported fabric types with non-default configs @@ -197,13 +198,13 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" FABRIC_TYPE: "{{ fabric_type_1 }}" ADVERTISE_PIP_BGP: true - ANYCAST_GW_MAC: 00:aa:bb:cc:dd:ee + ANYCAST_GW_MAC: "00:aa:bb:cc:dd:ee" BGP_AS: 65535 REPLICATION_MODE: Ingress DEPLOY: false - FABRIC_NAME: "{{ fabric_name_2 }}" FABRIC_TYPE: "{{ fabric_type_2 }}" - ANYCAST_GW_MAC: 00:aa:bb:cc:dd:ee + ANYCAST_GW_MAC: "00:aa:bb:cc:dd:ee" DEPLOY: true - FABRIC_NAME: "{{ fabric_name_3 }}" FABRIC_TYPE: "{{ fabric_type_3 }}" @@ -214,9 +215,11 @@ SUBINTERFACE_RANGE: 2-101 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -444,9 +447,11 @@ FABRIC_TYPE: "{{ fabric_type_2 }}" DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -637,9 +642,11 @@ IS_READ_ONLY: false DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -738,9 +745,11 @@ - name: REPLACED - TEST - Replace config for fabric_3 with default config - idempotence cisco.dcnm.dcnm_fabric: *replace_fabric_3 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -855,9 +864,11 @@ - FABRIC_NAME: "{{ fabric_name_2 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_ipfm.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_ipfm.yaml index 607da2e25..e6106f7ae 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_ipfm.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_ipfm.yaml @@ -51,7 +51,8 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # REPLACED - TEST - Create IPFM Fabric with non-default configs @@ -112,9 +113,11 @@ FABRIC_MTU: 1500 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -233,9 +236,11 @@ FABRIC_TYPE: "{{ fabric_type_4 }}" DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -323,9 +328,11 @@ - name: REPLACED - TEST - Replace config for fabric_4 with default config omnipotence cisco.dcnm.dcnm_fabric: *replace_fabric_4 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -392,9 +399,11 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_isn.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_isn.yaml index 044abcfec..427238cb2 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_isn.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_isn.yaml @@ -52,7 +52,8 @@ config: - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # REPLACED - TEST - Create ISN Fabric with non-default configs @@ -129,9 +130,11 @@ LOOPBACK0_IP_RANGE: "10.2.0.0/22" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -272,9 +275,11 @@ BGP_AS: 65005 DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -367,9 +372,11 @@ - name: REPLACED - TEST - Replace config for fabric_5 with default config omnipotence cisco.dcnm.dcnm_fabric: *replace_fabric_5 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -436,9 +443,11 @@ config: - FABRIC_NAME: "{{ fabric_name_5 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan.yaml index 1f12acf03..025f87107 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan.yaml @@ -52,7 +52,8 @@ config: - FABRIC_NAME: "{{ fabric_name_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # REPLACED - TEST - Create fabric_name_1 with non-default config @@ -117,14 +118,16 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" FABRIC_TYPE: "{{ fabric_type_1 }}" ADVERTISE_PIP_BGP: true - ANYCAST_GW_MAC: 00:aa:bb:cc:dd:ee + ANYCAST_GW_MAC: "00:aa:bb:cc:dd:ee" BGP_AS: 65535 REPLICATION_MODE: Ingress DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -251,9 +254,11 @@ BGP_AS: 65535 DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -347,9 +352,11 @@ - name: REPLACED - TEST - Replace config for fabric_1 with default config - idempotence cisco.dcnm.dcnm_fabric: *replace_fabric_1 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -416,9 +423,11 @@ config: - FABRIC_NAME: "{{ fabric_name_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan_site_id.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan_site_id.yaml index 980e42660..19a209d4b 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan_site_id.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_basic_vxlan_site_id.yaml @@ -52,7 +52,8 @@ config: - FABRIC_NAME: "{{ fabric_name_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # REPLACED - TEST - Create fabric_name_1 with non-default config @@ -121,16 +122,18 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" FABRIC_TYPE: "{{ fabric_type_1 }}" ADVERTISE_PIP_BGP: true - ANYCAST_GW_MAC: 00:aa:bb:cc:dd:ee + ANYCAST_GW_MAC: "00:aa:bb:cc:dd:ee" BGP_AS: 65535 REPLICATION_MODE: Ingress SITE_ID: 65000 UNDERLAY_IS_V6: false DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -263,9 +266,11 @@ BGP_AS: 65535 DEPLOY: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -360,9 +365,11 @@ - name: REPLACED - TEST - Replace config for fabric_1 with default config - idempotence cisco.dcnm.dcnm_fabric: *replace_fabric_1 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -429,9 +436,11 @@ config: - FABRIC_NAME: "{{ fabric_name_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy.yaml index 176a1d91b..3d7a7b030 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy.yaml @@ -75,7 +75,8 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -183,9 +184,11 @@ SUBINTERFACE_RANGE: 2-100 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -251,7 +254,8 @@ role: leaf preserve_config: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -271,7 +275,8 @@ # preserve_config must be True for LAN_CLASSIC preserve_config: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -353,7 +358,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "POST", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/rest/control/fabrics/VXLAN_EVPN_Fabric/config-deploy?forceShowRun=false", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# rest/control/fabrics/VXLAN_EVPN_Fabric/config-deploy?forceShowRun=false # "RETURN_CODE": 200, # "sequence_number": 3 # } @@ -387,9 +394,11 @@ BGP_AS: 65535 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -541,7 +550,9 @@ # }, # "MESSAGE": "OK", # "METHOD": "POST", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/rest/control/fabrics/LAN_CLASSIC_Fabric/config-deploy?forceShowRun=false", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# rest/control/fabrics/LAN_CLASSIC_Fabric/config-deploy?forceShowRun=false # "RETURN_CODE": 200, # "sequence_number": 3 # } @@ -576,9 +587,11 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -678,9 +691,11 @@ - name: REPLACED - TEST - Replace fabric_1 config with default config - idempotence cisco.dcnm.dcnm_fabric: *replace_fabric_1 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -743,9 +758,11 @@ - name: REPLACED - TEST - Replace fabric_3 config with default config - idempotence cisco.dcnm.dcnm_fabric: *replace_fabric_3 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -774,9 +791,11 @@ state: deleted config: register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -784,15 +803,17 @@ - result.response[0].MESSAGE == "OK" - result.response[0].METHOD == "DELETE" - result.response[0].RETURN_CODE == 200 -- name: Delete switches from fabric_3 + - name: Delete switches from fabric_3 cisco.dcnm.dcnm_inventory: fabric: "{{ fabric_name_3 }}" state: deleted config: register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -873,9 +894,11 @@ - FABRIC_NAME: "{{ fabric_name_1 }}" - FABRIC_NAME: "{{ fabric_name_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy_ipfm.yaml b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy_ipfm.yaml index 023151cf7..944996680 100644 --- a/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy_ipfm.yaml +++ b/tests/integration/targets/dcnm_fabric/tests/dcnm_fabric_replaced_save_deploy_ipfm.yaml @@ -68,7 +68,8 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -132,9 +133,11 @@ FABRIC_MTU: 1500 DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -173,7 +176,8 @@ role: leaf preserve_config: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -264,9 +268,11 @@ FABRIC_TYPE: "{{ fabric_type_4 }}" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -360,9 +366,11 @@ - name: REPLACED - TEST - Replace fabric_4 config with default config - idempotence cisco.dcnm.dcnm_fabric: *replace_fabric_4 register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false @@ -391,9 +399,11 @@ state: deleted config: register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -449,9 +459,11 @@ config: - FABRIC_NAME: "{{ fabric_name_4 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_fabric_group/defaults/main.yaml b/tests/integration/targets/dcnm_fabric_group/defaults/main.yaml index a78c9b09a..f762264ad 100644 --- a/tests/integration/targets/dcnm_fabric_group/defaults/main.yaml +++ b/tests/integration/targets/dcnm_fabric_group/defaults/main.yaml @@ -1,4 +1,4 @@ --- testcase: "*" fabric_group_name_1: MCFG1 -fabric_group_type_1: MCFG \ No newline at end of file +fabric_group_type_1: MCFG diff --git a/tests/integration/targets/dcnm_fabric_group/tasks/dcnm.yaml b/tests/integration/targets/dcnm_fabric_group/tasks/dcnm.yaml index e419fc865..f34edfe7e 100644 --- a/tests/integration/targets/dcnm_fabric_group/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_fabric_group/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set test_cases fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_fabric_group/tasks/main.yaml b/tests/integration/targets/dcnm_fabric_group/tasks/main.yaml index fbcfa5803..78e496d0b 100644 --- a/tests/integration/targets/dcnm_fabric_group/tasks/main.yaml +++ b/tests/integration/targets/dcnm_fabric_group/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } +- name: Include dcnm tasks + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_image_policy/defaults/main.yaml b/tests/integration/targets/dcnm_image_policy/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_image_policy/defaults/main.yaml +++ b/tests/integration/targets/dcnm_image_policy/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_image_policy/tasks/dcnm.yaml b/tests/integration/targets/dcnm_image_policy/tasks/dcnm.yaml index e419fc865..8b35d98d4 100644 --- a/tests/integration/targets/dcnm_image_policy/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_image_policy/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_image_policy/tasks/main.yaml b/tests/integration/targets/dcnm_image_policy/tasks/main.yaml index fbcfa5803..2d33809f3 100644 --- a/tests/integration/targets/dcnm_image_policy/tasks/main.yaml +++ b/tests/integration/targets/dcnm_image_policy/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } +- name: Include dcnm.yaml + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted.yaml b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted.yaml index 8bbb97fd0..016a2e85f 100644 --- a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted.yaml +++ b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted.yaml @@ -77,11 +77,12 @@ cisco.dcnm.dcnm_image_policy: state: deleted config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create two image policies and verify @@ -169,56 +170,58 @@ cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - platform: N9K - epld_image: "{{ epld_image_2 }}" - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + platform: N9K + epld_image: "{{ epld_image_2 }}" + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[0].epldImgName == epld_image_1 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[0].sequence_number == 1 - - result.diff[1].policyName == image_policy_2 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[1].sequence_number == 2 - - (result.metadata | length) == 2 - - result.metadata[0].action == "create" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "create" - - result.metadata[1].check_mode == False - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].sequence_number == 2 + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[0].epldImgName == epld_image_1 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[0].sequence_number == 1 + - result.diff[1].policyName == image_policy_2 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[1].sequence_number == 2 + - (result.metadata | length) == 2 + - result.metadata[0].action == "create" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "create" + - result.metadata[1].check_mode == False + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].sequence_number == 2 ################################################################################ # DELETED - TEST - Delete first image policy (image_policy_1) and verify @@ -266,33 +269,35 @@ # } - name: DELETED - TEST - Delete first image policy (image_policy_1) and verify cisco.dcnm.dcnm_image_policy: - state: deleted - config: + state: deleted + config: - name: KR5M register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - image_policy_1 in result.diff[0].policyNames - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - image_policy_1 in result.diff[0].policyNames + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true ################################################################################ # DELETED - TEST - Delete remaining policy (image_policy_2) and verify @@ -340,30 +345,32 @@ - name: DELETED - TEST - Delete remaining image policy (image_policy_2) and verify cisco.dcnm.dcnm_image_policy: - state: deleted - config: + state: deleted + config: - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - image_policy_2 in result.diff[0].policyNames - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - image_policy_2 in result.diff[0].policyNames + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true diff --git a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted_all_policies.yaml b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted_all_policies.yaml index b6f2f3e5d..e91176528 100644 --- a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted_all_policies.yaml +++ b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_deleted_all_policies.yaml @@ -79,11 +79,12 @@ cisco.dcnm.dcnm_image_policy: state: deleted config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # DELETED - TEST - Create two image policies and verify @@ -171,56 +172,58 @@ cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - platform: N9K - epld_image: "{{ epld_image_2 }}" - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + platform: N9K + epld_image: "{{ epld_image_2 }}" + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[0].epldImgName == epld_image_1 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[0].sequence_number == 1 - - result.diff[1].policyName == image_policy_2 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[1].sequence_number == 2 - - (result.metadata | length) == 2 - - result.metadata[0].action == "create" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "create" - - result.metadata[1].check_mode == False - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].sequence_number == 2 + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[0].epldImgName == epld_image_1 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[0].sequence_number == 1 + - result.diff[1].policyName == image_policy_2 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[1].sequence_number == 2 + - (result.metadata | length) == 2 + - result.metadata[0].action == "create" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "create" + - result.metadata[1].check_mode == False + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].sequence_number == 2 ################################################################################ # DELETED - TEST - Delete all image policies and verify the result @@ -267,29 +270,31 @@ # } - name: DELETED - TEST - Delete all image policies and verify the result cisco.dcnm.dcnm_image_policy: - state: deleted + state: deleted register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - image_policy_1 in result.diff[0].policyNames - - image_policy_2 in result.diff[0].policyNames - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - image_policy_1 in result.diff[0].policyNames + - image_policy_2 in result.diff[0].policyNames + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true diff --git a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_merged.yaml b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_merged.yaml index 65381e0c6..4e9645282 100644 --- a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_merged.yaml +++ b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_merged.yaml @@ -75,11 +75,12 @@ cisco.dcnm.dcnm_image_policy: state: deleted config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ # MERGED - TEST - Create two image policies using merged state @@ -165,132 +166,135 @@ cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - epld_image: "{{ epld_image_2 }}" - platform: N9K - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + epld_image: "{{ epld_image_2 }}" + platform: N9K + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].epldImgName == epld_image_1 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[0].platform == "N9K" - - result.diff[1].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - (result.metadata | length) == 2 - - result.metadata[0].action == "create" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "create" - - result.metadata[1].check_mode == False - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].DATA == "Policy created successfully." - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].DATA == "Policy created successfully." - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 - - result.result[1].changed == true - - result.result[1].success == true - - result.result[1].sequence_number == 2 - + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].epldImgName == epld_image_1 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[0].platform == "N9K" + - result.diff[1].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - (result.metadata | length) == 2 + - result.metadata[0].action == "create" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "create" + - result.metadata[1].check_mode == False + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].DATA == "Policy created successfully." + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].DATA == "Policy created successfully." + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 + - result.result[1].changed == true + - result.result[1].success == true + - result.result[1].sequence_number == 2 - name: MERGED - TEST - Edit the two image policies cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - description: "{{ image_policy_1 }} edited" - epld_image: "{{ epld_image_2 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }} edited" - epld_image: "" - platform: N9K - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + description: "{{ image_policy_1 }} edited" + epld_image: "{{ epld_image_2 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }} edited" + epld_image: "" + platform: N9K + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 + " edited" - - result.diff[1].policyDescr == image_policy_2 + " edited" - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].epldImgName == epld_image_2 - - result.diff[1].epldImgName == "" - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[0].platform == "N9K" - - result.diff[1].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - (result.metadata | length) == 2 - - result.metadata[0].action == "update" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "update" - - result.metadata[1].check_mode == False - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].DATA == "Policy updated successfully." - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].DATA == "Policy updated successfully." - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 - - result.result[1].changed == true - - result.result[1].success == true - - result.result[1].sequence_number == 2 + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + " edited" + - result.diff[1].policyDescr == image_policy_2 + " edited" + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].epldImgName == epld_image_2 + - result.diff[1].epldImgName == "" + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[0].platform == "N9K" + - result.diff[1].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - (result.metadata | length) == 2 + - result.metadata[0].action == "update" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "update" + - result.metadata[1].check_mode == False + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].DATA == "Policy updated successfully." + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].DATA == "Policy updated successfully." + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 + - result.result[1].changed == true + - result.result[1].success == true + - result.result[1].sequence_number == 2 ################################################################################ # MERGED - CLEANUP - Delete image policies @@ -344,28 +348,30 @@ - name: MERGED - CLEANUP - Delete image policies cisco.dcnm.dcnm_image_policy: - state: deleted - config: + state: deleted + config: - name: "{{ image_policy_1 }}" - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - image_policy_1 in result.diff[0].policyNames - - image_policy_2 in result.diff[0].policyNames - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - image_policy_1 in result.diff[0].policyNames + - image_policy_2 in result.diff[0].policyNames + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" diff --git a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_overridden.yaml b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_overridden.yaml index 02838c3f1..65e4e9683 100644 --- a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_overridden.yaml +++ b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_overridden.yaml @@ -86,11 +86,12 @@ cisco.dcnm.dcnm_image_policy: state: deleted config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -177,76 +178,78 @@ cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - packages: - install: - - "{{ install_package_1 }}" - uninstall: - - "{{ uninstall_package_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - epld_image: "{{ epld_image_2 }}" - platform: N9K - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + packages: + install: + - "{{ install_package_1 }}" + uninstall: + - "{{ uninstall_package_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + epld_image: "{{ epld_image_2 }}" + platform: N9K + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].packageName == install_package_1 - - result.diff[0].rpmimages == uninstall_package_1 - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].epldImgName == epld_image_1 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[0].platform == "N9K" - - result.diff[1].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - result.diff[0].sequence_number == 1 - - result.diff[1].sequence_number == 2 - - (result.metadata | length) == 2 - - result.metadata[0].action == "create" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "create" - - result.metadata[1].check_mode == false - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].sequence_number == 2 - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].changed == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].packageName == install_package_1 + - result.diff[0].rpmimages == uninstall_package_1 + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].epldImgName == epld_image_1 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[0].platform == "N9K" + - result.diff[1].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - result.diff[0].sequence_number == 1 + - result.diff[1].sequence_number == 2 + - (result.metadata | length) == 2 + - result.metadata[0].action == "create" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "create" + - result.metadata[1].check_mode == false + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].sequence_number == 2 + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].changed == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true ################################################################################ # OVERRIDDEN - TEST - override image_policy_1 which will delete image_policy_2 @@ -326,60 +329,62 @@ cisco.dcnm.dcnm_image_policy: state: overridden config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }} overridden" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }} overridden" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - image_policy_2 in result.diff[0].policyNames - - result.diff[0].sequence_number == 1 - - result.diff[1].agnostic == false - - result.diff[1].packageName == "" - - result.diff[1].rpmimages == "" - - result.diff[1].policyName == image_policy_1 - - result.diff[1].policyDescr == image_policy_1 + " overridden" - - result.diff[1].epldImgName == epld_image_1 - - result.diff[1].nxosVersion == nxos_release_1 - - result.diff[1].platform == "N9K" - - result.diff[1].policyType == "PLATFORM" - - result.diff[1].sequence_number == 2 - - (result.metadata | length) == 2 - - result.metadata[0].action == "delete" - - result.metadata[1].action == "replace" - - result.metadata[0].state == "overridden" - - result.metadata[1].state == "overridden" - - result.metadata[0].check_mode == False - - result.metadata[1].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[1].sequence_number == 2 - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].sequence_number == 2 - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].changed == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - image_policy_2 in result.diff[0].policyNames + - result.diff[0].sequence_number == 1 + - result.diff[1].agnostic == false + - result.diff[1].packageName == "" + - result.diff[1].rpmimages == "" + - result.diff[1].policyName == image_policy_1 + - result.diff[1].policyDescr == image_policy_1 + " overridden" + - result.diff[1].epldImgName == epld_image_1 + - result.diff[1].nxosVersion == nxos_release_1 + - result.diff[1].platform == "N9K" + - result.diff[1].policyType == "PLATFORM" + - result.diff[1].sequence_number == 2 + - (result.metadata | length) == 2 + - result.metadata[0].action == "delete" + - result.metadata[1].action == "replace" + - result.metadata[0].state == "overridden" + - result.metadata[1].state == "overridden" + - result.metadata[0].check_mode == False + - result.metadata[1].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[1].sequence_number == 2 + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].sequence_number == 2 + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].changed == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true ################################################################################ # OVERRIDDEN - TEST - query image policies and verify results @@ -466,42 +471,44 @@ cisco.dcnm.dcnm_image_policy: state: query config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - result.diff[0].agnostic == false - - result.diff[0].packageName == "" - - result.diff[0].rpmimages == "" - - result.diff[0].policyName == image_policy_1 - - result.diff[0].policyDescr == image_policy_1 + " overridden" - - result.diff[0].epldImgName == epld_image_1 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[0].platform == "N9K/N3K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[0].ref_count == 0 - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0].action == "query" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "query" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "GET" - - result.response[0].RETURN_CODE == 200 - - (result.result | length) == 1 - - result.result[0].found == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - result.diff[0].agnostic == false + - result.diff[0].packageName == "" + - result.diff[0].rpmimages == "" + - result.diff[0].policyName == image_policy_1 + - result.diff[0].policyDescr == image_policy_1 + " overridden" + - result.diff[0].epldImgName == epld_image_1 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[0].platform == "N9K/N3K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[0].ref_count == 0 + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0].action == "query" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "query" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "GET" + - result.response[0].RETURN_CODE == 200 + - (result.result | length) == 1 + - result.result[0].found == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true ################################################################################ # OVERRIDDEN - CLEANUP - Delete image policies and verify @@ -548,34 +555,36 @@ # } - name: OVERRIDDEN - CLEANUP - Delete image policies and verify cisco.dcnm.dcnm_image_policy: - state: deleted - config: + state: deleted + config: - name: "{{ image_policy_1 }}" - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - result.diff[0].sequence_number == 1 - - image_policy_1 in result.diff[0].policyNames - - image_policy_2 not in result.diff[0].policyNames - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - result.diff[0].sequence_number == 1 + - image_policy_1 in result.diff[0].policyNames + - image_policy_2 not in result.diff[0].policyNames + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true diff --git a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_query.yaml b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_query.yaml index 8cbbf55b1..2c173adc5 100644 --- a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_query.yaml +++ b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_query.yaml @@ -80,11 +80,12 @@ cisco.dcnm.dcnm_image_policy: state: deleted config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -169,67 +170,69 @@ cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - epld_image: "{{ epld_image_2 }}" - platform: N9K - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + epld_image: "{{ epld_image_2 }}" + platform: N9K + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].epldImgName == epld_image_1 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[0].platform == "N9K" - - result.diff[1].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - (result.metadata | length) == 2 - - result.metadata[0].action == "create" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "create" - - result.metadata[1].check_mode == false - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].sequence_number == 2 - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].changed == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].epldImgName == epld_image_1 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[0].platform == "N9K" + - result.diff[1].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - (result.metadata | length) == 2 + - result.metadata[0].action == "create" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "create" + - result.metadata[1].check_mode == false + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].sequence_number == 2 + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].changed == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true ################################################################################ # QUERY - TEST - query image policies and verify results @@ -412,57 +415,59 @@ cisco.dcnm.dcnm_image_policy: state: query config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].epldImgName == epld_image_1 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[0].platform == "N9K/N3K" - - result.diff[1].platform == "N9K/N3K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - result.diff[0].ref_count == 0 - - result.diff[1].ref_count == 0 - - result.diff[0].sequence_number == 1 - - result.diff[1].sequence_number == 2 - - (result.metadata | length) == 2 - - result.metadata[0].action == "query" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "query" - - result.metadata[1].action == "query" - - result.metadata[1].check_mode == false - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "query" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "GET" - - result.response[0].RETURN_CODE == 200 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "GET" - - result.response[1].RETURN_CODE == 200 - - (result.result | length) == 2 - - result.result[0].found == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].found == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == false + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].epldImgName == epld_image_1 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[0].platform == "N9K/N3K" + - result.diff[1].platform == "N9K/N3K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - result.diff[0].ref_count == 0 + - result.diff[1].ref_count == 0 + - result.diff[0].sequence_number == 1 + - result.diff[1].sequence_number == 2 + - (result.metadata | length) == 2 + - result.metadata[0].action == "query" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "query" + - result.metadata[1].action == "query" + - result.metadata[1].check_mode == false + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "query" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "GET" + - result.response[0].RETURN_CODE == 200 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "GET" + - result.response[1].RETURN_CODE == 200 + - (result.result | length) == 2 + - result.result[0].found == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].found == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true ################################################################################ # QUERY - CLEANUP - Delete image policies and verify @@ -511,34 +516,36 @@ - name: QUERY - CLEANUP - Delete image policies and verify cisco.dcnm.dcnm_image_policy: - state: deleted - config: + state: deleted + config: - name: "{{ image_policy_1 }}" - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - image_policy_1 in result.diff[0].policyNames - - image_policy_2 in result.diff[0].policyNames - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - image_policy_1 in result.diff[0].policyNames + - image_policy_2 in result.diff[0].policyNames + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true diff --git a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_replaced.yaml b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_replaced.yaml index 0298dc724..00dd79f86 100644 --- a/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_replaced.yaml +++ b/tests/integration/targets/dcnm_image_policy/tests/dcnm_image_policy_replaced.yaml @@ -85,11 +85,12 @@ cisco.dcnm.dcnm_image_policy: state: deleted config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -175,67 +176,69 @@ cisco.dcnm.dcnm_image_policy: state: merged config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - epld_image: "{{ epld_image_2 }}" - platform: N9K - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + epld_image: "{{ epld_image_2 }}" + platform: N9K + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].epldImgName == epld_image_1 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[0].platform == "N9K" - - result.diff[1].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - (result.metadata | length) == 2 - - result.metadata[0].action == "create" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "merged" - - result.metadata[1].action == "create" - - result.metadata[1].check_mode == False - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "merged" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].sequence_number == 2 - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].changed == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].epldImgName == epld_image_1 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[0].platform == "N9K" + - result.diff[1].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - (result.metadata | length) == 2 + - result.metadata[0].action == "create" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "merged" + - result.metadata[1].action == "create" + - result.metadata[1].check_mode == False + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "merged" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].sequence_number == 2 + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].changed == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true ################################################################################ # REPLACED - TEST - replace image_policy_1, will leave image_policy_2 untouched @@ -292,45 +295,47 @@ cisco.dcnm.dcnm_image_policy: state: replaced config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }} replaced" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }} replaced" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - result.diff[0].agnostic == false - - result.diff[0].policyName == image_policy_1 - - result.diff[0].policyDescr == image_policy_1 + " replaced" - - result.diff[0].epldImgName == epld_image_1 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[0].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0].action == "replace" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "replaced" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - result.diff[0].agnostic == false + - result.diff[0].policyName == image_policy_1 + - result.diff[0].policyDescr == image_policy_1 + " replaced" + - result.diff[0].epldImgName == epld_image_1 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[0].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0].action == "replace" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "replaced" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true ################################################################################ # REPLACED - TEST - query image policies and verify results @@ -514,57 +519,59 @@ cisco.dcnm.dcnm_image_policy: state: query config: - - name: "{{ image_policy_1 }}" - - name: "{{ image_policy_2 }}" + - name: "{{ image_policy_1 }}" + - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 + " replaced" - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].epldImgName == epld_image_1 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[0].platform == "N9K/N3K" - - result.diff[1].platform == "N9K/N3K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - result.diff[0].ref_count == 0 - - result.diff[1].ref_count == 0 - - result.diff[0].sequence_number == 1 - - result.diff[1].sequence_number == 2 - - (result.metadata | length) == 2 - - result.metadata[0].action == "query" - - result.metadata[0].check_mode == false - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "query" - - result.metadata[1].action == "query" - - result.metadata[1].check_mode == false - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "query" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "GET" - - result.response[0].RETURN_CODE == 200 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "GET" - - result.response[1].RETURN_CODE == 200 - - (result.result | length) == 2 - - result.result[0].found == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].found == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == false + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + " replaced" + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].epldImgName == epld_image_1 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[0].platform == "N9K/N3K" + - result.diff[1].platform == "N9K/N3K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - result.diff[0].ref_count == 0 + - result.diff[1].ref_count == 0 + - result.diff[0].sequence_number == 1 + - result.diff[1].sequence_number == 2 + - (result.metadata | length) == 2 + - result.metadata[0].action == "query" + - result.metadata[0].check_mode == false + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "query" + - result.metadata[1].action == "query" + - result.metadata[1].check_mode == false + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "query" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "GET" + - result.response[0].RETURN_CODE == 200 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "GET" + - result.response[1].RETURN_CODE == 200 + - (result.result | length) == 2 + - result.result[0].found == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].found == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true ################################################################################ # REPLACED - CLEANUP - Delete image policies and verify @@ -614,33 +621,35 @@ - name: REPLACED - CLEANUP - Delete image policies and verify cisco.dcnm.dcnm_image_policy: - state: deleted - config: + state: deleted + config: - name: "{{ image_policy_1 }}" - name: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - image_policy_1 in result.diff[0].policyNames - - image_policy_2 in result.diff[0].policyNames - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0].action == "delete" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "deleted" - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].RETURN_CODE == 200 - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - image_policy_1 in result.diff[0].policyNames + - image_policy_2 in result.diff[0].policyNames + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0].action == "delete" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "deleted" + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].RETURN_CODE == 200 + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true diff --git a/tests/integration/targets/dcnm_image_upgrade/defaults/main.yaml b/tests/integration/targets/dcnm_image_upgrade/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_image_upgrade/defaults/main.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_image_upgrade/tasks/dcnm.yaml b/tests/integration/targets/dcnm_image_upgrade/tasks/dcnm.yaml index e419fc865..8b35d98d4 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_image_upgrade/tasks/main.yaml b/tests/integration/targets/dcnm_image_upgrade/tasks/main.yaml index f3ccb253f..2d33809f3 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tasks/main.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include dcnm.yaml + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/00_setup_create_fabric.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/00_setup_create_fabric.yaml index 5bb1ffe05..662711a1f 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/00_setup_create_fabric.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/00_setup_create_fabric.yaml @@ -84,9 +84,11 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/01_setup_add_switches_to_fabric.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/01_setup_add_switches_to_fabric.yaml index 6e75edc65..472424908 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/01_setup_add_switches_to_fabric.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/01_setup_add_switches_to_fabric.yaml @@ -31,28 +31,30 @@ password: "{{ switch_password }}" max_hops: 0 role: leaf - preserve_config: True + preserve_config: true - seed_ip: "{{ ansible_switch_2 }}" auth_proto: MD5 user_name: "{{ switch_username }}" password: "{{ switch_password }}" max_hops: 0 role: leaf - preserve_config: True + preserve_config: true - seed_ip: "{{ ansible_switch_3 }}" auth_proto: MD5 user_name: "{{ switch_username }}" password: "{{ switch_password }}" max_hops: 0 role: spine - preserve_config: True + preserve_config: true register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true -- assert: +- name: Assert response codes + ansible.builtin.assert: that: - - item["RETURN_CODE"] == 200 - loop: '{{ result.response }}' + - item["RETURN_CODE"] == 200 + loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/02_setup_replace_image_policies.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/02_setup_replace_image_policies.yaml index f16e1c1cf..d64ebf9ac 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/02_setup_replace_image_policies.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/02_setup_replace_image_policies.yaml @@ -27,64 +27,66 @@ cisco.dcnm.dcnm_image_policy: state: replaced config: - - name: "{{ image_policy_1 }}" - agnostic: false - description: "{{ image_policy_1 }}" - epld_image: "{{ epld_image_1 }}" - platform: N9K - release: "{{ nxos_release_1 }}" - type: PLATFORM - - name: "{{ image_policy_2 }}" - description: "{{ image_policy_2 }}" - epld_image: "{{ epld_image_2 }}" - platform: N9K - release: "{{ nxos_release_2 }}" + - name: "{{ image_policy_1 }}" + agnostic: false + description: "{{ image_policy_1 }}" + epld_image: "{{ epld_image_1 }}" + platform: N9K + release: "{{ nxos_release_1 }}" + type: PLATFORM + - name: "{{ image_policy_2 }}" + description: "{{ image_policy_2 }}" + epld_image: "{{ epld_image_2 }}" + platform: N9K + release: "{{ nxos_release_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 2 - - result.diff[0].policyName == image_policy_1 - - result.diff[1].policyName == image_policy_2 - - result.diff[0].policyDescr == image_policy_1 - - result.diff[1].policyDescr == image_policy_2 - - result.diff[0].agnostic == false - - result.diff[1].agnostic == false - - result.diff[0].epldImgName == epld_image_1 - - result.diff[1].epldImgName == epld_image_2 - - result.diff[0].nxosVersion == nxos_release_1 - - result.diff[1].nxosVersion == nxos_release_2 - - result.diff[0].platform == "N9K" - - result.diff[1].platform == "N9K" - - result.diff[0].policyType == "PLATFORM" - - result.diff[1].policyType == "PLATFORM" - - (result.metadata | length) == 2 - - result.metadata[0].action == "replace" - - result.metadata[0].check_mode == False - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "replaced" - - result.metadata[1].action == "replace" - - result.metadata[1].check_mode == False - - result.metadata[1].sequence_number == 2 - - result.metadata[1].state == "replaced" - - (result.response | length) == 2 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "POST" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - result.response[1].MESSAGE == "OK" - - result.response[1].METHOD == "POST" - - result.response[1].RETURN_CODE == 200 - - result.response[1].sequence_number == 2 - - (result.result | length) == 2 - - result.result[0].changed == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true - - result.result[1].changed == true - - result.result[1].sequence_number == 2 - - result.result[1].success == true + - result.changed == true + - result.failed == false + - (result.diff | length) == 2 + - result.diff[0].policyName == image_policy_1 + - result.diff[1].policyName == image_policy_2 + - result.diff[0].policyDescr == image_policy_1 + - result.diff[1].policyDescr == image_policy_2 + - result.diff[0].agnostic == false + - result.diff[1].agnostic == false + - result.diff[0].epldImgName == epld_image_1 + - result.diff[1].epldImgName == epld_image_2 + - result.diff[0].nxosVersion == nxos_release_1 + - result.diff[1].nxosVersion == nxos_release_2 + - result.diff[0].platform == "N9K" + - result.diff[1].platform == "N9K" + - result.diff[0].policyType == "PLATFORM" + - result.diff[1].policyType == "PLATFORM" + - (result.metadata | length) == 2 + - result.metadata[0].action == "replace" + - result.metadata[0].check_mode == False + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "replaced" + - result.metadata[1].action == "replace" + - result.metadata[1].check_mode == False + - result.metadata[1].sequence_number == 2 + - result.metadata[1].state == "replaced" + - (result.response | length) == 2 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "POST" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + - result.response[1].MESSAGE == "OK" + - result.response[1].METHOD == "POST" + - result.response[1].RETURN_CODE == 200 + - result.response[1].sequence_number == 2 + - (result.result | length) == 2 + - result.result[0].changed == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true + - result.result[1].changed == true + - result.result[1].sequence_number == 2 + - result.result[1].success == true diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/deleted.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/deleted.yaml index 6f9f95935..8a95f58e2 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/deleted.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/deleted.yaml @@ -11,7 +11,7 @@ # # SETUP (these should be run prior to running this playbook) # 1. Run 00_setup_create_fabric.yaml -# 2. Run 01_setup_add_switches_to_fabric +# 2. Run 01_setup_add_switches_to_fabric # 3. Run 02_setup_replace_image_policies # PRE_TEST (this playbook) # 4. DELETED - PRE_TEST - Upgrade all switches using global config. @@ -67,33 +67,34 @@ cisco.dcnm.dcnm_image_upgrade: &global_config state: merged config: - policy: "{{ image_policy_1 }}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - - ip_address: "{{ ansible_switch_3 }}" + policy: "{{ image_policy_1 }}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -104,7 +105,7 @@ cisco.dcnm.dcnm_image_upgrade: state: query config: - switches: + switches: - ip_address: "{{ ansible_switch_1 }}" - ip_address: "{{ ansible_switch_2 }}" - ip_address: "{{ ansible_switch_3 }}" @@ -115,7 +116,7 @@ - ansible_switch_3 in result.diff[0] retries: 60 delay: 5 - ignore_errors: yes + ignore_errors: true ################################################################################ # DELETED - TEST - Detach policies from two switches and verify. @@ -159,7 +160,9 @@ # "DATA": "Successfully detach the policy from device.", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/policymgnt/detach-policy?serialNumber=FDO211218GC,FDO211218HH", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/policymgnt/detach-policy?serialNumber=FDO211218GC,FDO211218HH # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -176,39 +179,41 @@ ################################################################################ - name: DELETED - TEST - Detach policies from two switches and verify. cisco.dcnm.dcnm_image_upgrade: - state: deleted - config: - policy: "{{ image_policy_1 }}" - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" + state: deleted + config: + policy: "{{ image_policy_1 }}" + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - result.diff[0][ansible_switch_1]["action"] == "image_policy_detach" - - result.diff[0][ansible_switch_2]["action"] == "image_policy_detach" - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0]["action"] == "image_policy_detach" - - result.metadata[0]["check_mode"] == false - - result.metadata[0]["state"] == "deleted" - - result.metadata[0]["sequence_number"] == 1 - - (result.response | length) == 1 - - result.response[0].RETURN_CODE == 200 - - result.response[0].DATA == "Successfully detach the policy from device." - - result.response[0].METHOD == "DELETE" - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - result.diff[0][ansible_switch_1]["action"] == "image_policy_detach" + - result.diff[0][ansible_switch_2]["action"] == "image_policy_detach" + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0]["action"] == "image_policy_detach" + - result.metadata[0]["check_mode"] == false + - result.metadata[0]["state"] == "deleted" + - result.metadata[0]["sequence_number"] == 1 + - (result.response | length) == 1 + - result.response[0].RETURN_CODE == 200 + - result.response[0].DATA == "Successfully detach the policy from device." + - result.response[0].METHOD == "DELETE" + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 ################################################################################ # DELETED - TEST - Detach policies from remaining switch and verify. @@ -244,7 +249,9 @@ # "DATA": "Successfully detach the policy from device.", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/policymgnt/detach-policy?serialNumber=FOX2109PGD0", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/policymgnt/detach-policy?serialNumber=FOX2109PGD0 # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -261,37 +268,39 @@ ################################################################################ - name: DELETED - TEST - Detach policies from remaining switch and verify. cisco.dcnm.dcnm_image_upgrade: - state: deleted - config: - policy: "{{ image_policy_1 }}" - switches: - - ip_address: "{{ ansible_switch_3 }}" + state: deleted + config: + policy: "{{ image_policy_1 }}" + switches: + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - (result.diff | length) == 1 - - result.diff[0][ansible_switch_3]["action"] == "image_policy_detach" - - result.diff[0].sequence_number == 1 - - (result.metadata | length) == 1 - - result.metadata[0]["action"] == "image_policy_detach" - - result.metadata[0]["check_mode"] == false - - result.metadata[0]["state"] == "deleted" - - result.metadata[0]["sequence_number"] == 1 - - (result.response | length) == 1 - - result.response[0].RETURN_CODE == 200 - - result.response[0].DATA == "Successfully detach the policy from device." - - result.response[0].METHOD == "DELETE" - - result.response[0].sequence_number == 1 - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == true + - result.failed == false + - (result.diff | length) == 1 + - result.diff[0][ansible_switch_3]["action"] == "image_policy_detach" + - result.diff[0].sequence_number == 1 + - (result.metadata | length) == 1 + - result.metadata[0]["action"] == "image_policy_detach" + - result.metadata[0]["check_mode"] == false + - result.metadata[0]["state"] == "deleted" + - result.metadata[0]["sequence_number"] == 1 + - (result.response | length) == 1 + - result.response[0].RETURN_CODE == 200 + - result.response[0].DATA == "Successfully detach the policy from device." + - result.response[0].METHOD == "DELETE" + - result.response[0].sequence_number == 1 + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 ################################################################################ # CLEANUP @@ -299,4 +308,4 @@ # Run 03_cleanup_remove_devices_from_fabric.yaml # Run 04_cleanup_delete_image_policies.yaml # Run 05_cleanup_delete_fabric.yaml -################################################################################ \ No newline at end of file +################################################################################ diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/deleted_1x_switch.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/deleted_1x_switch.yaml index b8ec0ecd8..3f8a4e867 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/deleted_1x_switch.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/deleted_1x_switch.yaml @@ -11,7 +11,7 @@ # # SETUP (these should be run prior to running this playbook) # 1. Run 00_setup_create_fabric.yaml -# 2. Run 01_setup_add_switches_to_fabric +# 2. Run 01_setup_add_switches_to_fabric # 3. Run 02_setup_replace_image_policies # PRE_TEST (this playbook) # 4. DELETED - PRE_TEST - Upgrade all switches using global config. @@ -67,31 +67,32 @@ cisco.dcnm.dcnm_image_upgrade: &global_config state: merged config: - policy: "{{ image_policy_1 }}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" + policy: "{{ image_policy_1 }}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -102,14 +103,14 @@ cisco.dcnm.dcnm_image_upgrade: state: query config: - switches: + switches: - ip_address: "{{ ansible_switch_1 }}" register: result until: - ansible_switch_1 in result.diff[0] retries: 60 delay: 5 - ignore_errors: yes + ignore_errors: true ################################################################################ # DELETED - TEST - Detach policy from switch and verify. @@ -145,7 +146,9 @@ # "DATA": "Successfully detach the policy from device.", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/policymgnt/detach-policy?serialNumber=FDO211218GC", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/policymgnt/detach-policy?serialNumber=FDO211218GC # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -169,10 +172,12 @@ - ip_address: "{{ ansible_switch_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == true - result.failed == false @@ -201,4 +206,4 @@ # Run 03_cleanup_remove_devices_from_fabric.yaml # Run 04_cleanup_delete_image_policies.yaml # Run 05_cleanup_delete_fabric.yaml -################################################################################ \ No newline at end of file +################################################################################ diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/merged_global_config.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/merged_global_config.yaml index 19fbbb71b..d2ecdaaa3 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/merged_global_config.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/merged_global_config.yaml @@ -9,7 +9,7 @@ # All switches use the same image policy and the configuration specifics # are all specified in the global config stanza. # -# To minimize runtime, we use preserve_config: True during SETUP +# To minimize runtime, we use preserve_config: true during SETUP ################################################################################ # ################################################################################ @@ -27,7 +27,7 @@ # # SETUP (these should be run prior to running this playbook) # 1. Run 00_setup_create_fabric.yaml -# 2. Run 01_setup_add_switches_to_fabric +# 2. Run 01_setup_add_switches_to_fabric # 3. Run 02_setup_replace_image_policies # PRE_TEST (this playbook) # 4. MERGED - PRE_TEST - Upgrade all switches using global config. @@ -75,7 +75,7 @@ # MERGED - PRE_TEST - Detach image policies from all switches. # NOTES: # 1. Depending on whether the switches have policies attached, the -# detach operation may not be performed. Hence, we simply print the +# detach operation may not be performed. Hence, we simply print the # result and do not verify it. ################################################################################ @@ -89,7 +89,8 @@ - ip_address: "{{ ansible_switch_2 }}" - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -98,7 +99,7 @@ # 1. Images may or may not be staged depending on the current state of the # switches. Test only that the upgrade operation is successful. # 2. Since we detached the image policies, image validation will be -# performed, so we do test for this. +# performed, so we do test for this. ################################################################################ - name: MERGED - TEST - Upgrade all switches using global config. @@ -131,7 +132,8 @@ - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -153,7 +155,7 @@ - ansible_switch_3 in result.diff[0] retries: 60 delay: 5 - ignore_errors: yes + ignore_errors: true ################################################################################ # MERGED - TEST - global_config - test idempotence. @@ -260,9 +262,11 @@ - ip_address: "{{ ansible_switch_2 }}" - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.changed == false - result.failed == false diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/merged_override_global_config.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/merged_override_global_config.yaml index a9a280b9b..08dde891a 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/merged_override_global_config.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/merged_override_global_config.yaml @@ -24,7 +24,7 @@ # # SETUP (these should be run prior to running this playbook) # 1. Run 00_setup_create_fabric.yaml -# 2. Run 01_setup_add_switches_to_fabric +# 2. Run 01_setup_add_switches_to_fabric # 3. Run 02_setup_replace_image_policies # PRE_TEST (this playbook) # 4. MERGED - PRE_TEST - Upgrade all switches using switch config to override global config. @@ -80,36 +80,37 @@ cisco.dcnm.dcnm_image_upgrade: state: merged config: - policy: "{{ image_policy_1}}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" - policy: "{{ image_policy_2 }}" - - ip_address: "{{ ansible_switch_2 }}" - policy: "{{ image_policy_2 }}" - - ip_address: "{{ ansible_switch_3 }}" - policy: "{{ image_policy_2 }}" + policy: "{{ image_policy_1}}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" + policy: "{{ image_policy_2 }}" + - ip_address: "{{ ansible_switch_2 }}" + policy: "{{ image_policy_2 }}" + - ip_address: "{{ ansible_switch_3 }}" + policy: "{{ image_policy_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -120,7 +121,7 @@ cisco.dcnm.dcnm_image_upgrade: state: query config: - switches: + switches: - ip_address: "{{ ansible_switch_1 }}" - ip_address: "{{ ansible_switch_2 }}" - ip_address: "{{ ansible_switch_3 }}" @@ -131,9 +132,10 @@ - ansible_switch_3 in result.diff[0] retries: 60 delay: 5 - ignore_errors: yes + ignore_errors: true -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -156,43 +158,44 @@ cisco.dcnm.dcnm_image_upgrade: state: merged config: - policy: "{{ image_policy_1}}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" - policy: "{{ image_policy_2 }}" - - ip_address: "{{ ansible_switch_2 }}" - policy: "{{ image_policy_2 }}" - - ip_address: "{{ ansible_switch_3 }}" - policy: "{{ image_policy_2 }}" + policy: "{{ image_policy_1}}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" + policy: "{{ image_policy_2 }}" + - ip_address: "{{ ansible_switch_2 }}" + policy: "{{ image_policy_2 }}" + - ip_address: "{{ ansible_switch_3 }}" + policy: "{{ image_policy_2 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 6 - - (result.metadata | length) == 6 - - (result.response | length) == 6 - - (result.result | length) == 6 + - result.changed == false + - result.failed == false + - (result.diff | length) == 6 + - (result.metadata | length) == 6 + - (result.response | length) == 6 + - (result.result | length) == 6 ################################################################################ # MERGED - TEST - Upgrade all switches to image_policy_1 using switch config to override global config. @@ -202,36 +205,37 @@ cisco.dcnm.dcnm_image_upgrade: state: merged config: - policy: "{{ image_policy_2}}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" - policy: "{{ image_policy_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - policy: "{{ image_policy_1 }}" - - ip_address: "{{ ansible_switch_3 }}" - policy: "{{ image_policy_1 }}" + policy: "{{ image_policy_2}}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" + policy: "{{ image_policy_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + policy: "{{ image_policy_1 }}" + - ip_address: "{{ ansible_switch_3 }}" + policy: "{{ image_policy_1 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -242,7 +246,7 @@ cisco.dcnm.dcnm_image_upgrade: state: query config: - switches: + switches: - ip_address: "{{ ansible_switch_1 }}" - ip_address: "{{ ansible_switch_2 }}" - ip_address: "{{ ansible_switch_3 }}" @@ -253,9 +257,10 @@ - ansible_switch_3 in result.diff[0] retries: 60 delay: 5 - ignore_errors: yes + ignore_errors: true -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -276,43 +281,44 @@ cisco.dcnm.dcnm_image_upgrade: state: merged config: - policy: "{{ image_policy_2}}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" - policy: "{{ image_policy_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - policy: "{{ image_policy_1 }}" - - ip_address: "{{ ansible_switch_3 }}" - policy: "{{ image_policy_1 }}" + policy: "{{ image_policy_2}}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" + policy: "{{ image_policy_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + policy: "{{ image_policy_1 }}" + - ip_address: "{{ ansible_switch_3 }}" + policy: "{{ image_policy_1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 6 - - (result.metadata | length) == 6 - - (result.response | length) == 6 - - (result.result | length) == 6 + - result.changed == false + - result.failed == false + - (result.diff | length) == 6 + - (result.metadata | length) == 6 + - (result.response | length) == 6 + - (result.result | length) == 6 ################################################################################ # CLEANUP @@ -320,4 +326,4 @@ # Run 03_cleanup_remove_devices_from_fabric.yaml # Run 04_cleanup_delete_image_policies.yaml # Run 05_cleanup_delete_fabric.yaml -################################################################################ \ No newline at end of file +################################################################################ diff --git a/tests/integration/targets/dcnm_image_upgrade/tests/query.yaml b/tests/integration/targets/dcnm_image_upgrade/tests/query.yaml index 095051531..40c7f9d64 100644 --- a/tests/integration/targets/dcnm_image_upgrade/tests/query.yaml +++ b/tests/integration/targets/dcnm_image_upgrade/tests/query.yaml @@ -11,7 +11,7 @@ # # SETUP (these should be run prior to running this playbook) # 1. Run 00_setup_create_fabric.yaml -# 2. Run 01_setup_add_switches_to_fabric +# 2. Run 01_setup_add_switches_to_fabric # 3. Run 02_setup_replace_image_policies # PRE_TEST (this playbook) # 4. QUERY - PRE_TEST - Upgrade all switches using global_config. @@ -72,33 +72,34 @@ cisco.dcnm.dcnm_image_upgrade: state: merged config: - policy: "{{ image_policy_1 }}" - reboot: false - stage: true - validate: true - upgrade: - nxos: true - epld: false - options: - nxos: - mode: disruptive - bios_force: false - epld: - module: ALL - golden: false - reboot: - config_reload: false - write_erase: false - package: - install: false - uninstall: false - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - - ip_address: "{{ ansible_switch_3 }}" + policy: "{{ image_policy_1 }}" + reboot: false + stage: true + validate: true + upgrade: + nxos: true + epld: false + options: + nxos: + mode: disruptive + bios_force: false + epld: + module: ALL + golden: false + reboot: + config_reload: false + write_erase: false + package: + install: false + uninstall: false + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result ################################################################################ @@ -109,7 +110,7 @@ cisco.dcnm.dcnm_image_upgrade: state: query config: - switches: + switches: - ip_address: "{{ ansible_switch_1 }}" - ip_address: "{{ ansible_switch_2 }}" - ip_address: "{{ ansible_switch_3 }}" @@ -120,7 +121,7 @@ - ansible_switch_3 in result.diff[0] retries: 60 delay: 5 - ignore_errors: yes + ignore_errors: true ################################################################################ # QUERY - TEST - Verify image_policy_1 is attached to all switches. @@ -128,32 +129,34 @@ - name: QUERY - TEST - Verify image_policy_1 is attached to all switches. cisco.dcnm.dcnm_image_upgrade: - state: query - config: - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - - ip_address: "{{ ansible_switch_3 }}" + state: query + config: + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - (result.response | length) == 1 - - (result.diff[0][ansible_switch_1].ipAddress) == ansible_switch_1 - - (result.diff[0][ansible_switch_2].ipAddress) == ansible_switch_2 - - (result.diff[0][ansible_switch_3].ipAddress) == ansible_switch_3 - - (result.diff[0][ansible_switch_1].policy) == image_policy_1 - - (result.diff[0][ansible_switch_2].policy) == image_policy_1 - - (result.diff[0][ansible_switch_3].policy) == image_policy_1 - - (result.diff[0][ansible_switch_1].statusPercent) == 100 - - (result.diff[0][ansible_switch_2].statusPercent) == 100 - - (result.diff[0][ansible_switch_3].statusPercent) == 100 + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - (result.response | length) == 1 + - (result.diff[0][ansible_switch_1].ipAddress) == ansible_switch_1 + - (result.diff[0][ansible_switch_2].ipAddress) == ansible_switch_2 + - (result.diff[0][ansible_switch_3].ipAddress) == ansible_switch_3 + - (result.diff[0][ansible_switch_1].policy) == image_policy_1 + - (result.diff[0][ansible_switch_2].policy) == image_policy_1 + - (result.diff[0][ansible_switch_3].policy) == image_policy_1 + - (result.diff[0][ansible_switch_1].statusPercent) == 100 + - (result.diff[0][ansible_switch_2].statusPercent) == 100 + - (result.diff[0][ansible_switch_3].statusPercent) == 100 ################################################################################ # QUERY - TEST - Detach policies from two switches and verify. @@ -197,7 +200,9 @@ # "DATA": "Successfully detach the policy from device.", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/policymgnt/detach-policy?serialNumber=FDO211218GC,FDO211218HH", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/policymgnt/detach-policy?serialNumber=FDO211218GC,FDO211218HH # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -215,40 +220,42 @@ - name: QUERY - TEST - Detach policies from two switches and verify. cisco.dcnm.dcnm_image_upgrade: - state: deleted - config: - policy: "{{ image_policy_1 }}" - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" + state: deleted + config: + policy: "{{ image_policy_1 }}" + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - - (result.diff | length) == 1 - - result.diff[0][ansible_switch_1]["action"] == "image_policy_detach" - - result.diff[0][ansible_switch_2]["action"] == "image_policy_detach" - - result.diff[0][ansible_switch_1].policy_name == image_policy_1 - - result.diff[0][ansible_switch_2].policy_name == image_policy_1 - - result.diff[0].sequence_number == 1 - - - (result.response | length) == 1 - - result.response[0].RETURN_CODE == 200 - - result.response[0].DATA == "Successfully detach the policy from device." - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "DELETE" - - result.response[0].sequence_number == 1 - - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == true + - result.failed == false + + - (result.diff | length) == 1 + - result.diff[0][ansible_switch_1]["action"] == "image_policy_detach" + - result.diff[0][ansible_switch_2]["action"] == "image_policy_detach" + - result.diff[0][ansible_switch_1].policy_name == image_policy_1 + - result.diff[0][ansible_switch_2].policy_name == image_policy_1 + - result.diff[0].sequence_number == 1 + + - (result.response | length) == 1 + - result.response[0].RETURN_CODE == 200 + - result.response[0].DATA == "Successfully detach the policy from device." + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "DELETE" + - result.response[0].sequence_number == 1 + + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 ################################################################################ # QUERY - TEST - Verify image_policy_1 was removed from two switches. @@ -306,49 +313,51 @@ - name: QUERY - TEST - Verify image_policy_1 was removed from two switches. cisco.dcnm.dcnm_image_upgrade: - state: query - config: - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - - ip_address: "{{ ansible_switch_3 }}" + state: query + config: + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - (result.diff | length) == 1 - - result.diff[0][ansible_switch_1].ipAddress == ansible_switch_1 - - result.diff[0][ansible_switch_2].ipAddress == ansible_switch_2 - - result.diff[0][ansible_switch_3].ipAddress == ansible_switch_3 - - result.diff[0][ansible_switch_1].policy == "None" - - result.diff[0][ansible_switch_2].policy == "None" - - result.diff[0][ansible_switch_3].policy == image_policy_1 - - result.diff[0][ansible_switch_1].statusPercent == 0 - - result.diff[0][ansible_switch_2].statusPercent == 0 - - result.diff[0][ansible_switch_3].statusPercent == 100 - - result.diff[0].sequence_number == 1 - - - (result.metadata | length) == 1 - - result.metadata[0].action == "switch_issu_details" - - result.metadata[0].check_mode == true - - result.metadata[0].sequence_number == 1 - - result.metadata[0].state == "query" - - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].METHOD == "GET" - - result.response[0].RETURN_CODE == 200 - - result.response[0].sequence_number == 1 - - - (result.result | length) == 1 - - result.result[0].found == true - - result.result[0].sequence_number == 1 - - result.result[0].success == true + - result.changed == false + - result.failed == false + - (result.diff | length) == 1 + - result.diff[0][ansible_switch_1].ipAddress == ansible_switch_1 + - result.diff[0][ansible_switch_2].ipAddress == ansible_switch_2 + - result.diff[0][ansible_switch_3].ipAddress == ansible_switch_3 + - result.diff[0][ansible_switch_1].policy == "None" + - result.diff[0][ansible_switch_2].policy == "None" + - result.diff[0][ansible_switch_3].policy == image_policy_1 + - result.diff[0][ansible_switch_1].statusPercent == 0 + - result.diff[0][ansible_switch_2].statusPercent == 0 + - result.diff[0][ansible_switch_3].statusPercent == 100 + - result.diff[0].sequence_number == 1 + + - (result.metadata | length) == 1 + - result.metadata[0].action == "switch_issu_details" + - result.metadata[0].check_mode == true + - result.metadata[0].sequence_number == 1 + - result.metadata[0].state == "query" + + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].METHOD == "GET" + - result.response[0].RETURN_CODE == 200 + - result.response[0].sequence_number == 1 + + - (result.result | length) == 1 + - result.result[0].found == true + - result.result[0].sequence_number == 1 + - result.result[0].success == true ################################################################################ # QUERY - TEST - Detach policies from remaining switch and verify. @@ -384,7 +393,9 @@ # "DATA": "Successfully detach the policy from device.", # "MESSAGE": "OK", # "METHOD": "DELETE", -# "REQUEST_PATH": "https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/imagemanagement/rest/policymgnt/detach-policy?serialNumber=FOX2109PGD0", +# "REQUEST_PATH": >- +# https://172.22.150.244:443/appcenter/cisco/ndfc/api/v1/ +# imagemanagement/rest/policymgnt/detach-policy?serialNumber=FOX2109PGD0 # "RETURN_CODE": 200, # "sequence_number": 1 # } @@ -402,43 +413,45 @@ - name: QUERY - TEST - Detach policies from remaining switch and verify. cisco.dcnm.dcnm_image_upgrade: - state: deleted - config: - policy: "{{ image_policy_1 }}" - switches: - - ip_address: "{{ ansible_switch_3 }}" + state: deleted + config: + policy: "{{ image_policy_1 }}" + switches: + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == true - - result.failed == false - - - (result.diff | length) == 1 - - result.diff[0][ansible_switch_3]["action"] == "image_policy_detach" - - result.diff[0][ansible_switch_3]["policy_name"] == image_policy_1 - - result.diff[0].sequence_number == 1 - - - (result.metadata | length) == 1 - - result.metadata[0].action == "image_policy_detach" - - result.metadata[0].check_mode == false - - result.metadata[0].state == "deleted" - - result.metadata[0].sequence_number == 1 - - - (result.response | length) == 1 - - result.response[0].MESSAGE == "OK" - - result.response[0].RETURN_CODE == 200 - - result.response[0].DATA == "Successfully detach the policy from device." - - result.response[0].METHOD == "DELETE" - - result.response[0].sequence_number == 1 - - - (result.result | length) == 1 - - result.result[0].changed == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == true + - result.failed == false + + - (result.diff | length) == 1 + - result.diff[0][ansible_switch_3]["action"] == "image_policy_detach" + - result.diff[0][ansible_switch_3]["policy_name"] == image_policy_1 + - result.diff[0].sequence_number == 1 + + - (result.metadata | length) == 1 + - result.metadata[0].action == "image_policy_detach" + - result.metadata[0].check_mode == false + - result.metadata[0].state == "deleted" + - result.metadata[0].sequence_number == 1 + + - (result.response | length) == 1 + - result.response[0].MESSAGE == "OK" + - result.response[0].RETURN_CODE == 200 + - result.response[0].DATA == "Successfully detach the policy from device." + - result.response[0].METHOD == "DELETE" + - result.response[0].sequence_number == 1 + + - (result.result | length) == 1 + - result.result[0].changed == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 ################################################################################ # QUERY - TEST - Verify image_policy_1 was removed from all switches. @@ -502,48 +515,50 @@ - name: QUERY - TEST - Verify image_policy_1 was removed from all switches. cisco.dcnm.dcnm_image_upgrade: - state: query - config: - switches: - - ip_address: "{{ ansible_switch_1 }}" - - ip_address: "{{ ansible_switch_2 }}" - - ip_address: "{{ ansible_switch_3 }}" + state: query + config: + switches: + - ip_address: "{{ ansible_switch_1 }}" + - ip_address: "{{ ansible_switch_2 }}" + - ip_address: "{{ ansible_switch_3 }}" register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - result.changed == false - - result.failed == false - - - (result.diff | length) == 1 - - result.diff[0][ansible_switch_1].ipAddress == ansible_switch_1 - - result.diff[0][ansible_switch_2].ipAddress == ansible_switch_2 - - result.diff[0][ansible_switch_3].ipAddress == ansible_switch_3 - - result.diff[0][ansible_switch_1].policy == "None" - - result.diff[0][ansible_switch_2].policy == "None" - - result.diff[0][ansible_switch_3].policy == "None" - - result.diff[0][ansible_switch_1].statusPercent == 0 - - result.diff[0][ansible_switch_2].statusPercent == 0 - - result.diff[0][ansible_switch_3].statusPercent == 0 - - - (result.metadata | length) == 1 - - result.metadata[0].action == "switch_issu_details" - - result.metadata[0].check_mode == true - - result.metadata[0].state == "query" - - result.metadata[0].sequence_number == 1 - - - (result.response | length) == 1 - - result.response[0].RETURN_CODE == 200 - - result.response[0].MESSAGE == "OK" - - result.response[0].DATA.status == "SUCCESS" - - - (result.result | length) == 1 - - result.result[0].found == true - - result.result[0].success == true - - result.result[0].sequence_number == 1 + - result.changed == false + - result.failed == false + + - (result.diff | length) == 1 + - result.diff[0][ansible_switch_1].ipAddress == ansible_switch_1 + - result.diff[0][ansible_switch_2].ipAddress == ansible_switch_2 + - result.diff[0][ansible_switch_3].ipAddress == ansible_switch_3 + - result.diff[0][ansible_switch_1].policy == "None" + - result.diff[0][ansible_switch_2].policy == "None" + - result.diff[0][ansible_switch_3].policy == "None" + - result.diff[0][ansible_switch_1].statusPercent == 0 + - result.diff[0][ansible_switch_2].statusPercent == 0 + - result.diff[0][ansible_switch_3].statusPercent == 0 + + - (result.metadata | length) == 1 + - result.metadata[0].action == "switch_issu_details" + - result.metadata[0].check_mode == true + - result.metadata[0].state == "query" + - result.metadata[0].sequence_number == 1 + + - (result.response | length) == 1 + - result.response[0].RETURN_CODE == 200 + - result.response[0].MESSAGE == "OK" + - result.response[0].DATA.status == "SUCCESS" + + - (result.result | length) == 1 + - result.result[0].found == true + - result.result[0].success == true + - result.result[0].sequence_number == 1 ################################################################################ # CLEANUP diff --git a/tests/integration/targets/dcnm_image_upload/tasks/dcnm.yaml b/tests/integration/targets/dcnm_image_upload/tasks/dcnm.yaml index 881b81cb6..c533cf54b 100644 --- a/tests/integration/targets/dcnm_image_upload/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_image_upload/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_image_upload/tasks/main.yaml b/tests/integration/targets/dcnm_image_upload/tasks/main.yaml index 78c5fb834..ca7cc9a10 100644 --- a/tests/integration/targets/dcnm_image_upload/tasks/main.yaml +++ b/tests/integration/targets/dcnm_image_upload/tasks/main.yaml @@ -1,2 +1,5 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include tasks + ansible.builtin.include_tasks: + ansible.builtin.file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_delete.yaml b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_delete.yaml index e78f891b2..8daf37237 100644 --- a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_delete.yaml +++ b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_delete.yaml @@ -7,151 +7,160 @@ - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result -- assert: +- name: ASSERT - Initial delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Upload images to controller cisco.dcnm.dcnm_image_upload: - state: merged # choose form [merged, deleted, overridden, query], default is merged + state: merged # choose from [merged, deleted, overridden, query]; default is merged files: - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server - source: local # choose from [local, scp, sftp], default is local + source: local # choose from [local, scp, sftp]; default is local register: result - - assert: + - name: ASSERT - Upload result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Upload responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete an image cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged files: - name: "{{ IMAGE_3_NAME }}" # Name of the image on the controller register: result - - assert: + - name: ASSERT - Delete result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 1' - - assert: + - name: ASSERT - Delete responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Image(s) Deleted Successfully" in item["DATA"]' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Image - Idempotence cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result - - assert: + - name: ASSERT - Idempotence result + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Upload images to controller + - name: Upload images to controller (re-upload) cisco.dcnm.dcnm_image_upload: files: - - path: "{{ IMAGE_3_PATH }}" # Name of the image on local server - source: local # choose from [local, scp, sftp], default is local + - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server + source: local # choose from [local, scp, sftp]; default is local register: result - - assert: + - name: ASSERT - Re-upload result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Re-upload responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete an image - without explicitly including any config cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result - - assert: + - name: ASSERT - Delete (no config) structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 1' - - assert: + - name: ASSERT - Delete (no config) responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Image(s) Deleted Successfully" in item["DATA"]' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete an image that does not exist cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged files: - name: no-such-image.bin # Name of an image that does not exist on controller register: result - - assert: + - name: ASSERT - Delete non-existing image + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 0' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Upload images to controller + - name: Upload images to controller (multiple) cisco.dcnm.dcnm_image_upload: files: - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server source: local # choose from [local, scp, sftp], default is local - - path: "{{ IMAGE_2_PATH }}" # Full path to the image on the server source: sftp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp @@ -159,95 +168,103 @@ password: "{{ PASSWORD }}" # mandatory when source is scp or sftp register: result - - assert: + - name: ASSERT - Upload multiple result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Upload multiple responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete one image from existing list cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged files: - name: "{{ IMAGE_3_NAME }}" # Name of the image on the controller register: result - - assert: + - name: ASSERT - Delete one image structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 1' - - assert: + - name: ASSERT - Delete one image responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Image(s) Deleted Successfully" in item["DATA"]' loop: '{{ result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query and check if one image is still present cisco.dcnm.dcnm_image_upload: - state: query # choose form [merged, deleted, overridden, query], default is merged + state: query # choose from [merged, deleted, overridden, query]; default is merged register: result - - assert: + - name: ASSERT - Query one image present + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 1' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete one existing image and one non-existing image cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged files: - name: "{{ IMAGE_2_NAME }}" # Name of the image on the controller - name: no-such-image.bin # Name of an image that does not exist on controller register: result - - assert: + - name: ASSERT - Delete existing + non-existing structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 1' - - assert: + - name: ASSERT - Delete existing + non-existing responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Image(s) Deleted Successfully" in item["DATA"]' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_merge.yaml b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_merge.yaml index db30c00bd..c3f8b98ea 100644 --- a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_merge.yaml +++ b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_merge.yaml @@ -7,10 +7,11 @@ - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result -- assert: +- name: ASSERT - Initial delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -18,23 +19,21 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Upload images to controller cisco.dcnm.dcnm_image_upload: &img_upload - state: merged # choose form [merged, deleted, overridden, query], default is merged + state: merged # choose from [merged, deleted, overridden, query]; default is merged files: - path: "{{ IMAGE_1_PATH }}" # Full path to the image on the server source: scp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp - - path: "{{ IMAGE_3_PATH }}" # Full path to image on local host source: local # choose from [local, scp, sftp], default is local - - path: "{{ IMAGE_2_PATH }}" # Full path to the image on the server source: sftp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp @@ -42,59 +41,64 @@ password: "{{ PASSWORD }}" # mandatory when source is scp or sftp register: result - - assert: + - name: ASSERT - Upload result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Upload responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Image upload - Idempotence cisco.dcnm.dcnm_image_upload: *img_upload register: result - - assert: + - name: ASSERT - Idempotence result + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete an image cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged files: - name: "{{ IMAGE_3_NAME }}" # Name of the image on the controller source: local # choose from [local, scp, sftp], default is local register: result - - assert: + - name: ASSERT - Delete result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 1' - - assert: + - name: ASSERT - Delete responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Image(s) Deleted Successfully" in item["DATA"]' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Upload images to controller - without mentioning state cisco.dcnm.dcnm_image_upload: @@ -103,32 +107,35 @@ source: local # choose from [local, scp, sftp], default is local register: result - - assert: + - name: ASSERT - Upload (implicit state) structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Upload (implicit state) responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_override.yaml b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_override.yaml index 8c17f730e..7d289778e 100644 --- a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_override.yaml +++ b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_override.yaml @@ -7,10 +7,11 @@ - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result -- assert: +- name: ASSERT - Initial delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -18,23 +19,21 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Upload images to controller cisco.dcnm.dcnm_image_upload: - state: merged # choose form [merged, deleted, overridden, query], default is merged + state: merged # choose from [merged, deleted, overridden, query]; default is merged files: - path: "{{ IMAGE_2_PATH }}" # Full path to the image on the server source: sftp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp - - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server source: local # choose from [local, scp, sftp], default is local - - path: "{{ IMAGE_1_PATH }}" # Full path to the image on the server source: scp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp @@ -42,91 +41,97 @@ password: "{{ PASSWORD }}" # mandatory when source is scp or sftp register: result - - assert: + - name: ASSERT - Upload result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Upload responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override without any config cisco.dcnm.dcnm_image_upload: - state: overridden # choose form [merged, deleted, overridden, query], default is merged + state: overridden # choose from [merged, deleted, overridden, query]; default is merged register: result - - assert: + - name: ASSERT - Override (empty) structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 3' - - assert: + - name: ASSERT - Override (empty) responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Image(s) Deleted Successfully" in item["DATA"]' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override with a new config cisco.dcnm.dcnm_image_upload: &image_override - state: overridden # choose form [merged, deleted, overridden, query], default is merged + state: overridden # choose from [merged, deleted, overridden, query]; default is merged files: - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server source: local # choose from [local, scp, sftp], default is local register: result - - assert: + - name: ASSERT - Override new config structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Override new config responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Override - Idempotence cisco.dcnm.dcnm_image_upload: *image_override register: result - - assert: + - name: ASSERT - Override idempotence + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override with new images cisco.dcnm.dcnm_image_upload: - state: overridden # choose form [merged, deleted, overridden, query], default is merged + state: overridden # choose from [merged, deleted, overridden, query]; default is merged files: - path: "{{ IMAGE_2_PATH }}" # Full path to the image on the server source: sftp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp - - path: "{{ IMAGE_1_PATH }}" # Full path to the image on the server source: scp # choose from [local, scp, sftp], default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp @@ -134,66 +139,69 @@ password: "{{ PASSWORD }}" # mandatory when source is scp or sftp register: result - - assert: + - name: ASSERT - Override new images structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' - '(result["diff"][0]["deleted"] | length) == 1' - - assert: + - name: ASSERT - Override new images responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override with new images including existing images cisco.dcnm.dcnm_image_upload: - state: overridden # choose form [merged, deleted, overridden, query], default is merged + state: overridden # choose from [merged, deleted, overridden, query]; default is merged files: - path: "{{ IMAGE_2_PATH }}" # Full path to the image on the server - source: sftp # choose from [local, scp, sftp], default is local + source: sftp # choose from [local, scp, sftp]; default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp - - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server - source: local # choose from [local, scp, sftp], default is local - + source: local # choose from [local, scp, sftp]; default is local - path: "{{ IMAGE_1_PATH }}" # Full path to the image on the server - source: scp # choose from [local, scp, sftp], default is local + source: scp # choose from [local, scp, sftp]; default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp register: result - - assert: + - name: ASSERT - Override mixed images structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Override mixed images responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_query.yaml b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_query.yaml index 6e3066784..e8ece35d8 100644 --- a/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_query.yaml +++ b/tests/integration/targets/dcnm_image_upload/tests/dcnm/dcnm_image_upload_query.yaml @@ -7,10 +7,11 @@ - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result -- assert: +- name: ASSERT - Delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -18,148 +19,154 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Upload images to controller cisco.dcnm.dcnm_image_upload: state: merged files: - path: "{{ IMAGE_2_PATH }}" # Full path to the image on the server - source: sftp # choose from [local, scp, sftp], default is local + source: sftp # choose from [local, scp, sftp]; default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp - - path: "{{ IMAGE_3_PATH }}" # Full path to the image on local server - source: local # choose from [local, scp, sftp], default is local - + source: local # choose from [local, scp, sftp]; default is local - path: "{{ IMAGE_1_PATH }}" # Full path to the image on the server - source: scp # choose from [local, scp, sftp], default is local + source: scp # choose from [local, scp, sftp]; default is local remote_server: "{{ SERVER_IP }}" # mandatory when the source is scp or sftp username: "{{ USERNAME }}" # mandatory when source is scp or sftp password: "{{ PASSWORD }}" # mandatory when source is scp or sftp register: result - - assert: + - name: ASSERT - Upload result structure + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Upload responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Successfully uploaded selected image file(s)." in item["DATA"]' loop: '{{ result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query for existing image cisco.dcnm.dcnm_image_upload: - state: query # choose form [merged, deleted, overridden, query], default is merged + state: query # choose from [merged, deleted, overridden, query]; default is merged files: - name: "{{ IMAGE_3_NAME }}" # Name of the image to be used to filter the output register: result - - assert: + - name: ASSERT - Query existing image + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 1' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query without any filters cisco.dcnm.dcnm_image_upload: - state: query # choose form [merged, deleted, overridden, query], default is merged + state: query # choose from [merged, deleted, overridden, query]; default is merged register: result - - assert: + - name: ASSERT - Query all images + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 3' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query with specific names cisco.dcnm.dcnm_image_upload: - state: query # choose form [merged, deleted, overridden, query], default is merged + state: query # choose from [merged, deleted, overridden, query]; default is merged files: - name: "{{ IMAGE_2_NAME }}" # Name of the image to be used to filter the output - name: "{{ IMAGE_3_NAME }}" # Name of the image to be used to filter the output - name: "{{ IMAGE_1_NAME }}" # Name of the image to be used to filter the output register: result - - assert: + - name: ASSERT - Query specific names + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 3' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query with non existing image name cisco.dcnm.dcnm_image_upload: - state: query # choose form [merged, deleted, overridden, query], default is merged + state: query # choose from [merged, deleted, overridden, query]; default is merged files: - name: no-such-image.bin # Name of a non-existing image register: result - - assert: + - name: ASSERT - Query non-existing image + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 0' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query with existing and non existing image name cisco.dcnm.dcnm_image_upload: - state: query # choose form [merged, deleted, overridden, query], default is merged + state: query # choose from [merged, deleted, overridden, query]; default is merged files: - name: no-such-image.bin # Name of a non-existing image - name: "{{ IMAGE_1_NAME }}" # Name of the image to be used to filter the output register: result - - assert: + - name: ASSERT - Query mixed existing/non-existing + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result.response | length) == 1' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: Delete all images from controller cisco.dcnm.dcnm_image_upload: - state: deleted # choose form [merged, deleted, overridden, query], default is merged + state: deleted # choose from [merged, deleted, overridden, query]; default is merged register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup delete all images + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/meta/main.yaml b/tests/integration/targets/dcnm_interface/meta/main.yaml index a888edc3b..272771ca1 100644 --- a/tests/integration/targets/dcnm_interface/meta/main.yaml +++ b/tests/integration/targets/dcnm_interface/meta/main.yaml @@ -1,2 +1,2 @@ -dependencies: - - prepare_dcnm_intf \ No newline at end of file +dependencies: + - prepare_dcnm_intf diff --git a/tests/integration/targets/dcnm_interface/tasks/main.yaml b/tests/integration/targets/dcnm_interface/tasks/main.yaml index 26e18b4d2..951dc46c6 100644 --- a/tests/integration/targets/dcnm_interface/tasks/main.yaml +++ b/tests/integration/targets/dcnm_interface/tasks/main.yaml @@ -1,38 +1,43 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) +- name: Run test cases (connection=httpapi) ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: sanity -- meta: end_play +- name: Meta + ansible.builtin.meta: end_play ############################################### ## FACTS ## ############################################### -- set_fact: +- name: Set fact + ansible.builtin.set_fact: vpc_delete_path: {} -- set_fact: - vpc_delete_path: "{{ vpc_delete_path | combine (item) }}" +- name: Set fact + ansible.builtin.set_fact: + vpc_delete_path: "{{ vpc_delete_path | combine(item) }}" with_items: - {'12': '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair?serialNumber='} - {'11': '/rest/vpcpair?serialNumber='} @@ -43,13 +48,13 @@ - name: Final Cleanup - Delete DCNM VXLAN Fabric VPC switch pair cisco.dcnm.dcnm_rest: method: DELETE - path: "{{ [vpc_delete_path[controller_version], test_data_common.vxlan_fabric_sno1] | join ('') }}" + path: "{{ [vpc_delete_path[controller_version], test_data_common.vxlan_fabric_sno1] | join('') }}" register: result ignore_errors: true when: (test_data_common.vxlan_fabric is defined and test_data_common.vxlan_fabric_sno1 is defined and test_data_common.vxlan_fabric_sno2 is defined) - name: Wait for 10 secs - wait_for: + ansible.builtin.wait_for: timeout: 10 when: (test_data_common.vxlan_fabric is defined and test_data_common.vxlan_fabric_sno1 is defined and test_data_common.vxlan_fabric_sno2 is defined) @@ -86,13 +91,13 @@ - name: Final Cleanup - Delete DCNM CXT Fabric VPC switch pair cisco.dcnm.dcnm_rest: method: DELETE - path: "{{ [vpc_delete_path[controller_version], test_data_common.cxt_fabric_sno1] | join ('') }}" + path: "{{ [vpc_delete_path[controller_version], test_data_common.cxt_fabric_sno1] | join('') }}" register: result ignore_errors: true when: (test_data_common.cxt_fabric is defined and test_data_common.cxt_fabric_sno1 is defined and test_data_common.cxt_fabric_sno2 is defined) - name: Wait for 10 secs - wait_for: + ansible.builtin.wait_for: timeout: 10 when: (test_data_common.cxt_fabric is defined and test_data_common.cxt_fabric_sno1 is defined and test_data_common.cxt_fabric_sno2 is defined) @@ -138,7 +143,8 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -158,8 +164,9 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - tags: sanity \ No newline at end of file + tags: sanity diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_delete.yaml index cdd849ffd..8baccd54d 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_delete.yaml @@ -9,19 +9,21 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden # only choose from [merged, replaced, deleted, overridden, query] + register: initial_override -- assert: +- name: Assert initial override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - "item.RETURN_CODE == 200" + loop: + - "{{ initial_override.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -34,13 +36,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -51,76 +53,76 @@ cisco.dcnm.dcnm_interface: &fex_merge2 check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged # only choose from [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merged_conf }}" - register: result + register: result_create - name: QUERY - Get AA FEX interface state in NDFC (merge) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: result_query_merge - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (merge) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merged_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ result_query_merge }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete AA FEX interfaces - cisco.dcnm.dcnm_interface: &fex_del + cisco.dcnm.dcnm_interface: &fex_delete check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: deleted # only choose form [merged, replaced, deleted, overridden, query] + state: deleted # only choose from [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merged_conf }}" - register: result - + register: result_delete - name: QUERY - Get AA FEX interface state in NDFC (delete) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: result_query_delete - name: ASSERT - Verify AA FEX interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - - 'verify_result.response | length == 0' + - 'result_query_delete.response | length == 0' - name: Delete AA FEX interfaces - Idempotence - cisco.dcnm.dcnm_interface: *fex_del - register: result + cisco.dcnm.dcnm_interface: *fex_delete + register: result_delete_idem - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' + - 'result_delete_idem.changed == false' + - 'result_delete_idem.response is defined' + - 'result_delete_idem.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item.RETURN_CODE == 200' + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_merge.yaml index d872eda5c..0a7b58232 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_merge.yaml @@ -9,19 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden # only choose from [merged, replaced, deleted, overridden, query] + register: initial_override -- assert: +- name: Assert initial override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item.RETURN_CODE == 200' + loop: "{{ initial_override.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -40,16 +41,16 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge_basic - merged - merge_modify - merge_final delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Basic Merge Interface Config File ansible.builtin.set_fact: @@ -57,43 +58,41 @@ delegate_to: localhost - name: Create AA FEX interfaces w/o optional parameters - cisco.dcnm.dcnm_interface: &fex_merge + cisco.dcnm.dcnm_interface: &fex_merge_basic check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merge_basic_conf }}" - register: result - + register: result_basic_create - name: QUERY - Get AA FEX interface state in NDFC (basic merge) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merge_basic_conf }}" - register: verify_result + register: result_basic_query - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (basic merge) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merge_basic_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ result_basic_query }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Create AA FEX interfaces - Idempotence (basic merge) - cisco.dcnm.dcnm_interface: *fex_merge - register: result + cisco.dcnm.dcnm_interface: *fex_merge_basic + register: result_basic_idem - - name: ASSERT - Check changed flag is false and return codes for idempotence (basic merge) - assert: + - name: ASSERT - Idempotence checks (basic merge) + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' - + - 'result_basic_idem.changed == false' + - 'result_basic_idem.response is defined' + - 'result_basic_idem.response | length >= 0' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE WITH OPTIONAL PARAMETERS ## + ############################################## - name: Load Merged Interface Config File ansible.builtin.set_fact: @@ -104,85 +103,83 @@ cisco.dcnm.dcnm_interface: &fex_merge2 check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merged_conf }}" - register: result - + register: result_opt_create - name: QUERY - Get AA FEX interface state in NDFC (merged) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: result_opt_query - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (merged) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merged_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ result_opt_query }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Create AA FEX interfaces - Idempotence (merged) cisco.dcnm.dcnm_interface: *fex_merge2 - register: result + register: result_opt_idem - - name: ASSERT - Check changed flag is false and return codes for idempotence (merged) - assert: + - name: ASSERT - Idempotence checks (merged with optionals) + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' - + - 'result_opt_idem.changed == false' + - 'result_opt_idem.response is defined' + - 'result_opt_idem.response | length >= 0' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE MODIFY (INCREMENTAL) ## + ############################################## - name: Load Merge Modify Interface Config File ansible.builtin.set_fact: dcnm_interface_merge_modify_conf: "{{ lookup('file', test_data_interfaces.merge_modify_conf_file) | from_yaml }}" delegate_to: localhost - - name: Merge AA FEX interface + - name: Merge AA FEX interface (modify pass) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merge_modify_conf }}" - register: result - + register: result_modify - name: QUERY - Get AA FEX interface state in NDFC (merge modify) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merge_modify_conf }}" - register: verify_result + register: result_modify_query - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (merge modify) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merge_final_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ result_modify_query }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item.RETURN_CODE == 200' + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_override.yaml index ef594f465..bc9481000 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_override.yaml @@ -9,19 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden # only choose from [merged, replaced, deleted, overridden, query] register: result -- assert: +- name: Assert initial override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item.RETURN_CODE == 200' + loop: "{{ result.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -38,15 +39,15 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - override - override_modify delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -57,11 +58,11 @@ cisco.dcnm.dcnm_interface: &fex_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merged_conf }}" register: result - - name: QUERY - Get AA FEX interface state in NDFC (merge) + - name: QUERY - Get AA FEX interface state in NDFC (merged) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" @@ -75,9 +76,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -88,11 +89,10 @@ cisco.dcnm.dcnm_interface: &fex_override check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_override_conf }}" register: result - - name: QUERY - Get AA FEX interface state in NDFC (override) cisco.dcnm.dcnm_interface: state: query @@ -111,50 +111,50 @@ cisco.dcnm.dcnm_interface: *fex_override register: result - # - name: ASSERT - Check changed flag is false and return codes for idempotence (override) - # assert: - # that: - # - 'result.changed == false' - # - 'result.response is defined' - # - 'result.response | length >= 0' - -############################################## -## OVERRIDE MODIFY ## -############################################## - -# this fails due to an internal server error, checking the issue - - # - name: Load Override Modify Interface Config File - # ansible.builtin.set_fact: - # dcnm_interface_override_modify_conf: "{{ lookup('file', test_data_interfaces.override_modify_conf_file) | from_yaml }}" - # delegate_to: localhost - - # - name: Override existing AA FEX interface with a few modifications - # cisco.dcnm.dcnm_interface: - # check_deploy: "{{ test_data_common.check_deploy | bool }}" - # fabric: "{{ test_data_common.fabric }}" - # state: overridden # only choose form [merged, replaced, deleted, overridden, query] - # config: "{{ dcnm_interface_override_modify_conf }}" - # register: result - - # - name: QUERY - Get AA FEX interface state in NDFC (override modify) - # cisco.dcnm.dcnm_interface: - # state: query - # fabric: "{{ test_data_common.fabric }}" - # config: "{{ dcnm_interface_override_modify_conf }}" - # register: verify_result - - # - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (override modify) - # cisco.dcnm.tests.integration.ndfc_interface_validate: - # config_path: "{{ test_data_interfaces.override_modify_conf_file }}" - # ndfc_data: "{{ verify_result }}" - # test_data: "{{ test_data_common }}" - # switch_ip_sn_mapping: "{{ test_data_common.sw_sn | default(global_sw_sn_mapping | default({})) }}" - # delegate_to: localhost - -############################################## -## CLEANUP ## -############################################## + # - name: ASSERT - Check changed flag is false and return codes for idempotence (override) + # assert: + # that: + # - 'result.changed == false' + # - 'result.response is defined' + # - 'result.response | length >= 0' + + ############################################## + ## OVERRIDE MODIFY ## + ############################################## + + # this fails due to an internal server error, checking the issue + + # - name: Load Override Modify Interface Config File + # ansible.builtin.set_fact: + # dcnm_interface_override_modify_conf: "{{ lookup('file', test_data_interfaces.override_modify_conf_file) | from_yaml }}" + # delegate_to: localhost + + # - name: Override existing AA FEX interface with a few modifications + # cisco.dcnm.dcnm_interface: + # check_deploy: "{{ test_data_common.check_deploy | bool }}" + # fabric: "{{ test_data_common.fabric }}" + # state: overridden # only choose form [merged, replaced, deleted, overridden, query] + # config: "{{ dcnm_interface_override_modify_conf }}" + # register: result + + # - name: QUERY - Get AA FEX interface state in NDFC (override modify) + # cisco.dcnm.dcnm_interface: + # state: query + # fabric: "{{ test_data_common.fabric }}" + # config: "{{ dcnm_interface_override_modify_conf }}" + # register: verify_result + + # - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (override modify) + # cisco.dcnm.tests.integration.ndfc_interface_validate: + # config_path: "{{ test_data_interfaces.override_modify_conf_file }}" + # ndfc_data: "{{ verify_result }}" + # test_data: "{{ test_data_common }}" + # switch_ip_sn_mapping: "{{ test_data_common.sw_sn | default(global_sw_sn_mapping | default({})) }}" + # delegate_to: localhost + + ############################################## + ## CLEANUP ## + ############################################## always: @@ -162,12 +162,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result when: IT_CONTEXT is not defined - - assert: + - name: ASSERT - Cleanup override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item.RETURN_CODE == 200' + loop: "{{ result.response }}" when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_query.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_query.yaml index 05b62fe15..e50ae5a44 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_query.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_query.yaml @@ -12,16 +12,17 @@ state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result -- assert: +- name: Assert response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -53,11 +54,11 @@ - query_nonexist delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Interface Config File + - name: Load Interface Config Files ansible.builtin.set_fact: dcnm_interface_merged_conf: "{{ lookup('file', test_data_interfaces.merged_conf_file) | from_yaml }}" dcnm_interface_query_merge_conf: "{{ lookup('file', test_data_interfaces.query_merge_conf_file) | from_yaml }}" @@ -67,7 +68,7 @@ cisco.dcnm.dcnm_interface: &fex_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged # only choose from [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_query_merge_conf }}" register: result @@ -80,14 +81,15 @@ # - '(result["diff"][0]["overridden"] | length) == 0' # - '(result["diff"][0]["deploy"] | length) == 3' - - assert: + - name: ASSERT - Merge response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Load Query Interface Config File ansible.builtin.set_fact: @@ -98,51 +100,55 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: query # only choose form [merged, replaced, deleted, overridden, query] + state: query # only choose from [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_query_conf }}" register: result - - assert: + - name: ASSERT - Query existing result structure + ansible.builtin.assert: that: - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 0' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 3' - - - assert: + - '(result.diff[0].merged | length) == 0' + - '(result.diff[0].deleted | length) == 0' + - '(result.diff[0].replaced | length) == 0' + - '(result.diff[0].overridden | length) == 0' + - '(result.diff[0].deploy | length) == 0' + - '(result.diff[0].query | length) == 3' + + - name: ASSERT - Query existing response + ansible.builtin.assert: that: - - '(result["response"] | length) != 0' + - '(result.response | length) != 0' - name: Query interface details - Subset of Existing cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: query # only choose form [merged, replaced, deleted, overridden, query] + state: query config: "{{ lookup('file', test_data_interfaces.query_subset_conf_file) | from_yaml }}" register: result - - assert: + - name: ASSERT - Query subset result structure + ansible.builtin.assert: that: - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 0' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 2' - - - assert: + - '(result.diff[0].merged | length) == 0' + - '(result.diff[0].deleted | length) == 0' + - '(result.diff[0].replaced | length) == 0' + - '(result.diff[0].overridden | length) == 0' + - '(result.diff[0].deploy | length) == 0' + - '(result.diff[0].query | length) == 2' + + - name: ASSERT - Query subset response + ansible.builtin.assert: that: - - '(result["response"] | length) != 0' + - '(result.response | length) != 0' - name: Query interface details - Existing and Non-Existing cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: query # only choose form [merged, replaced, deleted, overridden, query] + state: query # only choose form [merged, replaced, deleted, overridden, query] config: "{{ lookup('file', test_data_interfaces.query_mixed_conf_file) | from_yaml }}" register: result @@ -156,35 +162,38 @@ # - '(result["diff"][0]["deploy"] | length) == 0' # - '(result["diff"][0]["query"] | length) == 1' - - assert: + - name: ASSERT - Query mixed response + ansible.builtin.assert: that: - - '(result["response"] | length) != 0' + - '(result.response | length) != 0' - name: Query interface details - Non-Existing cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: query # only choose form [merged, replaced, deleted, overridden, query] + state: query # only choose form [merged, replaced, deleted, overridden, query] config: "{{ lookup('file', test_data_interfaces.query_nonexist_conf_file) | from_yaml }}" register: result - - assert: + - name: ASSERT - Query non-existent result structure + ansible.builtin.assert: that: - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 0' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - - assert: + - '(result.diff[0].merged | length) == 0' + - '(result.diff[0].deleted | length) == 0' + - '(result.diff[0].replaced | length) == 0' + - '(result.diff[0].overridden | length) == 0' + - '(result.diff[0].deploy | length) == 0' + - '(result.diff[0].query | length) == 0' + + - name: ASSERT - Query non-existent response + ansible.builtin.assert: that: - - '(result["response"] | length) == 0' + - '(result.response | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -192,12 +201,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_replace.yaml index 9d587928f..5d7640ccb 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_aa_fex_replace.yaml @@ -9,19 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden # only choose from [merged, replaced, deleted, overridden, query] + register: initial_override -- assert: +- name: Assert initial override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item.RETURN_CODE == 200' + loop: "{{ initial_override.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -36,14 +37,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -54,9 +55,9 @@ cisco.dcnm.dcnm_interface: &fex_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merged_conf }}" - register: result + register: result_merge # - assert: # that: @@ -67,14 +68,15 @@ # - '(result["diff"][0]["overridden"] | length) == 0' # - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - name: ASSERT - Creation return codes (merged) + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item.RETURN_CODE == 200' + loop: "{{ result_merge.response }}" -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: @@ -85,52 +87,52 @@ cisco.dcnm.dcnm_interface: &fex_replace check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: replaced # only choose form [merged, replaced, deleted, overridden, query] + state: replaced # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_replace_conf }}" - register: result - + register: result_replace - name: QUERY - Get AA FEX interface state in NDFC (replace) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_replace_conf }}" - register: verify_result + register: result_replace_query - name: VALIDITY CHECK - Verify AA FEX interface state in NDFC (replace) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.replace_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ result_replace_query }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Replace AA FEX interface - Idempotence cisco.dcnm.dcnm_interface: *fex_replace - register: result + register: result_replace_idem - - name: ASSERT - Check changed flag is false and return codes for idempotence (replace) - assert: - that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' + - name: ASSERT - Idempotence checks (replace) + ansible.builtin.assert: + that: + - 'result_replace_idem.changed == false' + - 'result_replace_idem.response is defined' + - 'result_replace_idem.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup override succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item.RETURN_CODE == 200' + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_deploy.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_deploy.yaml index 50555a28c..fb1b45004 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_deploy.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_deploy.yaml @@ -10,18 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -47,9 +48,9 @@ - deploy_delete2 delegate_to: localhost -############################################## -## MERGE 1 ## -############################################## + ############################################## + ## MERGE 1 ## + ############################################## - name: Load Interface Config File - Deploy Merge 1 ansible.builtin.set_fact: @@ -78,9 +79,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE 1 ## -############################################## + ############################################## + ## DELETE 1 ## + ############################################## - name: Delete interfaces with global deploy as false cisco.dcnm.dcnm_interface: @@ -98,13 +99,13 @@ register: verify_result - name: ASSERT - Verify interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - 'verify_result.response | length == 0' -############################################## -## DELETE 2 ## -############################################## + ############################################## + ## DELETE 2 ## + ############################################## - name: Delete interfaces again, global deploy as true cisco.dcnm.dcnm_interface: @@ -122,13 +123,13 @@ register: verify_result - name: ASSERT - Verify interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - 'verify_result.response | length == 0' -############################################## -## DELETE 3 ## -############################################## + ############################################## + ## DELETE 3 ## + ############################################## - name: Delete interfaces - Idempotence cisco.dcnm.dcnm_interface: @@ -138,15 +139,16 @@ state: deleted # only choose form [merged, replaced, deleted, overridden,query] register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' -############################################## -## MERGE 2 ## -############################################## + ############################################## + ## MERGE 2 ## + ############################################## - name: Load Interface Config File - Deploy Merge 2 ansible.builtin.set_fact: @@ -175,9 +177,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE 4 ## -############################################## + ############################################## + ## DELETE 4 ## + ############################################## - name: Load Interface Config File - Deploy Delete 1 ansible.builtin.set_fact: @@ -187,7 +189,7 @@ - name: Delete interfaces - global deploy as true and deploy in config block as false cisco.dcnm.dcnm_interface: check_deploy: true - deploy: true + deploy: true fabric: "{{ test_data_common.fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden,query] config: "{{ dcnm_interface_deploy_delete1_conf }}" @@ -201,13 +203,13 @@ register: verify_result - name: ASSERT - Verify interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - 'verify_result.response | length == 0' -############################################## -## DELETE 5 ## -############################################## + ############################################## + ## DELETE 5 ## + ############################################## - name: Load Interface Config File - Deploy Delete 2 ansible.builtin.set_fact: @@ -217,7 +219,7 @@ - name: Delete interfaces - global deploy as false and deploy in config block as true cisco.dcnm.dcnm_interface: check_deploy: true - deploy: false + deploy: false fabric: "{{ test_data_common.fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden,query] config: "{{ dcnm_interface_deploy_delete2_conf }}" @@ -231,26 +233,26 @@ register: verify_result - name: ASSERT - Verify interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - 'verify_result.response | length == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml index 1d4b577f8..e383eed41 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_delete_diff_options.yaml @@ -9,19 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result -- assert: +- name: Assert response codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -42,7 +43,7 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - diff_options_merge1 - diff_options_merge2 - diff_options_merge3 @@ -50,9 +51,9 @@ - diff_options_delete3 delegate_to: localhost -############################################## -## MERGE 1 ## -############################################## + ############################################## + ## MERGE 1 ## + ############################################## - name: Load Interface Config File - Merge 1 ansible.builtin.set_fact: @@ -63,7 +64,7 @@ cisco.dcnm.dcnm_interface: check_deploy: false fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: - name: "{{ test_data_common.parent_intf1 }}" type: eth @@ -79,7 +80,7 @@ cisco.dcnm.dcnm_interface: &delete_diff_merge1 check_deploy: false fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_diff_options_merge1_conf }}" register: result @@ -97,18 +98,19 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE 1 ## -############################################## + ############################################## + ## DELETE 1 ## + ############################################## - name: Delete all interfaces form 1 cisco.dcnm.dcnm_interface: check_deploy: false fabric: "{{ test_data_common.fabric }}" - state: deleted # only choose form [merged, replaced, deleted, overridden,query] + state: deleted register: result - - assert: + - name: ASSERT - Verify diff stats (form 1) + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -117,14 +119,16 @@ - '(result["diff"][0]["overridden"] | length) == 0' - '(result["diff"][0]["deploy"] | length) != 0' - - assert: + - name: ASSERT - Verify return code + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 2 ## -############################################## + ############################################## + ## MERGE 2 ## + ############################################## + - name: Load Interface Config File - Merge 2 ansible.builtin.set_fact: @@ -169,9 +173,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE 2 ## -############################################## + ############################################## + ## DELETE 2 ## + ############################################## - name: Load Interface Config File - Delete 2 ansible.builtin.set_fact: @@ -182,11 +186,12 @@ cisco.dcnm.dcnm_interface: check_deploy: false fabric: "{{ test_data_common.fabric }}" - state: deleted # only choose form [merged, replaced, deleted, overridden,query] + state: deleted config: "{{ dcnm_interface_diff_options_delete2_conf }}" register: result - - assert: + - name: ASSERT - ASSERT - Verify diff stats + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -195,14 +200,15 @@ - '(result["diff"][0]["overridden"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - name: ASSERT - Verify return code + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 3 ## -############################################## + ############################################## + ## MERGE 3 ## + ############################################## - name: Load Interface Config File - Merge 3 ansible.builtin.set_fact: @@ -247,9 +253,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE 3 ## -############################################## + ############################################## + ## DELETE 3 ## + ############################################## - name: Load Interface Config File - Delete 3 ansible.builtin.set_fact: @@ -260,7 +266,7 @@ cisco.dcnm.dcnm_interface: check_deploy: false fabric: "{{ test_data_common.fabric }}" - state: deleted # only choose form [merged, replaced, deleted, overridden,query] + state: deleted # only choose form [merged, replaced, deleted, overridden,query] config: "{{ dcnm_interface_diff_options_delete3_conf }}" register: result @@ -275,12 +281,12 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -288,12 +294,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_delete.yaml index 357b3dade..c75239cde 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_delete.yaml @@ -17,20 +17,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,34 +43,33 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: dcnm_interface_delete_conf: "{{ lookup('file', test_data_interfaces.delete_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create ethernet interfaces + - name: Create ethernet interfaces (initial setup) cisco.dcnm.dcnm_interface: ð_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_delete_conf }}" - - register: result + register: merge_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Merge changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -86,59 +85,62 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE (BULK) ## + ############################################## - - name: Delete ethernet interfaces + - name: Delete ethernet interfaces (bulk) cisco.dcnm.dcnm_interface: ð_delete check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: deleted # only choose form [merged, replaced, deleted, overridden, query] + state: deleted config: "{{ dcnm_interface_delete_conf }}" - register: result + register: delete_result - - assert: + - name: ASSERT - Bulk delete diff counts + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 5' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - - assert: + - delete_result.changed == true + - (delete_result.diff[0].merged | length) == 0 + - (delete_result.diff[0].deleted | length) == 0 + - (delete_result.diff[0].replaced | length) == 5 + - (delete_result.diff[0].overridden | length) == 0 + - (delete_result.diff[0].deploy | length) == 0 + + - name: ASSERT - Bulk delete return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ delete_result.response }}" - name: Delete ethernet interfaces - Idempotence cisco.dcnm.dcnm_interface: *eth_delete - register: result + register: delete_idem_result - - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + - name: ASSERT - Bulk delete idempotence + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 0' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - - assert: + - delete_idem_result.changed == false + - (delete_idem_result.diff[0].merged | length) == 0 + - (delete_idem_result.diff[0].deleted | length) == 0 + - (delete_idem_result.diff[0].replaced | length) == 0 + - (delete_idem_result.diff[0].overridden | length) == 0 + - (delete_idem_result.diff[0].deploy | length) == 0 + + - name: ASSERT - Bulk delete idempotence return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ delete_idem_result.response }}" -############################################## -## MERGE ## -############################################## + ############################################## + ## CREATE SINGLE INTERFACE ## + ############################################## - - name: Create ethernet interfaces - cisco.dcnm.dcnm_interface: + - name: Create single ethernet interface + cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" - fabric: "{{ test_data_common.fabric }}" + fabric: "{{ test_data_common.fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: - name: "{{ test_data_common.eth_intf7 }}" # should be of the form eth @@ -153,34 +155,36 @@ bpdu_guard: true # choose from [true, false, 'no'] port_type_fast: true # choose from [true, false] mtu: jumbo # choose from [default, jumbo] - allowed_vlans: none # choose from [none, all, vlan range] + allowed_vlans: none # choose from [none, all, vlan range] cmds: # Freeform config - no shutdown - description: "eth interface acting as trunk" - register: result + description: "eth interface acting as trunk" + register: single_merge_result - - assert: + - name: ASSERT - Single merge diff counts + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 0' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 1' - - - assert: + - single_merge_result.changed == true + - (single_merge_result.diff[0].merged | length) == 1 + - (single_merge_result.diff[0].deploy | length) == 1 + - (single_merge_result.diff[0].deleted | length) == 0 + - (single_merge_result.diff[0].replaced | length) == 0 + - (single_merge_result.diff[0].overridden | length) == 0 + + - name: ASSERT - Single merge return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ single_merge_result.response }}" -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE SINGLE INTERFACE ## + ############################################## - - name: Delete a single ethernet interface + - name: Delete single ethernet interface cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" - fabric: "{{ test_data_common.fabric }}" + fabric: "{{ test_data_common.fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: - name: "{{ test_data_common.eth_intf7 }}" # should be of the form eth @@ -195,45 +199,44 @@ bpdu_guard: true # choose from [true, false, no] port_type_fast: true # choose from [true, false] mtu: jumbo # choose from [default, jumbo] - allowed_vlans: none # choose from [none, all, vlan range] + allowed_vlans: none # choose from [none, all, vlan range] cmds: # Freeform config - no shutdown - description: "eth interface acting as trunk" - register: result + description: "eth interface acting as trunk" + register: single_delete_result - - - - assert: + - name: ASSERT - Single delete diff counts + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["replaced"] | length) == 1' - - '(result["diff"][0]["overridden"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - - assert: + - single_delete_result.changed == true + - (single_delete_result.diff[0].merged | length) == 0 + - (single_delete_result.diff[0].deleted | length) == 0 + - (single_delete_result.diff[0].replaced | length) == 1 + - (single_delete_result.diff[0].overridden | length) == 0 + - (single_delete_result.diff[0].deploy | length) == 0 + + - name: ASSERT - Single delete return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - -############################################## -## CLEANUP ## -############################################## + - item.RETURN_CODE == 200 + loop: "{{ single_delete_result.response }}" always: + ############################################## + ## CLEANUP ## + ############################################## - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_merge.yaml index 452e503d6..4bfde76da 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_merge.yaml @@ -17,20 +17,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden # only choose from [merged, replaced, deleted, overridden, query] + register: setup_result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,13 +43,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -62,15 +62,14 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: "{{ dcnm_interface_merge_conf }}" - - register: result + register: merge_result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -88,33 +87,32 @@ - name: Create ethernet interfaces - Idempotence cisco.dcnm.dcnm_interface: *eth_merge - register: result + register: idem_result - - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + - name: ASSERT - Idempotence result + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty - -############################################## -## CLEANUP ## -############################################## + - idem_result.changed == false + - idem_result.response is defined + - idem_result.response | length >= 0 # Allow empty response for idempotence + # Don't loop over response items for idempotence check as they may be empty always: + ############################################## + ## CLEANUP ## + ############################################## - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_override.yaml index a42cba6b9..3e328ad9f 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_override.yaml @@ -17,20 +17,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -45,52 +45,52 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - override_merge - override delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Interface Config File + - name: Load Merge Interface Config File ansible.builtin.set_fact: dcnm_interface_override_merge_conf: "{{ lookup('file', test_data_interfaces.override_merge_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create ethernet interfaces + - name: Merge ethernet interfaces (initial state) cisco.dcnm.dcnm_interface: ð_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_override_merge_conf }}" - register: result + register: merge_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Merge changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - name: QUERY - Get interface state in NDFC after merge cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_override_merge_conf }}" - register: verify_result + register: merge_verify_result - name: VALIDITY CHECK - Verify interface state in NDFC after merge cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.override_merge_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ merge_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -101,60 +101,58 @@ cisco.dcnm.dcnm_interface: ð_override check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden config: "{{ dcnm_interface_override_conf }}" - register: result + register: override_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Override changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - override_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ override_result.response }}" - name: QUERY - Get interface state in NDFC after override cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_override_conf }}" - register: verify_result + register: override_verify_result - name: VALIDITY CHECK - Verify interface state in NDFC after override cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.override_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ override_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Override ethernet interfaces - Idempotence cisco.dcnm.dcnm_interface: *eth_override - register: result + register: override_idem_result - - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + - name: ASSERT - Override idempotence + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty - -############################################## -## CLEANUP ## -############################################## - + - override_idem_result.changed == false + - override_idem_result.response is defined + - override_idem_result.response | length >= 0 # Allow empty response for idempotence + # Don't loop over response items for idempotence check as they may be empty always: + ############################################## + ## CLEANUP ## + ############################################## - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_replace.yaml index e6b35bdd2..ede1dfb12 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_eth_replace.yaml @@ -17,20 +17,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result -- name: ASSERT - Check return codes for setup - assert: +- name: ASSERT - Setup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -45,52 +45,52 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Interface Config File + - name: Load Merge Interface Config File ansible.builtin.set_fact: dcnm_interface_merged_conf: "{{ lookup('file', test_data_interfaces.merged_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create ethernet interfaces + - name: Merge ethernet interfaces cisco.dcnm.dcnm_interface: ð_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merged_conf }}" - register: result + register: merge_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Merge changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - - name: QUERY - Get interface state in NDFC after merge + - name: QUERY - Get interface state after merge cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: merge_verify_result - - name: VALIDITY CHECK - Verify interface state in NDFC after merge + - name: VALIDITY CHECK - Merge state cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merged_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ merge_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: @@ -101,60 +101,58 @@ cisco.dcnm.dcnm_interface: ð_replace check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: replaced # only choose form [merged, replaced, deleted, overridden, query] + state: replaced config: "{{ dcnm_interface_replace_conf }}" - register: result + register: replace_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Replace changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - replace_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ replace_result.response }}" - - name: QUERY - Get interface state in NDFC after replace + - name: QUERY - Get interface state after replace cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_replace_conf }}" - register: verify_result + register: replace_verify_result - - name: VALIDITY CHECK - Verify interface state in NDFC after replace + - name: VALIDITY CHECK - Replace state cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.replace_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ replace_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Replace ethernet interfaces - Idempotence cisco.dcnm.dcnm_interface: *eth_replace - register: result + register: replace_idem_result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty - -############################################## -## CLEANUP ## -############################################## + - replace_idem_result.changed == false + - replace_idem_result.response is defined + - replace_idem_result.response | length >= 0 always: + ############################################## + ## CLEANUP ## + ############################################## - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - name: ASSERT - Check return codes for cleanup - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_misc.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_misc.yaml index d5068288d..7dbe03cf2 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_misc.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_misc.yaml @@ -10,19 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,7 +43,7 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - misc_merge - misc_delete_no_deploy - misc_delete @@ -51,9 +51,9 @@ - misc_non_manageable delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -66,14 +66,14 @@ fabric: "{{ test_data_common.fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_misc_merge_conf }}" - register: result + register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -89,9 +89,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Load Delete No Deploy Interface Config File ansible.builtin.set_fact: @@ -103,18 +103,18 @@ fabric: "{{ test_data_common.fabric }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_misc_delete_no_deploy_conf }}" - register: result + register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Load Delete Interface Config File ansible.builtin.set_fact: @@ -127,18 +127,18 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_misc_delete_conf }}" - register: result + register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete interface again (already deployed) with deploy set to True cisco.dcnm.dcnm_interface: @@ -146,21 +146,21 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_misc_delete_conf }}" - register: result + register: result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Monitoring Mode Interface Config File + - name: Load Monitoring Mode Interface Config File ansible.builtin.set_fact: dcnm_interface_misc_monitoring_mode_conf: "{{ lookup('file', test_data_interfaces.misc_monitoring_mode_conf_file) | from_yaml }}" delegate_to: localhost @@ -171,8 +171,8 @@ fabric: "{{ test_data_common.ext_fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_misc_monitoring_mode_conf }}" - register: result - ignore_errors: yes + register: result + ignore_errors: true # - assert: # that: @@ -180,9 +180,9 @@ # - '("No changes are allowed on the fabric" in result["msg"])' # - '("{{ test_data_common.ext_fabric }}" in result["msg"])' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Non-Manageable Interface Config File ansible.builtin.set_fact: @@ -195,18 +195,18 @@ fabric: "mmudigon-unnumbered" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_misc_non_manageable_conf }}" - register: result - ignore_errors: yes + register: result + ignore_errors: true - # - assert: - # that: - # - '("are not managable in Fabric" in result["msg"])' - # - '("No changes are allowed on these switches" in result["msg"])' - # - '("n9kv-test-sw2" in result["msg"])' + # - assert: + # that: + # - '("are not managable in Fabric" in result["msg"])' + # - '("No changes are allowed on these switches" in result["msg"])' + # - '("n9kv-test-sw2" in result["msg"])' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -215,12 +215,12 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + register: result + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_intf_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_intf_merge.yaml index 66e1e4fcb..2e49391f4 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_intf_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_intf_merge.yaml @@ -9,20 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -39,15 +39,15 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - multi_intf_merge - multi_intf_merge_modified - pc_merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -58,16 +58,16 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_multi_intf_merge_conf }}" register: result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Verify interface creation results + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -100,7 +100,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after modify @@ -117,9 +117,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load PC Interface Config File ansible.builtin.set_fact: @@ -138,7 +138,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for PC @@ -155,9 +155,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -165,13 +165,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - name: ASSERT - Check return codes for cleanup - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_switches.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_switches.yaml index ff3c0f86a..74ff37614 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_switches.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_multi_switches.yaml @@ -10,19 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -35,13 +35,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - multi_switches delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -57,11 +57,11 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -82,16 +82,16 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -101,11 +101,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_no_optional_elems.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_no_optional_elems.yaml index 8cc38fa62..befff7b3c 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_no_optional_elems.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_no_optional_elems.yaml @@ -9,20 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -35,32 +35,32 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - no_optional_elems_merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: dcnm_interface_no_optional_elems_merge_conf: "{{ lookup('file', test_data_interfaces.no_optional_elems_merge_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create all interfaces without optional elements + - name: Create interfaces without optional elements cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_no_optional_elems_merge_conf }}" register: result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Verify interface creation results + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -77,28 +77,27 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete all interfaces without optional elements cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: deleted # only choose form [merged, replaced, deleted, overridden,query] + state: deleted # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_no_optional_elems_merge_conf }}" register: result - name: ASSERT - Check changed flag is true and return codes for delete - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -106,13 +105,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - name: ASSERT - Check return codes for cleanup - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_override_specific_types.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_override_specific_types.yaml index 1efd3fa89..5f052dc11 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_override_specific_types.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_override_specific_types.yaml @@ -9,25 +9,25 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden # only choose form [merged, replaced, deleted, overridden, query] deploy: false - override_intf_types: # choose from [pc, vpc, sub_int, lo, eth, svi] + override_intf_types: # choose from [pc, vpc, sub_int, lo, eth, svi] - sub_int - lo - pc register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -42,34 +42,34 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - override_specific_types_merge - override_specific_types_pc delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: - dcnm_interface_override_specific_types_merge_conf: "{{ lookup('file', test_data_interfaces.override_specific_types_merge_conf_file) | from_yaml }}" + dcnm_interface_override_specific_types_merge_conf: "{{ lookup('file', test_data_interfaces.override_specific_types_merge_conf_file) | from_yaml }}" delegate_to: localhost - name: Create pc/sub/lo interfaces cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_override_specific_types_merge_conf }}" register: result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Verify interface override results + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -85,9 +85,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Override vpc interface types alone cisco.dcnm.dcnm_interface: @@ -99,14 +99,14 @@ register: result - name: ASSERT - Check return codes for override vpc - assert: + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load PC Interface Config File ansible.builtin.set_fact: @@ -124,14 +124,14 @@ register: result - name: ASSERT - Check return codes for override pc with config - assert: + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Override sub_int/lo interface types alone cisco.dcnm.dcnm_interface: @@ -144,32 +144,32 @@ register: result - name: ASSERT - Check return codes for override sub_int/lo - assert: + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: Put fabric to default state cisco.dcnm.dcnm_interface: fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - override_intf_types: # choose from [pc, vpc, sub_int, lo, eth, svi] + state: overridden # only choose form [merged, replaced, deleted, overridden, query] + override_intf_types: # choose from [pc, vpc, sub_int, lo, eth, svi] - lo - sub_int - pc deploy: false register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - name: ASSERT - Check return codes for cleanup - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_query.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_query.yaml index 46f0327de..1e14f82df 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_query.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_query.yaml @@ -10,19 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -45,9 +45,9 @@ - query_non_existing delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -63,10 +63,10 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -83,9 +83,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Load Query Existing Interface Config File ansible.builtin.set_fact: @@ -101,14 +101,14 @@ register: result - name: ASSERT - Check query result for existing interfaces - assert: + ansible.builtin.assert: that: - 'result.changed == false' - '(result["response"] | length) != 0' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Load Query Non-Existing Interface Config File ansible.builtin.set_fact: @@ -124,28 +124,27 @@ register: result - name: ASSERT - Check query result for non-existing interfaces - assert: + ansible.builtin.assert: that: - 'result.changed == false' - '(result["response"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_sanity.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_sanity.yaml index 9d55a09ff..10c19874d 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_sanity.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_intf_sanity.yaml @@ -2,31 +2,33 @@ ## SETUP ## ############################################## -- name: SANITY- Remove local log file +- name: Remove local log file local_action: command rm -f dcnm_intf.log tags: sanity -- name: SANITY- Put the fabric to default state +- name: Put the fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result tags: sanity -- assert: +- name: ASSERT - Check return codes for setup + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' tags: sanity - name: Sanity tests - 1 tags: sanity - block: -############################################## -## SETUP VARS ## -############################################## +- block: + + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -53,7 +55,7 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - sanity_eth_merge - sanity_eth_replace - sanity_pc_merge @@ -64,9 +66,9 @@ - sanity_mixed_modified delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGED ## + ############################################## - name: Load Ethernet Interface Config File ansible.builtin.set_fact: @@ -85,7 +87,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -102,9 +104,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Ethernet Replace Interface Config File ansible.builtin.set_fact: @@ -123,7 +125,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after replace @@ -150,11 +152,11 @@ - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -169,7 +171,7 @@ - name: ASSERT - Check return codes for cleanup assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' when: IT_CONTEXT is not defined @@ -177,9 +179,9 @@ tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create ethernet interfaces - 2 cisco.dcnm.dcnm_interface: ð_merge2 @@ -193,7 +195,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -210,9 +212,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: SANITY- Replace ethernet interfaces - 2 cisco.dcnm.dcnm_interface: ð_replace2 @@ -226,7 +228,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after replace @@ -253,11 +255,11 @@ - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -271,7 +273,7 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' when: IT_CONTEXT is not defined @@ -279,9 +281,9 @@ tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load PC Interface Config File ansible.builtin.set_fact: @@ -300,7 +302,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for PC @@ -317,9 +319,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load PC Replace Interface Config File ansible.builtin.set_fact: @@ -338,7 +340,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for PC replace @@ -359,18 +361,18 @@ cisco.dcnm.dcnm_interface: *pc_replace register: result - # possible bug - # - name: ASSERT - Check changed flag is false and return codes for idempotence - # assert: - # that: - # - 'result.changed == false' - # - 'result.response is defined' - # - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # possible bug + # - name: ASSERT - Check changed flag is false and return codes for idempotence + # assert: + # that: + # - 'result.changed == false' + # - 'result.response is defined' + # - 'result.response | length >= 0' # Allow empty response for idempotence + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -384,7 +386,7 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' when: IT_CONTEXT is not defined @@ -392,9 +394,9 @@ tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Sub Interface Config File ansible.builtin.set_fact: @@ -413,7 +415,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for sub-interfaces @@ -430,9 +432,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Sub Replace Interface Config File ansible.builtin.set_fact: @@ -451,7 +453,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for sub-interface replace @@ -478,11 +480,11 @@ - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -496,7 +498,7 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' when: IT_CONTEXT is not defined @@ -504,9 +506,9 @@ tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Multi Interface Config File ansible.builtin.set_fact: @@ -525,7 +527,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for multi-interfaces @@ -559,7 +561,7 @@ assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC for mixed modified interfaces @@ -576,22 +578,24 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## CLEANUP ## -############################################## + + ############################################## + ## CLEANUP ## + ############################################## always: - - name: SANITY- Put fabric to default state + - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_delete.yaml index 6a9334b3f..d7013b7cf 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_delete.yaml @@ -10,18 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -34,13 +35,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -69,9 +70,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete loopback interfaces cisco.dcnm.dcnm_interface: &lo_del @@ -101,15 +102,15 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -119,10 +120,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_fabric.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_fabric.yaml index 52432d125..d50341ed9 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_fabric.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_fabric.yaml @@ -15,12 +15,13 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - name: Save Data For Loopback0 cisco.dcnm.dcnm_interface: @@ -44,14 +45,16 @@ - "{{ test_data_common.switch2 }}" register: lpk1_data -- debug: msg="Loopback 0 Data - {{ lpk0_data.response[0]['interfaces'][0]['nvPairs'] }}" -- debug: msg="Loopback 1 Data - {{ lpk1_data.response[0]['interfaces'][0]['nvPairs'] }}" +- name: Debug + ansible.builtin.debug: msg="Loopback 0 Data - {{ lpk0_data.response[0]['interfaces'][0]['nvPairs'] }}" +- name: Debug + ansible.builtin.debug: msg="Loopback 1 Data - {{ lpk1_data.response[0]['interfaces'][0]['nvPairs'] }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -66,14 +69,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - lo0_replace - lo1_replace delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## # Note: Fabric loopback interfaces are created at fabric creation time # This test validates that we can modify them with the replace state @@ -92,7 +95,7 @@ register: result - name: ASSERT - Verify fabric loopback interface (loopback0) replace results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -128,7 +131,7 @@ register: result - name: ASSERT - Verify fabric loopback interface (loopback1) replace results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -155,32 +158,32 @@ register: result - name: ASSERT - Verify fabric loopback interface (loopback0) idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Idempotence check for loopback0 failed - {{ result }}" success_msg: "Idempotence check for loopback0 succeeded" - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty - name: Replace fabric loopback interface (loopback1) - Idempotence cisco.dcnm.dcnm_interface: *lo_replace_lo1 register: result - name: ASSERT - Verify fabric loopback interface (loopback1) idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Idempotence check for loopback1 failed - {{ result }}" success_msg: "Idempotence check for loopback1 succeeded" - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -190,10 +193,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_merge.yaml index 8c987d8b9..da690e47f 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_merge.yaml @@ -11,26 +11,26 @@ - "----------------------------------------------------------------" - name: Remove local log file - local_action: command rm -f dcnm_intf.log + ansible.builtin.command: rm -f dcnm_intf.log + delegate_to: localhost - name: Put the fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,13 +43,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -60,16 +60,16 @@ cisco.dcnm.dcnm_interface: &lo_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merge_conf }}" - register: result + register: merge_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Merge changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -87,33 +87,33 @@ - name: Create loopback interfaces - Idempotence cisco.dcnm.dcnm_interface: *lo_merge - register: result + register: merge_idem_result - - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + - name: ASSERT - Merge idempotence + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + - merge_idem_result.changed == false + - merge_idem_result.response is defined + - merge_idem_result.response | length >= 0 # Allow empty response for idempotence + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - name: ASSERT - Check return codes for cleanup - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_mpls.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_mpls.yaml index 6319274da..388c31d2f 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_mpls.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_mpls.yaml @@ -25,11 +25,11 @@ - name: Set Test Control Flag ansible.builtin.set_fact: - run_test: True + run_test: true - name: Test will not be run since Loopback101 does not appear to exist ansible.builtin.set_fact: - run_test: False + run_test: false when: lpk101_data.response == [] - name: Access Policy Data If Loopack101 Data Is Available @@ -39,17 +39,17 @@ - name: Test will not be run since Loopback101 is not an MPLS Fabric Loopback ansible.builtin.set_fact: - run_test: False + run_test: false when: (loopback_policy is defined) and (loopback_policy != 'int_mpls_loopback') -- debug: msg="Loopback 101 Data - {{ lpk101_data.response[0]['interfaces'][0]['nvPairs'] }}" +- name: Debug + ansible.builtin.debug: msg="Loopback 101 Data - {{ lpk101_data.response[0]['interfaces'][0]['nvPairs'] }}" when: run_test - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -69,9 +69,9 @@ - mpls_lo201_merge delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## # Note: MPLS fabric loopback interfaces are created at fabric creation time # This test validates that we can modify them with the replace state @@ -90,7 +90,7 @@ register: result - name: ASSERT - Verify MPLS fabric loopback interface (loopback101) replace results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -117,18 +117,18 @@ register: result - name: ASSERT - Verify MPLS fabric loopback interface (loopback101) idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Idempotence check for loopback101 failed - {{ result }}" success_msg: "Idempotence check for loopback101 succeeded" - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## # Test that we can also create new MPLS loopback interfaces @@ -146,7 +146,7 @@ register: result - name: ASSERT - Verify MPLS loopback interface (loopback201) creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -173,18 +173,18 @@ register: result - name: ASSERT - Verify MPLS loopback interface (loopback201) idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Idempotence check for loopback201 failed - {{ result }}" success_msg: "Idempotence check for loopback201 succeeded" - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete MPLS loopback interface (loopback201) cisco.dcnm.dcnm_interface: &lo_delete_lo201 @@ -195,7 +195,7 @@ register: result - name: ASSERT - Verify MPLS loopback interface (loopback201) deletion results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -223,33 +223,31 @@ register: result - name: ASSERT - Verify MPLS loopback interface (loopback201) deletion idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Deletion idempotence check for loopback201 failed - {{ result }}" success_msg: "Deletion idempotence check for loopback201 succeeded" - # Don't loop over response items for idempotence check as they may be empty - -############################################## -## CLEANUP ## -############################################## + # Don't loop over response items for idempotence check as they may be empty + ############################################## + ## CLEANUP ## + ############################################## when: run_test - always: - - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_override.yaml index cb2d42b59..0dc22857c 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_override.yaml @@ -9,19 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result -- assert: +- name: ASSERT - Setup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -36,54 +37,54 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - override_merge - override delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Interface Config File + - name: Load Merge Interface Config File ansible.builtin.set_fact: dcnm_interface_override_merge_conf: "{{ lookup('file', test_data_interfaces.override_merge_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create loopback interfaces + - name: Merge loopback interfaces cisco.dcnm.dcnm_interface: &lo_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_override_merge_conf }}" - register: result + register: merge_result - - name: ASSERT - Verify loopback interface creation results - assert: + - name: ASSERT - Merge changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - merge_result.changed == true + - item.RETURN_CODE == 200 fail_msg: "Creation of loopback interfaces failed - {{ result }}" success_msg: "Creation of loopback interfaces succeeded" - loop: '{{ result.response }}' + loop: "{{ merge_result.response }}" - name: QUERY - Get loopback interface state in NDFC (merge) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_override_merge_conf }}" - register: verify_result + register: merge_verify_result - name: VALIDITY CHECK - Verify loopback interface state in NDFC (merge) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.override_merge_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ merge_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -94,39 +95,39 @@ cisco.dcnm.dcnm_interface: &lo_override check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden config: "{{ dcnm_interface_override_conf }}" - register: result + register: override_result - - name: ASSERT - Verify loopback interface override results - assert: + - name: ASSERT - Override changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - override_result.changed == true + - item.RETURN_CODE == 200 fail_msg: "Override of loopback interfaces failed - {{ result }}" success_msg: "Override of loopback interfaces succeeded" - loop: '{{ result.response }}' + loop: "{{ override_result.response }}" - name: QUERY - Get loopback interface state in NDFC (override) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_override_conf }}" - register: verify_result + register: override_verify_result - name: VALIDITY CHECK - Verify loopback interface state in NDFC (override) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.override_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ override_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Override loopback interfaces - Idempotence cisco.dcnm.dcnm_interface: *lo_override - register: result + register: override_idem_result - name: ASSERT - Verify loopback interface override idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["deleted"] | length) == 0' @@ -137,24 +138,25 @@ - 'item["RETURN_CODE"] == 200' fail_msg: "Idempotence check for loopback interface override failed - {{ result }}" success_msg: "Idempotence check for loopback interface override succeeded" - loop: '{{ result.response }}' + loop: "{{ override_idem_result.response }}" -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_replace.yaml index a0cf6fcad..bb2668fa7 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_lo_replace.yaml @@ -17,20 +17,19 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result -- name: ASSERT - Check return codes for setup - assert: +- name: ASSERT - Setup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -45,52 +44,52 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Interface Config File + - name: Load Merge Interface Config File ansible.builtin.set_fact: dcnm_interface_merged_conf: "{{ lookup('file', test_data_interfaces.merged_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create loopback interfaces + - name: Merge loopback interfaces cisco.dcnm.dcnm_interface: &lo_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merged_conf }}" - register: result + register: merge_result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - name: QUERY - Get interface state in NDFC after merge cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: merge_verify_result - name: VALIDITY CHECK - Verify interface state in NDFC after merge cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merged_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ merge_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: @@ -101,60 +100,59 @@ cisco.dcnm.dcnm_interface: &lo_replace check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: replaced # only choose form [merged, replaced, deleted, overridden, query] + state: replaced config: "{{ dcnm_interface_replace_conf }}" - register: result + register: replace_result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - replace_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ replace_result.response }}" - - name: QUERY - Get interface state in NDFC after replace + - name: QUERY - Get interface state after replace cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.fabric }}" config: "{{ dcnm_interface_replace_conf }}" - register: verify_result + register: replace_verify_result - name: VALIDITY CHECK - Verify interface state in NDFC after replace cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.replace_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ replace_verify_result }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Replace loopback interfaces - Idempotence cisco.dcnm.dcnm_interface: *lo_replace - register: result + register: replace_idem_result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response is defined' - - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + - replace_idem_result.changed == false + - replace_idem_result.response is defined + - replace_idem_result.response | length >= 0 -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - name: ASSERT - Check return codes for cleanup - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_old_format_pb.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_old_format_pb.yaml index c2631c22b..ae1ff0648 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_old_format_pb.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_old_format_pb.yaml @@ -9,19 +9,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -46,7 +47,7 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - old_format1 - old_format2 - old_format3 @@ -56,9 +57,9 @@ - old_format7 delegate_to: localhost -############################################## -## MERGE 1 ## -############################################## + ############################################## + ## MERGE 1 ## + ############################################## - name: Load Interface Config File - Old Format 1 ansible.builtin.set_fact: @@ -69,12 +70,12 @@ cisco.dcnm.dcnm_interface: &old_format1 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format1_conf }}" register: result - name: ASSERT - Verify old format 1 interface creation results - assert: + ansible.builtin.assert: that: - 'result.failed == false' - 'result.changed == true' @@ -97,9 +98,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## MERGE 2 ## -############################################## + ############################################## + ## MERGE 2 ## + ############################################## - name: Load Interface Config File - Old Format 2 ansible.builtin.set_fact: @@ -110,23 +111,24 @@ cisco.dcnm.dcnm_interface: &old_format2 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format2_conf }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.failed == false' - 'result.changed == true' - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 3 ## -############################################## + ############################################## + ## MERGE 3 ## + ############################################## - name: Load Interface Config File - Old Format 3 ansible.builtin.set_fact: @@ -137,23 +139,24 @@ cisco.dcnm.dcnm_interface: &old_format3 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format3_conf }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.failed == false' - 'result.changed == true' - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 4 ## -############################################## + ############################################## + ## MERGE 4 ## + ############################################## - name: Load Interface Config File - Old Format 4 ansible.builtin.set_fact: @@ -164,7 +167,7 @@ cisco.dcnm.dcnm_interface: &old_format4 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format4_conf }}" register: result @@ -175,12 +178,12 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 5 ## -############################################## + ############################################## + ## MERGE 5 ## + ############################################## - name: Load Interface Config File - Old Format 5 ansible.builtin.set_fact: @@ -191,7 +194,7 @@ cisco.dcnm.dcnm_interface: &old_format5 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format5_conf }}" register: result @@ -202,12 +205,12 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 6 ## -############################################## + ############################################## + ## MERGE 6 ## + ############################################## - name: Load Interface Config File - Old Format 6 ansible.builtin.set_fact: @@ -218,7 +221,7 @@ cisco.dcnm.dcnm_interface: &old_format6 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format6_conf }}" register: result @@ -229,12 +232,12 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE 7 ## -############################################## + ############################################## + ## MERGE 7 ## + ############################################## - name: Load Interface Config File - Old Format 7 ansible.builtin.set_fact: @@ -245,7 +248,7 @@ cisco.dcnm.dcnm_interface: &old_format7 check_deploy: true fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_old_format7_conf }}" register: result @@ -256,12 +259,12 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -269,12 +272,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_delete.yaml index 0bf0ca0d6..6ad68a0cc 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_delete.yaml @@ -10,18 +10,18 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -38,9 +38,9 @@ - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -69,9 +69,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete port channel interfaces cisco.dcnm.dcnm_interface: &pc_del @@ -89,7 +89,7 @@ register: verify_result - name: ASSERT - Verify port channel interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - 'verify_result.response | length == 0' @@ -98,28 +98,28 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_merge.yaml index 9bad9bf5e..5533fd937 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_merge.yaml @@ -1,7 +1,6 @@ ############################################## ## SETUP ## ############################################## - - name: PC MERGE - Test Entry Point - [ndfc_interface] ansible.builtin.debug: msg: @@ -17,20 +16,19 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: setup_result -- name: ASSERT - Check return codes for setup - assert: +- name: ASSERT - Setup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - item.RETURN_CODE == 200 + loop: "{{ setup_result.response }}" - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -47,9 +45,9 @@ - merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -60,16 +58,16 @@ cisco.dcnm.dcnm_interface: &pc_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merge_conf }}" - register: result + register: merge_result - - name: ASSERT - Check changed flag is true and return codes - assert: + - name: ASSERT - Merge changed & return codes + ansible.builtin.assert: that: - - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - merge_result.changed == true + - item.RETURN_CODE == 200 + loop: "{{ merge_result.response }}" - name: QUERY - Get interface state in NDFC cisco.dcnm.dcnm_interface: @@ -87,32 +85,32 @@ - name: Create port channel interfaces - Idempotence cisco.dcnm.dcnm_interface: *pc_merge - register: result + register: merge_idem_result - - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + - name: ASSERT - Merge idempotence + ansible.builtin.assert: that: - - 'result.changed == false' + - merge_idem_result.changed == false - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_override.yaml index f6170a7d1..7685e3bbd 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_override.yaml @@ -10,18 +10,18 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -41,9 +41,9 @@ - override delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -59,7 +59,7 @@ register: result - name: ASSERT - Verify port channel interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -81,9 +81,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -99,7 +99,7 @@ register: result - name: ASSERT - Verify port channel interface override results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -126,7 +126,7 @@ register: result - name: ASSERT - Verify port channel interface override idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'item["RETURN_CODE"] == 200' @@ -134,22 +134,22 @@ success_msg: "Idempotence check for port channel interface override succeeded" loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_replace.yaml index bb969ad29..9547f3c81 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_pc_replace.yaml @@ -10,18 +10,18 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -41,9 +41,9 @@ - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -59,7 +59,7 @@ register: result - name: ASSERT - Verify port channel interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -81,9 +81,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: @@ -99,7 +99,7 @@ register: result - name: ASSERT - Verify port channel interface replace results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -126,7 +126,7 @@ register: result - name: ASSERT - Verify port channel interface replace idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'item["RETURN_CODE"] == 200' @@ -134,22 +134,22 @@ success_msg: "Idempotence check for port channel interface replace succeeded" loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Put fabric to default state cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_delete.yaml index 33f45a05a..7fe3464bc 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_delete.yaml @@ -28,18 +28,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -52,13 +53,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -71,7 +72,6 @@ fabric: "{{ test_data_common.fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_delete_conf }}" - register: result - name: QUERY - Get ST FEX interface state in NDFC (merge) @@ -88,9 +88,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete ST FEX interfaces cisco.dcnm.dcnm_interface: &fex_del @@ -120,15 +120,15 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -138,10 +138,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_merge.yaml index b97a69aed..761f42a4a 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_merge.yaml @@ -32,18 +32,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -64,7 +65,7 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge - merge_po150 - merge_po151 @@ -72,9 +73,9 @@ - merge_po151_update delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config Files ansible.builtin.set_fact: @@ -91,11 +92,10 @@ fabric: "{{ test_data_common.fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merge_po150_conf }}" - register: result - name: ASSERT - Verify ST FEX interface creation results (po150) - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -122,16 +122,16 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create ST FEX interfaces including optional parameters cisco.dcnm.dcnm_interface: &fex_merge2 @@ -142,7 +142,7 @@ register: result - name: ASSERT - Verify ST FEX interface creation results (po151) - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -169,16 +169,16 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Merge ST FEX interface cisco.dcnm.dcnm_interface: &fex_merge3 @@ -189,7 +189,7 @@ register: result - name: ASSERT - Verify ST FEX interface merge results (po151 update) - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -211,9 +211,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create ST FEX interfaces - multiple switches cisco.dcnm.dcnm_interface: &fex_merge4 @@ -224,7 +224,7 @@ register: result - name: ASSERT - Verify ST FEX interface creation results (po155) - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -246,9 +246,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -258,10 +258,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_override.yaml index cde050114..86b21a74e 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_override.yaml @@ -27,19 +27,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -54,16 +55,16 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - override_merge - override delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Load Interface Config File + - name: Load Interface Config Files ansible.builtin.set_fact: dcnm_interface_override_merge_conf: "{{ lookup('file', test_data_interfaces.override_merge_conf_file) | from_yaml }}" delegate_to: localhost @@ -72,17 +73,17 @@ cisco.dcnm.dcnm_interface: &fex_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_override_merge_conf }}" register: result - name: ASSERT - Verify ST FEX interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' - fail_msg: "Creation of ST FEX interfaces failed - {{ result }}" - success_msg: "Creation of ST FEX interfaces succeeded" + fail_msg: "Creation of ST FEX interface failed - {{ result }}" + success_msg: "Creation of ST FEX interface succeeded" loop: '{{ result.response }}' - name: QUERY - Get ST FEX interface state in NDFC (merge) @@ -99,9 +100,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -112,7 +113,7 @@ cisco.dcnm.dcnm_interface: &fex_override check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden config: "{{ dcnm_interface_override_conf }}" register: result @@ -151,11 +152,11 @@ - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Idempotence check for ST FEX interface override failed - {{ result }}" success_msg: "Idempotence check for ST FEX interface override succeeded" - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -163,12 +164,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_query.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_query.yaml index efd8615f5..77bca4d59 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_query.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_query.yaml @@ -27,19 +27,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -54,14 +55,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - query - query_merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config Files ansible.builtin.set_fact: @@ -73,12 +74,12 @@ cisco.dcnm.dcnm_interface: &fex_merge check_deploy: false fabric: "{{ test_data_common.fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_query_merge_conf }}" register: result - name: ASSERT - Verify ST FEX interface creation results for query tests - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -100,25 +101,24 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## QUERY ## -############################################## - + ############################################## + ## QUERY ## + ############################################## - name: Query interface details - Existing cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: query # only choose form [merged, replaced, deleted, overridden, query] + state: query config: - name: po150 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" - name: po151 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" - name: po152 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" register: result - assert: @@ -143,13 +143,14 @@ config: - name: po150 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" - name: po152 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -171,10 +172,10 @@ config: - name: po151 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" - name: po122 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" register: result - assert: @@ -199,10 +200,10 @@ config: - name: po121 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" - name: po122 switch: - - "{{ test_data_common.switch1 }}" + - "{{ test_data_common.switch1 }}" register: result - assert: @@ -218,10 +219,9 @@ - assert: that: - '(result["response"] | length) == 0' - -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -229,12 +229,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_replace.yaml index ab68fe6d1..53068ccbe 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_st_fex_replace.yaml @@ -27,19 +27,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -54,14 +55,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - replace - merged delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -100,9 +101,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Replace ST FEX interfaces cisco.dcnm.dcnm_interface: &fex_replace @@ -147,12 +148,11 @@ - 'result.response | length >= 0' # Allow empty response for idempotence fail_msg: "Idempotence check for ST FEX interface replace failed - {{ result }}" success_msg: "Idempotence check for ST FEX interface replace succeeded" - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty - -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -160,12 +160,13 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_delete.yaml index 5c7af67e0..89c83e44b 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_delete.yaml @@ -10,18 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -34,13 +35,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -69,9 +70,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete sub-interfaces cisco.dcnm.dcnm_interface: &sub_delete @@ -101,15 +102,15 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -119,10 +120,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_merge.yaml index 179ea194f..66240cb50 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_merge.yaml @@ -18,19 +18,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,13 +43,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -65,7 +65,7 @@ register: result - name: ASSERT - Verify sub-interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -92,16 +92,16 @@ register: result - name: ASSERT - Verify sub-interface idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response|length == 0' fail_msg: "Idempotence test failed for sub-interfaces - {{ result }}" success_msg: "Idempotence test passed for sub-interfaces" -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -111,10 +111,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_override.yaml index 39c59ddc0..2844b2e1f 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_override.yaml @@ -10,18 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -36,14 +37,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - override_merge - override delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -59,7 +60,7 @@ register: result - name: ASSERT - Verify sub-interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -81,9 +82,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -99,7 +100,7 @@ register: result - name: ASSERT - Verify sub-interface override results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -126,7 +127,7 @@ register: result - name: ASSERT - Verify sub-interface override idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -138,9 +139,9 @@ success_msg: "Idempotence check for sub-interface override succeeded" loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -150,10 +151,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_replace.yaml index e4e7e02db..5cecbbc7c 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_sub_replace.yaml @@ -10,18 +10,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -36,14 +37,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -59,7 +60,7 @@ register: result - name: ASSERT - Verify sub-interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -81,9 +82,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: @@ -99,7 +100,7 @@ register: result - name: ASSERT - Verify sub-interface replace results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -126,7 +127,7 @@ register: result - name: ASSERT - Verify sub-interface replace idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -139,9 +140,9 @@ success_msg: "Idempotence check for sub-interface replace succeeded" loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -151,10 +152,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_delete.yaml index 0db16c655..a38bde71a 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_delete.yaml @@ -3,7 +3,7 @@ ############################################## - name: Skip SVI tests if svi_fabric is not defined - meta: end_play + ansible.builtin.meta: end_play when: test_data_common.svi_fabric is not defined or test_data_common.svi_fabric == "" - name: Remove local log file @@ -14,18 +14,18 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -34,20 +34,20 @@ merged_conf_file: "{{ role_path }}/files/dcnm_interface_svi_merged_conf.yaml" delete_conf_template: "templates/dcnm_svi/delete_conf.j2" delete_conf_file: "{{ role_path }}/files/dcnm_interface_svi_delete_conf.yaml" - delegate_to: localhost + delegate_to: localhost - name: Create Interface Config Files using J2 Templates ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -76,9 +76,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Load Delete Interface Config File ansible.builtin.set_fact: @@ -94,37 +94,37 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - - 'result.changed == True' + - 'result.changed == true' - name: QUERY - Get interface state in NDFC (delete) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.svi_fabric }}" config: "{{ dcnm_interface_delete_conf }}" - register: result + register: verify_delete - name: ASSERT RESPONSE IS EMPTY - assert: + ansible.builtin.assert: that: - - 'result.response is defined' - - 'result.response | length == 0' + - 'verify_delete.response is defined' + - 'verify_delete.response | length == 0' - name: Delete SVI interfaces - Idempotence cisco.dcnm.dcnm_interface: *svi_del register: result - name: ASSERT - Check changed flag is false and return codes for idempotence (delete) - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -134,10 +134,11 @@ fabric: "{{ test_data_common.svi_fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_invalid_params.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_invalid_params.yaml index f64becfc4..1f7131c59 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_invalid_params.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_invalid_params.yaml @@ -3,7 +3,7 @@ ############################################## - name: Skip SVI tests if svi_fabric is not defined - meta: end_play + ansible.builtin.meta: end_play when: test_data_common.svi_fabric is not defined or test_data_common.svi_fabric == "" - name: Remove local log file @@ -11,53 +11,55 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create SVI interfaces w/o admin state cisco.dcnm.dcnm_interface: check_deploy: false fabric: "{{ test_data_common.svi_fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged # only choose from [merged, replaced, deleted, overridden, query] config: - name: vlan3000 # should be of the form vlan - type: svi # choose from this list [pc, vpc, sub_int, lo, eth, svi] - switch: - - "{{ test_data_common.switch1 }}" # provide the switch information where the config is to be deployed - deploy: true # choose from [true, false] - profile: - mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" - ignore_errors: yes + type: svi # choose from [pc, vpc, sub_int, lo, eth, svi] + switch: + - "{{ test_data_common.switch1 }}" # provide the switch information where the config is to be deployed + deploy: true # choose from [true, false] + profile: + mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("admin_state" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"admin_state" in result.msg' - name: Create SVI interfaces w/o mode cisco.dcnm.dcnm_interface: check_deploy: false fabric: "{{ test_data_common.svi_fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged # only choose from [merged, replaced, deleted, overridden, query] config: - name: vlan3000 # should be of the form vlan - type: svi # choose from this list [pc, vpc, sub_int, lo, eth, svi] - switch: - - "{{ test_data_common.switch1 }}" # provide the switch information where the config is to be deployed - deploy: true # choose from [true, false] - profile: - admin_state: true # Flag to enable/disable Vlan interaface - #mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" - ignore_errors: yes + type: svi # choose from [pc, vpc, sub_int, lo, eth, svi] + switch: # provide the switch information where the config is to be deployed + - "{{ test_data_common.switch1 }}" + deploy: true # choose from [true, false] + profile: + admin_state: true # Flag to enable/disable Vlan interface + # mode : vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("mode" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"mode" in result.msg' - name: Create SVI interfaces with ipv4_addr but w/o mask length cisco.dcnm.dcnm_interface: @@ -74,13 +76,14 @@ admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" ipv4_addr: 10.1.1.1 # optional, Interfae IP, default is "" - ignore_errors: yes + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("ipv4_mask_len" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"ipv4_mask_len" in result.msg' - name: Create SVI interfaces with HSRP not enabled, but preempt included cisco.dcnm.dcnm_interface: @@ -97,13 +100,14 @@ admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" preempt: true # optional, flag to enable/disable overthrow of low priority active routers, optional is "false" - ignore_errors: yes + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("preempt" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"preempt" in result.msg' - name: Create SVI interfaces with HSRP enabled but w/o HSRP VIP cisco.dcnm.dcnm_interface: @@ -120,13 +124,14 @@ admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" enable_hsrp: true # optional, flag to enable/disable HSRP on the interface, default is "false" - ignore_errors: yes + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("hsrp_vip" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"hsrp_vip" in result.msg' - name: Create SVI interfaces with HSRP enabled but w/o HSRP Group cisco.dcnm.dcnm_interface: @@ -144,13 +149,14 @@ mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" enable_hsrp: true # optional, flag to enable/disable HSRP on the interface, default is "false" hsrp_vip: 192.129.1.1 # optional, Virtual IP address for HSRP, default is "" - ignore_errors: yes + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("hsrp_group" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"hsrp_group" in result.msg' - name: Create SVI interfaces with NETFLOW enabled but w/o NETFLOW Monitor cisco.dcnm.dcnm_interface: @@ -167,13 +173,14 @@ admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" enable_netflow: true # optional, flag to enable netflow, default is "false" - ignore_errors: yes + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("netflow_monitor" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"netflow_monitor" in result.msg' - name: Create SVI interfaces with DHCP1 Server Address but w/o VRF DHCP1 cisco.dcnm.dcnm_interface: @@ -189,14 +196,15 @@ profile: admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" - dhcp_server_addr1: 192.200.1.1 - ignore_errors: yes + dhcp_server_addr1: 192.200.1.1 # IP of the primary DHCP server, defaults to "" + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("vrf_dhcp1" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"vrf_dhcp1" in result.msg' - name: Create SVI interfaces with DHCP2 Server Address but w/o VRF DHCP2 cisco.dcnm.dcnm_interface: @@ -212,14 +220,15 @@ profile: admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" - dhcp_server_addr2: 192.200.1.1 - ignore_errors: yes + dhcp_server_addr2: 192.200.1.1 # IP of the secondary DHCP server, defaults to "" + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("vrf_dhcp2" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"vrf_dhcp2" in result.msg' - name: Create SVI interfaces with DHCP3 Server Address but w/o VRF DHCP3 cisco.dcnm.dcnm_interface: @@ -235,11 +244,12 @@ profile: admin_state: true # Flag to enable/disable Vlan interaface mode: vlan # choose from [int_vlan, int_vlan_admin_state], default is "int_vlan" - dhcp_server_addr3: 192.200.1.1 - ignore_errors: yes + dhcp_server_addr3: 192.200.1.1 # IP of the tertiary DHCP server, defaults to "" + ignore_errors: true register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - '("Invalid parameters" in result["msg"])' - - '("vrf_dhcp3" in result["msg"])' + - '"Invalid parameters" in result.msg' + - '"vrf_dhcp3" in result.msg' diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_merge.yaml index 6ce753c28..19ecb55cd 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_merge.yaml @@ -3,7 +3,7 @@ ############################################## - name: Skip SVI tests if svi_fabric is not defined - meta: end_play + ansible.builtin.meta: end_play when: test_data_common.svi_fabric is not defined or test_data_common.svi_fabric == "" - name: Remove local log file @@ -14,37 +14,37 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: - -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_interfaces: merged_conf_template: "templates/dcnm_svi/merged_conf.j2" merged_conf_file: "{{ role_path }}/files/dcnm_interface_svi_merged_conf.yaml" - delegate_to: localhost + delegate_to: localhost - name: Create Interface Config Files using J2 Templates ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -57,11 +57,10 @@ fabric: "{{ test_data_common.svi_fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merged_conf }}" - register: result - name: ASSERT - Verify SVI interface creation results - assert: + ansible.builtin.assert: that: - 'result.changed == true' - 'item["RETURN_CODE"] == 200' @@ -88,7 +87,7 @@ register: result - name: ASSERT - Verify SVI interface idempotence results - assert: + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -100,9 +99,9 @@ success_msg: "Idempotence check for SVI interfaces succeeded" loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -112,10 +111,11 @@ fabric: "{{ test_data_common.svi_fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_override.yaml index 4185f8809..bb4222671 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_override.yaml @@ -1,9 +1,9 @@ ############################################## -## SETUP ## +## . SETUP ## ############################################## - name: Skip SVI tests if svi_fabric is not defined - meta: end_play + ansible.builtin.meta: end_play when: test_data_common.svi_fabric is not defined or test_data_common.svi_fabric == "" - name: Remove local log file @@ -13,20 +13,20 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: fabric_reset -- assert: +- name: Assert initial state reset succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ fabric_reset.response }}' - block: -############################################## -## SETUP VARS ## -############################################## - + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_interfaces: @@ -40,55 +40,53 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - override delegate_to: localhost -############################################## -## MERGE ## -############################################## - - - name: Load Interface Config File + ############################################## + ## MERGE ## + ############################################## + - name: Load Interface Config File (merged) ansible.builtin.set_fact: dcnm_interface_merged_conf: "{{ lookup('file', test_data_interfaces.merged_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create SVI interfaces + - name: Create SVI interfaces (merged) cisco.dcnm.dcnm_interface: &svi_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merged_conf }}" - register: result + register: merge_result - name: ASSERT - Verify SVI interface creation results - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'merge_result.changed == true' - 'item["RETURN_CODE"] == 200' - fail_msg: "Creation of SVI interfaces failed - {{ result }}" + fail_msg: "Creation of SVI interfaces failed - {{ merge_result }}" success_msg: "Creation of SVI interfaces succeeded" - loop: '{{ result.response }}' + loop: '{{ merge_result.response }}' - name: QUERY - Get SVI interface state in NDFC (merge) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.svi_fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: verify_merge - name: VALIDITY CHECK - Verify SVI interface state in NDFC (merge) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merged_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ verify_merge }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## - + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: dcnm_interface_override_conf: "{{ lookup('file', test_data_interfaces.override_conf_file) | from_yaml }}" @@ -98,62 +96,60 @@ cisco.dcnm.dcnm_interface: &svi_override check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] + state: overridden config: "{{ dcnm_interface_override_conf }}" - register: result + register: override_result - name: ASSERT - Verify SVI interface override results - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'override_result.changed == true' - 'item["RETURN_CODE"] == 200' - fail_msg: "Override of SVI interfaces failed - {{ result }}" + fail_msg: "Override of SVI interfaces failed - {{ override_result }}" success_msg: "Override of SVI interfaces succeeded" - loop: '{{ result.response }}' + loop: '{{ override_result.response }}' - name: QUERY - Get SVI interface state in NDFC (override) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.svi_fabric }}" config: "{{ dcnm_interface_override_conf }}" - register: verify_result + register: verify_override - name: VALIDITY CHECK - Verify SVI interface state in NDFC (override) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.override_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ verify_override }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Override SVI interfaces - Idempotence cisco.dcnm.dcnm_interface: *svi_override - register: result + register: override_idem - name: ASSERT - Verify SVI interface idempotence results - assert: + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' - fail_msg: "Idempotence test failed for SVI interfaces - {{ result }}" - success_msg: "Idempotence test passed for SVI interfaces" - loop: '{{ result.response }}' - -############################################## -## CLEANUP ## -############################################## - + - 'override_idem.changed == false' + - '(override_idem.response | length) == 0' + fail_msg: "Idempotence test failed for SVI interfaces - {{ override_idem }}" + success_msg: "Idempotence test passed for SVI interfaces" + loop: '{{ override_idem.response }}' + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item["RETURN_CODE"] == 200' + loop: '{{ cleanup_result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_query.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_query.yaml index 72b1e7c8f..71c3e2193 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_query.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_query.yaml @@ -1,9 +1,9 @@ ############################################## -## SETUP ## +## SETUP ## ############################################## - name: Skip SVI tests if svi_fabric is not defined - meta: end_play + ansible.builtin.meta: end_play when: test_data_common.svi_fabric is not defined or test_data_common.svi_fabric == "" - name: Remove local log file @@ -13,19 +13,19 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: fabric_reset -- assert: +- name: Assert initial state reset succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - + - 'item["RETURN_CODE"] == 200' + loop: '{{ fabric_reset.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -34,48 +34,48 @@ merge_conf_file: "{{ role_path }}/files/dcnm_interface_svi_merge_conf.yaml" delegate_to: localhost - - name: Create Interface Config Files using J2 Templates + - name: Create Interface Config File using J2 Template ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: dcnm_interface_merge_conf: "{{ lookup('file', test_data_interfaces.merge_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create SVI interfaces + - name: Create SVI interfaces (merged) cisco.dcnm.dcnm_interface: &svi_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merge_conf }}" - register: result + register: merge_result - name: ASSERT - Verify SVI interface creation results - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'merge_result.changed == true' - 'item["RETURN_CODE"] == 200' - fail_msg: "Creation of SVI interfaces failed - {{ result }}" + fail_msg: "Creation of SVI interfaces failed - {{ merge_result }}" success_msg: "Creation of SVI interfaces succeeded" - loop: '{{ result.response }}' + loop: '{{ merge_result.response }}' - - name: QUERY - Get SVI interface state in NDFC (setup) + - name: QUERY - Get SVI interface state in NDFC (after merge) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.svi_fabric }}" config: "{{ dcnm_interface_merge_conf }}" register: verify_result - - name: VALIDITY CHECK - Verify SVI interface state in NDFC (setup) + - name: VALIDITY CHECK - Verify SVI interface state in NDFC (query) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merge_conf_file }}" ndfc_data: "{{ verify_result }}" @@ -83,23 +83,21 @@ delegate_to: localhost - -############################################## -## CLEANUP ## -############################################## - + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item["RETURN_CODE"] == 200' + loop: '{{ cleanup_result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_replace.yaml index 665f945a5..dc4d4dc44 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_svi_replace.yaml @@ -1,9 +1,9 @@ ############################################## -## SETUP ## +## SETUP ## ############################################## - name: Skip SVI tests if svi_fabric is not defined - meta: end_play + ansible.builtin.meta: end_play when: test_data_common.svi_fabric is not defined or test_data_common.svi_fabric == "" - name: Remove local log file @@ -13,20 +13,21 @@ cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + state: overridden + register: fabric_reset -- assert: +- name: Assert initial state reset succeeded + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ fabric_reset.response }}' -- block: -############################################## -## SETUP VARS ## -############################################## +- block: + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_interfaces: @@ -40,55 +41,53 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## - - - name: Load Interface Config File + ############################################## + ## MERGE ## + ############################################## + - name: Load Interface Config File (merged) ansible.builtin.set_fact: dcnm_interface_merged_conf: "{{ lookup('file', test_data_interfaces.merged_conf_file) | from_yaml }}" delegate_to: localhost - - name: Create SVI interfaces + - name: Create SVI interfaces (merged) cisco.dcnm.dcnm_interface: &svi_merge check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: merged # only choose form [merged, replaced, deleted, overridden, query] + state: merged config: "{{ dcnm_interface_merged_conf }}" - register: result + register: merge_result - name: ASSERT - Verify SVI interface creation results - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'merge_result.changed == true' - 'item["RETURN_CODE"] == 200' - fail_msg: "Creation of SVI interfaces failed - {{ result }}" + fail_msg: "Creation of SVI interfaces failed - {{ merge_result }}" success_msg: "Creation of SVI interfaces succeeded" - loop: '{{ result.response }}' + loop: '{{ merge_result.response }}' - name: QUERY - Get SVI interface state in NDFC (merge) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.svi_fabric }}" config: "{{ dcnm_interface_merged_conf }}" - register: verify_result + register: verify_merge - name: VALIDITY CHECK - Verify SVI interface state in NDFC (merge) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.merged_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ verify_merge }}" test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## - + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: dcnm_interface_replace_conf: "{{ lookup('file', test_data_interfaces.replace_conf_file) | from_yaml }}" @@ -98,68 +97,67 @@ cisco.dcnm.dcnm_interface: &svi_replace check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: replaced # only choose form [merged, replaced, deleted, overridden, query] + state: replaced config: "{{ dcnm_interface_replace_conf }}" - register: result + register: replace_result - name: ASSERT - Verify SVI interface replace results - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'replace_result.changed == true' - 'item["RETURN_CODE"] == 200' - fail_msg: "Replace of SVI interfaces failed - {{ result }}" + fail_msg: "Replace of SVI interfaces failed - {{ replace_result }}" success_msg: "Replace of SVI interfaces succeeded" - loop: '{{ result.response }}' + loop: '{{ replace_result.response }}' - name: QUERY - Get SVI interface state in NDFC (replace) cisco.dcnm.dcnm_interface: state: query fabric: "{{ test_data_common.svi_fabric }}" config: "{{ dcnm_interface_replace_conf }}" - register: verify_result + register: verify_replace - name: VALIDITY CHECK - Verify SVI interface state in NDFC (replace) cisco.dcnm.tests.integration.ndfc_interface_validate: config_path: "{{ test_data_interfaces.replace_conf_file }}" - ndfc_data: "{{ verify_result }}" + ndfc_data: "{{ verify_replace }}" test_data: "{{ test_data_common }}" delegate_to: localhost - name: Replace SVI interfaces - Idempotence cisco.dcnm.dcnm_interface: *svi_replace - register: result + register: replace_idem - name: ASSERT - Verify SVI interface idempotence results - assert: + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' - fail_msg: "Idempotence test failed for SVI interfaces - {{ result }}" + - 'replace_idem.changed == false' + - '(replace_idem.response | length) == 0' + fail_msg: "Idempotence test failed for SVI interfaces - {{ replace_idem }}" success_msg: "Idempotence test passed for SVI interfaces" # - '(result["diff"][0]["replaced"] | length) == 0' # - '(result["diff"][0]["overridden"] | length) == 0' - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## - + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Put fabric to default state + - name: Put fabric to default state (cleanup) cisco.dcnm.dcnm_interface: check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.svi_fabric }}" - state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result - when: IT_CONTEXT is not defined + state: overridden + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup condition + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - 'item["RETURN_CODE"] == 200' + loop: '{{ cleanup_result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_delete.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_delete.yaml index 005a43506..2f6f463fc 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_delete.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_delete.yaml @@ -18,19 +18,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,13 +43,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - delete delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -62,14 +62,13 @@ fabric: "{{ test_data_common.fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_delete_conf }}" - register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -86,9 +85,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete vPC interfaces cisco.dcnm.dcnm_interface: &vpc_del @@ -99,10 +98,10 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -113,7 +112,7 @@ register: verify_result - name: ASSERT - Verify interfaces are deleted (response length should be 0) - assert: + ansible.builtin.assert: that: - 'verify_result.response | length == 0' @@ -122,16 +121,16 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -141,11 +140,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_merge.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_merge.yaml index 2281715e3..81db95d75 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_merge.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_merge.yaml @@ -18,19 +18,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -43,13 +43,13 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merge delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -62,14 +62,13 @@ fabric: "{{ test_data_common.fabric }}" state: merged # only choose form [merged, replaced, deleted, overridden, query] config: "{{ dcnm_interface_merge_conf }}" - register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC @@ -91,16 +90,16 @@ register: result - name: ASSERT - Check changed flag is false and return codes for idempotence - assert: + ansible.builtin.assert: that: - 'result.changed == false' - 'result.response is defined' - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -110,11 +109,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_override.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_override.yaml index ef404efa1..3d347b91b 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_override.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_override.yaml @@ -18,19 +18,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -45,14 +45,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - override_merge - override delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -68,10 +68,10 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after merge @@ -88,9 +88,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## OVERRIDE ## -############################################## + ############################################## + ## OVERRIDE ## + ############################################## - name: Load Override Interface Config File ansible.builtin.set_fact: @@ -106,10 +106,10 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after override @@ -131,17 +131,17 @@ register: result - # failing, changed is true, possible bug - # - name: ASSERT - Check changed flag is false and return codes for idempotence - # assert: - # that: - # - 'result.changed == false' - # - 'result.response is defined' - # - 'result.response | length >= 0' + # failing, changed is true, possible bug + # - name: ASSERT - Check changed flag is false and return codes for idempotence + # assert: + # that: + # - 'result.changed == false' + # - 'result.response is defined' + # - 'result.response | length >= 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -151,11 +151,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_replace.yaml b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_replace.yaml index 293ae8ceb..888d54bd4 100644 --- a/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_replace.yaml +++ b/tests/integration/targets/dcnm_interface/tests/dcnm/dcnm_vpc_replace.yaml @@ -18,19 +18,19 @@ check_deploy: "{{ test_data_common.check_deploy | bool }}" fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] - register: result + register: result - name: ASSERT - Check return codes for setup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## SETUP VARS ## -############################################## + ############################################## + ## SETUP VARS ## + ############################################## - name: Setup Internal TestCase Variables ansible.builtin.set_fact: @@ -45,14 +45,14 @@ ansible.builtin.template: src: "{{ test_data_interfaces[item ~ '_conf_template'] }}" dest: "{{ test_data_interfaces[item ~ '_conf_file'] }}" - with_items: + loop: - merged - replace delegate_to: localhost -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Load Interface Config File ansible.builtin.set_fact: @@ -68,10 +68,10 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after merge @@ -88,9 +88,9 @@ test_data: "{{ test_data_common }}" delegate_to: localhost -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Load Replace Interface Config File ansible.builtin.set_fact: @@ -106,10 +106,10 @@ register: result - name: ASSERT - Check changed flag is true and return codes - assert: + ansible.builtin.assert: that: - 'result.changed == true' - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: QUERY - Get interface state in NDFC after replace @@ -130,17 +130,17 @@ cisco.dcnm.dcnm_interface: *vpc_replace register: result - # - name: ASSERT - Check changed flag is false and return codes for idempotence - # assert: - # that: - # - 'result.changed == false' - # - 'result.response is defined' - # - 'result.response | length >= 0' # Allow empty response for idempotence - # Don't loop over response items for idempotence check as they may be empty + # - name: ASSERT - Check changed flag is false and return codes for idempotence + # assert: + # that: + # - 'result.changed == false' + # - 'result.response is defined' + # - 'result.response | length >= 0' # Allow empty response for idempotence + # Don't loop over response items for idempotence check as they may be empty -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -150,11 +150,11 @@ fabric: "{{ test_data_common.fabric }}" state: overridden # only choose form [merged, replaced, deleted, overridden, query] register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - name: ASSERT - Check return codes for cleanup - assert: + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_inventory/defaults/main.yaml b/tests/integration/targets/dcnm_inventory/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_inventory/defaults/main.yaml +++ b/tests/integration/targets/dcnm_inventory/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_inventory/meta/main.yaml b/tests/integration/targets/dcnm_inventory/meta/main.yaml index 5514b6a40..32cf5dda7 100644 --- a/tests/integration/targets/dcnm_inventory/meta/main.yaml +++ b/tests/integration/targets/dcnm_inventory/meta/main.yaml @@ -1 +1 @@ -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/tests/integration/targets/dcnm_inventory/tasks/main.yaml b/tests/integration/targets/dcnm_inventory/tasks/main.yaml index b05dafae9..65905abb1 100644 --- a/tests/integration/targets/dcnm_inventory/tasks/main.yaml +++ b/tests/integration/targets/dcnm_inventory/tasks/main.yaml @@ -7,10 +7,11 @@ register: ndfc_testcases - name: Build List of Test Items - ansible.builtin.set_fact: test_items="{{ ndfc_testcases.files | map(attribute='path') | list }}" + ansible.builtin.set_fact: + test_items: "{{ ndfc_testcases.files | map(attribute='path') | list }}" - name: Run NDFC Test Cases ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: - loop_var: test_case_to_run \ No newline at end of file + loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_inventory/tests/base_tasks.yaml b/tests/integration/targets/dcnm_inventory/tests/base_tasks.yaml index 67baec5b6..7b52db4c1 100644 --- a/tests/integration/targets/dcnm_inventory/tests/base_tasks.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/base_tasks.yaml @@ -43,8 +43,8 @@ - name: Import Configuration Prepare Tasks vars: - file: base - import_tasks: conf_prep_tasks.yaml + ansible.builtin.file: base + ansible.builtin.import_tasks: conf_prep_tasks.yaml # ---------------------------------------------- # Test Setup @@ -53,10 +53,11 @@ cisco.dcnm.dcnm_fabric: state: query config: - - FABRIC_NAME: "{{ test_data.test_fabric }}" + - FABRIC_NAME: "{{ test_data.test_fabric }}" register: query_result -- assert: +- name: Assert + ansible.builtin.assert: that: - query_result.result[0].found == true fail_msg: "Fabric '{{ test_data.test_fabric }}' not found." @@ -64,4 +65,4 @@ - name: Base - Clean Up Existing Devices in Fabric cisco.dcnm.dcnm_inventory: fabric: "{{ test_data.test_fabric }}" - state: deleted \ No newline at end of file + state: deleted diff --git a/tests/integration/targets/dcnm_inventory/tests/conf_prep_tasks.yaml b/tests/integration/targets/dcnm_inventory/tests/conf_prep_tasks.yaml index 119007a05..10e55bc58 100644 --- a/tests/integration/targets/dcnm_inventory/tests/conf_prep_tasks.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/conf_prep_tasks.yaml @@ -8,4 +8,4 @@ - name: Access Fabric Configuration Data and Save to Local Variable ansible.builtin.set_fact: "{{ 'ndfc_fabric_' + file +'_conf' }}": "{{ lookup('file', '{{ role_path }}/files/ndfc_inventory_{{file}}_conf.yaml') | from_yaml }}" - delegate_to: localhost \ No newline at end of file + delegate_to: localhost diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/deleted.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/deleted.yaml index 4343d7daa..64bfd940e 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/deleted.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/deleted.yaml @@ -1,7 +1,7 @@ --- - name: Import DCNM Inventory Base Tasks - import_tasks: ../base_tasks.yaml + ansible.builtin.import_tasks: ../base_tasks.yaml tags: deleted # ---------------------------------------------- @@ -17,7 +17,7 @@ register: merged_result tags: deleted -- name: Deleted TC1 - Query Inventory State in Fabric +- name: Deleted TC1 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -38,7 +38,7 @@ fabric: "{{ test_data.test_fabric }}" state: deleted config: - - seed_ip: "{{ test_data.sw1 }}" + - seed_ip: "{{ test_data.sw1 }}" register: delete_result tags: deleted @@ -48,7 +48,7 @@ delegate_to: localhost tags: deleted -- name: Deleted TC2 - Query Inventory State in Fabric +- name: Deleted TC2 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -69,10 +69,11 @@ register: result tags: deleted -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is not part of the fabric and cannot be deleted"' + - 'result.changed == false' + - 'result.response == "The switch provided is not part of the fabric and cannot be deleted"' tags: deleted # TC - 4 @@ -85,11 +86,11 @@ - name: Deleted TC4 - Prepare Test Data ansible.builtin.set_fact: - ndfc_fabric_delete_conf: + ndfc_fabric_delete_conf: delegate_to: localhost tags: deleted -- name: Deleted TC4 - Query Inventory State in Fabric +- name: Deleted TC4 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -117,8 +118,8 @@ - name: Import Configuration Prepare Tasks vars: - file: delete - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: delete + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: deleted - name: Deleted TC5 - Merge a Switch using BrownField Deployment @@ -130,7 +131,7 @@ register: merged_result tags: deleted -- name: Deleted TC5 - Query Inventory State in Fabric +- name: Deleted TC5 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -151,15 +152,16 @@ fabric: "{{ test_data.test_fabric }}" state: deleted config: - - seed_ip: + - seed_ip: register: result - ignore_errors: yes + ignore_errors: true tags: deleted -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - '"Invalid parameters in playbook: seed_ip : Required parameter not found" in result.msg' + - 'result.changed == false' + - '"Invalid parameters in playbook: seed_ip : Required parameter not found" in result.msg' tags: deleted # TC - 7 @@ -174,7 +176,7 @@ register: delete_result tags: deleted -- name: Deleted TC7 - Query Inventory State in Fabric +- name: Deleted TC7 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -195,8 +197,9 @@ register: result tags: deleted -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is not part of the fabric and cannot be deleted"' - tags: deleted \ No newline at end of file + - 'result.changed == false' + - 'result.response == "The switch provided is not part of the fabric and cannot be deleted"' + tags: deleted diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/merged.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/merged.yaml index 133a9fafd..b65a69e3d 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/merged.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/merged.yaml @@ -1,7 +1,7 @@ --- - name: Import DCNM Inventory Base Tasks - import_tasks: ../base_tasks.yaml + ansible.builtin.import_tasks: ../base_tasks.yaml tags: merged # ---------------------------------------------- @@ -17,7 +17,7 @@ register: merged_result tags: merged -- name: Merged TC1 - Query Inventory State in Fabric +- name: Merged TC1 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -38,10 +38,11 @@ register: result tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' tags: merged # TC - 3 @@ -54,11 +55,11 @@ - name: Merged TC3 - Prepare Test Data ansible.builtin.set_fact: - ndfc_fabric_delete_conf: + ndfc_fabric_delete_conf: delegate_to: localhost tags: merged -- name: Merged TC3 - Query Inventory State in Fabric +- name: Merged TC3 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -87,8 +88,8 @@ - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC4 - Merge a Switch using BrownField Deployment @@ -100,7 +101,7 @@ register: merged_result tags: merged -- name: Merged TC4 - Query Inventory State in Fabric +- name: Merged TC4 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -121,10 +122,11 @@ register: result tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' tags: merged # TC - 6 @@ -145,8 +147,8 @@ - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC6 - Merge a Switch using GreenField Deployment - Using default role/auth_proto @@ -166,7 +168,7 @@ delegate_to: localhost tags: merged -- name: Merged TC6 - Query Inventory State in Fabric +- name: Merged TC6 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -187,10 +189,11 @@ register: result tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' tags: merged # TC - 8 @@ -217,8 +220,8 @@ - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC8 - Add Switch with Border Gateways and MD5 to Fabric @@ -230,7 +233,7 @@ register: merged_result tags: merged -- name: Merged TC8 - Query Inventory State in Fabric +- name: Merged TC8 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -251,10 +254,11 @@ register: result tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' tags: merged # TC - 10 @@ -277,8 +281,8 @@ - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC10 - Merge a Switch using GreenField Deployment - Non-Zero Max Hop Config @@ -290,7 +294,7 @@ register: merged_result tags: merged -- name: Merged TC10 - Query Inventory State in Fabric +- name: Merged TC10 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -311,10 +315,11 @@ register: merged_result tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'merged_result.changed == false' - - 'merged_result.response == "The switch provided is already part of the fabric and cannot be created again"' + - 'merged_result.changed == false' + - 'merged_result.response == "The switch provided is already part of the fabric and cannot be created again"' tags: merged # TC - 12 @@ -329,17 +334,17 @@ - name: Merged TC13 - Prepare Config ansible.builtin.set_fact: switch_conf: - - seed_ip: - max_hops: 0 - role: leaf - auth_proto: MD5 + - seed_ip: + max_hops: 0 + role: leaf + auth_proto: MD5 delegate_to: localhost tags: merged - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC13 - Merge a Switch without seed_ip @@ -348,31 +353,32 @@ state: merged config: "{{ ndfc_fabric_merge_conf }}" deploy: "{{ test_data.deploy }}" - ignore_errors: yes + ignore_errors: true register: merged_result tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'merged_result.changed == false' - - '"Invalid parameters in playbook: seed_ip : Required parameter not found" in merged_result.msg' + - 'merged_result.changed == false' + - '"Invalid parameters in playbook: seed_ip : Required parameter not found" in merged_result.msg' tags: merged # TC - 14 - name: Merged TC14 - Prepare Config ansible.builtin.set_fact: switch_conf: - - seed_ip: "{{ test_data.sw1 }}" - auth_proto: MD5 - max_hops: 0 - role: invalid + - seed_ip: "{{ test_data.sw1 }}" + auth_proto: MD5 + max_hops: 0 + role: invalid delegate_to: localhost tags: merged - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC14 - Merge a Switch with Invalid Role @@ -382,30 +388,31 @@ config: "{{ ndfc_fabric_merge_conf }}" deploy: "{{ test_data.deploy }}" register: merged_result - ignore_errors: yes + ignore_errors: true tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'merged_result.changed == false' - - '"Invalid choice " in merged_result.msg' + - 'merged_result.changed == false' + - '"Invalid choice " in merged_result.msg' tags: merged # TC - 15 - name: Merged TC15 - Prepare Config ansible.builtin.set_fact: switch_conf: - - seed_ip: "{{ test_data.sw1 }}" - auth_proto: MD55DM - max_hops: 0 - role: leaf + - seed_ip: "{{ test_data.sw1 }}" + auth_proto: MD55DM + max_hops: 0 + role: leaf delegate_to: localhost tags: merged - name: Import Configuration Prepare Tasks vars: - file: merge - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: merge + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: merged - name: Merged TC15 - Merge a Switch with invalid auth choice @@ -415,13 +422,14 @@ config: "{{ ndfc_fabric_merge_conf }}" deploy: "{{ test_data.deploy }}" register: merged_result - ignore_errors: yes + ignore_errors: true tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'merged_result.changed == false' - - '"Invalid choice " in merged_result.msg' + - 'merged_result.changed == false' + - '"Invalid choice " in merged_result.msg' tags: merged # TC - 16 @@ -430,13 +438,14 @@ fabric: "{{ test_data.test_fabric }}" state: merged register: merged_result - ignore_errors: yes + ignore_errors: true tags: merged -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'merged_result.changed == false' - - '"config: element is mandatory for this state merged" in merged_result.msg' + - 'merged_result.changed == false' + - '"config: element is mandatory for this state merged" in merged_result.msg' tags: merged # ---------------------------------------------- @@ -448,4 +457,4 @@ fabric: "{{ test_data.test_fabric }}" state: deleted register: result - tags: merged \ No newline at end of file + tags: merged diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/overridden.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/overridden.yaml index c8dc7d552..2e9d25708 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/overridden.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/overridden.yaml @@ -1,6 +1,6 @@ --- - name: Import DCNM Inventory Base Tasks - import_tasks: ../base_tasks.yaml + ansible.builtin.import_tasks: ../base_tasks.yaml tags: overridden # ---------------------------------------------- @@ -17,7 +17,7 @@ register: merged_result tags: overridden -- name: Overridden TC1 - Query Inventory State in Fabric +- name: Overridden TC1 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -38,9 +38,10 @@ register: result tags: overridden -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' tags: overridden # TC - 3 @@ -56,8 +57,8 @@ - name: Import Configuration Prepare Tasks vars: - file: overridden - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: overridden + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: overridden - name: Overridden TC3 - Override Existing Switch - Removes Other Switches from Fabric @@ -69,7 +70,7 @@ register: overridden_result tags: overridden -- name: Overridden TC3 - Query Inventory State in Fabric +- name: Overridden TC3 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -97,8 +98,8 @@ - name: Import Configuration Prepare Tasks vars: - file: overridden - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: overridden + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: overridden - name: Overridden TC4 - New Role for the Existing Switch @@ -110,7 +111,7 @@ register: overridden_result tags: overridden -- name: Overridden TC4 - Query Inventory State in Fabric +- name: Overridden TC4 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -137,8 +138,8 @@ - name: Import Configuration Prepare Tasks vars: - file: overridden - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: overridden + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: overridden - name: Overridden TC5 - Unspecified Role for the Existing Switch (Default, Leaf) @@ -150,9 +151,10 @@ register: overridden_result tags: overridden -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'overridden_result.changed == false' + - 'overridden_result.changed == false' tags: overridden # ---------------------------------------------- @@ -164,4 +166,4 @@ fabric: "{{ test_data.test_fabric }}" state: deleted register: result - tags: overridden \ No newline at end of file + tags: overridden diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/poap.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/poap.yaml index 8ef913239..7de7fcfeb 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/poap.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/poap.yaml @@ -22,14 +22,14 @@ poap_gateway: "192.168.2.1/24" sw3: "{{ ansible_switch3 }}" deploy: "{{ deploy }}" - poap_enabled: False - poap_switch_present: False - found_fabric: False + poap_enabled: false + poap_switch_present: false + found_fabric: false delegate_to: localhost tags: poap # Below commented tasks are sample tasks to enable Bootstrap and DHCP along with DHCP configs -# Please make sure you provide correct values for required fields +# Please make sure you provide correct values for required fields # Fabric config has many NDFC/DCNM auto generated values, so always GET the configs first # and then set the required values. # # @@ -48,7 +48,7 @@ # result.response.DATA.nvPairs["MGMT_GW"] = "192.168.1.1" # result.response.DATA.nvPairs["MGMT_PREFIX"] = "24" # -# - name: Poap Merged - Configure Bootstrap and DHCP on Fabric +# - name: Poap Merged - Configure Bootstrap and DHCP on Fabric # cisco.dcnm.dcnm_rest: # method: PUT # path: "{{ rest_path }}" @@ -63,20 +63,20 @@ cisco.dcnm.dcnm_fabric: state: query config: - - FABRIC_NAME: "{{ test_data.test_fabric }}" + - FABRIC_NAME: "{{ test_data.test_fabric }}" register: query_result tags: poap - name: Poap Base Task - Check Fabric ansible.builtin.set_fact: - found_fabric: True + found_fabric: true fabric_data: "{{ item }}" when: item['fabricName'] == "{{ test_data.test_fabric }}" loop: "{{ query_result.response[0].DATA }}" tags: poap - name: Poap Base Task - Assert Fabric Existence - assert: + ansible.builtin.assert: that: - found_fabric == true fail_msg: "Fabric '{{ test_data.test_fabric }}' not found." @@ -84,7 +84,7 @@ - name: Poap Base Task - Set Variable ansible.builtin.set_fact: - poap_enabled: True + poap_enabled: true when: fabric_data.nvPairs["BOOTSTRAP_ENABLE"] == "true" tags: poap @@ -101,7 +101,7 @@ register: deleted_result tags: poap -- name: Poap Base Task - Query Inventory State in Fabric +- name: Poap Base Task - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -116,7 +116,7 @@ tags: poap # ---------------------------------------------- # -# Merged # +# Merged # # ---------------------------------------------- # # TC - 1 @@ -129,20 +129,20 @@ role: border poap: - preprovision_serial: "{{ test_data.sw2_serial }}" - model: "{{ test_data.poap_model }}" - version: "{{ test_data.poap_version }}" - hostname: "{{ test_data.poap_hostname }}" - config_data: - modulesModel: ["N9K-C9300v"] - gateway: "10.15.15.1/24" + model: "{{ test_data.poap_model }}" + version: "{{ test_data.poap_version }}" + hostname: "{{ test_data.poap_hostname }}" + config_data: + modulesModel: ["N9K-C9300v"] + gateway: "10.15.15.1/24" when: poap_enabled == True delegate_to: localhost tags: poap - name: Import Configuration Prepare Tasks vars: - file: poap - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: poap + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml when: poap_enabled == True tags: poap @@ -156,7 +156,7 @@ register: merged_result tags: poap -- name: Poap TC1 - Merged - Query Inventory State in Fabric +- name: Poap TC1 - Merged - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -180,35 +180,37 @@ register: merged_result tags: poap -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'merged_result.changed == false' - - 'merged_result.response == "The switch provided is already part of the fabric and cannot be created again"' - when: poap_enabled == True + - 'merged_result.changed == false' + - 'merged_result.response == "The switch provided is already part of the fabric and cannot be created again"' + when: poap_enabled == True tags: poap # TC - 3 - name: Poap TC3 - Query for POAP enabled swicthes cisco.dcnm.dcnm_inventory: fabric: "{{ test_data.test_fabric }}" - query_poap: True + query_poap: true state: query when: poap_enabled == True register: query_result tags: poap -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'query_result.response != None' - when: poap_enabled == True + - 'query_result.response != None' + when: poap_enabled == True tags: poap - name: Poap TC3 - Check Query for POAP enabled swicthes - set_fact: - poap_switch_present: True + ansible.builtin.set_fact: + poap_switch_present: true when: (poap_enabled == True and (item['serialNumber'] == "{{ test_data.sw2_serial }}")) loop: "{{ query_result.response }}" - ignore_errors: yes + ignore_errors: true tags: poap # TC - 4 @@ -219,12 +221,12 @@ role: border_gateway poap: - serial_number: "{{ test_data.sw1_serial }}" - model: "{{ test_data.poap_model }}" - version: "{{ test_data.poap_version }}" - hostname: "{{ test_data.poap_hostname }}" - config_data: - modulesModel: "{{ test_data.poap_modulesModel }}" - gateway: "{{ test_data.poap_gateway }}" + model: "{{ test_data.poap_model }}" + version: "{{ test_data.poap_version }}" + hostname: "{{ test_data.poap_hostname }}" + config_data: + modulesModel: "{{ test_data.poap_modulesModel }}" + gateway: "{{ test_data.poap_gateway }}" - seed_ip: "{{ test_data.sw3 }}" auth_proto: MD5 role: spine @@ -232,20 +234,20 @@ role: border poap: - preprovision_serial: "{{ test_data.sw2_serial }}" - model: "{{ test_data.poap_model }}" - version: "{{ test_data.poap_version }}" - hostname: "{{ test_data.poap_hostname }}" - config_data: - modulesModel: "{{ test_data.poap_modulesModel }}" - gateway: "{{ test_data.poap_gateway }}" + model: "{{ test_data.poap_model }}" + version: "{{ test_data.poap_version }}" + hostname: "{{ test_data.poap_hostname }}" + config_data: + modulesModel: "{{ test_data.poap_modulesModel }}" + gateway: "{{ test_data.poap_gateway }}" when: (poap_enabled == True and poap_switch_present == True) delegate_to: localhost tags: poap - name: Import Configuration Prepare Tasks vars: - file: poap - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: poap + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml when: poap_enabled == True tags: poap @@ -259,7 +261,7 @@ register: merged_result tags: poap -- name: Poap TC4 - Merged - Query Inventory State in Fabric +- name: Poap TC4 - Merged - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -283,11 +285,12 @@ register: result tags: poap -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' - when: (poap_enabled == True and poap_switch_present == True) + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + when: (poap_enabled == True and poap_switch_present == True) tags: poap # ---------------------------------------------- @@ -300,4 +303,4 @@ state: deleted when: (poap_enabled == True) register: deleted_result - tags: poap \ No newline at end of file + tags: poap diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/query.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/query.yaml index e8a257977..190d4f1ac 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/query.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/query.yaml @@ -1,6 +1,6 @@ --- - name: Import DCNM Inventory Base Tasks - import_tasks: ../base_tasks.yaml + ansible.builtin.import_tasks: ../base_tasks.yaml tags: query # ---------------------------------------------- @@ -17,7 +17,7 @@ register: create_result tags: query -- name: Query TC1 - Query Inventory State in Fabric +- name: Query TC1 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -125,14 +125,15 @@ fabric: "{{ test_data.test_fabric }}" state: query config: - - seed_ip: "{{ test_data.sw1 }}" - role: spine + - seed_ip: "{{ test_data.sw1 }}" + role: spine register: query_result tags: query -- assert: +- name: Assert + ansible.builtin.assert: that: - - '"The queried switch is not part of the fabric configured" in query_result.response' + - '"The queried switch is not part of the fabric configured" in query_result.response' tags: query # TC - 7 @@ -171,35 +172,36 @@ fabric: "{{ test_data.test_fabric }}" state: query config: - - seed_ip: "{{ test_data.sw1 }}" - role: leaf + - seed_ip: "{{ test_data.sw1 }}" + role: leaf register: query_result tags: query -- assert: +- name: Assert + ansible.builtin.assert: that: - - '"The queried switch is not part of the fabric configured" in query_result.response' + - '"The queried switch is not part of the fabric configured" in query_result.response' tags: query # TC - 9 - name: Query TC9 - Prepare Config ansible.builtin.set_fact: switch_conf: - - seed_ip: "{{ test_data.sw1 }}" - max_hops: 0 - auth_proto: MD5 - role: border_gateway - - seed_ip: "{{ test_data.sw2 }}" - max_hops: 0 - auth_proto: MD5 - role: border_gateway + - seed_ip: "{{ test_data.sw1 }}" + max_hops: 0 + auth_proto: MD5 + role: border_gateway + - seed_ip: "{{ test_data.sw2 }}" + max_hops: 0 + auth_proto: MD5 + role: border_gateway delegate_to: localhost tags: query - name: Import Configuration Prepare Tasks vars: - file: query - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: query + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: query - name: Query TC9 - Add Switch with Border Gateways to Fabric @@ -235,4 +237,4 @@ fabric: "{{ test_data.test_fabric }}" state: deleted register: result - tags: query \ No newline at end of file + tags: query diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/rma.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/rma.yaml index f4fba7a8c..e1730bbdc 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/rma.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/rma.yaml @@ -20,9 +20,9 @@ rma_modulesModel: "['SW1-K1234v']" rma_gateway: "192.168.2.1/24" deploy: "{{ deploy }}" - rma_enabled: False - rma_switch_present: False - found_fabric: False + rma_enabled: false + rma_switch_present: false + found_fabric: false delegate_to: localhost tags: rma @@ -30,15 +30,19 @@ # ansible.builtin.set_fact: # - set_fact: # mode_maintenance: "/rest/control/fabrics/{{ test_data.test_fabric }}/switches/{{ ansible_switch1_serial }}/maintenance-mode" -# mode_deploy: "/rest/control/fabrics/{{ test_data.test_fabric }}/switches/{{ ansible_switch1_serial }}/deploy-maintenance-mode" +# mode_deploy: "/rest/control/fabrics/{{ test_data.test_fabric }}/switches/{{ ansible_switch1_serial }}/deploy-maintenance-mode" # when: controller_version == "11" # tags: rma - name: RMA - Setup Rest Variables ansible.builtin.set_fact: - mode_maintenance: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data.test_fabric }}/switches/{{ test_data.sw1_serial }}/maintenance-mode" - mode_deploy: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data.test_fabric }}/switches/{{ test_data.sw1_serial }}/deploy-maintenance-mode" - tags: rma + mode_maintenance: >- + /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/ + {{ test_data.test_fabric }}/switches/{{ test_data.sw1_serial }}/maintenance-mode + mode_deploy: >- + /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/ + {{ test_data.test_fabric }}/switches/{{ test_data.sw1_serial }}/deploy-maintenance-mode + tags: rma # when: controller_version >= "12" # ---------------------------------------------- @@ -55,14 +59,14 @@ - name: RMA Base Task - Check Fabric ansible.builtin.set_fact: - found_fabric: True + found_fabric: true fabric_data: "{{ item }}" when: item['fabricName'] == "{{ test_data.test_fabric }}" loop: "{{ query_result.response[0].DATA }}" tags: rma - name: RMA Base Task - Assert Fabric Existence - assert: + ansible.builtin.assert: that: - found_fabric == true fail_msg: "Fabric '{{ test_data.test_fabric }}' not found." @@ -70,7 +74,7 @@ - name: RMA Base Task - Set Variable ansible.builtin.set_fact: - rma_enabled: True + rma_enabled: true when: fabric_data.nvPairs["BOOTSTRAP_ENABLE"] == "true" tags: rma @@ -88,7 +92,7 @@ register: deleted_result tags: rma -- name: RMA TC1 - Query Inventory State in Fabric +- name: RMA TC1 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -120,22 +124,22 @@ - name: Import Configuration Prepare Tasks vars: - file: rma - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: rma + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml when: rma_enabled == True tags: rma - name: RMA TC2 - Add Switch to the Fabric cisco.dcnm.dcnm_inventory: - fabric: "{{ test_data.test_fabric }}" - state: merged - config: "{{ ndfc_fabric_rma_conf }}" - deploy: "{{ test_data.deploy }}" + fabric: "{{ test_data.test_fabric }}" + state: merged + config: "{{ ndfc_fabric_rma_conf }}" + deploy: "{{ test_data.deploy }}" when: rma_enabled == True register: merged_result tags: rma -- name: RMA TC2 - Query Inventory State in Fabric +- name: RMA TC2 - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -155,24 +159,25 @@ - name: RMA TC2 - Query for POAP enabled swicthes cisco.dcnm.dcnm_inventory: fabric: "{{ test_data.test_fabric }}" - query_poap: True + query_poap: true state: query when: rma_enabled == True register: query_result tags: rma -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'query_result.response != None' - when: rma_enabled == True + - 'query_result.response != None' + when: rma_enabled == True tags: rma - name: RMA TC2 - Check Query for POAP enabled swicthes - set_fact: - rma_switch_present: True + ansible.builtin.set_fact: + rma_switch_present: true when: (rma_enabled == True and (item['serialNumber'] == "{{ test_data.sw1_serial }}")) loop: "{{ query_result.response }}" - ignore_errors: yes + ignore_errors: true tags: rma - name: RMA TC2 - Configure Maintenance Mode in Switch @@ -192,7 +197,7 @@ tags: rma - name: RMA TC2 - sleep for 1 minute - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: rma @@ -204,26 +209,26 @@ state: merged config: - seed_ip: '{{ test_data.sw1 }}' - user_name: '{{ switch_username }}' - password: '{{ switch_password }}' - rma: - - serial_number: '{{ test_data.sw1_rma_serial }}' - old_serial: '{{ test_data.sw1_serial }}' - model: '{{ test_data.rma_model }}' - version: '{{ test_data.rma_model }}' - hostname: '{{ test_data.rma_hostname }}' - config_data: - modulesModel: '{{ test_data.rma_modulesModel }}' - gateway: '{{ test_data.rma_gateway }}' + user_name: '{{ switch_username }}' + password: '{{ switch_password }}' + rma: + - serial_number: '{{ test_data.sw1_rma_serial }}' + old_serial: '{{ test_data.sw1_serial }}' + model: '{{ test_data.rma_model }}' + version: '{{ test_data.rma_model }}' + hostname: '{{ test_data.rma_hostname }}' + config_data: + modulesModel: '{{ test_data.rma_modulesModel }}' + gateway: '{{ test_data.rma_gateway }}' register: result - - assert: - that: + - name: ASSERT - Check condition + ansible.builtin.assert: - 'result.changed == true' - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - name: ASSERT - Check condition + ansible.builtin.assert: + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' when: (rma_enabled == True and rma_switch_present == True) tags: rma @@ -237,4 +242,4 @@ fabric: "{{ test_data.test_fabric }}" state: deleted register: result - tags: rma \ No newline at end of file + tags: rma diff --git a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml index 3fbb53487..f5909a9a9 100644 --- a/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_inventory/tests/dcnm/sanity.yaml @@ -1,7 +1,7 @@ --- - name: Import DCNM Inventory Base Tasks - import_tasks: ../base_tasks.yaml + ansible.builtin.import_tasks: ../base_tasks.yaml tags: sanity # ---------------------------------------------- @@ -9,7 +9,7 @@ # ---------------------------------------------- # ---------------------------------------------- # -# Merged # +# Merged # # ---------------------------------------------- # # TC - 1 @@ -22,7 +22,7 @@ register: create_result tags: sanity -- name: Sanity TC1 - Merged - Query Inventory State in Fabric +- name: Sanity TC1 - Merged - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -43,14 +43,15 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' - tags: sanity + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and cannot be created again"' + tags: sanity # ---------------------------------------------- # -# Query # +# Query # # ---------------------------------------------- # # TC - 3 @@ -79,7 +80,7 @@ tags: sanity # ---------------------------------------------- # -# Overridden # +# Overridden # # ---------------------------------------------- # # TC - 4 @@ -95,8 +96,8 @@ - name: Import Configuration Prepare Tasks vars: - file: sanity - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: sanity + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: sanity - name: Sanity TC4 - Overridden - Update a New Switch using GreenField Deployment - Delete and Create - default role @@ -108,7 +109,7 @@ register: result tags: sanity -- name: Sanity TC4 - Overridden - Query Inventory State in Fabric +- name: Sanity TC4 - Overridden - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -129,14 +130,15 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is already part of the fabric and there is no more device to delete in the fabric"' + - 'result.changed == false' + - 'result.response == "The switch provided is already part of the fabric and there is no more device to delete in the fabric"' tags: sanity # ---------------------------------------------- # -# Clean-up # +# Clean-up # # ---------------------------------------------- # # TC - 6 @@ -154,7 +156,7 @@ delegate_to: localhost tags: sanity -- name: Sanity TC6 - Deleted - Query Inventory State in Fabric +- name: Sanity TC6 - Deleted - Query Inventory State in Fabric cisco.dcnm.dcnm_inventory: state: query fabric: "{{ test_data.test_fabric }}" @@ -175,32 +177,33 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response == "The switch provided is not part of the fabric and cannot be deleted"' + - 'result.changed == false' + - 'result.response == "The switch provided is not part of the fabric and cannot be deleted"' # ---------------------------------------------- # -# Reset Fabric # +# Reset Fabric # # ---------------------------------------------- # # TC - 8 - name: Sanity TC8 - Reset - Prepare Conf ansible.builtin.set_fact: switch_conf: - - seed_ip: "{{ test_data.sw1 }}" - max_hops: 0 - preserve_config: false - - seed_ip: "{{ test_data.sw2 }}" - max_hops: 0 - preserve_config: false + - seed_ip: "{{ test_data.sw1 }}" + max_hops: 0 + preserve_config: false + - seed_ip: "{{ test_data.sw2 }}" + max_hops: 0 + preserve_config: false delegate_to: localhost tags: sanity - name: Import Configuration Prepare Tasks vars: - file: sanity - import_tasks: ../conf_prep_tasks.yaml + ansible.builtin.file: sanity + ansible.builtin.import_tasks: ../conf_prep_tasks.yaml tags: sanity - name: Sanity TC8 - Reset - Setup Switches in Fabric @@ -209,4 +212,3 @@ config: "{{ ndfc_fabric_sanity_conf }}" register: result tags: sanity - \ No newline at end of file diff --git a/tests/integration/targets/dcnm_links/tasks/dcnm.yaml b/tests/integration/targets/dcnm_links/tasks/dcnm.yaml index a92ff1618..e7e82086e 100644 --- a/tests/integration/targets/dcnm_links/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_links/tasks/dcnm.yaml @@ -1,23 +1,25 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_links/tasks/main.yaml b/tests/integration/targets/dcnm_links/tasks/main.yaml index 78c5fb834..ca7cc9a10 100644 --- a/tests/integration/targets/dcnm_links/tasks/main.yaml +++ b/tests/integration/targets/dcnm_links/tasks/main.yaml @@ -1,2 +1,5 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include tasks + ansible.builtin.include_tasks: + ansible.builtin.file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_delete.yaml index 4bb39fecb..c84848c04 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_delete.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links on ipv6 fabric + - name: Baseline - Delete any pre-existing IPv6 inter-fabric links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" @@ -33,19 +33,20 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - register: result + register: baseline_delete_result - - assert: + - name: ASSERT - Baseline delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ baseline_delete_result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Create Links including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt1 + - name: Merge - Create single link with minimal params + cisco.dcnm.dcnm_links: &links_merge_basic state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -54,118 +55,121 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + # template to be applied; choose from + # [ext_fabric_setup, ext_multisite_underlay_setup, ext_evpn_multisite_overlay_setup] + template: ext_fabric_setup profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination interface - no shutdown # optional, default is "" + register: merge_basic_result - register: result - - - assert: + - name: ASSERT - Basic merge diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - '(merge_basic_result.changed == true' + - '(merge_basic_result.diff[0].merged | length) == 1' + - '(merge_basic_result.diff[0].modified | length) == 0' + - '(merge_basic_result.diff[0].deleted | length) == 0' + - '(merge_basic_result.diff[0].query | length) == 0' + - '(merge_basic_result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_basic_result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + + - name: ASSERT - Basic merge return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_basic_result.response }}' -############################################### -### DELETE ## -############################################### + ############################################## + ## BASIC DELETE ## + ############################################## - - name: Delete Links + - name: Delete - Remove the basic link cisco.dcnm.dcnm_links: *links_delete - register: result + register: delete_basic_result - - assert: + - name: ASSERT - Basic delete diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 1' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - '(delete_basic_result.changed == true' + - '(delete_basic_result.diff[0].merged | length) == 0' + - '(delete_basic_result.diff[0].modified | length) == 0' + - '(delete_basic_result.diff[0].deleted | length) == 1' + - '(delete_basic_result.diff[0].query | length) == 0' + - '(delete_basic_result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(delete_basic_result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + + - name: ASSERT - Basic delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - -############################################### -### IDEMPOTENCE ## -############################################### + loop: '{{ delete_basic_result.response }}' + + ############################################## + ## BASIC DELETE - IDEMPOTENCE ## + ############################################## - - name: Delete Links - Idempotence + - name: Delete - Idempotence (basic link) cisco.dcnm.dcnm_links: *links_delete - register: result + register: delete_basic_idem - - assert: + - name: ASSERT - Basic delete idempotence diff counters + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - - assert: + - '(delete_basic_idem.changed == false' + - '(delete_basic_idem.diff[0].merged | length) == 0' + - '(delete_basic_idem.diff[0].modified | length) == 0' + - '(delete_basic_idem.diff[0].deleted | length) == 0' + - '(delete_basic_idem.diff[0].query | length) == 0' + - '(delete_basic_idem.diff[0].deploy | length) == 0' + + - name: ASSERT - Basic delete idempotence return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ delete_basic_idem.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Create Links (multisite) including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt2 - state: merged # choose from [merged, replaced, deleted, query] + - name: Merge - Create multisite underlay + overlay links (minimal) + cisco.dcnm.dcnm_links: &links_merge_ms + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: - ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + ipv4_subnet: 193.168.2.1/24 + neighbor_ip: 193.168.2.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -173,94 +177,97 @@ peer2_cmds: # Freeform config for destination interface - no shutdown # optional, default is "" - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_evpn_multisite_overlay_setup profile: - ipv4_addr: 193.168.3.1 # IP address of interface in src fabric - neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric + ipv4_addr: 193.168.3.1 + neighbor_ip: 193.168.3.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebpg_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] + register: merge_ms_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite merge diff counters (minimal) + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - '(merge_ms_result.changed == true' + - '(merge_ms_result.diff[0].merged | length) == 2' + - '(merge_ms_result.diff[0].modified | length) == 0' + - '(merge_ms_result.diff[0].deleted | length) == 0' + - '(merge_ms_result.diff[0].query | length) == 0' + - '(merge_ms_result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_ms_result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite merge return codes (minimal) + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ merge_ms_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################### -### DELETE ## -############################################### + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Merge - Multisite idempotence (minimal) cisco.dcnm.dcnm_links: *links_delete - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + register: merge_ms_idem + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite merge idempotence diff counters (minimal) + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 2' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - '(merge_ms_idem.changed == true' + - '(merge_ms_idem.diff[0].merged | length) == 0' + - '(merge_ms_idem.diff[0].modified | length) == 0' + - '(merge_ms_idem.diff[0].deleted | length) == 2' + - '(merge_ms_idem.diff[0].query | length) == 0' + - '(merge_ms_idem["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_ms_idem["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite merge idempotence return codes (minimal) + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - -############################################### -### IDEMPOTENCE ## -############################################### - - - name: Delete Links - Idempotence + loop: '{{ merge_ms_idem.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + ############################################## + ## IDEMPOTENCE ## + ############################################## + + - name: Delete - Remove multisite links cisco.dcnm.dcnm_links: *links_delete - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + register: delete_ms_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite delete diff counters + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - '(delete_ms_result.changed == false' + - '(delete_ms_result.diff[0].merged | length) == 0' + - '(delete_ms_result.diff[0].modified | length) == 0' + - '(delete_ms_result.diff[0].deleted | length) == 2' + - '(delete_ms_result.diff[0].query | length) == 0' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ delete_ms_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_merge.yaml index 04113094a..941c846d1 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_merge.yaml @@ -7,132 +7,133 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## BASELINE DELETE ## + ############################################## - - name: Initial setup - Delete Links on ipv6 fabric + - name: Baseline - Delete any pre-existing IPv6 inter-fabric links cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] + state: deleted src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - register: result - - - assert: + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + register: baseline_delete_result + + - name: ASSERT - Baseline delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ baseline_delete_result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## BASIC MERGE (MINIMAL) ## + ############################################## - - name: Create Links without including optional parameters - cisco.dcnm.dcnm_links: &links_merge_no_opt1 - state: merged # choose from [merged, replaced, deleted, query] + - name: Merge - Create single ext_fabric_setup link (minimal params) + cisco.dcnm.dcnm_links: &links_merge_basic + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - - register: result - - - assert: + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + register: merge_basic_result + + - name: ASSERT - Basic merge diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - 'merge_basic_result.changed == true' + - '(merge_basic_result.diff[0].merged | length) == 1' + - '(merge_basic_result.diff[0].modified | length) == 0' + - '(merge_basic_result.diff[0].deleted | length) == 0' + - '(merge_basic_result.diff[0].query | length) == 0' + - '(merge_basic_result.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + - '(merge_basic_result.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + + - name: ASSERT - Basic merge return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_basic_result.response }}' -############################################### -### IDEMPOTENCE ## -############################################### + ############################################## + ## BASIC MERGE - IDEMPOTENCE ## + ############################################## - - name: Create Links - Idempotence - cisco.dcnm.dcnm_links: *links_merge_no_opt1 - register: result + - name: Merge - Idempotence check (basic link) + cisco.dcnm.dcnm_links: *links_merge_basic + register: merge_basic_idem - - assert: + - name: ASSERT - Basic merge idempotence diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - 'merge_basic_idem.changed == true' + - '(merge_basic_idem.diff[0].merged | length) == 0' + - '(merge_basic_idem.diff[0].modified | length) == 0' + - '(merge_basic_idem.diff[0].deleted | length) == 0' + - '(merge_basic_idem.diff[0].query | length) == 0' + - '(merge_basic_idem.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + - '(merge_basic_idem.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + + - name: ASSERT - Basic merge idempotence return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_basic_idem.response }}' -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - name: ASSERT - Delete diff counters + ansible.builtin.assert: that: - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 1' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - '(result.diff[0].merged | length) == 0' + - '(result.diff[0].modified | length) == 0' + - '(result.diff[0].deleted | length) == 1' + - '(result.diff[0].query | length) == 0' + - '(result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + + - name: ASSERT - Delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################## -## MERGE ## -############################################## - - name: Create Links (multisite) without including optional parameters - cisco.dcnm.dcnm_links: &links_merge_no_opt2 + ############################################## + ## MERGE WITH OPTIONAL PARAMS ## + ############################################## + + - name: Merge - Enrich existing link with optional params (should modify) + cisco.dcnm.dcnm_links: &links_merge_basic_opt state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -141,9 +142,9 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric @@ -155,71 +156,74 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric + register: merge_basic_opt_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - name: ASSERT - Basic optional merge diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'merge_basic_opt_result.changed == true' + - '(merge_basic_opt_result.diff[0].merged | length) == 2' + - '(merge_basic_opt_result.diff[0].modified | length) == 0' + - '(merge_basic_opt_result.diff[0].deleted | length) == 0' + - '(merge_basic_opt_result.diff[0].query | length) == 0' + - '(merge_basic_opt_result.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + - '(merge_basic_opt_result.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Basic optional merge return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ merge_basic_opt_result.response }}' -############################################### -### IDEMPOTENCE ## -############################################### + ############################################## + ## IDEMPOTENCE ## + ############################################## - - name: Create Links - Idempotence - cisco.dcnm.dcnm_links: *links_merge_no_opt2 - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + - name: Merge - Idempotence (optional params link) + cisco.dcnm.dcnm_links: *links_merge_basic_opt + register: merge_basic_opt_idem + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Optional merge idempotence diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'merge_basic_opt_idem.changed == true' + - '(merge_basic_opt_idem.diff[0].merged | length) == 0' + - '(merge_basic_opt_idem.diff[0].modified | length) == 0' + - '(merge_basic_opt_idem.diff[0].deleted | length) == 0' + - '(merge_basic_opt_idem.diff[0].query | length) == 0' + - '(merge_basic_opt_idem.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + - '(merge_basic_opt_idem.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Optional merge idempotence return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ merge_basic_opt_idem.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Delete diff counters + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -228,21 +232,22 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - -############################################## -## MERGE ## -############################################## + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - name: Create Links including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt1 - state: merged # choose from [merged, replaced, deleted, query] + ############################################## + ## MULTISITE MERGE (MINIMAL) ## + ############################################## + + - name: Merge - Create multisite underlay + overlay links (minimal) + cisco.dcnm.dcnm_links: &links_merge_ms + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric @@ -250,183 +255,181 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination interface - no shutdown # optional, default is "" - register: result + register: merge_ms_result - - assert: + - name: ASSERT - Multisite merge diff counters (minimal) + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - 'merge_ms_result.changed == true' + - '(merge_ms_result.diff[0].merged | length) == 1' + - '(merge_ms_result.diff[0].modified | length) == 0' + - '(merge_ms_result.diff[0].deleted | length) == 0' + - '(merge_ms_result.diff[0].query | length) == 0' + - '(merge_ms_result.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + - '(merge_ms_result.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + + - name: ASSERT - Multisite merge return codes (minimal) + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_ms_result.response }}' -############################################### -### IDEMPOTENCE ## -############################################### + ############################################## + ## IDEMPOTENCE ## + ############################################## - - name: Create Links - Idempotence - cisco.dcnm.dcnm_links: *links_merge_with_opt1 - register: result + - name: Merge - Multisite idempotence (minimal) + cisco.dcnm.dcnm_links: *links_merge_ms + register: merge_ms_idem - - assert: + - name: ASSERT - Multisite merge idempotence diff counters (minimal) + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - 'merge_ms_idem.changed == true' + - '(merge_ms_idem.diff[0].merged | length) == 0' + - '(merge_ms_idem.diff[0].modified | length) == 0' + - '(merge_ms_idem.diff[0].deleted | length) == 0' + - '(merge_ms_idem.diff[0].query | length) == 0' + - '(merge_ms_idem.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + - '(merge_ms_idem.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + + - name: ASSERT - Multisite merge idempotence return codes (minimal) + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_ms_idem.response }}' + ############################################## + ## MERGE ## + ############################################## -############################################## -## MERGE ## -############################################## - - - name: Create Links (multisite) including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt2 - state: merged # choose from [merged, replaced, deleted, query] + - name: Merge - Enrich multisite links with optional params (modify expected) + cisco.dcnm.dcnm_links: &links_merge_ms_opt + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: - ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # - deploy_dci_tracking: false # optional, default is false - max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true - ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - peer1_description: "Description of source" # optional, default is "" - peer2_description: "Description of dest" # optional, default is "" - peer1_cmds: # Freeform config for source interface - - no shutdown # optional, default is "" - peer2_cmds: # Freeform config for destination interface - - no shutdown # optional, default is "" - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + ipv4_subnet: 193.168.2.1/24 + neighbor_ip: 193.168.2.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 9216 + deploy_dci_tracking: false + max_paths: 1 + route_tag: 12345 + ebgp_password_enable: true + ebgp_password: 9BFE3270E19CA112 + inherit_from_msd: true + ebgp_auth_key_type: 3 + peer1_description: "Description of source" + peer2_description: "Description of dest" + peer1_cmds: + - no shutdown + peer2_cmds: + - no shutdown + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_evpn_multisite_overlay_setup profile: - ipv4_addr: 193.168.3.1 # IP address of interface in src fabric - neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true - ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + ipv4_addr: 193.168.3.1 + neighbor_ip: 193.168.3.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + trm_enabled: false + bgp_multihop: 5 + ebgp_password_enable: true + ebgp_password: 9BFE3270E19CA112 + inherit_from_msd: false + ebgp_auth_key_type: 3 + register: merge_ms_opt_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite optional merge diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'merge_ms_opt_result.changed == true' + - '(merge_ms_opt_result.diff[0].merged | length) == 2' + - '(merge_ms_opt_result.diff[0].modified | length) == 0' + - '(merge_ms_opt_result.diff[0].deleted | length) == 0' + - '(merge_ms_opt_result.diff[0].query | length) == 0' + - '(merge_ms_opt_result.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + - '(merge_ms_opt_result.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite optional merge return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ merge_ms_opt_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################### -### IDEMPOTENCE ## -############################################### + ############################################## + ## MULTISITE OPTIONAL MERGE - IDEMPOTENCE ## + ############################################## - - name: Create Links - Idempotence - cisco.dcnm.dcnm_links: *links_merge_with_opt2 - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + - name: Merge - Multisite optional idempotence + cisco.dcnm.dcnm_links: *links_merge_ms_opt + register: merge_ms_opt_idem + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite optional merge idempotence diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'merge_ms_opt_idem.changed == true' + - '(merge_ms_opt_idem.diff[0].merged | length) == 0' + - '(merge_ms_opt_idem.diff[0].modified | length) == 0' + - '(merge_ms_opt_idem.diff[0].deleted | length) == 0' + - '(merge_ms_opt_idem.diff[0].query | length) == 0' + - '(merge_ms_opt_idem.diff[0].deploy[0]["{{ ansible_unnum_fabric }}"] | length) == 1' + - '(merge_ms_opt_idem.diff[0].deploy[0]["{{ ansible_ipv6_fabric }}"] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite optional merge idempotence return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ merge_ms_opt_idem.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Cleanup - Delete Links + - name: Cleanup - Delete all created links cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + loop: '{{ cleanup_result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_modify.yaml index 44d6b773e..dc07eac08 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_modify.yaml @@ -7,91 +7,89 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## BASELINE DELETE ## + ############################################## - - name: Initial setup - Delete Links on ipv6 fabric + - name: Baseline - Delete any pre-existing IPv6 inter-fabric links cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] + state: deleted src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - register: result + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + register: baseline_delete_result - - assert: + - name: ASSERT - Baseline delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ baseline_delete_result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## BASIC MERGE (CREATION) ## + ############################################## - - name: Create Links including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt1 - state: merged # choose from [merged, replaced, deleted, query] + - name: Merge - Create single link with minimal params + cisco.dcnm.dcnm_links: &links_merge_basic + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination interface - no shutdown # optional, default is "" - register: result + register: merge_basic_result - - assert: + - name: ASSERT - Basic merge diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + - 'merge_basic_result.changed == true' + - '(merge_basic_result.diff[0].merged | length) == 1' + - '(merge_basic_result.diff[0].modified | length) == 0' + - '(merge_basic_result.diff[0].deleted | length) == 0' + - '(merge_basic_result.diff[0].query | length) == 0' + - '(merge_basic_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_basic_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - name: ASSERT - Basic merge return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - + loop: '{{ merge_basic_result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links (multisite) including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt2 @@ -103,24 +101,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -133,45 +131,47 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] + register: modify_basic_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Basic modify diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + - 'modify_basic_result.changed == true' + - '(modify_basic_result.diff[0].merged | length) == 2' + - '(modify_basic_result.diff[0].modified | length) == 0' + - '(modify_basic_result.diff[0].deleted | length) == 0' + - '(modify_basic_result.diff[0].query | length) == 0' + - '(modify_basic_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(modify_basic_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Basic modify return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ modify_basic_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: &links_modify1 @@ -183,129 +183,124 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.10.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.10.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 1216 # + mtu: 1216 # auto_deploy: true # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source - MOD" # optional, default is "" peer2_description: "Description of dest - MOD" # optional, default is "" peer1_cmds: # Freeform config for source interface - cdp enable # optional, default is "" peer2_cmds: # Freeform config for destination interface - cdp enable # optional, default is "" - register: result + register: merge_ms_result - - assert: + - name: ASSERT - Multisite merge diff counters (minimal) + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + - 'merge_ms_result.changed == true' + - '(merge_ms_result.diff[0].merged | length) == 0' + - '(merge_ms_result.diff[0].modified | length) == 1' + - '(merge_ms_result.diff[0].deleted | length) == 0' + - '(merge_ms_result.diff[0].query | length) == 0' + - '(merge_ms_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_ms_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - name: ASSERT - Multisite merge return codes (minimal) + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_ms_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## MERGE ## -############################################## + ############################################## + ## MULTISITE MODIFY (OPTIONAL ENRICHMENT) ## + ############################################## - - name: Merge (multisite) modified info into existing links - cisco.dcnm.dcnm_links: &links_modify2 - state: merged # choose from [merged, replaced, deleted, query] + - name: Modify - Enrich multisite links with optional params + cisco.dcnm.dcnm_links: &links_modify_ms + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: - ipv4_subnet: 193.168.20.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.20.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 2216 # - deploy_dci_tracking: true # optional, default is false - max_paths: 2 # optional, default is 1 - route_tag: 11111 # optional, optional is "" - ebgp_password_enable: false # optional, default is true - ebgp_password: 28E71E338DA17111 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: False # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - peer1_description: "Description of source - MOD" # optional, default is "" - peer2_description: "Description of dest - MOD" # optional, default is "" - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + ipv4_subnet: 193.168.20.1/24 + neighbor_ip: 193.168.20.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 2216 + deploy_dci_tracking: true + max_paths: 2 + route_tag: 11111 + ebgp_password_enable: false + ebgp_password: 28E71E338DA17111 + inherit_from_msd: false + ebgp_auth_key_type: 7 + peer1_description: "Description of source - MOD" + peer2_description: "Description of dest - MOD" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_evpn_multisite_overlay_setup profile: - ipv4_addr: 193.168.30.1 # IP address of interface in src fabric - neighbor_ip: 193.168.30.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - trm_enabled: true # optional, default is false - bgp_multihop: 3 # optional, default is 5 - ebgp_password_enable: false # optional, default is true - ebgp_password: 8F8F790E1CB7AF60 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + ipv4_addr: 193.168.30.1 + neighbor_ip: 193.168.30.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + trm_enabled: true + bgp_multihop: 3 + ebgp_password_enable: false + ebgp_password: 8F8F790E1CB7AF60 + inherit_from_msd: true + ebgp_auth_key_type: 7 + register: modify_ms_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite modify diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 2' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + - '(modify_ms_result.diff[0].merged | length) == 0' + - '(modify_ms_result.diff[0].modified | length) == 2' + - '(modify_ms_result.diff[0].deleted | length) == 0' + - '(modify_ms_result.diff[0].query | length) == 0' + - '(modify_ms_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(modify_ms_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite modify return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ modify_ms_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Cleanup - Delete Links + - name: Cleanup - Delete all created links cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + loop: '{{ cleanup_result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_replace.yaml index e891d4bf4..289e10e92 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_ipv6_replace.yaml @@ -7,120 +7,116 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## BASELINE DELETE ## + ############################################## - - name: Initial setup - Delete Links on ipv6 fabric + - name: Baseline - Delete any pre-existing IPv6 inter-fabric links cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] + state: deleted src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - register: result - - - assert: + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + register: baseline_delete_result + + - name: ASSERT - Baseline delete return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ baseline_delete_result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## BASIC MERGE (CREATION) ## + ############################################## - - name: Create Links including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt1 - state: merged # choose from [merged, replaced, deleted, query] + - name: Merge - Create single link (minimal params) + cisco.dcnm.dcnm_links: &links_merge_basic + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination interface - no shutdown # optional, default is "" - register: result + register: merge_basic_result - - assert: + - name: ASSERT - Basic merge diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - - assert: + - 'merge_basic_result.changed == true' + - '(merge_basic_result.diff[0].merged | length) == 1' + - '(merge_basic_result.diff[0].modified | length) == 0' + - '(merge_basic_result.diff[0].deleted | length) == 0' + - '(merge_basic_result.diff[0].query | length) == 0' + - '(merge_basic_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_basic_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + + - name: ASSERT - Basic merge return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_basic_result.response }}' + ############################################## + ## MERGE ## + ############################################## -############################################## -## MERGE ## -############################################## - - - name: Create Links (multisite) including optional parameters - cisco.dcnm.dcnm_links: &links_merge_with_opt2 - state: merged # choose from [merged, replaced, deleted, query] + - name: Merge - Create multisite underlay + overlay links (minimal) + cisco.dcnm.dcnm_links: &links_merge_ms + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -133,229 +129,226 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] + register: merge_ms_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite merge diff counters (minimal) + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'merge_ms_result.changed == true' + - '(merge_ms_result.diff[0].merged | length) == 2' + - '(merge_ms_result.diff[0].modified | length) == 0' + - '(merge_ms_result.diff[0].deleted | length) == 0' + - '(merge_ms_result.diff[0].query | length) == 0' + - '(merge_ms_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(merge_ms_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite merge return codes (minimal) + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ merge_ms_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - - name: Replace existing links - cisco.dcnm.dcnm_links: &links_replace1 - state: replaced # choose from [merged, replaced, deleted, query] + - name: Replace - Replace single link with new params + cisco.dcnm.dcnm_links: &links_replace_basic + state: replaced src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.10.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.10.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 1216 # - auto_deploy: true # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration - peer1_description: "Description of source - REP" # optional, default is "" - peer2_description: "Description of dest - REP" # optional, default is "" - peer1_cmds: # Freeform config for source interface - - cdp enable # optional, default is "" - peer2_cmds: # Freeform config for destination interface - - cdp enable # optional, default is "" - - register: result - - - assert: + ipv4_subnet: 193.168.10.1/24 + neighbor_ip: 193.168.10.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 1216 + auto_deploy: true + peer1_description: "Description of source - REP" + peer2_description: "Description of dest - REP" + peer1_cmds: + - cdp enable + peer2_cmds: + - cdp enable + register: replace_basic_result + + - name: ASSERT - Basic replace diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - - assert: + - 'replace_basic_result.changed == true' + - '(replace_basic_result.diff[0].merged | length) == 0' + - '(replace_basic_result.diff[0].modified | length) == 1' + - '(replace_basic_result.diff[0].deleted | length) == 0' + - '(replace_basic_result.diff[0].query | length) == 0' + - '(replace_basic_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(replace_basic_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + + - name: ASSERT - Basic replace return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ replace_basic_result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - - name: Replace Links - Idempotence - cisco.dcnm.dcnm_links: *links_replace1 - register: result + - name: Replace - Idempotence (basic link) + cisco.dcnm.dcnm_links: *links_replace_basic + register: replace_basic_idem - - assert: + - name: ASSERT - Basic replace idempotence diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - - assert: + - 'replace_basic_idem.changed == true' + - '(replace_basic_idem.diff[0].merged | length) == 0' + - '(replace_basic_idem.diff[0].modified | length) == 0' + - '(replace_basic_idem.diff[0].deleted | length) == 0' + - '(replace_basic_idem.diff[0].query | length) == 0' + - '(replace_basic_idem.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(replace_basic_idem.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + + - name: ASSERT - Basic replace idempotence return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ replace_basic_idem.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - - name: Replace (multisite) existing links - cisco.dcnm.dcnm_links: &links_replace2 - state: replaced # choose from [merged, replaced, deleted, query] + - name: Replace - Multisite links with new params + cisco.dcnm.dcnm_links: &links_replace_ms + state: replaced src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_4 }}" + dst_interface: "{{ intf_1_4 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: - ipv4_subnet: 193.168.20.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.20.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 2216 # - deploy_dci_tracking: true # optional, default is false - max_paths: 2 # optional, default is 1 - route_tag: 11111 # optional, optional is "" - ebgp_password_enable: false # optional, default is true + ipv4_subnet: 193.168.20.1/24 + neighbor_ip: 193.168.20.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + mtu: 2216 + deploy_dci_tracking: true + max_paths: 2 + route_tag: 11111 + ebgp_password_enable: false ebgp_password: 28E71E338DA17111 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: False # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - peer1_description: "Description of source - REP" # optional, default is "" - peer2_description: "Description of dest - REP" # optional, default is "" - - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + inherit_from_msd: false + ebgp_auth_key_type: 7 + peer1_description: "Description of source - REP" + peer2_description: "Description of dest - REP" + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_5 }}" + dst_interface: "{{ intf_1_5 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_evpn_multisite_overlay_setup profile: - ipv4_addr: 193.168.30.1 # IP address of interface in src fabric - neighbor_ip: 193.168.30.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - trm_enabled: true # optional, default is false - bgp_multihop: 3 # optional, default is 5 - ebgp_password_enable: false # optional, default is true - ebgp_password: 8F8F790E1CB7AF60 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false - ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + ipv4_addr: 193.168.30.1 + neighbor_ip: 193.168.30.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + trm_enabled: true + bgp_multihop: 3 + ebgp_password_enable: false + ebgp_password: 8F8F790E1CB7AF60 + inherit_from_msd: true + ebgp_auth_key_type: 7 + register: replace_ms_result + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite replace diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 2' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'replace_ms_result.changed == true' + - '(replace_ms_result.diff[0].merged | length) == 0' + - '(replace_ms_result.diff[0].modified | length) == 2' + - '(replace_ms_result.diff[0].deleted | length) == 0' + - '(replace_ms_result.diff[0].query | length) == 0' + - '(replace_ms_result.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(replace_ms_result.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite replace return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ replace_ms_result.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## MULTISITE REPLACE - IDEMPOTENCE ## + ############################################## - - name: Replace (multisite) Links - Idempotence - cisco.dcnm.dcnm_links: *links_replace2 - register: result - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + - name: Replace - Multisite idempotence + cisco.dcnm.dcnm_links: *links_replace_ms + register: replace_ms_idem + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - name: ASSERT - Multisite replace idempotence diff counters + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - - assert: + - 'replace_ms_idem.changed == true' + - '(replace_ms_idem.diff[0].merged | length) == 0' + - '(replace_ms_idem.diff[0].modified | length) == 0' + - '(replace_ms_idem.diff[0].deleted | length) == 0' + - '(replace_ms_idem.diff[0].query | length) == 0' + - '(replace_ms_idem.diff[0].deploy[0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' + - '(replace_ms_idem.diff[0].deploy[0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + - name: ASSERT - Multisite replace idempotence return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + loop: '{{ replace_ms_idem.response }}' + when: (ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Cleanup - Delete Links + - name: Cleanup - Delete all created links cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + loop: '{{ cleanup_result.response }}' + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_missing_params.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_missing_params.yaml index bec59f95e..33b1bd16d 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_missing_params.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_missing_params.yaml @@ -6,309 +6,268 @@ local_action: command rm -f dcnm_links.log - block: - -############################################## -## MERGE ## -############################################## + ############################################## + ## NEGATIVE MERGE (MISSING PARAMS) ## + ############################################## - name: Create Links with invalid template name cisco.dcnm.dcnm_links: + state: merged src_fabric: "{{ ansible_num_fabric }}" - state: merged # choose from [merged, replaced, deleted, query] config: - - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric - src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: dcnm_links_invalid_template # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_num_fabric }}" + src_interface: "{{ intf_1_1 }}" + dst_interface: "{{ intf_1_1 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_num_switch2 }}" + template: dcnm_links_invalid_template profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: invalid_template - name: Create Links without source fabric cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_src_fabric - name: Create Links without destination fabric cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_dst_fabric - name: Create Links without source interface cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_src_interface - name: Create Links without destination interface cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_dst_interface - name: Create Links without source device cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_src_device - name: Create Links without destination device cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_dst_device - name: Create Links without template cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_template - name: Create Links without ipv4_subnet cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_ipv6_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_ipv6_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_ipv6_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_ipv4_subnet - - name: Create Links without ipv4_addr + - name: Create Links without ipv4_addr (using overlay template) cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_evpn_multisite_overlay_setup profile: - neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - trm_enabled: false # optional, default is false - ignore_errors: yes - register: result + neighbor_ip: 193.168.3.2 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + trm_enabled: false + ignore_errors: true + register: no_ipv4_addr - name: Create Links without neighbor_ip cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + src_asn: "{{ ansible_num_asn }}" + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_neighbor_ip - name: Create Links without src_asn cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_fabric_setup profile: - ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - ignore_errors: yes - register: result + ipv4_subnet: 193.168.1.1/24 + neighbor_ip: 193.168.1.2 + dst_asn: "{{ ansible_unnum_asn }}" + ignore_errors: true + register: no_src_asn - name: Create Links without dst_asn cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_3 }}" + dst_interface: "{{ intf_1_3 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_evpn_multisite_overlay_setup profile: - ipv4_addr: 193.168.1.1 # IP address of interface in src fabric with mask - neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric - src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric - ignore_errors: yes - register: result + ipv4_addr: 193.168.1.1 + neighbor_ip: 193.168.1.2 + src_asn: "{{ ansible_num_asn }}" + ignore_errors: true + register: no_dst_asn - name: Create Links without profile cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - ignore_errors: yes - register: result + - dst_fabric: "{{ ansible_unnum_fabric }}" + template: ext_multisite_underlay_setup + ignore_errors: true + register: no_profile - - name: Create Links without multiple profile parameters + - name: Create Links with invalid profile parameters cisco.dcnm.dcnm_links: - state: merged # choose from [merged, replaced, deleted, query] + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric - src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric - src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" + src_interface: "{{ intf_1_1 }}" + dst_interface: "{{ intf_1_1 }}" + src_device: "{{ ansible_num_switch1 }}" + dst_device: "{{ ansible_unnum_switch1 }}" + template: ext_multisite_underlay_setup profile: dummy: 1 - ignore_errors: yes - register: result + ignore_errors: true + register: bad_profile diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_delete.yaml index 62732ad37..b7160768d 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_delete.yaml @@ -3,13 +3,14 @@ ############################################## - name: Remove local log file - local_action: command rm -f dcnm_links.log + ansible.builtin.command: rm -f dcnm_links.log + delegate_to: localhost - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -54,14 +55,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt1 @@ -73,17 +74,17 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -96,17 +97,17 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -116,7 +117,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -132,15 +133,16 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### DELETE ## -############################################### + + ############################################### + ### DELETE ## + ############################################### - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -151,20 +153,20 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################### -### IDEMPOTENCE ## -############################################### + + ############################################### + ### IDEMPOTENCE ## + ############################################### - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -173,14 +175,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links (multisite) including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt2 @@ -192,24 +194,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -222,46 +224,46 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebpg_password_enable: True # optional, default is true + route_tag: 12345 # optional, optional is "" + ebpg_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -274,26 +276,26 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.6.1 # IP address of interface in src fabric neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: True # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' @@ -303,24 +305,24 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -330,24 +332,24 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - -############################################### -### IDEMPOTENCE ## -############################################### + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + + ############################################### + ### IDEMPOTENCE ## + ############################################### - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -355,10 +357,10 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_merge.yaml index 3010d1ad3..b073f10ff 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_merge.yaml @@ -3,13 +3,14 @@ ############################################## - name: Remove local log file - local_action: command rm -f dcnm_links.log + ansible.builtin.command: rm -f dcnm_links.log + delegate_to: localhost - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -54,14 +55,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt1 @@ -73,9 +74,9 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric @@ -87,9 +88,9 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric @@ -97,7 +98,7 @@ dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -113,15 +114,15 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### IDEMPOTENCE ## -############################################### + ############################################### + ### IDEMPOTENCE ## + ############################################### - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_no_opt1 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -132,20 +133,20 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -156,14 +157,14 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################## -## MERGE ## -############################################## + + ############################################## + ## MERGE ## + ############################################## - name: Create Links (multisite) without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt2 @@ -175,9 +176,9 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric @@ -189,9 +190,9 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric @@ -203,9 +204,9 @@ dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric @@ -217,18 +218,18 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.6.1 # IP address of interface in src fabric neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' @@ -238,24 +239,24 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################### -### IDEMPOTENCE ## -############################################### + ############################################### + ### IDEMPOTENCE ## + ############################################### - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_no_opt2 register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -265,24 +266,24 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -292,17 +293,16 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - -############################################## -## MERGE ## -############################################## + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + ############################################## + ## MERGE ## + ############################################## - name: Create Links including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt3 @@ -314,17 +314,17 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -337,17 +337,17 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -356,7 +356,7 @@ - no shutdown # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -367,20 +367,20 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### IDEMPOTENCE ## -############################################### + ############################################### + ### IDEMPOTENCE ## + ############################################### - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt3 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -391,14 +391,14 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links (multisite) including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt4 @@ -410,24 +410,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -440,46 +440,46 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebpg_password_enable: True # optional, default is true + route_tag: 12345 # optional, optional is "" + ebpg_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -492,26 +492,26 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.6.1 # IP address of interface in src fabric neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: True # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' @@ -521,24 +521,24 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################### -### IDEMPOTENCE ## -############################################### + ############################################### + ### IDEMPOTENCE ## + ############################################### - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt4 register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -548,27 +548,27 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response | default([]) }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_modify.yaml index 7f825e129..5f13a8c94 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_modify.yaml @@ -3,13 +3,13 @@ ############################################## - name: Remove local log file - local_action: command rm -f dcnm_links.log + ansible.builtin.command: rm -f dcnm_links.log + delegate_to: localhost - block: - -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -54,14 +54,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt1 @@ -73,17 +73,17 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -96,17 +96,17 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -115,7 +115,7 @@ - no shutdown # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -126,14 +126,14 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links (multisite) including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt2 @@ -145,24 +145,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -175,46 +175,46 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebpg_password_enable: True # optional, default is true + route_tag: 12345 # optional, optional is "" + ebpg_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -227,26 +227,26 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.6.1 # IP address of interface in src fabric neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: True # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' @@ -256,17 +256,17 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: &links_modify1 @@ -278,17 +278,17 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.10.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.10.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 1216 # + mtu: 1216 # auto_deploy: true # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source - MOD" # optional, default is "" peer2_description: "Description of dest - MOD" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -301,17 +301,17 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.40.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.40.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 4216 # + mtu: 4216 # auto_deploy: true # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -320,7 +320,7 @@ - no shutdown # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -331,14 +331,14 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge (multisite) modified info into existing links cisco.dcnm.dcnm_links: &links_modify2 @@ -350,24 +350,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.20.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.20.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 2216 # + mtu: 2216 # deploy_dci_tracking: true # optional, default is false max_paths: 2 # optional, default is 1 - route_tag: 11111 # optional, optional is "" - ebgp_password_enable: false # optional, default is true + route_tag: 11111 # optional, optional is "" + ebgp_password_enable: false # optional, default is true ebgp_password: 28E71E338DA17111 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: False # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source - MOD" # optional, default is "" peer2_description: "Description of dest - MOD" # optional, default is "" @@ -376,46 +376,46 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.30.1 # IP address of interface in src fabric neighbor_ip: 193.168.30.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: true # optional, default is false - bgp_multihop: 3 # optional, default is 5 - ebgp_password_enable: false # optional, default is true - ebgp_password: 8F8F790E1CB7AF60 # optional, required only if ebgp_password_enable flag is true + bgp_multihop: 3 # optional, default is 5 + ebgp_password_enable: false # optional, default is true + ebgp_password: 8F8F790E1CB7AF60 # optional, required only if ebgp_password_enable flag is true inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.50.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.50.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 5216 # + mtu: 5216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebpg_password_enable: True # optional, default is true + route_tag: 12345 # optional, optional is "" + ebpg_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" @@ -424,26 +424,26 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.60.1 # IP address of interface in src fabric neighbor_ip: 193.168.60.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric trm_enabled: true # optional, default is false - bgp_multihop: 6 # optional, default is 5 - ebgp_password_enable: True # optional, default is true + bgp_multihop: 6 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -453,27 +453,27 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response | default([]) }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_replace.yaml index ece601070..f42268841 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_numbered_replace.yaml @@ -7,9 +7,9 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -54,14 +54,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt1 @@ -73,17 +73,17 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -96,17 +96,17 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # auto_deploy: false # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -115,7 +115,7 @@ - no shutdown # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -126,14 +126,14 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links (multisite) including optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt2 @@ -145,24 +145,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebgp_password_enable: true # optional, default is true + route_tag: 12345 # optional, optional is "" + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -175,46 +175,46 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: true # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebpg_password_enable: True # optional, default is true + route_tag: 12345 # optional, optional is "" + ebpg_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: True # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -227,26 +227,26 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.6.1 # IP address of interface in src fabric neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric trm_enabled: false # optional, default is false - bgp_multihop: 5 # optional, default is 5 - ebgp_password_enable: True # optional, default is true + bgp_multihop: 5 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 9BFE3270E19CA112 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 3 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' @@ -256,17 +256,17 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Replace existing links cisco.dcnm.dcnm_links: &links_replace1 @@ -278,17 +278,17 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.10.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.10.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 1216 # + mtu: 1216 # auto_deploy: true # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source - REP" # optional, default is "" peer2_description: "Description of dest - REP" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -301,17 +301,17 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.40.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.40.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 4216 # + mtu: 4216 # auto_deploy: true # optional, default is false - # Flag that controls auto generation of neighbor VRF Lite configuration + # Flag that controls auto generation of neighbor VRF Lite configuration peer1_description: "Description of source - REP" # optional, default is "" peer2_description: "Description of dest - REP" # optional, default is "" peer1_cmds: # Freeform config for source interface @@ -320,7 +320,7 @@ - no shutdown # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -331,20 +331,20 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Replace Links - Idempotence cisco.dcnm.dcnm_links: *links_replace1 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -355,15 +355,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Replace (multisite) existing links cisco.dcnm.dcnm_links: &links_replace2 @@ -375,24 +375,24 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.20.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.20.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 2216 # + mtu: 2216 # deploy_dci_tracking: true # optional, default is false max_paths: 2 # optional, default is 1 - route_tag: 11111 # optional, optional is "" - ebgp_password_enable: false # optional, default is true + route_tag: 11111 # optional, optional is "" + ebgp_password_enable: false # optional, default is true ebgp_password: 28E71E338DA17111 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false - inherit_from_msd: False # optional, required only if ebgp_password_enable flag is true, default is false + inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source - REP" # optional, default is "" peer2_description: "Description of dest - REP" # optional, default is "" @@ -401,46 +401,46 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.30.1 # IP address of interface in src fabric neighbor_ip: 193.168.30.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric trm_enabled: true # optional, default is false - bgp_multihop: 3 # optional, default is 5 - ebgp_password_enable: false # optional, default is true + bgp_multihop: 3 # optional, default is 5 + ebgp_password_enable: false # optional, default is true ebgp_password: 8F8F790E1CB7AF60 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: true # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.50.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.50.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 5216 # + mtu: 5216 # deploy_dci_tracking: false # optional, default is false max_paths: 1 # optional, default is 1 - route_tag: 12345 # optional, optional is "" - ebpg_password_enable: True # optional, default is true + route_tag: 12345 # optional, optional is "" + ebpg_password_enable: true # optional, default is true ebgp_password: 34DEA21BE32A757D # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" @@ -449,26 +449,26 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.60.1 # IP address of interface in src fabric neighbor_ip: 193.168.60.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric trm_enabled: true # optional, default is false - bgp_multihop: 6 # optional, default is 5 - ebgp_password_enable: True # optional, default is true + bgp_multihop: 6 # optional, default is 5 + ebgp_password_enable: true # optional, default is true ebgp_password: 0DAEAF7E1F5F0CC6 # optional, required only if ebgp_password_enable flag is true and inherit_from_msd is false inherit_from_msd: false # optional, required only if ebgp_password_enable flag is true, default is false ebgp_auth_key_type: 7 # optional, required only if ebpg_password_enable is true and inherit_from_msd - # is false. Default is 3 - # choose from [3 - 3DES, 7 - Cisco ] + # is false. Default is 3 + # choose from [3 - 3DES, 7 - Cisco ] register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -478,24 +478,24 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Replace Links - Idempotence cisco.dcnm.dcnm_links: *links_replace2 register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -505,27 +505,27 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_ipv6_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined - - assert: + - name: ASSERT - Cleanup return codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + - item.RETURN_CODE == 200 + loop: "{{ cleanup_result.response | default([]) }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_query.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_query.yaml index f996a7398..c8f1abf7a 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_query.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_query.yaml @@ -7,9 +7,9 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -54,14 +54,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -74,39 +74,39 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric @@ -119,39 +119,39 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ipv6_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_8 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.6.1 # IP address of interface in src fabric neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric @@ -161,7 +161,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 6' @@ -170,52 +170,51 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 6' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: - dst_fabric: "{{ ansible_unnum_fabric }}" # optional, Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -223,12 +222,12 @@ src_interface: "{{ intf_1_3 }}" # optional, Interface on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -236,12 +235,12 @@ src_interface: "{{ intf_1_6 }}" # optional, Interface on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -250,12 +249,12 @@ dst_interface: "{{ intf_1_3 }}" # optional, Interface on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -264,12 +263,12 @@ dst_interface: "{{ intf_1_6 }}" # optional, Interface on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -279,12 +278,12 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -294,12 +293,12 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -310,12 +309,12 @@ dst_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -326,12 +325,12 @@ dst_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -340,10 +339,10 @@ dst_interface: "{{ intf_1_3 }}" # optional, Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Destination fabric - template: ext_fabric_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + template: ext_fabric_setup # optional, template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_unnum_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_4 }}" # optional, Interface on the Source fabric @@ -351,8 +350,8 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Destination fabric template: ext_multisite_underlay_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_unnum_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_5 }}" # optional, Interface on the Source fabric @@ -360,17 +359,17 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Destination fabric template: ext_evpn_multisite_overlay_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -379,10 +378,10 @@ dst_interface: "{{ intf_1_6 }}" # optional, Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Destination fabric - template: ext_fabric_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] - + template: ext_fabric_setup # optional, template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] + - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_7 }}" # optional, Interface on the Source fabric @@ -390,8 +389,8 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Destination fabric template: ext_multisite_underlay_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_8 }}" # optional, Interface on the Source fabric @@ -399,27 +398,26 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Destination fabric template: ext_evpn_multisite_overlay_setup # optional, template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' -############################################## -## CLEANUP ## -############################################## - + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_template_change.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_template_change.yaml index d81b5a04d..8c0733b65 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_template_change.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_inter_template_change.yaml @@ -7,9 +7,9 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -54,14 +54,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links with ext_fabric_setup template cisco.dcnm.dcnm_links: @@ -73,19 +73,19 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 9216 # + mtu: 9216 # register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -95,7 +95,7 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -110,20 +110,20 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_multisite_underlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_multisite_underlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric - mtu: 2216 # + mtu: 2216 # register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -132,13 +132,13 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - name: Modify Links changing template to ext_evpn_multisite_overlay_setup cisco.dcnm.dcnm_links: @@ -150,9 +150,9 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch1 }}" # Device on the Destination fabric - template: ext_evpn_multisite_overlay_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_evpn_multisite_overlay_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_addr: 193.168.3.1 # IP address of interface in src fabric neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric @@ -161,9 +161,9 @@ trm_enabled: false # optional, default is false register: result - when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -172,26 +172,26 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' - when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) + when: (ansible_num_fabric in ms_fabric_list or ansible_unnum_fabric in ms_fabric_list) -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_delete.yaml index e7f0f157a..bff9e2524 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_delete.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,46 +67,46 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv6_addr: 2080:0201::01 # IP address of the Source interface peer2_ipv6_addr: 2080:0201::02 # IP address of the Source interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv6_addr: 2080:0202::01 # IP address of the Source interface peer2_ipv6_addr: 2080:0202::02 # IP address of the Source interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' @@ -115,21 +115,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -138,21 +138,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -161,22 +161,22 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_merge.yaml index 732a3e886..c7676f66f 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_merge.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,46 +67,46 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv6_addr: 2080:0201::01 # IP address of the Source interface peer2_ipv6_addr: 2080:0201::02 # IP address of the Source interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv6_addr: 2080:0202::01 # IP address of the Source interface peer2_ipv6_addr: 2080:0202::02 # IP address of the Source interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' @@ -115,21 +115,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_no_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -138,27 +138,27 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -170,11 +170,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.1.1 # optional, default is "" peer2_ipv4_addr: 192.169.1.2 # optional, default is "" @@ -197,20 +197,20 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface @@ -230,7 +230,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' @@ -239,20 +239,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -261,23 +261,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_modify.yaml index 65021c1fb..6c2f7075c 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_modify.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" @@ -27,9 +27,9 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric @@ -50,14 +50,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: @@ -69,11 +69,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.171.1.1 # optional, default is "" peer2_ipv4_addr: 192.171.1.2 # optional, default is "" @@ -96,20 +96,20 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.172.2.1 # optional, default is "" peer2_ipv4_addr: 192.172.2.2 # optional, default is "" @@ -129,7 +129,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - 'result.changed == true' @@ -139,15 +139,15 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: @@ -159,11 +159,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.171.1.1 # optional, default is "" peer2_ipv4_addr: 193.171.1.2 # optional, default is "" @@ -186,20 +186,20 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.172.2.1 # optional, default is "" peer2_ipv4_addr: 193.172.2.2 # optional, default is "" @@ -219,7 +219,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -228,21 +228,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_query.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_query.yaml index 27d62e3a2..c41e3345e 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_query.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_query.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### MERGE ## -############################################### + ############################################### + ### MERGE ## + ############################################### - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,46 +67,46 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv6_addr: 2080:0201::01 # IP address of the Source interface peer2_ipv6_addr: 2080:0201::02 # IP address of the Source interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv6_addr: 2080:0202::01 # IP address of the Source interface peer2_ipv6_addr: 2080:0202::02 # IP address of the Source interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' @@ -115,39 +115,39 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -155,12 +155,12 @@ src_interface: "{{ intf_1_1 }}" # optional, Interface on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -169,12 +169,12 @@ dst_interface: "{{ intf_1_1 }}" # optional, Interface on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -184,12 +184,12 @@ src_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -200,12 +200,12 @@ dst_device: "{{ ansible_ipv6_switch2 }}" # optional, Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" config: @@ -216,9 +216,9 @@ src_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # optional, Device on the Destination fabric template: int_intra_fabric_ipv6_link_local # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_2 }}" # optional, Interface on the Source fabric @@ -226,37 +226,37 @@ src_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # optional, Device on the Destination fabric template: int_pre_provision_intra_fabric_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_3 }}" # optional, Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # optional, Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # optional, Device on the Destination fabric - template: int_intra_fabric_num_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_fabric_num_link # optional, template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 3' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_replace.yaml index a3d7039a5..f8ffe75b6 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_ipv6_replace.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_ipv6_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.1.1 # optional, default is "" peer2_ipv4_addr: 192.169.1.2 # optional, default is "" @@ -94,20 +94,20 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface @@ -127,7 +127,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' @@ -136,14 +136,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Replace Links cisco.dcnm.dcnm_links: &links_replace @@ -155,11 +155,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_ipv6_link_local # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_ipv6_link_local # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.169.1.1 # optional, default is "" peer2_ipv4_addr: 193.169.1.2 # optional, default is "" @@ -178,20 +178,20 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_ipv6_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.169.2.1 # optional, default is "" peer2_ipv4_addr: 193.169.2.2 # optional, default is "" @@ -207,7 +207,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -216,20 +216,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Repalce Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -238,23 +238,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ipv6_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_missing_params.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_missing_params.yaml index 18ab96f9a..2a2afd1d9 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_missing_params.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_missing_params.yaml @@ -7,9 +7,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links with invalid template name cisco.dcnm.dcnm_links: @@ -21,17 +21,17 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_invalid_temp # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_invalid_temp # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without source fabric @@ -43,17 +43,16 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without destination fabric @@ -65,17 +64,16 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without source interface @@ -87,17 +85,16 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without destination interface @@ -109,11 +106,11 @@ src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - ignore_errors: yes + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + ignore_errors: true register: result - name: Create Links without source device @@ -125,11 +122,10 @@ src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface @@ -137,7 +133,7 @@ peer2_ipv6_addr: 2080:21::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 1500 # optional, default is 1500 - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without destination device @@ -149,11 +145,11 @@ src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface @@ -161,7 +157,7 @@ peer2_ipv6_addr: 2080:11::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without template @@ -181,7 +177,7 @@ peer2_ipv6_addr: 2080:11::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without peer1 IPV6 @@ -194,10 +190,10 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface @@ -205,7 +201,7 @@ peer2_ipv6_addr: 2080:11::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 9216 - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without peer2 IPV6 @@ -218,10 +214,10 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_ipv6_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_ipv6_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface @@ -229,7 +225,7 @@ peer1_ipv6_addr: 2080:11::01 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 9216 - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without MTU @@ -242,10 +238,10 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface @@ -253,7 +249,7 @@ peer1_ipv6_addr: 2080:11::01 # optional, default is "" peer2_ipv6_addr: 2080:11::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without peer1 IPV4 @@ -266,18 +262,17 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface peer1_ipv6_addr: 2080:11::01 # optional, default is "" peer2_ipv6_addr: 2080:11::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without peer2 IPV4 @@ -290,18 +285,17 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Destination interface peer1_ipv6_addr: 2080:11::01 # optional, default is "" peer2_ipv6_addr: 2080:11::02 # optional, default is "" admin_state: true # optional, choose from [true, false], default is true mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without Admin State @@ -314,18 +308,17 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Destination interface peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface peer1_ipv6_addr: 2080:11::01 # optional, default is "" peer2_ipv6_addr: 2080:11::02 # optional, default is "" mtu: 9216 # - ignore_errors: yes + ignore_errors: true register: result - name: Create Links without profile @@ -338,11 +331,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - ignore_errors: yes + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + ignore_errors: true register: result - name: Create Links with profile parameters @@ -355,12 +348,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: dummy: 11 - ignore_errors: yes + ignore_errors: true register: result diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_delete.yaml index 2319a3655..0dd71394f 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_delete.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,29 +67,29 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -98,21 +98,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -121,20 +121,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -143,22 +143,22 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_merge.yaml index 0651bbcf6..e5d1f0b8d 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_merge.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,29 +67,29 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -98,21 +98,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_no_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -121,27 +121,27 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -153,11 +153,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface @@ -178,13 +178,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -193,20 +193,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -215,30 +215,30 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links - with deploy being false - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] deploy: false src_fabric: "{{ ansible_num_fabric }}" @@ -248,11 +248,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface @@ -269,7 +269,7 @@ - no shutdown # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -278,23 +278,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_modify.yaml index c775d08a2..0023a7f02 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_modify.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -27,9 +27,9 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric @@ -50,14 +50,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: @@ -69,11 +69,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface @@ -94,13 +94,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -109,15 +109,15 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: @@ -129,11 +129,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 193.168.1.2 # IP address of the Destination interface @@ -154,13 +154,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -169,21 +169,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_query.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_query.yaml index 3093562ac..5e791cfbd 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_query.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_query.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### MERGE ## -############################################### + ############################################### + ### MERGE ## + ############################################### - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: @@ -67,29 +67,29 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -98,39 +98,39 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 2' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: - dst_fabric: "{{ ansible_num_fabric }}" # optional, Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 2' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -138,12 +138,12 @@ src_interface: "{{ intf_1_1 }}" # optional, Interface on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -152,12 +152,12 @@ dst_interface: "{{ intf_1_1 }}" # optional, Interface on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -167,12 +167,12 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -183,12 +183,12 @@ dst_device: "{{ ansible_num_switch2 }}" # optional, Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -197,10 +197,10 @@ dst_interface: "{{ intf_1_1 }}" # optional, Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # optional, Device on the Destination fabric - template: int_intra_fabric_num_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_fabric_num_link # optional, template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_num_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_2 }}" # optional, Interface on the Source fabric @@ -208,27 +208,27 @@ src_device: "{{ ansible_num_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # optional, Device on the Destination fabric template: int_pre_provision_intra_fabric_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 2' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_replace.yaml index 6f64fcc14..5237c253b 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_replace.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -48,17 +48,17 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Create Links - cisco.dcnm.dcnm_links: + - name: Create Links + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface @@ -92,13 +92,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -107,16 +107,16 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - - name: Replace Links + - name: Replace Links cisco.dcnm.dcnm_links: &links_replace state: replaced # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -126,11 +126,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.169.1.2 # IP address of the Destination interface @@ -147,13 +147,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -162,20 +162,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Repalce Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -184,23 +184,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_template_change.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_template_change.yaml index 3bfe6aa2d..ee25ca638 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_template_change.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_numbered_template_change.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,20 +67,20 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -89,17 +89,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Modify the template name - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -108,13 +108,13 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -123,24 +123,24 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################### -### CLEANUP ## -############################################### + + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_delete.yaml index 8a3406673..21bf30e52 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_delete.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,30 +67,30 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.173.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.173.1.2 # IP address of the Destination interface admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -99,21 +99,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### DELETE ## -############################################### + ############################################### + ### DELETE ## + ############################################### - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -122,21 +122,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -145,23 +145,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_merge.yaml index 01be13939..821d2dd79 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_merge.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,28 +67,28 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -97,21 +97,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_no_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -120,27 +120,27 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -152,11 +152,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: true # choose from [true, false] mtu: 9216 # @@ -173,13 +173,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -188,20 +188,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -210,23 +210,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_modify.yaml index 26e59fc67..4016a198a 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_modify.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,28 +67,28 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -97,15 +97,15 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: @@ -117,27 +117,27 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: false # choose from [true, false] - mtu: 1800 # + mtu: 1800 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -146,21 +146,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_query.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_query.yaml index 92a2349b7..5daf9bc01 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_query.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_query.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -47,14 +47,14 @@ dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### MERGE ## -############################################### + ############################################### + ### MERGE ## + ############################################### - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -66,28 +66,28 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -96,39 +96,39 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 2' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: - dst_fabric: "{{ ansible_unnum_fabric }}" # optional, Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 2' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: @@ -136,12 +136,12 @@ src_interface: "{{ intf_1_1 }}" # optional, Interface on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: @@ -150,12 +150,12 @@ dst_interface: "{{ intf_1_1 }}" # optional, Interface on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: @@ -165,12 +165,12 @@ src_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: @@ -181,12 +181,12 @@ dst_device: "{{ ansible_unnum_switch2 }}" # optional, Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: @@ -195,10 +195,10 @@ dst_interface: "{{ intf_1_1 }}" # optional, Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # optional, Device on the Destination fabric - template: int_intra_fabric_unnum_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_fabric_unnum_link # optional, template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_unnum_fabric }}" # optional, Destination fabric src_interface: "{{ intf_1_2 }}" # optional, Interface on the Source fabric @@ -206,29 +206,29 @@ src_device: "{{ ansible_unnum_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # optional, Device on the Destination fabric template: int_pre_provision_intra_fabric_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 2' register: result -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_replace.yaml index 7123b3f83..96703aad9 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_replace.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: true # choose from [true, false] mtu: 9216 # @@ -88,13 +88,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -103,16 +103,16 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - - name: Replace Links + - name: Replace Links cisco.dcnm.dcnm_links: &links_replace state: replaced # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -122,11 +122,11 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: false # choose from [true, false] mtu: 1216 # @@ -141,13 +141,13 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -156,20 +156,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Repalce Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -178,23 +178,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_template_change.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_template_change.yaml index 7e12bc093..784e114d5 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_template_change.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_unnumbered_template_change.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,18 +67,18 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_intra_fabric_unnum_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_fabric_unnum_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: admin_state: true # choose from [true, false] - mtu: 9216 # + mtu: 9216 # register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -87,17 +87,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Modify template name - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_unnum_fabric }}" config: @@ -106,13 +106,13 @@ dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric src_device: "{{ ansible_unnum_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_unnum_switch2 }}" # Device on the Destination fabric - template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_pre_provision_intra_fabric_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -121,23 +121,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - -############################################### -### CLEANUP ## -############################################### + + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_delete.yaml index bbad7fb4c..c9e57c7e1 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_delete.yaml @@ -7,12 +7,12 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links - cisco.dcnm.dcnm_links: + - name: Initial setup - Delete Links + cisco.dcnm.dcnm_links: state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface @@ -80,7 +80,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -89,17 +89,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" @@ -111,7 +111,7 @@ dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -120,20 +120,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -142,14 +142,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -157,7 +157,7 @@ cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_merge.yaml index 58609ace0..fbed06517 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_merge.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface @@ -80,7 +80,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -89,21 +89,21 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_no_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -112,27 +112,27 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -144,11 +144,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.170.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.170.1.2 # IPV4 address of the Destination interface @@ -163,11 +163,11 @@ - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination device - no shutdown # optional, default is "" - intf_vrf: "test_vrf" # optional, default is "" + intf_vrf: "test_vrf" # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -176,20 +176,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -198,24 +198,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_modify.yaml index 81f625c60..acbdaa417 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_modify.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" @@ -48,17 +48,17 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.170.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.170.1.2 # IPV4 address of the Destination interface @@ -86,11 +86,11 @@ - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination device - no shutdown # optional, default is "" - intf_vrf: "test_vrf" # optional, default is "" + intf_vrf: "test_vrf" # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -99,14 +99,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -118,11 +118,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.170.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 193.170.1.2 # IPV4 address of the Destination interface @@ -137,11 +137,11 @@ - cdp enable # optional, default is "" peer2_cmds: # Freeform config for destination device - cdp enable # optional, default is "" - intf_vrf: "test2_vrf" # optional, default is "" + intf_vrf: "test2_vrf" # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -150,23 +150,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_query.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_query.yaml index d4b60942a..d60f1dbba 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_query.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_query.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" @@ -48,14 +48,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### MERGE ## -############################################### + ############################################### + ### MERGE ## + ############################################### - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IPV4 address of the Destination interface @@ -80,7 +80,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -89,40 +89,40 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: - dst_fabric: "{{ ansible_vpc_fabric }}" # optional, Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -130,12 +130,12 @@ src_interface: "{{ intf_1_4 }}" # optional, Interface on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -144,12 +144,12 @@ dst_interface: "{{ intf_1_4 }}" # optional, Interface on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -159,12 +159,12 @@ src_device: "{{ ansible_vpc_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -175,12 +175,12 @@ dst_device: "{{ ansible_vpc_switch2 }}" # optional, Device on the Destination fabric register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -189,29 +189,29 @@ dst_interface: "{{ intf_1_4 }}" # optional, Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # optional, Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: int_intra_vpc_peer_keep_alive_link # optional, template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: '(result["response"] | length) >= 1' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_replace.yaml index bcef998d7..7aca18acc 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_intra_vpc_replace.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" @@ -48,17 +48,17 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -67,11 +67,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.170.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.170.1.2 # IPV4 address of the Destination interface @@ -86,11 +86,11 @@ - no shutdown # optional, default is "" peer2_cmds: # Freeform config for destination device - no shutdown # optional, default is "" - intf_vrf: "test_vrf" # optional, default is "" + intf_vrf: "test_vrf" # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -99,17 +99,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Replace Link - cisco.dcnm.dcnm_links: &links_replace + cisco.dcnm.dcnm_links: &links_replace state: replaced # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_vpc_fabric }}" config: @@ -118,11 +118,11 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "{{ ansible_vpc_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_vpc_switch2 }}" # Device on the Destination fabric - template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: int_intra_vpc_peer_keep_alive_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.170.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 193.170.1.2 # IPV4 address of the Destination interface @@ -137,11 +137,11 @@ - cdp enable # optional, default is "" peer2_cmds: # Freeform config for destination device - cdp enable # optional, default is "" - intf_vrf: "test_vrf" # optional, default is "" + intf_vrf: "test_vrf" # optional, default is "" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -150,20 +150,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Repalce Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -172,23 +172,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_vpc_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_misc.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_misc.yaml index 3091b795e..9fe45da58 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_misc.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_misc.yaml @@ -7,9 +7,9 @@ - block: -############################################# -# DELETE ## -############################################# + ############################################# + # DELETE ## + ############################################# - name: Initial setup - Delete Links on numbered fabric cisco.dcnm.dcnm_links: &links_delete @@ -21,94 +21,94 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "dummy-switch-1" # Device on the Source fabric dst_device: "{{ ansible_num_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_svi_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw3" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_svi_fabric }}" # Destination fabric src_interface: "{{ intf_1_4 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw100" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_svi_fabric }}" # Destination fabric src_interface: "{{ intf_1_5 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-svi1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_svi_fabric }}" # Destination fabric src_interface: "{{ intf_1_6 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-test-sw3" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_svi_fabric }}" # Destination fabric src_interface: "{{ intf_1_7 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-svi1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_ext_fabric }}" # Destination fabric src_interface: "{{ intf_1_8 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw4" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_9 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_9 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-unnum-1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_ext_fabric }}" # Destination fabric src_interface: "{{ intf_1_10 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_10 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-ext-sw1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] - dst_fabric: "{{ ansible_unnum_fabric }}" # Destination fabric src_interface: "{{ intf_1_11 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_11 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-unnum-1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Source Fabric in Monitoring mode - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_extmon_fabric }}" config: @@ -117,18 +117,18 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "dummy-switch-1" # Device on the Source fabric dst_device: "{{ ansible_num_switch1 }}" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.1.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.1.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_extmon_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_num_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - '("Monitoring mode" in result["msg"])' - '("No changes are allowed on the fabric" in result["msg"])' @@ -144,18 +144,18 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw3" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.2.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.2.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_svi_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -165,15 +165,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################ -# IDEMPOTENCE # -############################################ + ############################################ + # IDEMPOTENCE # + ############################################ - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create1 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -183,12 +183,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -197,18 +197,18 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw3" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Destination Fabric - Monitoring, Source Switches Not Managable and Destination Switches Not Managable (not present) cisco.dcnm.dcnm_links: &links_create2 @@ -220,9 +220,9 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw100" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.3.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.3.2 # IP address of the interface in dst fabric @@ -231,9 +231,9 @@ peer1_description: "Description of source" # optional, default is "" peer2_description: "Description of dest" # optional, default is "" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -253,9 +253,9 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw100" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.20.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.20.2 # IP address of the interface in dst fabric @@ -264,9 +264,9 @@ peer1_description: "Description of source - REP" # optional, default is "" peer2_description: "Description of dest - REP" # optional, default is "" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -286,9 +286,9 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw100" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.20.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.20.2 # IP address of the interface in dst fabric @@ -297,9 +297,9 @@ peer1_description: "Description of source - REP" # optional, default is "" peer2_description: "Description of dest - REP" # optional, default is "" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -309,15 +309,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create2 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -327,12 +327,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -341,18 +341,18 @@ dst_interface: "{{ intf_1_4 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw100" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Destination Fabric - Monitoring, Source Switches Not Managable and Destination Switches Managable cisco.dcnm.dcnm_links: &links_create3 @@ -364,18 +364,18 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-svi1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.4.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.4.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_svi_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -385,15 +385,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create3 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -403,12 +403,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -417,18 +417,18 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-svi1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Destination Fabric - Monitoring, Source Switches Managable and Destination Switches Not Managable cisco.dcnm.dcnm_links: &links_create4 @@ -440,18 +440,18 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-test-sw3" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.5.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.5.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_svi_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -461,15 +461,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create4 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -479,12 +479,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -493,18 +493,18 @@ dst_interface: "{{ intf_1_6 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-test-sw3" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Destination Fabric - Monitoring, Source Switches Managable and Destination Switches Managable cisco.dcnm.dcnm_links: &links_create5 @@ -516,18 +516,18 @@ dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-svi1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.6.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.6.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_svi_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -537,15 +537,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create5 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -555,12 +555,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_svi_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -569,18 +569,18 @@ dst_interface: "{{ intf_1_7 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-svi1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Source Switches Not Managable and Destination Switches Not Managable cisco.dcnm.dcnm_links: &links_create6 @@ -592,18 +592,18 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw4" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.7.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.7.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ext_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -613,15 +613,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ext_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create6 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -631,12 +631,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ext_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -645,18 +645,18 @@ dst_interface: "{{ intf_1_8 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-test-sw4" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Source Switches Not Managable and Destination Switches Managable cisco.dcnm.dcnm_links: &links_create7 @@ -668,18 +668,18 @@ dst_interface: "{{ intf_1_9 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-unnum-1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.8.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.8.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -689,15 +689,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create7 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -707,12 +707,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -721,18 +721,18 @@ dst_interface: "{{ intf_1_9 }}" # Interface on the Destination fabric src_device: "n9kv-test-sw1" # Device on the Source fabric dst_device: "n9kv-unnum-1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Source Switches Managable and Destination Switches Not Managable (not present in Fabric) cisco.dcnm.dcnm_links: &links_create8 @@ -744,18 +744,18 @@ dst_interface: "{{ intf_1_10 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-ext-sw1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.9.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.9.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_ext_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -765,15 +765,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ext_fabric }}" ] | length) == 0' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create8 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -783,12 +783,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_ext_fabric }}" ] | length) == 0' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -797,18 +797,18 @@ dst_interface: "{{ intf_1_10 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-ext-sw1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# MERGE ## -############################################# + ############################################# + # MERGE ## + ############################################# - name: Create Links - Source Switches Managable and Destination Switches Managable cisco.dcnm.dcnm_links: &links_create9 @@ -820,18 +820,18 @@ dst_interface: "{{ intf_1_11 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-unnum-1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] profile: ipv4_subnet: 193.168.10.1/24 # IP address of interface in src fabric with mask neighbor_ip: 193.168.10.2 # IP address of the interface in dst fabric src_asn: "{{ ansible_num_asn }}" # BGP ASN in source fabric dst_asn: "{{ ansible_unnum_asn }}" # BGP ASN in destination fabric register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -841,15 +841,15 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' -############################################# -# IDEMPOTENCE ## -############################################# + ############################################# + # IDEMPOTENCE ## + ############################################# - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_create9 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -859,12 +859,12 @@ - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 1' - '(result["diff"][0]["deploy"][0][ "{{ ansible_unnum_fabric }}" ] | length) == 1' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" config: @@ -873,27 +873,27 @@ dst_interface: "{{ intf_1_11 }}" # Interface on the Destination fabric src_device: "n9kv-num-1" # Device on the Source fabric dst_device: "n9kv-unnum-1" # Device on the Destination fabric - template: ext_fabric_setup # template to be applied, choose from - # [ ext_fabric_setup, ext_multisite_underlay_setup, - # ext_evpn_multisite_overlay_setup ] + template: ext_fabric_setup # template to be applied, choose from + # [ ext_fabric_setup, ext_multisite_underlay_setup, + # ext_evpn_multisite_overlay_setup ] register: result - - assert: + - ansible.builtin.assert: that: - '(result["response"] | length) >= 1' + - '(result["response"] | length) >= 1' -############################################# -# CLEANUP ## -############################################# + ############################################# + # CLEANUP ## + ############################################# always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_sanity.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_sanity.yaml index 2ee148afa..3a8038cef 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_sanity.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/dcnm_links_sanity.yaml @@ -8,11 +8,11 @@ - tags: sanity block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: SANITY- Initial setup - Delete Links + - name: SANITY- Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -49,14 +49,14 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create Links cisco.dcnm.dcnm_links: @@ -69,10 +69,10 @@ src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.168.1.2 # IP address of the Destination interface @@ -94,12 +94,12 @@ src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -108,14 +108,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: SANITY- Merge modified info into existing links cisco.dcnm.dcnm_links: @@ -128,9 +128,9 @@ src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: peer1_ipv4_addr: 193.168.1.1 # IP address of the Source interface @@ -153,12 +153,12 @@ src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -167,16 +167,16 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - - name: SANITY- Replace Links + - name: SANITY- Replace Links cisco.dcnm.dcnm_links: &links_replace state: replaced # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_num_fabric }}" @@ -187,10 +187,10 @@ src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric template: int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.1.1 # IP address of the Source interface peer2_ipv4_addr: 192.169.1.2 # IP address of the Destination interface @@ -208,12 +208,12 @@ src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric template: int_pre_provision_intra_fabric_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -222,20 +222,20 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: SANITY- Replace Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -244,23 +244,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_num_fabric }}" ] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: SANITY- Cleanup - Delete Links + - name: SANITY- Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_delete.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_delete.yaml index a260c202c..3055d67b8 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_delete.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_delete.yaml @@ -2,25 +2,24 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: XE DELETE - Remove local log file local_action: command rm -f dcnm_links.log - block: -############################################## -## DELETE ## -############################################## - - - name: Initial setup - Delete Links + ############################################## + ## DELETE ## + ############################################## + - name: XE DELETE - Baseline delete (ensure clean start) cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] + state: deleted src_fabric: "{{ ansible_xe_fabric }}" config: - - dst_fabric: "{{ ansible_xe_fabric }}" # Destination fabric - src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric - dst_interface: "{{ intf_1_1 }}" # Interface on the Destination fabric - src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric - dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric + - dst_fabric: "{{ ansible_xe_fabric }}" + src_interface: "{{ intf_1_1 }}" + dst_interface: "{{ intf_1_1 }}" + src_device: "{{ ansible_xe_switch1 }}" + dst_device: "{{ ansible_xe_switch2 }}" - dst_fabric: "{{ ansible_xe_fabric }}" # Destination fabric src_interface: "{{ intf_1_2 }}" # Interface on the Source fabric @@ -45,17 +44,16 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - register: result - - assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - name: ASSERT - Baseline delete RETURN_CODE + ansible.builtin.assert: + that: "item['RETURN_CODE'] == 200" + loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: &links_merge_no_opt @@ -67,38 +65,38 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.2.2 # IPV4 address of the Destination interface admin_state: true # choose from [true, false] + register: create_result - register: result - - - assert: + - name: ASSERT - Create diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 1' - - - assert: + - "create_result.changed == true" + - "(create_result.diff[0].merged | length) == 1" + - "(create_result.diff[0].modified | length) == 0" + - "(create_result.diff[0].deleted | length) == 0" + - "(create_result.diff[0].query | length) == 0" + - '(create_result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 1' + + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ create_result.response }}' + ############################################### + ### DELETE ## + ############################################### -############################################### -### DELETE ## -############################################### - - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result @@ -116,9 +114,9 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Links - Idempotence cisco.dcnm.dcnm_links: *links_delete @@ -138,13 +136,13 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_merge.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_merge.yaml index 31fa06bc7..8efbb35f9 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_merge.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_merge.yaml @@ -2,19 +2,19 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: XE MERGE - Remove local log file local_action: command rm -f dcnm_links.log - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## BASELINE DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: XE MERGE - Baseline delete existing links cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] - src_fabric: "{{ ansible_num_fabric }}" + state: deleted + src_fabric: "{{ ansible_xe_fabric }}" config: - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric src_interface: "{{ intf_1_1 }}" # Interface on the Source fabric @@ -45,21 +45,20 @@ dst_interface: "{{ intf_1_5 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - register: result - - assert: + - name: ASSERT - Baseline delete RETURN_CODE + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - -############################################## -## MERGE ## -############################################## - - - name: Create Links without including optional parameters - cisco.dcnm.dcnm_links: &links_merge_no_opt - state: merged # choose from [merged, replaced, deleted, query] + loop: '{{ result.response }}' + ############################################## + ## MERGE ## + ############################################## + + - name: XE MERGE - Create numbered link + cisco.dcnm.dcnm_links: &links_merge + state: merged src_fabric: "{{ ansible_num_fabric }}" config: - dst_fabric: "{{ ansible_num_fabric }}" # Destination fabric @@ -67,70 +66,74 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] profile: - peer1_ipv4_addr: 192.168.2.1 # IPV4 address of the Source interface - peer2_ipv4_addr: 192.168.2.2 # IPV4 address of the Destination interface - admin_state: true # choose from [true, false] + peer1_ipv4_addr: 192.168.2.1 + peer2_ipv4_addr: 192.168.2.2 + admin_state: true + register: merge_result - register: result - - - assert: + - name: ASSERT - Merge diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - - assert: + - "merge_result.changed == true" + - "(merge_result.diff[0].merged | length) == 1" + - "(merge_result.diff[0].modified | length) == 0" + - "(merge_result.diff[0].deleted | length) == 0" + - "(merge_result.diff[0].query | length) == 0" + - '(merge_result.diff[0].deploy[0][ "{{ ansible_xe_fabric }}" ] | length) == 2' + + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - - name: Create Links - Idempotence - cisco.dcnm.dcnm_links: *links_merge_no_opt - register: result + - name: XE MERGE - Idempotence + cisco.dcnm.dcnm_links: *links_merge + register: merge_idem - - assert: + - name: ASSERT - Merge idempotence diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - - assert: + - "merge_idem.changed == true" + - "(merge_idem.diff[0].merged | length) == 0" + - "(merge_idem.diff[0].modified | length) == 0" + - "(merge_idem.diff[0].deleted | length) == 0" + - "(merge_idem.diff[0].query | length) == 0" + - '(merge_idem.diff[0].deploy[0][ "{{ ansible_xe_fabric }}" ] | length) == 2' + + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ merge_idem.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Delete Links + - name: Delete Links cisco.dcnm.dcnm_links: *links_delete register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: &links_merge_with_opt @@ -142,11 +145,11 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_num_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_num_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface @@ -166,7 +169,8 @@ register: result - - assert: + - name: ASSERT - result + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -175,20 +179,22 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Links - Idempotence cisco.dcnm.dcnm_links: *links_merge_with_opt register: result - - assert: + - name: ASSERT - result + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -197,24 +203,24 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - - name: Cleanup - Delete Links + - name: XE MERGE - Cleanup delete link cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined - - - assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined + + - name: ASSERT - cleanup response + ansible.builtin.assert: + that: "item['RETURN_CODE'] == 200" + loop: "{{ cleanup_result.response | default([]) }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_modify.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_modify.yaml index 4279aa390..7d6956b40 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_modify.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_modify.yaml @@ -2,18 +2,18 @@ ## SETUP ## ############################################## -- name: Remove local log file +- name: XE MODIFY - Remove local log file local_action: command rm -f dcnm_links.log - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## BASELINE DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: XE MODIFY - Baseline delete cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] + state: deleted src_fabric: "{{ ansible_xe_fabric }}" config: - dst_fabric: "{{ ansible_xe_fabric }}" # Destination fabric @@ -27,9 +27,9 @@ dst_interface: "{{ intf_1_2 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - dst_fabric: "{{ ansible_xe_fabric }}" # Destination fabric src_interface: "{{ intf_1_3 }}" # Interface on the Source fabric dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric @@ -48,16 +48,17 @@ src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - register: result + register: delete_result - - assert: + - name: ASSERT - Baseline delete RETURN_CODE + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ delete_result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Links including all optional parameters cisco.dcnm.dcnm_links: @@ -69,11 +70,11 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.169.1.2 # IPV4 address of the Destination interface @@ -92,7 +93,8 @@ - no shutdown # optional, default is "" register: result - - assert: + - name: ASSERT - result + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -101,15 +103,16 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: Merge modified info into existing links cisco.dcnm.dcnm_links: @@ -121,11 +124,11 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 193.169.1.1 # IPV4 address of the Source interface peer2_ipv4_addr: 193.169.1.2 # IPV4 address of the Destination interface @@ -145,7 +148,8 @@ register: result - - assert: + - name: ASSERT - result + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -154,22 +158,24 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################### + ### CLEANUP ## + ############################################### - - name: Cleanup - Delete Links + always: + - name: XE MODIFY - Cleanup delete link cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined - - - assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined + + - name: ASSERT - Cleanup RETURN_CODE + ansible.builtin.assert: + that: "item['RETURN_CODE'] == 200" + loop: "{{ cleanup_result.response | default([]) }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_query.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_query.yaml index 3cae3430f..4fc38d704 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_query.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_query.yaml @@ -7,11 +7,11 @@ - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: Initial setup - Delete Links cisco.dcnm.dcnm_links: &links_delete state: deleted # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" @@ -48,14 +48,15 @@ register: result - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################### -### MERGE ## -############################################### + ############################################### + ### MERGE ## + ############################################### - name: Create Links without including optional parameters cisco.dcnm.dcnm_links: @@ -67,11 +68,11 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.168.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.168.2.2 # IPV4 address of the Destination interface @@ -88,39 +89,42 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################### -### QUERY ## -############################################### + ############################################### + ### QUERY ## + ############################################### - name: Query Links - with Src Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: - dst_fabric: "{{ ansible_xe_fabric }}" # optional, Destination fabric register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: @@ -128,12 +132,13 @@ src_interface: "{{ intf_1_1 }}" # optional, Interface on the Source fabric register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: @@ -142,12 +147,13 @@ dst_interface: "{{ intf_1_1 }}" # optional, Interface on the Destination fabric register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: @@ -157,12 +163,13 @@ src_device: "{{ ansible_xe_switch1 }}" # optional, Device on the Source fabric register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: @@ -173,12 +180,13 @@ dst_device: "{{ ansible_xe_switch2 }}" # optional, Device on the Destination fabric register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' - name: Query Links - with Src & Dst Fabric, Src & Dst Intf, Src & Dst Device, Template - cisco.dcnm.dcnm_links: + cisco.dcnm.dcnm_links: state: query # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: @@ -188,28 +196,30 @@ src_device: "{{ ansible_xe_switch1 }}" # optional, Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # optional, Device on the Destination fabric template: ios_xe_int_intra_fabric_num_link # optional, template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: '(result["response"] | length) >= 1' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - name: Cleanup - Delete Links + - name: Cleanup - Delete Links cisco.dcnm.dcnm_links: *links_delete register: result when: IT_CONTEXT is not defined - - assert: + - name: ASSERT - Cleanup response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_replace.yaml b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_replace.yaml index 61dfb6fa6..04e2e6b56 100644 --- a/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_replace.yaml +++ b/tests/integration/targets/dcnm_links/tests/dcnm/xe-test-cases/dcnm_links_intra_xe_replace.yaml @@ -2,18 +2,18 @@ ## SETUP ## ############################################## -- name: Remove local log file - local_action: command rm -f dcnm_links.log +- name: XE REPLACE - Remove local log file + local_action: command rm - f dcnm_links.log - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## BASELINE DELETE ## + ############################################## - - name: Initial setup - Delete Links + - name: XE REPLACE - Baseline delete cisco.dcnm.dcnm_links: &links_delete - state: deleted # choose from [merged, replaced, deleted, query] + state: deleted src_fabric: "{{ ansible_xe_fabric }}" config: - dst_fabric: "{{ ansible_xe_fabric }}" # Destination fabric @@ -48,17 +48,18 @@ register: result - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Create Links - cisco.dcnm.dcnm_links: + - name: Create Links + cisco.dcnm.dcnm_links: state: merged # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" config: @@ -67,11 +68,11 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.169.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.169.2.2 # IPV4 address of the Destination interface @@ -91,7 +92,8 @@ register: result - - assert: + - name: ASSERT - diff + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -100,16 +102,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - - name: Replace Links + - name: Replace Links cisco.dcnm.dcnm_links: &links_replace state: replaced # choose from [merged, replaced, deleted, query] src_fabric: "{{ ansible_xe_fabric }}" @@ -119,11 +122,11 @@ dst_interface: "{{ intf_1_3 }}" # Interface on the Destination fabric src_device: "{{ ansible_xe_switch1 }}" # Device on the Source fabric dst_device: "{{ ansible_xe_switch2 }}" # Device on the Destination fabric - template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from - # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, - # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, - # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] - + template: ios_xe_int_intra_fabric_num_link # template to be applied, choose from + # [ int_intra_fabric_ipv6_link_local, int_intra_fabric_num_link, + # int_intra_fabric_unnum_link, int_intra_vpc_peer_keep_alive_link, + # int_pre_provision_intra_fabric_link, ios_xe_int_intra_fabric_num_link ] + profile: peer1_ipv4_addr: 192.170.2.1 # IPV4 address of the Source interface peer2_ipv4_addr: 192.170.2.2 # IPV4 address of the Destination interface @@ -143,7 +146,8 @@ register: result - - assert: + - name: ASSERT - diff + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -152,20 +156,22 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Repalce Links - Idempotence cisco.dcnm.dcnm_links: *links_replace register: result - - assert: + - name: ASSERT - diff + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -174,24 +180,24 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"][0][ "{{ ansible_xe_fabric }}" ] | length) == 2' - - assert: + - name: ASSERT - response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################### -### CLEANUP ## -############################################### + ############################################### + ### CLEANUP ## + ############################################### always: - - - name: Cleanup - Delete Links + - name: XE REPLACE - Cleanup delete link cisco.dcnm.dcnm_links: *links_delete - register: result - when: IT_CONTEXT is not defined - - - assert: - that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + register: cleanup_result + when: it_context is not defined + + - name: ASSERT - Cleanup RETURN_CODE + ansible.builtin.assert: + that: "item['RETURN_CODE'] == 200" + loop: "{{ cleanup_result.response | default([]) }}" + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_log/defaults/main.yaml b/tests/integration/targets/dcnm_log/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_log/defaults/main.yaml +++ b/tests/integration/targets/dcnm_log/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_log/meta/main.yaml b/tests/integration/targets/dcnm_log/meta/main.yaml index 5514b6a40..32cf5dda7 100644 --- a/tests/integration/targets/dcnm_log/meta/main.yaml +++ b/tests/integration/targets/dcnm_log/meta/main.yaml @@ -1 +1 @@ -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/tests/integration/targets/dcnm_log/tasks/dcnm.yaml b/tests/integration/targets/dcnm_log/tasks/dcnm.yaml index c42460d6c..5ba7e2ae1 100644 --- a/tests/integration/targets/dcnm_log/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_log/tasks/dcnm.yaml @@ -1,31 +1,33 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: ["{{ role_path }}/tests/dcnm"] patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity - name: Debug test_items - debug: - var: test_items + ansible.builtin.debug: + var: test_items - name: Debug tesetcase - debug: - var: testcase + ansible.builtin.debug: + var: testcase -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_log/tasks/main.yaml b/tests/integration/targets/dcnm_log/tasks/main.yaml index 2b42141e5..2ade0125f 100644 --- a/tests/integration/targets/dcnm_log/tasks/main.yaml +++ b/tests/integration/targets/dcnm_log/tasks/main.yaml @@ -2,4 +2,4 @@ - name: Import Role Tasks ansible.builtin.import_tasks: dcnm.yaml - tags: ['dcnm'] \ No newline at end of file + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_log/tests/dcnm/test_logging.yaml b/tests/integration/targets/dcnm_log/tests/dcnm/test_logging.yaml index 7b8c2f349..44f886571 100644 --- a/tests/integration/targets/dcnm_log/tests/dcnm/test_logging.yaml +++ b/tests/integration/targets/dcnm_log/tests/dcnm/test_logging.yaml @@ -9,7 +9,7 @@ # # The environment variable NDFC_LOGGING_CONFIG must be set. # The value is an absolute path to the logging config file. -# +# # Example: # # export NDFC_LOGGING_CONFIG=$HOME/repos/ansible/collections/ansible_collections/cisco/dcnm/plugins/module_utils/common/logging_config.json @@ -27,9 +27,10 @@ ansible.builtin.debug: var: ndfc_logging_config -- assert: +- name: Assert + ansible.builtin.assert: that: - - ndfc_logging_config != "" + - ndfc_logging_config != "" ############################################## ## TESTS ## @@ -45,13 +46,14 @@ ansible.builtin.debug: var: result_1 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_1.changed == false' - - 'result_1.failed == false' + - 'result_1.changed == false' + - 'result_1.failed == false' -- name: TEST.2 - Verify ERROR severity. + - name: TEST.2 - Verify ERROR severity. cisco.dcnm.dcnm_log: msg: Testing ERROR severity severity: ERROR @@ -61,12 +63,13 @@ ansible.builtin.debug: var: result_2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2.changed == false' - - 'result_2.failed == false' + - 'result_2.changed == false' + - 'result_2.failed == false' -- name: TEST.3 - Verify INFO severity. + - name: TEST.3 - Verify INFO severity. cisco.dcnm.dcnm_log: msg: Testing INFO severity severity: INFO @@ -76,12 +79,13 @@ ansible.builtin.debug: var: result_3 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_3.changed == false' - - 'result_3.failed == false' + - 'result_3.changed == false' + - 'result_3.failed == false' -- name: TEST.4 - Verify WARNING severity. + - name: TEST.4 - Verify WARNING severity. cisco.dcnm.dcnm_log: msg: Testing WARNING severity severity: WARNING @@ -91,12 +95,13 @@ ansible.builtin.debug: var: result_4 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_4.changed == false' - - 'result_4.failed == false' + - 'result_4.changed == false' + - 'result_4.failed == false' -- name: TEST.5 - Verify missing severity uses default (DEBUG). + - name: TEST.5 - Verify missing severity uses default (DEBUG). cisco.dcnm.dcnm_log: msg: Testing missing severity register: result_5 @@ -106,12 +111,13 @@ ansible.builtin.debug: var: result_5 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_5.changed == false' - - 'result_5.failed == false' + - 'result_5.changed == false' + - 'result_5.failed == false' -- name: TEST.6 - Negative. Verify invalid severity (FOO). + - name: TEST.6 - Negative. Verify invalid severity (FOO). cisco.dcnm.dcnm_log: msg: Testing FOO severity severity: FOO @@ -122,16 +128,18 @@ ansible.builtin.debug: var: result_6 -- set_fact: +- name: Set fact + ansible.builtin.set_fact: error_message: value of severity must be one of -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_6.changed == false' - - 'result_6.failed == true' - - error_message in result_6.msg + - 'result_6.changed == false' + - 'result_6.failed == true' + - error_message in result_6.msg -- name: TEST.7 - Negative. Missing msg. + - name: TEST.7 - Negative. Missing msg. cisco.dcnm.dcnm_log: severity: DEBUG register: result_7 @@ -141,11 +149,13 @@ ansible.builtin.debug: var: result_7 -- set_fact: +- name: Set fact + ansible.builtin.set_fact: error_message: missing required arguments -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_7.changed == false' - - 'result_7.failed == true' - - error_message in result_7.msg + - 'result_7.changed == false' + - 'result_7.failed == true' + - error_message in result_7.msg diff --git a/tests/integration/targets/dcnm_maintenance_mode/defaults/main.yaml b/tests/integration/targets/dcnm_maintenance_mode/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/defaults/main.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_maintenance_mode/tasks/dcnm.yaml b/tests/integration/targets/dcnm_maintenance_mode/tasks/dcnm.yaml index e419fc865..8b35d98d4 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_maintenance_mode/tasks/main.yaml b/tests/integration/targets/dcnm_maintenance_mode/tasks/main.yaml index fbcfa5803..2d33809f3 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tasks/main.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include_tasks: dcnm.yaml, tags: ['dcnm'] } +- name: Include dcnm.yaml + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_1x_rw.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_1x_rw.yaml index 6002bacb3..19962fbdc 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_1x_rw.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_1x_rw.yaml @@ -53,16 +53,19 @@ BGP_AS: "65535.65534" DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.failed == false -- assert: +- name: Assert response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' ################################################################################ # 00_SETUP - Merge leaf_1 and leaf_2 into fabric_1 ################################################################################ @@ -86,9 +89,11 @@ role: leaf preserve_config: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'result.failed == false' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_2x_rw.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_2x_rw.yaml index ebde6e6f6..fca617c35 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_2x_rw.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/00_setup_fabrics_2x_rw.yaml @@ -65,16 +65,19 @@ IS_READ_ONLY: false DEPLOY: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - result.failed == false -- assert: +- name: Assert response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' ################################################################################ # 00_SETUP - Add one leaf switch to fabric_1 ################################################################################ @@ -91,10 +94,12 @@ role: leaf preserve_config: false register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'result.failed == false' @@ -115,9 +120,11 @@ # preserve_config must be True for LAN_CLASSIC preserve_config: true register: result -- debug: +- name: Debug + ansible.builtin.debug: var: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'result.failed == false' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/01_merged_maintenance_mode_deploy_no_wait_switch_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/01_merged_maintenance_mode_deploy_no_wait_switch_level.yaml index 8f4510677..f15a3092c 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/01_merged_maintenance_mode_deploy_no_wait_switch_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/01_merged_maintenance_mode_deploy_no_wait_switch_level.yaml @@ -78,17 +78,17 @@ # ], - name: MERGED - SETUP - Ensure switch mode is normal cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 40 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" ################################################################################ # 2. MERGED - TEST - Change switch mode to maintenance (switch-level) @@ -97,22 +97,23 @@ ################################################################################ - name: MERGED - TEST - Change switch mode to maintenance (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: normal - switches: - - ip_address: "{{ leaf_1 }}" - deploy: true - mode: maintenance - wait_for_mode_change: false - - ip_address: "{{ leaf_2 }}" - deploy: true - mode: maintenance - wait_for_mode_change: false + state: merged + config: + - deploy: false + - mode: normal + - switches: + - ip_address: "{{ leaf_1 }}" + deploy: true + mode: maintenance + wait_for_mode_change: false + - ip_address: "{{ leaf_2 }}" + deploy: true + mode: maintenance + wait_for_mode_change: false register: result_maintenance_mode -- debug: - var: result_maintenance_mode +- name: Debug + ansible.builtin.debug: + var: result_maintenance_mode ################################################################################ # 7. MERGED - TEST - Verify switch mode is maintenance (switch-level) @@ -142,32 +143,33 @@ # ], - name: MERGED - TEST - Verify switch mode is maintenance (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" - - result.diff[2][leaf_2].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_2].mode == "maintenance" -- assert: - that: - - result_maintenance_mode.failed == false - - result_maintenance_mode.metadata[2].action == "change_sytem_mode" - - result_maintenance_mode.metadata[3].action == "change_sytem_mode" - - result_maintenance_mode.metadata[2].check_mode == False - - result_maintenance_mode.metadata[3].check_mode == False - - result_maintenance_mode.metadata[2].state == "merged" - - result_maintenance_mode.metadata[3].state == "merged" - - result_maintenance_mode.response[2].DATA.status == "Success" - - result_maintenance_mode.response[3].DATA.status == "Success" - - result_maintenance_mode.response[2].METHOD == "POST" - - result_maintenance_mode.response[3].METHOD == "POST" - - result_maintenance_mode.response[2].RETURN_CODE == 200 - - result_maintenance_mode.response[3].RETURN_CODE == 200 - - result_maintenance_mode.response[4].DATA.status is match 'Success' - - result_maintenance_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_maintenance_mode.failed == false + - result_maintenance_mode.metadata[2].action == "change_sytem_mode" + - result_maintenance_mode.metadata[3].action == "change_sytem_mode" + - result_maintenance_mode.metadata[2].check_mode == False + - result_maintenance_mode.metadata[3].check_mode == False + - result_maintenance_mode.metadata[2].state == "merged" + - result_maintenance_mode.metadata[3].state == "merged" + - result_maintenance_mode.response[2].DATA.status == "Success" + - result_maintenance_mode.response[3].DATA.status == "Success" + - result_maintenance_mode.response[2].METHOD == "POST" + - result_maintenance_mode.response[3].METHOD == "POST" + - result_maintenance_mode.response[2].RETURN_CODE == 200 + - result_maintenance_mode.response[3].RETURN_CODE == 200 + - result_maintenance_mode.response[4].DATA.status is match 'Success' + - result_maintenance_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/02_merged_normal_mode_deploy_no_wait_switch_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/02_merged_normal_mode_deploy_no_wait_switch_level.yaml index a1899e21f..bc57cdccb 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/02_merged_normal_mode_deploy_no_wait_switch_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/02_merged_normal_mode_deploy_no_wait_switch_level.yaml @@ -78,17 +78,17 @@ # ], - name: MERGED - SETUP - Ensure switch mode is maintenance cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" - - result.diff[2][leaf_2].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_2].mode == "maintenance" ################################################################################ # 2. MERGED - TEST - Change switch mode to normal (switch-level) @@ -97,22 +97,23 @@ ################################################################################ - name: MERGED - TEST - Change switch mode to normal (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: maintenance - switches: - - ip_address: "{{ leaf_1 }}" - deploy: true - mode: normal - wait_for_mode_change: false - - ip_address: "{{ leaf_2 }}" - deploy: true - mode: normal - wait_for_mode_change: false + state: merged + config: + - deploy: false + mode: maintenance + switches: + - ip_address: "{{ leaf_1 }}" + deploy: true + mode: normal + wait_for_mode_change: false + - ip_address: "{{ leaf_2 }}" + deploy: true + mode: normal + wait_for_mode_change: false register: result_normal_mode -- debug: - var: result_normal_mode +- name: Debug + ansible.builtin.debug: + var: result_normal_mode ################################################################################ # 3. MERGED - TEST - Verify switch mode is normal (switch-level) @@ -142,32 +143,33 @@ # ], - name: MERGED - TEST - Verify switch mode is normal (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" -- assert: - that: - - result_normal_mode.failed == false - - result_normal_mode.metadata[2].action == "change_sytem_mode" - - result_normal_mode.metadata[3].action == "change_sytem_mode" - - result_normal_mode.metadata[2].check_mode == False - - result_normal_mode.metadata[3].check_mode == False - - result_normal_mode.metadata[2].state == "merged" - - result_normal_mode.metadata[3].state == "merged" - - result_normal_mode.response[2].DATA.status == "Success" - - result_normal_mode.response[3].DATA.status == "Success" - - result_normal_mode.response[2].METHOD == "DELETE" - - result_normal_mode.response[3].METHOD == "DELETE" - - result_normal_mode.response[2].RETURN_CODE == 200 - - result_normal_mode.response[3].RETURN_CODE == 200 - - result_normal_mode.response[4].DATA.status is match 'Success' - - result_normal_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_normal_mode.failed == false + - result_normal_mode.metadata[2].action == "change_sytem_mode" + - result_normal_mode.metadata[3].action == "change_sytem_mode" + - result_normal_mode.metadata[2].check_mode == False + - result_normal_mode.metadata[3].check_mode == False + - result_normal_mode.metadata[2].state == "merged" + - result_normal_mode.metadata[3].state == "merged" + - result_normal_mode.response[2].DATA.status == "Success" + - result_normal_mode.response[3].DATA.status == "Success" + - result_normal_mode.response[2].METHOD == "DELETE" + - result_normal_mode.response[3].METHOD == "DELETE" + - result_normal_mode.response[2].RETURN_CODE == 200 + - result_normal_mode.response[3].RETURN_CODE == 200 + - result_normal_mode.response[4].DATA.status is match 'Success' + - result_normal_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/03_merged_maintenance_mode_deploy_no_wait_top_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/03_merged_maintenance_mode_deploy_no_wait_top_level.yaml index cf1991486..e5878e11f 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/03_merged_maintenance_mode_deploy_no_wait_top_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/03_merged_maintenance_mode_deploy_no_wait_top_level.yaml @@ -77,34 +77,35 @@ # ], - name: MERGED - SETUP - Ensure switch mode is normal cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" ################################################################################ # 2. MERGED - TEST - Change switch mode to maintenance (top-level) ################################################################################ - name: MERGED - TEST - Change switch mode to maintenance (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: true - mode: maintenance - wait_for_mode_change: false - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: merged + config: + deploy: true + mode: maintenance + wait_for_mode_change: false + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result_maintenance_mode -- debug: - var: result_maintenance_mode +- name: Debug + ansible.builtin.debug: + var: result_maintenance_mode ################################################################################ # 3. MERGED - TEST - Verify switch mode is maintenance (top-level) @@ -134,32 +135,33 @@ # ], - name: MERGED - TEST - Verify switch mode is maintenance (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" - - result.diff[2][leaf_2].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_2].mode == "maintenance" -- assert: - that: - - result_maintenance_mode.failed == false - - result_maintenance_mode.metadata[2].action == "change_sytem_mode" - - result_maintenance_mode.metadata[3].action == "change_sytem_mode" - - result_maintenance_mode.metadata[2].check_mode == False - - result_maintenance_mode.metadata[3].check_mode == False - - result_maintenance_mode.metadata[2].state == "merged" - - result_maintenance_mode.metadata[3].state == "merged" - - result_maintenance_mode.response[2].DATA.status == "Success" - - result_maintenance_mode.response[3].DATA.status == "Success" - - result_maintenance_mode.response[2].METHOD == "POST" - - result_maintenance_mode.response[3].METHOD == "POST" - - result_maintenance_mode.response[2].RETURN_CODE == 200 - - result_maintenance_mode.response[3].RETURN_CODE == 200 - - result_maintenance_mode.response[4].DATA.status is match 'Success' - - result_maintenance_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_maintenance_mode.failed == false + - result_maintenance_mode.metadata[2].action == "change_sytem_mode" + - result_maintenance_mode.metadata[3].action == "change_sytem_mode" + - result_maintenance_mode.metadata[2].check_mode == False + - result_maintenance_mode.metadata[3].check_mode == False + - result_maintenance_mode.metadata[2].state == "merged" + - result_maintenance_mode.metadata[3].state == "merged" + - result_maintenance_mode.response[2].DATA.status == "Success" + - result_maintenance_mode.response[3].DATA.status == "Success" + - result_maintenance_mode.response[2].METHOD == "POST" + - result_maintenance_mode.response[3].METHOD == "POST" + - result_maintenance_mode.response[2].RETURN_CODE == 200 + - result_maintenance_mode.response[3].RETURN_CODE == 200 + - result_maintenance_mode.response[4].DATA.status is match 'Success' + - result_maintenance_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/04_merged_normal_mode_deploy_no_wait_top_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/04_merged_normal_mode_deploy_no_wait_top_level.yaml index 3dcd1e0cd..85944dfe5 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/04_merged_normal_mode_deploy_no_wait_top_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/04_merged_normal_mode_deploy_no_wait_top_level.yaml @@ -76,37 +76,38 @@ # }, # "sequence_number": 3 # } -# ], - name: MERGED - SETUP - Ensure switch mode is maintenance cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 40 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" - - result.diff[2][leaf_2].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_2].mode == "maintenance" ################################################################################ # 2. MERGED - TEST - Change switch mode to normal (top-level) ################################################################################ - name: MERGED - TEST - Change switch mode to normal (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: true - mode: normal - wait_for_mode_change: false - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: merged + config: + deploy: true + mode: normal + wait_for_mode_change: false + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result_normal_mode -- debug: - var: result_normal_mode + +- name: Debug + ansible.builtin.debug: + var: result_normal_mode ################################################################################ # 3. MERGED - TEST - Verify switch mode is normal (top-level) @@ -132,36 +133,35 @@ # "mode": "normal", # }, # "sequence_number": 3 -# } -# ], - name: MERGED - TEST - Verify switch mode is normal (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" -- assert: - that: - - result_normal_mode.failed == false - - result_normal_mode.metadata[2].action == "change_sytem_mode" - - result_normal_mode.metadata[3].action == "change_sytem_mode" - - result_normal_mode.metadata[2].check_mode == False - - result_normal_mode.metadata[3].check_mode == False - - result_normal_mode.metadata[2].state == "merged" - - result_normal_mode.metadata[3].state == "merged" - - result_normal_mode.response[2].DATA.status == "Success" - - result_normal_mode.response[3].DATA.status == "Success" - - result_normal_mode.response[2].METHOD == "DELETE" - - result_normal_mode.response[3].METHOD == "DELETE" - - result_normal_mode.response[2].RETURN_CODE == 200 - - result_normal_mode.response[3].RETURN_CODE == 200 - - result_normal_mode.response[4].DATA.status is match 'Success' - - result_normal_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_normal_mode.failed == false + - result_normal_mode.metadata[2].action == "change_sytem_mode" + - result_normal_mode.metadata[3].action == "change_sytem_mode" + - result_normal_mode.metadata[2].check_mode == False + - result_normal_mode.metadata[3].check_mode == False + - result_normal_mode.metadata[2].state == "merged" + - result_normal_mode.metadata[3].state == "merged" + - result_normal_mode.response[2].DATA.status == "Success" + - result_normal_mode.response[3].DATA.status == "Success" + - result_normal_mode.response[2].METHOD == "DELETE" + - result_normal_mode.response[3].METHOD == "DELETE" + - result_normal_mode.response[2].RETURN_CODE == 200 + - result_normal_mode.response[3].RETURN_CODE == 200 + - result_normal_mode.response[4].DATA.status is match 'Success' + - result_normal_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/05_merged_maintenance_mode_deploy_wait_top_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/05_merged_maintenance_mode_deploy_wait_top_level.yaml index 17c541e4c..5fc2a90dc 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/05_merged_maintenance_mode_deploy_wait_top_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/05_merged_maintenance_mode_deploy_wait_top_level.yaml @@ -79,16 +79,16 @@ # ], - name: MERGED - SETUP - Ensure switch mode is normal cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" - result.diff[2][leaf_2].mode == "normal" ################################################################################ @@ -96,17 +96,18 @@ ################################################################################ - name: MERGED - TEST - Change switch mode to maintenance (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: true - mode: maintenance - wait_for_mode_change: true - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: merged + config: + deploy: true + mode: maintenance + wait_for_mode_change: true + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result_maintenance_mode -- debug: - var: result_maintenance_mode +- name: Debug + ansible.builtin.debug: + var: result_maintenance_mode ################################################################################ # 3. MERGED - TEST - Verify switch mode is maintenance (top-level) @@ -136,32 +137,33 @@ # ], - name: MERGED - TEST - Verify switch mode is maintenance (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" - result.diff[2][leaf_2].mode == "maintenance" -- assert: - that: - - result_maintenance_mode.failed == false - - result_maintenance_mode.metadata[2].action == "change_sytem_mode" - - result_maintenance_mode.metadata[3].action == "change_sytem_mode" - - result_maintenance_mode.metadata[2].check_mode == False - - result_maintenance_mode.metadata[3].check_mode == False - - result_maintenance_mode.metadata[2].state == "merged" - - result_maintenance_mode.metadata[3].state == "merged" - - result_maintenance_mode.response[2].DATA.status == "Success" - - result_maintenance_mode.response[3].DATA.status == "Success" - - result_maintenance_mode.response[2].METHOD == "POST" - - result_maintenance_mode.response[3].METHOD == "POST" - - result_maintenance_mode.response[2].RETURN_CODE == 200 - - result_maintenance_mode.response[3].RETURN_CODE == 200 - - result_maintenance_mode.response[4].DATA.status is match 'Success' - - result_maintenance_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_maintenance_mode.failed == false + - result_maintenance_mode.metadata[2].action == "change_sytem_mode" + - result_maintenance_mode.metadata[3].action == "change_sytem_mode" + - result_maintenance_mode.metadata[2].check_mode == False + - result_maintenance_mode.metadata[3].check_mode == False + - result_maintenance_mode.metadata[2].state == "merged" + - result_maintenance_mode.metadata[3].state == "merged" + - result_maintenance_mode.response[2].DATA.status == "Success" + - result_maintenance_mode.response[3].DATA.status == "Success" + - result_maintenance_mode.response[2].METHOD == "POST" + - result_maintenance_mode.response[3].METHOD == "POST" + - result_maintenance_mode.response[2].RETURN_CODE == 200 + - result_maintenance_mode.response[3].RETURN_CODE == 200 + - result_maintenance_mode.response[4].DATA.status is match 'Success' + - result_maintenance_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/06_merged_normal_mode_deploy_wait_top_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/06_merged_normal_mode_deploy_wait_top_level.yaml index d458bfa11..02973d1aa 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/06_merged_normal_mode_deploy_wait_top_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/06_merged_normal_mode_deploy_wait_top_level.yaml @@ -79,16 +79,16 @@ # ], - name: MERGED - SETUP - Ensure switch mode is maintenance cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 40 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" - result.diff[2][leaf_2].mode == "maintenance" ################################################################################ @@ -96,17 +96,18 @@ ################################################################################ - name: MERGED - TEST - Change switch mode to normal (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: true - mode: normal - wait_for_mode_change: true - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: merged + config: + deploy: true + mode: normal + wait_for_mode_change: true + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result_normal_mode -- debug: - var: result_normal_mode +- name: Debug + ansible.builtin.debug: + var: result_normal_mode ################################################################################ @@ -137,32 +138,33 @@ # ], - name: MERGED - TEST - Verify switch mode is normal (top-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" - result.diff[2][leaf_2].mode == "normal" -- assert: - that: - - result_normal_mode.failed == false - - result_normal_mode.metadata[2].action == "change_sytem_mode" - - result_normal_mode.metadata[3].action == "change_sytem_mode" - - result_normal_mode.metadata[2].check_mode == False - - result_normal_mode.metadata[3].check_mode == False - - result_normal_mode.metadata[2].state == "merged" - - result_normal_mode.metadata[3].state == "merged" - - result_normal_mode.response[2].DATA.status == "Success" - - result_normal_mode.response[3].DATA.status == "Success" - - result_normal_mode.response[2].METHOD == "DELETE" - - result_normal_mode.response[3].METHOD == "DELETE" - - result_normal_mode.response[2].RETURN_CODE == 200 - - result_normal_mode.response[3].RETURN_CODE == 200 - - result_normal_mode.response[4].DATA.status is match 'Success' - - result_normal_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_normal_mode.failed == false + - result_normal_mode.metadata[2].action == "change_sytem_mode" + - result_normal_mode.metadata[3].action == "change_sytem_mode" + - result_normal_mode.metadata[2].check_mode == False + - result_normal_mode.metadata[3].check_mode == False + - result_normal_mode.metadata[2].state == "merged" + - result_normal_mode.metadata[3].state == "merged" + - result_normal_mode.response[2].DATA.status == "Success" + - result_normal_mode.response[3].DATA.status == "Success" + - result_normal_mode.response[2].METHOD == "DELETE" + - result_normal_mode.response[3].METHOD == "DELETE" + - result_normal_mode.response[2].RETURN_CODE == 200 + - result_normal_mode.response[3].RETURN_CODE == 200 + - result_normal_mode.response[4].DATA.status is match 'Success' + - result_normal_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/07_merged_maintenance_mode_deploy_wait_switch_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/07_merged_maintenance_mode_deploy_wait_switch_level.yaml index 34fafe960..2b03d6d86 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/07_merged_maintenance_mode_deploy_wait_switch_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/07_merged_maintenance_mode_deploy_wait_switch_level.yaml @@ -78,17 +78,17 @@ # ], - name: MERGED - SETUP - Ensure switch mode is normal cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" ################################################################################ # 2. MERGED - TEST - Change switch mode to maintenance (switch-level) @@ -97,22 +97,23 @@ ################################################################################ - name: MERGED - TEST - Change switch mode to maintenance (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: normal - switches: - - ip_address: "{{ leaf_1 }}" - deploy: true - mode: maintenance - wait_for_mode_change: true - - ip_address: "{{ leaf_2 }}" - deploy: true - mode: maintenance - wait_for_mode_change: true + state: merged + config: + deploy: false + mode: normal + switches: + - ip_address: "{{ leaf_1 }}" + deploy: true + mode: maintenance + wait_for_mode_change: true + - ip_address: "{{ leaf_2 }}" + deploy: true + mode: maintenance + wait_for_mode_change: true register: result_maintenance_mode -- debug: - var: result_maintenance_mode +- name: Debug + ansible.builtin.debug: + var: result_maintenance_mode ################################################################################ # 7. MERGED - TEST - Verify switch mode is maintenance (switch-level) @@ -142,32 +143,33 @@ # ], - name: MERGED - TEST - Verify switch mode is maintenance (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" - - result.diff[2][leaf_2].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_2].mode == "maintenance" -- assert: - that: - - result_maintenance_mode.failed == false - - result_maintenance_mode.metadata[2].action == "change_sytem_mode" - - result_maintenance_mode.metadata[3].action == "change_sytem_mode" - - result_maintenance_mode.metadata[2].check_mode == False - - result_maintenance_mode.metadata[3].check_mode == False - - result_maintenance_mode.metadata[2].state == "merged" - - result_maintenance_mode.metadata[3].state == "merged" - - result_maintenance_mode.response[2].DATA.status == "Success" - - result_maintenance_mode.response[3].DATA.status == "Success" - - result_maintenance_mode.response[2].METHOD == "POST" - - result_maintenance_mode.response[3].METHOD == "POST" - - result_maintenance_mode.response[2].RETURN_CODE == 200 - - result_maintenance_mode.response[3].RETURN_CODE == 200 - - result_maintenance_mode.response[4].DATA.status is match 'Success' - - result_maintenance_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_maintenance_mode.failed == false + - result_maintenance_mode.metadata[2].action == "change_sytem_mode" + - result_maintenance_mode.metadata[3].action == "change_sytem_mode" + - result_maintenance_mode.metadata[2].check_mode == False + - result_maintenance_mode.metadata[3].check_mode == False + - result_maintenance_mode.metadata[2].state == "merged" + - result_maintenance_mode.metadata[3].state == "merged" + - result_maintenance_mode.response[2].DATA.status == "Success" + - result_maintenance_mode.response[3].DATA.status == "Success" + - result_maintenance_mode.response[2].METHOD == "POST" + - result_maintenance_mode.response[3].METHOD == "POST" + - result_maintenance_mode.response[2].RETURN_CODE == 200 + - result_maintenance_mode.response[3].RETURN_CODE == 200 + - result_maintenance_mode.response[4].DATA.status is match 'Success' + - result_maintenance_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/08_merged_normal_mode_deploy_wait_switch_level.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/08_merged_normal_mode_deploy_wait_switch_level.yaml index b72b3a388..3711df550 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/08_merged_normal_mode_deploy_wait_switch_level.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/08_merged_normal_mode_deploy_wait_switch_level.yaml @@ -78,17 +78,17 @@ # ], - name: MERGED - SETUP - Ensure switch mode is maintenance cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "maintenance" - - result.diff[2][leaf_2].mode == "maintenance" + - result.diff[2][leaf_1].mode == "maintenance" + - result.diff[2][leaf_2].mode == "maintenance" ################################################################################ # 2. MERGED - TEST - Change switch mode to normal (switch-level) @@ -97,23 +97,24 @@ ################################################################################ - name: MERGED - TEST - Change switch mode to normal (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: maintenance - wait_for_mode_change: false - switches: - - ip_address: "{{ leaf_1 }}" - deploy: true - mode: normal - wait_for_mode_change: true - - ip_address: "{{ leaf_2 }}" - deploy: true - mode: normal - wait_for_mode_change: true + state: merged + config: + deploy: false + mode: maintenance + wait_for_mode_change: false + switches: + - ip_address: "{{ leaf_1 }}" + deploy: true + mode: normal + wait_for_mode_change: true + - ip_address: "{{ leaf_2 }}" + deploy: true + mode: normal + wait_for_mode_change: true register: result_normal_mode -- debug: - var: result_normal_mode +- name: Debug + ansible.builtin.debug: + var: result_normal_mode ################################################################################ # 3. MERGED - TEST - Verify switch mode is normal (switch-level) @@ -143,32 +144,33 @@ # ], - name: MERGED - TEST - Verify switch mode is normal (switch-level) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" -- assert: - that: - - result_normal_mode.failed == false - - result_normal_mode.metadata[2].action == "change_sytem_mode" - - result_normal_mode.metadata[3].action == "change_sytem_mode" - - result_normal_mode.metadata[2].check_mode == False - - result_normal_mode.metadata[3].check_mode == False - - result_normal_mode.metadata[2].state == "merged" - - result_normal_mode.metadata[3].state == "merged" - - result_normal_mode.response[2].DATA.status == "Success" - - result_normal_mode.response[3].DATA.status == "Success" - - result_normal_mode.response[2].METHOD == "DELETE" - - result_normal_mode.response[3].METHOD == "DELETE" - - result_normal_mode.response[2].RETURN_CODE == 200 - - result_normal_mode.response[3].RETURN_CODE == 200 - - result_normal_mode.response[4].DATA.status is match 'Success' - - result_normal_mode.response[5].DATA.status is match 'Success' +- name: Assert + ansible.builtin.assert: + that: + - result_normal_mode.failed == false + - result_normal_mode.metadata[2].action == "change_sytem_mode" + - result_normal_mode.metadata[3].action == "change_sytem_mode" + - result_normal_mode.metadata[2].check_mode == False + - result_normal_mode.metadata[3].check_mode == False + - result_normal_mode.metadata[2].state == "merged" + - result_normal_mode.metadata[3].state == "merged" + - result_normal_mode.response[2].DATA.status == "Success" + - result_normal_mode.response[3].DATA.status == "Success" + - result_normal_mode.response[2].METHOD == "DELETE" + - result_normal_mode.response[3].METHOD == "DELETE" + - result_normal_mode.response[2].RETURN_CODE == 200 + - result_normal_mode.response[3].RETURN_CODE == 200 + - result_normal_mode.response[4].DATA.status is match 'Success' + - result_normal_mode.response[5].DATA.status is match 'Success' diff --git a/tests/integration/targets/dcnm_maintenance_mode/tests/09_merged_maintenance_mode_no_deploy.yaml b/tests/integration/targets/dcnm_maintenance_mode/tests/09_merged_maintenance_mode_no_deploy.yaml index c452e5f13..22fead9f8 100644 --- a/tests/integration/targets/dcnm_maintenance_mode/tests/09_merged_maintenance_mode_no_deploy.yaml +++ b/tests/integration/targets/dcnm_maintenance_mode/tests/09_merged_maintenance_mode_no_deploy.yaml @@ -87,33 +87,33 @@ # ], - name: MERGED - SETUP - ensure switches are in normal mode cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" ################################################################################ # 2. MERGED - TEST - Change switch mode to maintenance (global config) ################################################################################ - name: MERGED - TEST - Change switch mode to maintenance (global config) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: maintenance - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: merged + config: + deploy: false + mode: maintenance + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result_maintenance_mode - debug: - var: result_maintenance_mode + var: result_maintenance_mode ################################################################################ # 3. MERGED - TEST - Verify switch mode is inconsistent (global config) @@ -143,33 +143,33 @@ # ], - name: MERGED - TEST - Verify switch mode is inconsistent (global config) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "inconsistent" - - result.diff[2][leaf_2].mode == "inconsistent" + - result.diff[2][leaf_1].mode == "inconsistent" + - result.diff[2][leaf_2].mode == "inconsistent" ################################################################################ # 4. MERGED - TEST - Change switch mode to normal (global config) ################################################################################ - name: MERGED - TEST - Change switch mode to normal (global config) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: normal - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: merged + config: + deploy: false + mode: normal + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result_normal_mode - debug: - var: result_normal_mode + var: result_normal_mode ################################################################################ # 5. MERGED - TEST - Verify switch mode is normal (global config) @@ -199,69 +199,69 @@ # ], - name: MERGED - TEST - Verify switch mode is normal (global config) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" - debug: - var: result_maintenance_mode + var: result_maintenance_mode - debug: - var: result_normal_mode + var: result_normal_mode - assert: - that: - - result_maintenance_mode.failed == false - - result_maintenance_mode.metadata[2].action == "change_sytem_mode" - - result_maintenance_mode.metadata[3].action == "change_sytem_mode" - - result_maintenance_mode.metadata[2].check_mode == False - - result_maintenance_mode.metadata[3].check_mode == False - - result_maintenance_mode.metadata[2].state == "merged" - - result_maintenance_mode.metadata[3].state == "merged" - - result_maintenance_mode.response[2].DATA.status == "Success" - - result_maintenance_mode.response[3].DATA.status == "Success" - - result_maintenance_mode.response[2].METHOD == "POST" - - result_maintenance_mode.response[3].METHOD == "POST" - - result_maintenance_mode.response[2].RETURN_CODE == 200 - - result_maintenance_mode.response[3].RETURN_CODE == 200 - - result_normal_mode.failed == false - - result_normal_mode.metadata[2].action == "change_sytem_mode" - - result_normal_mode.metadata[3].action == "change_sytem_mode" - - result_normal_mode.metadata[2].check_mode == False - - result_normal_mode.metadata[3].check_mode == False - - result_normal_mode.metadata[2].state == "merged" - - result_normal_mode.metadata[3].state == "merged" - - result_normal_mode.response[2].DATA.status == "Success" - - result_normal_mode.response[3].DATA.status == "Success" - - result_normal_mode.response[2].METHOD == "DELETE" - - result_normal_mode.response[3].METHOD == "DELETE" - - result_normal_mode.response[2].RETURN_CODE == 200 - - result_normal_mode.response[3].RETURN_CODE == 200 + that: + - result_maintenance_mode.failed == false + - result_maintenance_mode.metadata[2].action == "change_sytem_mode" + - result_maintenance_mode.metadata[3].action == "change_sytem_mode" + - result_maintenance_mode.metadata[2].check_mode == False + - result_maintenance_mode.metadata[3].check_mode == False + - result_maintenance_mode.metadata[2].state == "merged" + - result_maintenance_mode.metadata[3].state == "merged" + - result_maintenance_mode.response[2].DATA.status == "Success" + - result_maintenance_mode.response[3].DATA.status == "Success" + - result_maintenance_mode.response[2].METHOD == "POST" + - result_maintenance_mode.response[3].METHOD == "POST" + - result_maintenance_mode.response[2].RETURN_CODE == 200 + - result_maintenance_mode.response[3].RETURN_CODE == 200 + - result_normal_mode.failed == false + - result_normal_mode.metadata[2].action == "change_sytem_mode" + - result_normal_mode.metadata[3].action == "change_sytem_mode" + - result_normal_mode.metadata[2].check_mode == False + - result_normal_mode.metadata[3].check_mode == False + - result_normal_mode.metadata[2].state == "merged" + - result_normal_mode.metadata[3].state == "merged" + - result_normal_mode.response[2].DATA.status == "Success" + - result_normal_mode.response[3].DATA.status == "Success" + - result_normal_mode.response[2].METHOD == "DELETE" + - result_normal_mode.response[3].METHOD == "DELETE" + - result_normal_mode.response[2].RETURN_CODE == 200 + - result_normal_mode.response[3].RETURN_CODE == 200 ################################################################################ # 6. MERGED - TEST - Change switch mode to maintenance (switch config) ################################################################################ - name: MERGED - TEST - Change switch mode to maintenance (switch config) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - switches: - - ip_address: "{{ leaf_1 }}" - mode: maintenance - - ip_address: "{{ leaf_2 }}" - mode: maintenance + state: merged + config: + deploy: false + switches: + - ip_address: "{{ leaf_1 }}" + mode: maintenance + - ip_address: "{{ leaf_2 }}" + mode: maintenance register: result_maintenance_mode - debug: - var: result_maintenance_mode + var: result_maintenance_mode ################################################################################ # 7. MERGED - TEST - Verify switch mode is inconsistent (switch config) @@ -291,35 +291,35 @@ # ], - name: MERGED - TEST - Verify switch mode is inconsistent (switch config) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "inconsistent" - - result.diff[2][leaf_2].mode == "inconsistent" + - result.diff[2][leaf_1].mode == "inconsistent" + - result.diff[2][leaf_2].mode == "inconsistent" ################################################################################ # 8. MERGED - TEST - Change switch mode to normal (switch config) ################################################################################ - name: MERGED - TEST - Change switch mode to normal (switch config) cisco.dcnm.dcnm_maintenance_mode: - state: merged - config: - deploy: false - mode: normal - switches: - - ip_address: "{{ leaf_1 }}" - mode: normal - - ip_address: "{{ leaf_2 }}" - mode: normal + state: merged + config: + deploy: false + mode: normal + switches: + - ip_address: "{{ leaf_1 }}" + mode: normal + - ip_address: "{{ leaf_2 }}" + mode: normal register: result_normal_mode - debug: - var: result_normal_mode + var: result_normal_mode ################################################################################ # 9. MERGED - TEST - Verify switch mode is normal (switch config) @@ -349,49 +349,49 @@ # ], - name: MERGED - TEST - Verify switch mode is normal (switch config) cisco.dcnm.dcnm_maintenance_mode: - state: query - config: - switches: - - ip_address: "{{ leaf_1 }}" - - ip_address: "{{ leaf_2 }}" + state: query + config: + switches: + - ip_address: "{{ leaf_1 }}" + - ip_address: "{{ leaf_2 }}" register: result retries: 60 delay: 10 until: - - result.diff[2][leaf_1].mode == "normal" - - result.diff[2][leaf_2].mode == "normal" + - result.diff[2][leaf_1].mode == "normal" + - result.diff[2][leaf_2].mode == "normal" - debug: - var: result_maintenance_mode + var: result_maintenance_mode - debug: - var: result_normal_mode + var: result_normal_mode - assert: - that: - - result_maintenance_mode.failed == false - - result_maintenance_mode.metadata[2].action == "change_sytem_mode" - - result_maintenance_mode.metadata[3].action == "change_sytem_mode" - - result_maintenance_mode.metadata[2].check_mode == False - - result_maintenance_mode.metadata[3].check_mode == False - - result_maintenance_mode.metadata[2].state == "merged" - - result_maintenance_mode.metadata[3].state == "merged" - - result_maintenance_mode.response[2].DATA.status == "Success" - - result_maintenance_mode.response[3].DATA.status == "Success" - - result_maintenance_mode.response[2].METHOD == "POST" - - result_maintenance_mode.response[3].METHOD == "POST" - - result_maintenance_mode.response[2].RETURN_CODE == 200 - - result_maintenance_mode.response[3].RETURN_CODE == 200 - - result_normal_mode.failed == false - - result_normal_mode.metadata[2].action == "change_sytem_mode" - - result_normal_mode.metadata[3].action == "change_sytem_mode" - - result_normal_mode.metadata[2].check_mode == False - - result_normal_mode.metadata[3].check_mode == False - - result_normal_mode.metadata[2].state == "merged" - - result_normal_mode.metadata[3].state == "merged" - - result_normal_mode.response[2].DATA.status == "Success" - - result_normal_mode.response[3].DATA.status == "Success" - - result_normal_mode.response[2].METHOD == "DELETE" - - result_normal_mode.response[3].METHOD == "DELETE" - - result_normal_mode.response[2].RETURN_CODE == 200 - - result_normal_mode.response[3].RETURN_CODE == 200 + that: + - result_maintenance_mode.failed == false + - result_maintenance_mode.metadata[2].action == "change_sytem_mode" + - result_maintenance_mode.metadata[3].action == "change_sytem_mode" + - result_maintenance_mode.metadata[2].check_mode == False + - result_maintenance_mode.metadata[3].check_mode == False + - result_maintenance_mode.metadata[2].state == "merged" + - result_maintenance_mode.metadata[3].state == "merged" + - result_maintenance_mode.response[2].DATA.status == "Success" + - result_maintenance_mode.response[3].DATA.status == "Success" + - result_maintenance_mode.response[2].METHOD == "POST" + - result_maintenance_mode.response[3].METHOD == "POST" + - result_maintenance_mode.response[2].RETURN_CODE == 200 + - result_maintenance_mode.response[3].RETURN_CODE == 200 + - result_normal_mode.failed == false + - result_normal_mode.metadata[2].action == "change_sytem_mode" + - result_normal_mode.metadata[3].action == "change_sytem_mode" + - result_normal_mode.metadata[2].check_mode == False + - result_normal_mode.metadata[3].check_mode == False + - result_normal_mode.metadata[2].state == "merged" + - result_normal_mode.metadata[3].state == "merged" + - result_normal_mode.response[2].DATA.status == "Success" + - result_normal_mode.response[3].DATA.status == "Success" + - result_normal_mode.response[2].METHOD == "DELETE" + - result_normal_mode.response[3].METHOD == "DELETE" + - result_normal_mode.response[2].RETURN_CODE == 200 + - result_normal_mode.response[3].RETURN_CODE == 200 diff --git a/tests/integration/targets/dcnm_network/defaults/main.yaml b/tests/integration/targets/dcnm_network/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_network/defaults/main.yaml +++ b/tests/integration/targets/dcnm_network/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_network/meta/main.yaml b/tests/integration/targets/dcnm_network/meta/main.yaml index 5514b6a40..32cf5dda7 100644 --- a/tests/integration/targets/dcnm_network/meta/main.yaml +++ b/tests/integration/targets/dcnm_network/meta/main.yaml @@ -1 +1 @@ -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/tests/integration/targets/dcnm_network/tasks/main.yaml b/tests/integration/targets/dcnm_network/tasks/main.yaml index c406aacec..861fa66d8 100644 --- a/tests/integration/targets/dcnm_network/tasks/main.yaml +++ b/tests/integration/targets/dcnm_network/tasks/main.yaml @@ -2,12 +2,12 @@ - name: MAIN - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_setup: - #---------------------------------- + # ---------------------------------- # config template for vrf setup - #---------------------------------- - vrf_conf_template: "dcnm_network_setup_vrf_conf.j2" + # ---------------------------------- + vrf_conf_template: "dcnm_network_setup_vrf_conf.j2" vrf_conf_file: "{{ role_path }}/files/dcnm_network_setup_vrf_conf.yaml" - #---------------------------------- + # ---------------------------------- delegate_to: localhost tags: always @@ -20,7 +20,7 @@ tags: always - name: MAIN - ASSERT - Fabric Found - assert: + ansible.builtin.assert: that: - result.result[0].found == true fail_msg: "Fabric '{{ test_data_common.fabric }}' not found." @@ -30,6 +30,7 @@ ansible.builtin.template: src: "{{ test_data_setup.vrf_conf_template }}" dest: "{{ test_data_setup.vrf_conf_file }}" + mode: "0644" delegate_to: localhost tags: always @@ -47,7 +48,7 @@ tags: always - name: MAIN - Collect DCNM Network Test Cases - find: + ansible.builtin.find: paths: ["{{ role_path }}/tests/dcnm", "{{ role_path }}/tests/dcnm/self-contained-tests"] patterns: "{{ testcase }}.yaml" connection: local @@ -56,19 +57,20 @@ tags: always - name: MAIN - Set Test Cases Fact - set_fact: + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" delegate_to: localhost tags: always - name: MAIN - Build List of Test Items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" delegate_to: localhost tags: always - name: MAIN - Run Test Cases - include_tasks: "{{ test_case_to_run }}" + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml index d296f6497..ff7fd7258 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/deleted.yaml @@ -16,9 +16,9 @@ - name: DELETED - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_deleted: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # COMMON - Create, Attach and Deploy Single Network with multiple switch Attach net1_conf_template: "deleted/dcnm_network_deleted_net1_conf.j2" net1_conf_file: "{{ role_path }}/files/dcnm_network_deleted_net1_conf.yaml" @@ -102,9 +102,9 @@ tags: deleted - name: DELETED - TC1 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC1 - QUERY - Get network state in NDFC @@ -132,9 +132,9 @@ tags: deleted - name: DELETED - TC1 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC1 - QUERY - Get network state in NDFC @@ -159,9 +159,9 @@ tags: deleted - name: DELETED - TC1 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: deleted # TC2 @@ -186,9 +186,9 @@ tags: deleted - name: DELETED - TC2 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC2 - QUERY - Get network state in NDFC @@ -215,9 +215,9 @@ tags: deleted - name: DELETED - TC2 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC2 - QUERY - Get network state in NDFC @@ -250,9 +250,9 @@ tags: deleted - name: DELETED - TC2 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: deleted - name: DELETED - TC2 - Delete the other Single Network with deleted state @@ -264,9 +264,9 @@ tags: deleted - name: DELETED - TC2 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC2 - QUERY - Get network state in NDFC @@ -291,9 +291,9 @@ tags: deleted - name: DELETED - TC2 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: deleted # TC3 @@ -327,9 +327,9 @@ tags: deleted - name: DELETED - TC3 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC3 - QUERY - Get network state in NDFC @@ -353,9 +353,9 @@ tags: deleted - name: DELETED - TC3 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: deleted @@ -376,9 +376,9 @@ tags: deleted - name: DELETED - TC4 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC4 - QUERY - Get network state in NDFC @@ -405,9 +405,9 @@ tags: deleted - name: DELETED - TC4 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC4 - QUERY - Get network state in NDFC @@ -432,9 +432,9 @@ tags: deleted - name: DELETED - TC4 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: deleted # TC5 @@ -453,9 +453,9 @@ tags: deleted - name: DELETED - TC5 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC5 - QUERY - Get network state in NDFC @@ -481,9 +481,9 @@ tags: deleted - name: DELETED - conf5 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: deleted - name: DELETED - TC5 - QUERY - Get network state in NDFC @@ -508,9 +508,9 @@ tags: deleted - name: DELETED - TC5 - conf5 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: deleted # TC6 - invalid configs @@ -519,21 +519,21 @@ fabric: "{{ test_data_common.fabric }}" state: deleted config: - - net_name: - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' + - net_name: "" + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' register: result - ignore_errors: yes + ignore_errors: true tags: deleted - name: DELETED - TC6 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: net_name : Required parameter not found" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: net_name : Required parameter not found" in result.msg' + - result.changed == false tags: deleted - name: DELETED - TC6 - Delete Single Network with invalid network name which is not configured @@ -541,21 +541,21 @@ fabric: "{{ test_data_common.fabric }}" state: deleted config: - - net_name: invalid-name - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' + - net_name: invalid-name + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' register: result - ignore_errors: yes + ignore_errors: true tags: deleted - name: DELETED - TC6 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false - - result.response|length == 0 + - result.changed == false + - result.response|length == 0 tags: deleted ############################################### diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml index 8d320efe2..932882c00 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/merged.yaml @@ -17,25 +17,25 @@ ansible.builtin.set_fact: # some cases are for a specific deploy state deploy_local: false - + test_data_merged: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- - # TC1 + # ---------------------------------- + # TC1 net1_no_attach_conf_template: "merged/dcnm_network_merged_net1_no_attach_conf.j2" # undeployed net1_no_attach_conf_file: "{{ role_path }}/files/dcnm_network_merged_net1_no_attach_conf.yaml" # deployed net1_no_attach_conf_deployed_file: "{{ role_path }}/files/dcnm_network_merged_net1_no_attach_conf_deployed.yaml" - #---------------------------------- + # ---------------------------------- # TC3 net1_conf_template: "merged/dcnm_network_merged_net1_conf.j2" # undeployed net1_conf_file: "{{ role_path }}/files/dcnm_network_merged_net1_conf.yaml" # deployed net1_conf_deployed_file: "{{ role_path }}/files/dcnm_network_merged_net1_conf_deployed.yaml" - #---------------------------------- + # ---------------------------------- # TC5 double_net_conf_template: "merged/dcnm_network_merged_double_net_conf.j2" double_let_conf_file: "{{ role_path }}/files/dcnm_network_merged_double_net_conf.yaml" @@ -197,9 +197,9 @@ tags: merged - name: MERGED - TC1 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC1 - QUERY - Get network state in NDFC @@ -238,9 +238,9 @@ tags: merged - name: MERGED - TC2 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged # state does not change to DEPLOYED without attachment @@ -274,7 +274,7 @@ dcnm_network_net1_conf_deployed: "{{ lookup('file', '{{ test_data_merged.net1_conf_deployed_file }}') | from_yaml }}" delegate_to: localhost tags: merged - + - name: MERGED - TC3 - MERGED - Create New Network with Attach and global deploy cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" @@ -284,9 +284,9 @@ tags: merged - name: MERGED - TC3 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC3 - Query fabric state until networkStatus transitions to DEPLOYED state @@ -329,9 +329,9 @@ tags: merged - name: MERGED - TC4 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC4 - QUERY - Get network state in NDFC @@ -347,9 +347,9 @@ tags: merged - name: MERGED - TC4 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: merged # TC5 @@ -373,9 +373,9 @@ register: result - name: MERGED - TC5 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC5 - QUERY - Verify network state in NDFC @@ -398,9 +398,9 @@ tags: merged - name: MERGED - TC5 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: merged # TC6 @@ -425,9 +425,9 @@ tags: merged - name: MERGED - TC6 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC6 - QUERY - Verify network state in NDFC @@ -443,9 +443,9 @@ tags: merged - name: MERGED - TC6 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: merged # TC7 @@ -470,9 +470,9 @@ tags: merged - name: MERGED - TC7 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC7 - QUERY - Verify network state in NDFC @@ -497,9 +497,9 @@ tags: merged - name: MERGED - TC7 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: merged # TC8 @@ -524,9 +524,9 @@ tags: merged - name: MERGED - TC8 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC8 - QUERY - Verify network state in NDFC @@ -565,9 +565,9 @@ tags: merged - name: MERGED - TC9 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC9 - QUERY - Verify network state in NDFC @@ -590,13 +590,13 @@ tags: merged - name: MERGED - TC9 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: merged -# TC10 +# TC10 - name: MERGED - TC10 - DELETED - Clean up any existing network cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" @@ -618,9 +618,9 @@ tags: merged - name: MERGED - TC10 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC10 - QUERY - Verify network state in NDFC @@ -643,9 +643,9 @@ tags: merged - name: MERGED - TC10 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: merged # TC11 @@ -670,9 +670,9 @@ tags: merged - name: MERGED - TC11 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC11 - QUERY - Verify network state in NDFC @@ -710,9 +710,9 @@ tags: merged - name: MERGED - TC11 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: merged - name: MERGED - TC11 - QUERY - Verify network state in NDFC @@ -741,23 +741,23 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - deploy: true + - net_name: "" + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid network name - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: net_name : Required parameter not found" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: net_name : Required parameter not found" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create Network with invalid VRF name @@ -765,23 +765,23 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-10000 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - deploy: true + - net_name: ansible-net13 + vrf_name: Tenant-10000 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid VRF name - assert: + ansible.builtin.assert: that: - - '"VRF: Tenant-10000 is missing in fabric:" in result.msg' - - result.changed == false + - '"VRF: Tenant-10000 is missing in fabric:" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create Network with invalid vlan id @@ -789,23 +789,23 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 15000 - gw_ip_subnet: '192.168.30.1/24' - deploy: true + - net_name: ansible-net13 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 15000 + gw_ip_subnet: '192.168.30.1/24' + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid vlan id - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: vlan_id:15000 : The item exceeds the allowed range of max 4094" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: vlan_id:15000 : The item exceeds the allowed range of max 4094" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create Network and deploy in invalid switch @@ -813,26 +813,26 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - attach: - - ip_address: - ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"] - deploy: false + - net_name: ansible-net13 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + attach: + - ip_address: "{{ test_data_common.sw1 }}" + ports: ["{{ test_data_common.sw1_int1 }}", "{{ test_data_common.sw1_int2 }}"] + deploy: false register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid switch - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: ip_address : Required parameter not found" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: ip_address : Required parameter not found" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create Network with out of range routing tag @@ -840,24 +840,24 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-1000 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - routing_tag: 4294967296 - gw_ip_subnet: '192.168.30.1/24' - deploy: true + - net_name: ansible-net13 + vrf_name: Tenant-1000 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + routing_tag: 4294967296 + gw_ip_subnet: '192.168.30.1/24' + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid routing tag - assert: + ansible.builtin.assert: that: - - '"routing_tag:4294967296 : The item exceeds the allowed range of max 4294967295" in result.msg' - - result.changed == false + - '"routing_tag: 4294967296 : The item exceeds the allowed range of max 4294967295" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create L2 only Network with a vrf name @@ -865,24 +865,24 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-1000 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - is_l2only: True - deploy: true + - net_name: ansible-net13 + vrf_name: Tenant-1000 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + is_l2only: true + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid vrf name - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: vrf_name should not be specified for L2 Networks" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: vrf_name should not be specified for L2 Networks" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create L3 Network without a vrf name @@ -890,22 +890,22 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - deploy: true + - net_name: ansible-net13 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid vrf name - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: vrf_name is required for L3 Networks" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: vrf_name is required for L3 Networks" in result.msg' + - result.changed == false tags: merged - name: MERGED - TC12 - Create L3 Network with DHCP server IP alone @@ -913,24 +913,24 @@ fabric: "{{ test_data_common.fabric }}" state: merged config: - - net_name: ansible-net13 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - dhcp_srvr1_ip: '1.1.1.1' - deploy: true + - net_name: ansible-net13 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + dhcp_srvr1_ip: '1.1.1.1' + deploy: true register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC12 - ASSERT - Check invalid vrf name - assert: + ansible.builtin.assert: that: - - '"Invalid parameters in playbook: DHCP server IP should be specified along with DHCP server VRF" in result.msg' - - result.changed == false + - '"Invalid parameters in playbook: DHCP server IP should be specified along with DHCP server VRF" in result.msg' + - result.changed == false tags: merged ############################################## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml index a1fcff90d..ac40d7378 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/overridden.yaml @@ -16,22 +16,22 @@ - name: OVERRIDDEN - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_overridden: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach double_net_conf_template: "overridden/dcnm_network_overridden_double_net_conf.j2" double_net_conf_file: "{{ role_path }}/files/dcnm_network_overridden_double_net_conf.yaml" - #---------------------------------- + # ---------------------------------- net1_conf_template: "overridden/dcnm_network_overridden_net1_conf.j2" net1_conf_file: "{{ role_path }}/files/dcnm_network_overridden_net1_conf.yaml" # TC2 - OVERRIDDEN - MERGED - Create, Attach and Deploy L2. L3 Network with Switch Attach l2_l3_net_conf_template: "overridden/dcnm_network_overridden_l2_l3_net_conf.j2" l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_overridden_l2_l3_net_conf.yaml" - #---------------------------------- + # ---------------------------------- l2_l3_net_changed_conf_template: "overridden/dcnm_network_overridden_l2_l3_net_changed_conf.j2" l2_l3_net_changed_conf_file: "{{ role_path }}/files/dcnm_network_overridden_l2_l3_net_changed_conf.yaml" - #---------------------------------- + # ---------------------------------- delegate_to: localhost tags: overridden @@ -92,9 +92,9 @@ tags: overridden - name: OVERRIDDEN - TC1 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: overridden - name: OVERRIDDEN - TC1 - QUERY - Get network state in NDFC @@ -126,9 +126,9 @@ tags: overridden - name: OVERRIDDEN - TC1 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: overridden - name: OVERRIDDEN - TC1 - QUERY - Get network state in NDFC @@ -183,9 +183,9 @@ tags: overridden - name: OVERRIDDEN - TC2 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: overridden - name: OVERRIDDEN - TC2 - QUERY - Get network state in NDFC @@ -202,23 +202,23 @@ test_data: "{{ test_data_common }}" tags: overridden -- name: OVERRIDDEN - TC2 - Load Network Config File with a new L2 network +- name: OVERRIDDEN - TC2 - Load Network Config File with a new L2 network ansible.builtin.set_fact: dcnm_network_overridden_l2_l3_net_changed_conf: "{{ lookup('file', '{{ test_data_overridden.l2_l3_net_changed_conf_file }}') | from_yaml }}" delegate_to: localhost tags: overridden -- name: OVERRIDDEN - Override L2, L3 Networks with a new L2 network +- name: OVERRIDDEN - Override L2, L3 Networks with a new L2 network cisco.dcnm.dcnm_network: &conf2 fabric: "{{ test_data_common.fabric }}" state: overridden config: "{{ dcnm_network_overridden_l2_l3_net_changed_conf }}" - + register: result - name: OVERRIDDEN - TC2 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: overridden - name: OVERRIDDEN - TC2 - QUERY - Get network state in NDFC @@ -241,9 +241,9 @@ tags: overridden - name: OVERRIDDEN - TC2 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: overridden diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml index fd68e8447..1d57634c7 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/query.yaml @@ -16,16 +16,16 @@ - name: QUERY - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_query: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - QUERY - merged_conf_template: "sanity/dcnm_network_sanity_merged_conf.j2" + merged_conf_template: "sanity/dcnm_network_sanity_merged_conf.j2" merged_conf_file: "{{ role_path }}/files/dcnm_network_sanity_merged_conf.yaml" # TC5 - L2only and L3 network with dhcp, arp options l2_l3_net_conf_template: "deleted/dcnm_network_deleted_l2_l3_net_conf.j2" l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_deleted_l2_l3_net_conf.yaml" - #---------------------------------- + # ---------------------------------- delegate_to: localhost tags: query @@ -74,9 +74,9 @@ tags: query - name: QUERY - TC1 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: query - name: QUERY - TC1 - QUERY - Get network state in NDFC using config @@ -111,7 +111,7 @@ delegate_to: localhost tags: query -# TC3 +# TC3 - name: QUERY - TC3 - DELETED - Delete all the networks cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" @@ -145,9 +145,9 @@ tags: query - name: QUERY - TC4 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: query # TC5 @@ -166,9 +166,9 @@ tags: query - name: QUERY - TC5 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: query - name: QUERY - TC5 - Query the L2 and L3 Network with config diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml index 5c3c41f8b..06241e997 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/replaced.yaml @@ -16,23 +16,23 @@ - name: REPLACED - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_replaced: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- - # TC1 + # ---------------------------------- + # TC1 double_net_conf_template: "replaced/dcnm_network_replaced_double_net_conf.j2" double_net_conf_file: "{{ role_path }}/files/dcnm_network_replaced_double_net_conf.yaml" - #---------------------------------- + # ---------------------------------- double_net_changed_conf_template: "replaced/dcnm_network_replaced_double_net_changed_conf.j2" double_net_changed_conf_file: "{{ role_path }}/files/dcnm_network_replaced_double_net_changed_conf.yaml" - #---------------------------------- + # ---------------------------------- # TC3 l2_l3_net_conf_template: "replaced/dcnm_network_replaced_l2_l3_net_conf.j2" l2_l3_net_conf_file: "{{ role_path }}/files/dcnm_network_replaced_l2_l3_net_conf.yaml" - #---------------------------------- + # ---------------------------------- l2_l3_net_changed_conf_template: "replaced/dcnm_network_replaced_l2_l3_net_changed_conf.j2" l2_l3_net_changed_conf_file: "{{ role_path }}/files/dcnm_network_replaced_l2_l3_net_changed_conf.yaml" - #---------------------------------- + # ---------------------------------- delegate_to: localhost tags: replaced @@ -94,9 +94,9 @@ tags: replaced - name: REPLACED - TC1 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: replaced - name: REPLACED - TC1 - QUERY - Get network state in NDFC @@ -128,9 +128,9 @@ tags: replaced - name: REPLACED - TC1 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: replaced - name: REPLACED - TC1 - QUERY - Get network state in NDFC @@ -153,9 +153,9 @@ tags: replaced - name: REPLACED - TC1 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: replaced # TC2 @@ -168,9 +168,9 @@ tags: replaced - name: REPLACED - TC2 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: replaced - name: REPLACED - TC2 - QUERY - Get network state in NDFC @@ -193,9 +193,9 @@ tags: replaced - name: REPLACED - TC2 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: replaced # TC3 @@ -220,9 +220,9 @@ tags: replaced - name: REPLACED - TC3 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: replaced - name: REPLACED - TC3 - QUERY - Get network state in NDFC @@ -254,9 +254,9 @@ tags: replaced - name: REPLACED - TC3 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: replaced - name: REPLACED - TC3 - QUERY - Get network state in NDFC @@ -279,9 +279,9 @@ tags: replaced - name: REPLACED - TC3 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: replaced # TC4 @@ -294,9 +294,9 @@ tags: replaced - name: REPLACED - TC4 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true tags: replaced - name: REPLACED - TC4 - QUERY - Get network state in NDFC @@ -319,9 +319,9 @@ tags: replaced - name: REPLACED - TC4 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: replaced ############################################## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml index 68050b9bf..63e7971dd 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/sanity.yaml @@ -16,11 +16,11 @@ - name: SANITY - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_sanity: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - MERGED - Create, Attach and Deploy Multiple Network with Single Switch Attach - merged_conf_template: "sanity/dcnm_network_sanity_merged_conf.j2" + merged_conf_template: "sanity/dcnm_network_sanity_merged_conf.j2" merged_conf_file: "{{ role_path }}/files/dcnm_network_sanity_merged_conf.yaml" # TC2 - OVERRIDDEN - Create, Attach and Deploy Multiple Network with Single Switch Attach overridden_conf_template: "sanity/dcnm_network_sanity_overridden_conf.j2" @@ -28,7 +28,7 @@ # TC3 - REPLACED - Update Network using replace - Delete Attachments replaced_conf_template: "sanity/dcnm_network_sanity_replaced_conf.j2" replaced_conf_file: "{{ role_path }}/files/dcnm_network_sanity_replaced_conf.yaml" - #---------------------------------- + # ---------------------------------- delegate_to: localhost tags: sanity @@ -88,9 +88,9 @@ tags: sanity - name: SANITY - TC1 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: sanity - name: SANITY - TC1 - QUERY - Get network state in NDFC @@ -126,9 +126,9 @@ tags: sanity - name: SANITY - TC2 - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: sanity - name: SANITY - TC2 - QUERY - Get network state in NDFC @@ -151,9 +151,9 @@ tags: sanity - name: SANITY - TC2 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: sanity ############################################## @@ -175,9 +175,9 @@ tags: sanity - name: SANITY - TC3 - ASSERT - Check changed flag - assert: + ansible.builtin.assert: that: - - 'result.changed == true' + - 'result.changed == true' tags: sanity - name: SANITY - TC3 - QUERY - Get network state in NDFC @@ -230,9 +230,9 @@ tags: sanity - name: SANITY - TC3 - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - result.changed == false + - result.changed == false tags: sanity - name: SANITY - END - Clean up any existing networks diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml index dd4091523..d575658f9 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/deleted_net_all.yaml @@ -15,9 +15,9 @@ - name: DELETED_ALL - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_conf_template: "self-contained-tests/net1_conf.j2" net1_conf_file: "{{ role_path }}/files/self_contained_deleted_all_conf.yaml" @@ -50,9 +50,9 @@ register: result - name: DELETED_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: DELETED_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -72,9 +72,9 @@ register: result - name: DELETED_ALL - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' - name: DELETED_ALL - Delete any existing networks cisco.dcnm.dcnm_network: &conf1 @@ -87,7 +87,7 @@ fabric: "{{ test_data_common.fabric }}" state: query register: verify_result - + - name: DELETED_ALL - VALIDITY CHECK - Verify deleted network state in NDFC cisco.dcnm.tests.integration.ndfc_network_validate: config_path: "{{ test_data.net1_conf_file }}" @@ -95,16 +95,16 @@ test_data: "{{ test_data_common }}" check_deleted: true delegate_to: localhost - + - name: DELETED_ALL - conf - Idempotence cisco.dcnm.dcnm_network: *conf1 register: result - name: DELETED_ALL - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################## ## CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/ingress_replication_networks.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/ingress_replication_networks.yaml index 80d9ebe0d..23b8342e2 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/ingress_replication_networks.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/ingress_replication_networks.yaml @@ -2,133 +2,133 @@ ## SETUP ## ############################################## - block: - - set_fact: - rest_path: "/rest/control/fabrics/{{ test_ing_fabric }}" - when: controller_version == "11" + - ansible.builtin.set_fact: + rest_path: "/rest/control/fabrics/{{ test_ing_fabric }}" + when: controller_version == "11" - - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_ing_fabric }}" - when: controller_version >= "12" + - ansible.builtin.set_fact: + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_ing_fabric }}" + when: controller_version >= "12" - - name: ING_REP - Verify if fabric - Fabric1 is deployed. - cisco.dcnm.dcnm_rest: - method: GET - path: "{{ rest_path }}" - register: result + - name: ING_REP - Verify if fabric - Fabric1 is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result - - assert: - that: - - 'result.response.DATA != None' + - ansible.builtin.assert: + that: + - 'result.response.DATA != None' - - name: ING_REP - Remove all existing networks to start with a clean state - cisco.dcnm.dcnm_network: - fabric: "{{ test_ing_fabric }}" - state: deleted + - name: ING_REP - Remove all existing networks to start with a clean state + cisco.dcnm.dcnm_network: + fabric: "{{ test_ing_fabric }}" + state: deleted - - name: ING_REP - Create vrfs required for this test and remove all other vrfs - cisco.dcnm.dcnm_vrf: - fabric: "{{ test_ing_fabric }}" - state: overridden - config: - - vrf_name: Tenant-1 - vrf_id: 9008012 - vlan_id: 501 - attach: - - ip_address: "{{ ansible_ing_switch1 }}" - deploy: true + - name: ING_REP - Create vrfs required for this test and remove all other vrfs + cisco.dcnm.dcnm_vrf: + fabric: "{{ test_ing_fabric }}" + state: overridden + config: + - vrf_name: Tenant-1 + vrf_id: 9008012 + vlan_id: 501 + attach: + - ip_address: "{{ ansible_ing_switch1 }}" + deploy: true -############################################## -## MERGED ## -############################################## + ############################################## + ## MERGED ## + ############################################## - - name: ING_REP - Create New Network with Deploy - cisco.dcnm.dcnm_network: - fabric: "{{ test_ing_fabric }}" - state: merged - config: - - net_name: ansible-net15 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - deploy: True - register: result + - name: ING_REP - Create New Network with Deploy + cisco.dcnm.dcnm_network: + fabric: "{{ test_ing_fabric }}" + state: merged + config: + - net_name: ansible-net15 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + deploy: true + register: result - - name: Query fabric for creation of Network Object - cisco.dcnm.dcnm_network: - fabric: "{{ test_ing_fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.displayName is search('ansible-net15')" - - "query_result.response[0].parent.networkId is search('7005')" - - "query_result.response[0].parent.vrf is search('Tenant-1')" - retries: 5 - delay: 2 + - name: Query fabric for creation of Network Object + cisco.dcnm.dcnm_network: + fabric: "{{ test_ing_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.displayName is search('ansible-net15')" + - "query_result.response[0].parent.networkId is search('7005')" + - "query_result.response[0].parent.vrf is search('Tenant-1')" + retries: 5 + delay: 2 - - assert: - that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.diff[0].attach|length == 0' - - 'result.diff[0].net_name == "ansible-net15"' - - 'result.diff[0].net_id == 7005' - - 'result.diff[0].vrf_name == "Tenant-1"' + - ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.diff[0].attach|length == 0' + - 'result.diff[0].net_name == "ansible-net15"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' - - name: ING_REP - setup - Clean up any existing networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_ing_fabric }}" - state: deleted + - name: ING_REP - setup - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_ing_fabric }}" + state: deleted - - name: MERGED - Create New Network with Attach and global deploy - cisco.dcnm.dcnm_network: - fabric: "{{ test_ing_fabric }}" - state: merged - config: - - net_name: ansible-net16 - vrf_name: Tenant-1 - net_id: 7005 - net_template: Default_Network_Universal - net_extension_template: Default_Network_Extension_Universal - vlan_id: 1500 - gw_ip_subnet: '192.168.30.1/24' - attach: - - ip_address: "{{ ansible_ing_switch1 }}" - ports: ["{{ ansible_ing_sw1_int1 }}", "{{ ansible_ing_sw1_int2 }}"] - deploy: True - register: result + - name: MERGED - Create New Network with Attach and global deploy + cisco.dcnm.dcnm_network: + fabric: "{{ test_ing_fabric }}" + state: merged + config: + - net_name: ansible-net16 + vrf_name: Tenant-1 + net_id: 7005 + net_template: Default_Network_Universal + net_extension_template: Default_Network_Extension_Universal + vlan_id: 1500 + gw_ip_subnet: '192.168.30.1/24' + attach: + - ip_address: "{{ ansible_ing_switch1 }}" + ports: ["{{ ansible_ing_sw1_int1 }}", "{{ ansible_ing_sw1_int2 }}"] + deploy: true + register: result - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_ing_fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 + - name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_ing_fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 - - assert: - that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' - - 'result.diff[0].net_name == "ansible-net16"' - - 'result.diff[0].net_id == 7005' - - 'result.diff[0].vrf_name == "Tenant-1"' + - ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' + - 'result.diff[0].net_name == "ansible-net16"' + - 'result.diff[0].net_id == 7005' + - 'result.diff[0].vrf_name == "Tenant-1"' -############################################## -## CLEAN-UP ## -############################################## + ############################################## + ## CLEAN-UP ## + ############################################## - - name: MERGED - setup - remove any networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: deleted - when: test_ing_fabric is defined + - name: MERGED - setup - remove any networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: deleted + when: test_ing_fabric is defined diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml index 8bb7cb73e..3c6235450 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/merged_net_all.yaml @@ -15,9 +15,9 @@ - name: MERGED_ALL - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_conf_template: "self-contained-tests/net1_conf.j2" net1_conf_file: "{{ role_path }}/files/self_contained_deleted_all_conf.yaml" @@ -50,9 +50,9 @@ register: result - name: MERGED_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: MERGED_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -72,9 +72,9 @@ register: result - name: MERGED_ALL - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml index 5db4cc299..4f6389989 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/overridden_net_all.yaml @@ -15,15 +15,15 @@ - name: OVERRIDDEN_ALL - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_conf_template: "self-contained-tests/net1_conf.j2" net1_conf_file: "{{ role_path }}/files/self_contained_overridden_all_net1_conf.yaml" - #---------------------------------- + # ---------------------------------- net2_conf_template: "self-contained-tests/net2_conf.j2" net2_conf_file: "{{ role_path }}/files/self_contained_overridden_all_net2_conf.yaml" - #---------------------------------- +# ---------------------------------- - name: OVERRIDDEN_ALL - Create Network Config File using J2 Template ansible.builtin.template: @@ -59,9 +59,9 @@ register: result - name: OVERRIDDEN_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: OVERRIDDEN_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -89,9 +89,9 @@ register: result - name: OVERRIDDEN_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: OVERRIDDEN_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -111,9 +111,9 @@ register: result - name: OVERRIDDEN_ALL - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################## ## CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml index 02627020b..1e0e1c002 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/replaced_net_all.yaml @@ -15,15 +15,15 @@ - name: REPLACED_ALL - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_conf_template: "self-contained-tests/net1_conf.j2" net1_conf_file: "{{ role_path }}/files/self_contained_replaced_all_net1_conf.yaml" - #---------------------------------- + # ---------------------------------- net1_changed_conf_template: "self-contained-tests/net1_changed_conf.j2" net1_changed_conf_file: "{{ role_path }}/files/self_contained_replaced_all_net1_changed_conf.yaml" - #---------------------------------- +# ---------------------------------- - name: REPLACED_ALL - Create Network Config File using J2 Template ansible.builtin.template: @@ -59,9 +59,9 @@ register: result - name: REPLACED_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: REPLACED_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -89,9 +89,9 @@ register: result - name: REPLACED_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: REPLACED_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -111,9 +111,9 @@ register: result - name: REPLACED_ALL - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################## ## CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml index 00a8d502c..69373eee4 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/scale.yaml @@ -15,12 +15,12 @@ - name: SCALED_ALL - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- scale_conf_template: "self-contained-tests/scale_conf.j2" scale_conf_file: "{{ role_path }}/files/self_contained_scale_conf.yaml" - #---------------------------------- +# ---------------------------------- - name: SCALED_ALL - Create Network Config File using J2 Template @@ -48,9 +48,9 @@ register: result - name: SCALED_ALL - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SCALED_ALL - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -70,9 +70,9 @@ register: result - name: SCALED_ALL - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml index bec852d10..e9087dfce 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_params.yaml @@ -15,9 +15,9 @@ - name: SM_DHCP_PARAMS - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_dhcp_conf_template: "self-contained-tests/net1_dhcp_conf.j2" net1_dhcp_conf_file: "{{ role_path }}/files/self_contained_dhcp_conf.yaml" @@ -51,9 +51,9 @@ register: result - name: SM_DHCP_PARAMS - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SM_DHCP_PARAMS - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml index 5d2d5a3d2..fc31fbc70 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_dhcp_update.yaml @@ -15,12 +15,12 @@ - name: SM_DHCP_UPDATE - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_dhcp_conf_template: "self-contained-tests/net1_dhcp_conf.j2" net1_dhcp_conf_file: "{{ role_path }}/files/self_contained_dhcp_conf.yaml" - #---------------------------------- + # ---------------------------------- net1_dhcp_changed_conf_template: "self-contained-tests/net1_dhcp_changed_conf.j2" net1_dhcp_changed_conf_file: "{{ role_path }}/files/self_contained_dhcp_changed_conf.yaml" @@ -58,9 +58,9 @@ register: result - name: SM_DHCP_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SM_DHCP_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -88,9 +88,9 @@ register: result - name: SM_DHCP_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SM_DHCP_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -112,4 +112,4 @@ - name: SM_DHCP_UPDATE - END - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" - state: deleted \ No newline at end of file + state: deleted diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml index 32ee69749..59d5d7ea1 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_params.yaml @@ -15,9 +15,9 @@ - name: SM_MCAST_PARAMS - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_mcast_template: "self-contained-tests/net1_mcast_conf.j2" net1_mcast_file: "{{ role_path }}/files/self_contained_net1_mcast_conf.yaml" @@ -51,9 +51,9 @@ register: result - name: SM_MCAST_PARAMS - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SM_MCAST_PARAMS - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -73,9 +73,9 @@ register: result - name: SM_MCAST_PARAMS - ASSERT - Check changed flag is false - assert: + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################## diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml index aaa4ec6c4..d47bedcb8 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/sm_mcast_update.yaml @@ -15,12 +15,12 @@ - name: SM_MCAST_UPDATE - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- net1_mcast_conf_template: "self-contained-tests/net1_mcast_conf.j2" net1_mcast_conf_file: "{{ role_path }}/files/self_contained_mcast_conf.yaml" - #---------------------------------- + # ---------------------------------- net1_mcast_changed_conf_template: "self-contained-tests/net1_mcast_changed_conf.j2" net1_mcast_changed_conf_file: "{{ role_path }}/files/self_contained_mcast_changed_conf.yaml" @@ -59,9 +59,9 @@ register: result - name: SM_MCAST_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SM_MCAST_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -89,9 +89,9 @@ register: result - name: SM_MCAST_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SM_MCAST_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -113,4 +113,4 @@ - name: SM_MCAST_UPDATE - END - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" - state: deleted \ No newline at end of file + state: deleted diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml index 747f3f695..54571f765 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_dhcp_update.yaml @@ -15,12 +15,12 @@ - name: SO_DHCP_UPDATE - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- double_net_dhcp_conf_template: "self-contained-tests/double_net_dhcp_conf.j2" double_net_dhcp_conf_file: "{{ role_path }}/files/self_contained_dhcp_conf.yaml" - #---------------------------------- + # ---------------------------------- double_net_dhcp_changed_conf_template: "self-contained-tests/double_net_dhcp_changed_conf.j2" double_net_dhcp_changed_conf_file: "{{ role_path }}/files/self_contained_double_net_dhcp_changed_conf.yaml" @@ -58,9 +58,9 @@ register: result - name: SO_DHCP_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SO_DHCP_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -88,9 +88,9 @@ register: result - name: SO_DHCP_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SO_DHCP_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -112,4 +112,4 @@ - name: SO_DHCP_UPDATE - END - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" - state: deleted \ No newline at end of file + state: deleted diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml index 8e6a3f3ee..43aa25d69 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/so_mcast_update.yaml @@ -15,12 +15,12 @@ - name: SO_MCAST_UPDATE - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- double_net_mcast_conf_template: "self-contained-tests/double_net_mcast_conf.j2" double_net_mcast_conf_file: "{{ role_path }}/files/self_contained_mcast_conf.yaml" - #---------------------------------- + # ---------------------------------- double_net_mcast_changed_conf_template: "self-contained-tests/double_net_mcast_changed_conf.j2" double_net_mcast_changed_conf_file: "{{ role_path }}/files/self_contained_double_net_mcast_changed_conf.yaml" @@ -59,9 +59,9 @@ register: result - name: SO_MCAST_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SO_MCAST_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -89,9 +89,9 @@ register: result - name: SO_MCAST_UPDATE - ASSERT - Check changed flag is true - assert: + ansible.builtin.assert: that: - - result.changed == true + - result.changed == true - name: SO_MCAST_UPDATE - Query fabric for creation of Network Object cisco.dcnm.dcnm_network: @@ -113,4 +113,4 @@ - name: SO_MCAST_UPDATE - END - Clean up any existing networks cisco.dcnm.dcnm_network: fabric: "{{ test_data_common.fabric }}" - state: deleted \ No newline at end of file + state: deleted diff --git a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/tor_ports_networks.yaml b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/tor_ports_networks.yaml index 605a34da8..2828ad0cf 100644 --- a/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/tor_ports_networks.yaml +++ b/tests/integration/targets/dcnm_network/tests/dcnm/self-contained-tests/tor_ports_networks.yaml @@ -3,38 +3,38 @@ ############################################## - block: - - set_fact: - rest_path: "/rest/control/fabrics/{{ test_data_common.fabric }}" - when: controller_version == "11" - - - set_fact: - rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.fabric }}" - when: controller_version >= "12" - - - name: TOR - Verify if fabric is deployed. - cisco.dcnm.dcnm_rest: - method: GET - path: "{{ rest_path }}" - register: result - - - assert: - that: - - 'result.response.DATA != None' - - - name: TOR - Clean up any existing networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: deleted - + - set_fact: + rest_path: "/rest/control/fabrics/{{ test_data_common.fabric }}" + when: controller_version == "11" + + - set_fact: + rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.fabric }}" + when: controller_version >= "12" + + - name: TOR - Verify if fabric is deployed. + cisco.dcnm.dcnm_rest: + method: GET + path: "{{ rest_path }}" + register: result + + - assert: + that: + - 'result.response.DATA != None' + + - name: TOR - Clean up any existing networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: deleted + ############################################## ## TESTS ## ############################################## - - - name: TOR - Create, Attach and Deploy Single Network with Multiple Switch and TOR Attach - cisco.dcnm.dcnm_network: &conf1 - fabric: "{{ test_data_common.fabric }}" - state: merged - config: + +- name: TOR - Create, Attach and Deploy Single Network with Multiple Switch and TOR Attach + cisco.dcnm.dcnm_network: &conf1 + fabric: "{{ test_data_common.fabric }}" + state: merged + config: - net_name: ansible-net13 vrf_name: Tenant-1 net_id: 7005 @@ -43,28 +43,28 @@ vlan_id: 1500 gw_ip_subnet: '192.168.30.1/24' attach: - - ip_address: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - tor_ports: - - ip_address: "{{ ansible_tor_switch1 }}" - ports: ["{{ ansible_tor_int1 }}", "{{ ansible_tor_int2 }}"] - - ip_address: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] - deploy: True + - ip_address: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + tor_ports: + - ip_address: "{{ ansible_tor_switch1 }}" + ports: ["{{ ansible_tor_int1 }}", "{{ ansible_tor_int2 }}"] + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true register: result - - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 - - - assert: - that: + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 + +- assert: + that: - 'result.changed == true' - 'result.response[0].RETURN_CODE == 200' - 'result.response[1].RETURN_CODE == 200' @@ -80,21 +80,21 @@ - 'result.diff[0].net_name == "ansible-net13"' - 'result.diff[0].net_id == 7005' - 'result.diff[0].vrf_name == "Tenant-1"' - - - name: TOR - conf1 - Idempotence - cisco.dcnm.dcnm_network: *conf1 - register: result - - - assert: - that: + +- name: TOR - conf1 - Idempotence + cisco.dcnm.dcnm_network: *conf1 + register: result + +- assert: + that: - 'result.changed == false' - 'result.response|length == 0' - - - name: TOR - Attach new TOR ports to already Attached TOR ports - cisco.dcnm.dcnm_network: &conf2 - fabric: "{{ test_data_common.fabric }}" - state: merged - config: + +- name: TOR - Attach new TOR ports to already Attached TOR ports + cisco.dcnm.dcnm_network: &conf2 + fabric: "{{ test_data_common.fabric }}" + state: merged + config: - net_name: ansible-net13 vrf_name: Tenant-1 net_id: 7005 @@ -103,28 +103,28 @@ vlan_id: 1500 gw_ip_subnet: '192.168.30.1/24' attach: - - ip_address: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - tor_ports: - - ip_address: "{{ ansible_tor_switch1 }}" - ports: ["{{ ansible_tor_int3 }}"] - - ip_address: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] - deploy: True + - ip_address: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + tor_ports: + - ip_address: "{{ ansible_tor_switch1 }}" + ports: ["{{ ansible_tor_int3 }}"] + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true register: result - - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 - - - assert: - that: + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 + +- assert: + that: - 'result.changed == true' - 'result.response[0].RETURN_CODE == 200' - 'result.response[1].RETURN_CODE == 200' @@ -135,26 +135,26 @@ - '"{{ ansible_tor_int2 }}" in result.diff[0].attach[0].tor_ports' - '"{{ ansible_tor_int3 }}" in result.diff[0].attach[0].tor_ports' - 'result.diff[0].net_name == "ansible-net13"' - - - name: TOR - conf2 - Idempotence - cisco.dcnm.dcnm_network: *conf2 - register: result - - - assert: - that: + +- name: TOR - conf2 - Idempotence + cisco.dcnm.dcnm_network: *conf2 + register: result + +- assert: + that: - 'result.changed == false' - 'result.response|length == 0' - - - name: TOR - setup - Clean up any existing network - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: deleted - - - name: TOR - Create, Attach and Deploy Single Network with Multiple Switch Attach - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: merged - config: + +- name: TOR - setup - Clean up any existing network + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: deleted + +- name: TOR - Create, Attach and Deploy Single Network with Multiple Switch Attach + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: merged + config: - net_name: ansible-net13 vrf_name: Tenant-1 net_id: 7005 @@ -163,25 +163,25 @@ vlan_id: 1500 gw_ip_subnet: '192.168.30.1/24' attach: - - ip_address: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - - ip_address: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] - deploy: True + - ip_address: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true register: result - - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 - - - assert: - that: + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 + +- assert: + that: - 'result.changed == true' - 'result.response[0].RETURN_CODE == 200' - 'result.response[1].RETURN_CODE == 200' @@ -195,12 +195,12 @@ - 'result.diff[0].net_name == "ansible-net13"' - 'result.diff[0].net_id == 7005' - 'result.diff[0].vrf_name == "Tenant-1"' - - - name: TOR - Attach new TOR ports to already Attached network ports - cisco.dcnm.dcnm_network: &conf3 - fabric: "{{ test_data_common.fabric }}" - state: merged - config: + +- name: TOR - Attach new TOR ports to already Attached network ports + cisco.dcnm.dcnm_network: &conf3 + fabric: "{{ test_data_common.fabric }}" + state: merged + config: - net_name: ansible-net13 vrf_name: Tenant-1 net_id: 7005 @@ -209,28 +209,28 @@ vlan_id: 1500 gw_ip_subnet: '192.168.30.1/24' attach: - - ip_address: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - tor_ports: - - ip_address: "{{ ansible_tor_switch1 }}" - ports: ["{{ ansible_tor_int3 }}"] - - ip_address: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] - deploy: True + - ip_address: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + tor_ports: + - ip_address: "{{ ansible_tor_switch1 }}" + ports: ["{{ ansible_tor_int3 }}"] + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true register: result - - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 - - - assert: - that: + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 + +- assert: + that: - 'result.changed == true' - 'result.response[0].RETURN_CODE == 200' - 'result.response[1].RETURN_CODE == 200' @@ -239,21 +239,21 @@ - '"{{ ansible_switch1 }}" in result.diff[0].attach[0].ip_address' - '"{{ ansible_tor_int3 }}" in result.diff[0].attach[0].tor_ports' - 'result.diff[0].net_name == "ansible-net13"' - - - name: TOR - conf3 - Idempotence - cisco.dcnm.dcnm_network: *conf3 - register: result - - - assert: - that: + +- name: TOR - conf3 - Idempotence + cisco.dcnm.dcnm_network: *conf3 + register: result + +- assert: + that: - 'result.changed == false' - 'result.response|length == 0' - - - name: TOR - Replace new TOR ports to already Attached network ports - cisco.dcnm.dcnm_network: &conf4 - fabric: "{{ test_data_common.fabric }}" - state: replaced - config: + +- name: TOR - Replace new TOR ports to already Attached network ports + cisco.dcnm.dcnm_network: &conf4 + fabric: "{{ test_data_common.fabric }}" + state: replaced + config: - net_name: ansible-net13 vrf_name: Tenant-1 net_id: 7005 @@ -262,28 +262,28 @@ vlan_id: 1500 gw_ip_subnet: '192.168.30.1/24' attach: - - ip_address: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - tor_ports: - - ip_address: "{{ ansible_tor_switch1 }}" - ports: ["{{ ansible_tor_int1 }}", "{{ ansible_tor_int2 }}"] - - ip_address: "{{ ansible_switch2 }}" - ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] - deploy: True + - ip_address: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + tor_ports: + - ip_address: "{{ ansible_tor_switch1 }}" + ports: ["{{ ansible_tor_int1 }}", "{{ ansible_tor_int2 }}"] + - ip_address: "{{ ansible_switch2 }}" + ports: ["{{ ansible_sw2_int5 }}", "{{ ansible_sw2_int6 }}"] + deploy: true register: result - - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 - - - assert: - that: + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 + +- assert: + that: - 'result.changed == true' - 'result.response[0].RETURN_CODE == 200' - 'result.response[1].RETURN_CODE == 200' @@ -293,21 +293,21 @@ - '"{{ ansible_tor_int1 }}" in result.diff[0].attach[0].tor_ports' - '"{{ ansible_tor_int2 }}" in result.diff[0].attach[0].tor_ports' - 'result.diff[0].net_name == "ansible-net13"' - - - name: TOR - conf4 - Idempotence - cisco.dcnm.dcnm_network: *conf4 - register: result - - - assert: - that: + +- name: TOR - conf4 - Idempotence + cisco.dcnm.dcnm_network: *conf4 + register: result + +- assert: + that: - 'result.changed == false' - 'result.response|length == 0' - - - name: TOR - Override new TOR ports to already Attached network ports - cisco.dcnm.dcnm_network: &conf5 - fabric: "{{ test_data_common.fabric }}" - state: overridden - config: + +- name: TOR - Override new TOR ports to already Attached network ports + cisco.dcnm.dcnm_network: &conf5 + fabric: "{{ test_data_common.fabric }}" + state: overridden + config: - net_name: ansible-net13 vrf_name: Tenant-1 net_id: 7005 @@ -316,26 +316,26 @@ vlan_id: 1500 gw_ip_subnet: '192.168.30.1/24' attach: - - ip_address: "{{ ansible_switch1 }}" - ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] - tor_ports: - - ip_address: "{{ ansible_tor_switch1 }}" - ports: ["{{ ansible_tor_int3 }}", "{{ ansible_tor_int4 }}"] - deploy: True + - ip_address: "{{ ansible_switch1 }}" + ports: ["{{ ansible_sw1_int1 }}", "{{ ansible_sw1_int2 }}"] + tor_ports: + - ip_address: "{{ ansible_tor_switch1 }}" + ports: ["{{ ansible_tor_int3 }}", "{{ ansible_tor_int4 }}"] + deploy: true register: result - - - name: Query fabric state until networkStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: query - register: query_result - until: - - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" - retries: 30 - delay: 2 - - - assert: - that: + +- name: Query fabric state until networkStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: query + register: query_result + until: + - "query_result.response[0].parent.networkStatus is search('DEPLOYED|PENDING')" + retries: 30 + delay: 2 + +- assert: + that: - 'result.changed == true' - 'result.response[0].RETURN_CODE == 200' - 'result.response[1].RETURN_CODE == 200' @@ -345,22 +345,22 @@ - '"{{ ansible_tor_int3 }}" in result.diff[0].attach[0].tor_ports' - '"{{ ansible_tor_int4 }}" in result.diff[0].attach[0].tor_ports' - 'result.diff[0].net_name == "ansible-net13"' - - - name: TOR - conf5 - Idempotence - cisco.dcnm.dcnm_network: *conf5 - register: result - - - assert: - that: + +- name: TOR - conf5 - Idempotence + cisco.dcnm.dcnm_network: *conf5 + register: result + +- assert: + that: - 'result.changed == false' - 'result.response|length == 0' - + ############################################## ## CLEAN-UP ## ############################################## - - - name: TOR - setup - remove any networks - cisco.dcnm.dcnm_network: - fabric: "{{ test_data_common.fabric }}" - state: deleted + +- name: TOR - setup - remove any networks + cisco.dcnm.dcnm_network: + fabric: "{{ test_data_common.fabric }}" + state: deleted when: test_tor_pair is defined diff --git a/tests/integration/targets/dcnm_policy/meta/main.yaml b/tests/integration/targets/dcnm_policy/meta/main.yaml index 1089ea8e6..e930c9cdf 100644 --- a/tests/integration/targets/dcnm_policy/meta/main.yaml +++ b/tests/integration/targets/dcnm_policy/meta/main.yaml @@ -1,2 +1,2 @@ -dependencies: +dependencies: - prepare_dcnm_policy diff --git a/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml b/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml index 76745b74b..2119e61bf 100644 --- a/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_policy/tasks/dcnm.yaml @@ -1,22 +1,24 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) +- name: Run test cases (connection=httpapi) ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: @@ -36,7 +38,8 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -57,7 +60,8 @@ register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_policy/tasks/main.yaml b/tests/integration/targets/dcnm_policy/tasks/main.yaml index 390715438..2d33809f3 100644 --- a/tests/integration/targets/dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/dcnm_policy/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { ansible.builtin.include_tasks: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include dcnm.yaml + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_delete.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_delete.yaml index f0c425584..998479644 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_delete.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_delete.yaml @@ -19,16 +19,17 @@ - ip: "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Create policies cisco.dcnm.dcnm_policy: &create_pol @@ -36,21 +37,16 @@ state: merged config: - name: template_101 # name is mandatory - - name: template_102 # name is mandatory - - name: template_103 # name is mandatory - - name: template_104 # name is mandatory - - name: template_105 # name is mandatory - - switch: - ip: "{{ ansible_switch1 }}" - register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -59,7 +55,8 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - name: ASSERT create responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -67,9 +64,8 @@ loop: '{{ result.response }}' loop_control: index_var: my_idx - - # Assert for deploy responses - - assert: + - name: ASSERT deploy responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' @@ -81,48 +77,45 @@ - name: Delete policies - using template names cisco.dcnm.dcnm_policy: &del_pol fabric: "{{ ansible_it_fabric }}" - state: deleted + state: deleted # only choose from [merged, deleted, query] config: - name: template_101 # name is mandatory - - name: template_102 # name is mandatory - - name: template_103 # name is mandatory - - name: template_104 # name is mandatory - - name: template_105 # name is mandatory - - switch: - ip: "{{ ansible_switch1 }}" - register: result - - assert: + - name: ASSERT delete by template summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 5' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - name: ASSERT delete by template responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' loop: '{{ result.response }}' - - name: Delete policies - Idempotence cisco.dcnm.dcnm_policy: *del_pol register: result - - assert: + - name: ASSERT idempotent delete summary + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - name: ASSERT idempotent delete responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -131,7 +124,8 @@ loop_control: index_var: my_idx - - assert: + - name: ASSERT idempotent delete responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -140,7 +134,8 @@ loop_control: index_var: my_idx - - assert: + - name: ASSERT idempotent delete responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Deleted successfully" in item["DATA"]["message"]' @@ -153,7 +148,8 @@ cisco.dcnm.dcnm_policy: *create_pol register: result - - assert: + - name: ASSERT recreate summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -161,8 +157,8 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - # Assert for Create responses - - assert: + - name: ASSERT recreate responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -171,8 +167,8 @@ loop_control: index_var: my_idx - # Assert for deploy responses - - assert: + - name: ASSERT recreate deploy responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' @@ -181,8 +177,8 @@ loop_control: index_var: my_idx - - name: Setting fact - set_fact: + - name: Setting fact (policy IDs list1) + ansible.builtin.set_fact: del_policy_list1: "{{ (del_policy_list1 | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' @@ -190,11 +186,11 @@ index_var: my_idx - name: Show the policy_list information - debug: + ansible.builtin.debug: var: del_policy_list1 - name: Setting fact - set_fact: + ansible.builtin.set_fact: list_len: "{{ del_policy_list1 | length }}" - name: Delete policies - using policy IDs @@ -205,11 +201,11 @@ - name: "{{ item }}" # Pick the policy Ids from the facts - switch: - ip: "{{ ansible_switch1 }}" - loop: '{{ del_policy_list1 }}' register: result - - assert: + - name: ASSERT delete by policy IDs responses + ansible.builtin.assert: that: - 'item.changed == true' - '(item["diff"][0]["merged"] | length) == 0' @@ -229,16 +225,14 @@ config: - name: template_101 # name is mandatory create_additional_policy: true # Create a policy even if it already exists - - name: template_101 # name is mandatory create_additional_policy: true # Create a policy even if it already exists - - switch: - ip: "{{ ansible_switch1 }}" - register: result - - assert: + - name: ASSERT multi create (2) summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -246,8 +240,8 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - # Assert for Create responses - - assert: + - name: ASSERT multi create (2) responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -256,8 +250,8 @@ loop_control: index_var: my_idx - # Assert for deploy responses - - assert: + - name: ASSERT multi create (2) deploy responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 2' @@ -273,17 +267,19 @@ config: - name: template_101 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT delete matching template summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 2' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - name: ASSERT delete matching template responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -298,33 +294,28 @@ create_additional_policy: false priority: 101 description: test policies with same template name - 101 - - name: template_101 # name is mandatory create_additional_policy: false priority: 102 description: test policies with same template name - 102 - - name: template_101 # name is mandatory create_additional_policy: false priority: 103 description: test policies with same template name - 103 - - name: template_101 # name is mandatory create_additional_policy: false priority: 104 description: test policies with same template name - 104 - - name: template_101 # name is mandatory create_additional_policy: false priority: 105 description: test policies with same template name - 105 - - switch: - ip: "{{ ansible_switch1 }}" - register: result - - assert: + - name: ASSERT multi create (5) summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -332,8 +323,8 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - # Assert for Create responses - - assert: + - name: ASSERT multi create (5) responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -342,8 +333,8 @@ loop_control: index_var: my_idx - # Assert for deploy responses - - assert: + - name: ASSERT multi create (5) deploy responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' @@ -352,8 +343,8 @@ loop_control: index_var: my_idx - - name: Setting fact - set_fact: + - name: Setting fact (policy IDs list2) + ansible.builtin.set_fact: del_policy_list2: "{{ (del_policy_list2 | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' @@ -361,11 +352,11 @@ index_var: my_idx - name: Show the policy_list information - debug: + ansible.builtin.debug: var: del_policy_list2 - name: Setting fact - set_fact: + ansible.builtin.set_fact: list_len: "{{ del_policy_list2 | length }}" - name: Delete policies with same template name - using policy IDs @@ -376,11 +367,11 @@ - name: "{{ item }}" # Pick the policy Ids from the facts - switch: - ip: "{{ ansible_switch1 }}" - loop: '{{ del_policy_list2 }}' register: result - - assert: + - name: ASSERT delete policies (list2) responses + ansible.builtin.assert: that: - 'item.changed == true' - '(item["diff"][0]["merged"] | length) == 0' @@ -400,13 +391,12 @@ config: - name: template_101 # name is mandatory create_additional_policy: false # Create a policy even if it already exists - - switch: - ip: "{{ ansible_switch1 }}" - register: result - - assert: + - name: ASSERT single create (1) summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -414,8 +404,8 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - # Assert for Create responses - - assert: + - name: ASSERT single create (1) responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -424,8 +414,8 @@ loop_control: index_var: my_idx - # Assert for deploy responses - - assert: + - name: ASSERT single create (1) deploy responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' @@ -442,10 +432,11 @@ config: - name: template_101 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT delete without deploy summary + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -453,49 +444,49 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["response"] | length) == 1' - - assert: + - name: ASSERT delete without deploy responses + ansible.builtin.assert: that: - 'result["response"][0]["RETURN_CODE"] == 200' - 'result["response"][0]["MESSAGE"] == "OK"' - # TBD: This test case needs to be refactored to test delete with and without deploy - # using a the switch_freeform template. The following order should be verified. - # 1. Create policy with deploy - # 2. Delete policy with deploy - # 3. Create policy with deploy - # 4. Delete policy without deploy and verify policy config is not removed from switch - # 5. Delete policy with deploy and verify policy config is removed from switch - - - # - name: Delete policy using template name - with deploy - # cisco.dcnm.dcnm_policy: - # fabric: "{{ ansible_it_fabric }}" - # state: deleted # only choose form [merged, deleted, query] - # config: - # - name: template_101 # This can either be a policy name like POLICY-xxxxx or template name - # - switch: - # - ip: "{{ ansible_switch1 }}" - # register: result - - # - assert: - # that: - # - 'result.changed == true' - # - '(result["diff"][0]["merged"] | length) == 0' - # - '(result["diff"][0]["deleted"] | length) == 1' - # - '(result["diff"][0]["query"] | length) == 0' - # - '(result["response"] | length) == 2' - - # - assert: - # that: - # - 'result["response"][0]["RETURN_CODE"] == 200' - # - 'result["response"][0]["MESSAGE"] == "OK"' - -############################################## -## CLEANUP ## -############################################## + # TBD: This test case needs to be refactored to test delete with and without deploy + # using a the switch_freeform template. The following order should be verified. + # 1. Create policy with deploy + # 2. Delete policy with deploy + # 3. Create policy with deploy + # 4. Delete policy without deploy and verify policy config is not removed from switch + # 5. Delete policy with deploy and verify policy config is removed from switch + + + # - name: Delete policy using template name - with deploy + # cisco.dcnm.dcnm_policy: + # fabric: "{{ ansible_it_fabric }}" + # state: deleted # only choose form [merged, deleted, query] + # config: + # - name: template_101 # This can either be a policy name like POLICY-xxxxx or template name + # - switch: + # - ip: "{{ ansible_switch1 }}" + # register: result + + # - assert: + # that: + # - 'result.changed == true' + # - '(result["diff"][0]["merged"] | length) == 0' + # - '(result["diff"][0]["deleted"] | length) == 1' + # - '(result["diff"][0]["query"] | length) == 0' + # - '(result["response"] | length) == 2' + + # - assert: + # that: + # - 'result["response"][0]["RETURN_CODE"] == 200' + # - 'result["response"][0]["MESSAGE"] == "OK"' + + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete all created policies cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" @@ -507,10 +498,11 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT cleanup responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge.yaml index 6c99be56c..7698c453f 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge.yaml @@ -19,17 +19,17 @@ - ip: "{{ ansible_switch1 }}" register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing policies cisco.dcnm.dcnm_policy: &dcnm_pol @@ -61,7 +61,7 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -70,7 +70,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -80,7 +80,7 @@ index_var: my_idx # Assert for deploy responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' @@ -93,7 +93,7 @@ cisco.dcnm.dcnm_policy: *dcnm_pol register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -102,7 +102,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -112,7 +112,7 @@ index_var: my_idx # Assert for deploy responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' @@ -129,17 +129,17 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 2' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -175,7 +175,7 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -184,7 +184,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -194,7 +194,7 @@ index_var: my_idx # Assert for deploy responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' @@ -211,17 +211,17 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 2' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -243,7 +243,7 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -252,7 +252,7 @@ - '(result["diff"][0]["deploy"] | length) == 2' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -262,7 +262,7 @@ index_var: my_idx # Assert for deploy responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 2' @@ -279,17 +279,17 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 2' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -314,7 +314,7 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -323,7 +323,7 @@ - '(result["diff"][0]["deploy"] | length) == 2' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -333,7 +333,7 @@ index_var: my_idx # Assert for deploy responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 2' @@ -350,17 +350,17 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 2' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -380,7 +380,7 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -389,7 +389,7 @@ - '(result["diff"][0]["deploy"] | length) == 0' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -399,7 +399,7 @@ index_var: my_idx # Assert for deploy responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 0' @@ -419,10 +419,10 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' @@ -468,7 +468,7 @@ priority: 105 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 8' @@ -476,18 +476,18 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - '(((item["serialNumber"] == "{{ ansible_sw1_sno }}") and + - '(((item["serialNumber"] == "{{ ansible_sw1_sno }}") and ((item["templateName"] == "template_101") or (item["templateName"] == "template_102") or (item["templateName"] == "template_103"))) or ((item["serialNumber"] == "{{ ansible_sw2_sno }}") and ((item["templateName"] == "template_101") or (item["templateName"] == "template_102") or (item["templateName"] == "template_103") or (item["templateName"] == "template_104") or (item["templateName"] == "template_105"))))' loop: '{{ result["diff"][0]["merged"] }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -502,10 +502,10 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_multi_switch.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_multi_switch.yaml index 33f9ea663..baec916cc 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_multi_switch.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_multi_switch.yaml @@ -20,24 +20,25 @@ - ip: "{{ ansible_switch2 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create policy on multile switches cisco.dcnm.dcnm_policy: &dcnm_pol fabric: "{{ ansible_it_fabric }}" deploy: true state: merged - config: + config: - name: template_101 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists priority: 101 @@ -47,7 +48,8 @@ - ip: "{{ ansible_switch2 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -56,7 +58,7 @@ - '(result["diff"][0]["deploy"] | length) == 2' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -66,20 +68,22 @@ index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' when: (my_idx >= (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Create policies - Idempotence cisco.dcnm.dcnm_policy: *dcnm_pol register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -88,7 +92,7 @@ - '(result["diff"][0]["deploy"] | length) == 2' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -98,18 +102,19 @@ index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' when: (my_idx >= (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -120,11 +125,11 @@ config: - name: template_101 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" - - ip: "{{ ansible_switch2 }}" + - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch2 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_same_template.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_same_template.yaml index bcdfb0c49..2bc8d844a 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_same_template.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_merge_same_template.yaml @@ -15,23 +15,24 @@ - ip: "{{ ansible_switch2 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create policy with template name cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" deploy: true state: merged - config: + config: - name: template_101 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists priority: 101 @@ -40,24 +41,24 @@ - ip: "{{ ansible_switch2 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 1' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 1' - name: Create more policies with the same template name but with some changes cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" deploy: true state: merged - config: + config: - name: template_101 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists priority: 101 - description: "Added to check if merge works for existing policies" - name: template_101 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists @@ -73,32 +74,33 @@ - ip: "{{ ansible_switch2 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 3' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 3' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 3' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 3' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete all created policies cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" - state: deleted # only choose form [merged, deleted, query] + state: deleted # only choose from [merged, deleted, query] config: - name: template_101 # This must be a valid template name - switch: - - ip: "{{ ansible_switch2 }}" + - ip: "{{ ansible_switch2 }}" register: result - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - 'item["MESSAGE"] == "OK"' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - 'item["MESSAGE"] == "OK"' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_modify.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_modify.yaml index 28817990c..a93568ea2 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_modify.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_modify.yaml @@ -19,16 +19,17 @@ - ip: "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing policies cisco.dcnm.dcnm_policy: &dcnm_pol @@ -42,7 +43,7 @@ - name: template_102 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists - description: 102 - No piority given + description: 102 - false priority given - name: template_103 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists @@ -51,16 +52,17 @@ - switch: - ip: "{{ ansible_switch1 }}" - policies: - - name: template_104 # This must be a valid template name - create_additional_policy: false # Do not create a policy if it already exists + policies: + - name: template_104 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists - - name: template_105 # This must be a valid template name - create_additional_policy: false # Do not create a policy if it already exists + - name: template_105 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists - ip: "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -69,7 +71,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -79,17 +81,18 @@ index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Setting fact - set_fact: + ansible.builtin.set_fact: modify_policy_list: "{{ (modify_policy_list | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' @@ -97,11 +100,11 @@ index_var: my_idx - name: Show the policy_list information - debug: + ansible.builtin.debug: var: modify_policy_list - name: Setting fact - set_fact: + ansible.builtin.set_fact: list_len: "{{ modify_policy_list | length }}" - name: Modify existing policy using template name - should create the policy @@ -118,13 +121,14 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 1' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 1' - name: Modify policies - using policy IDs cisco.dcnm.dcnm_policy: @@ -138,40 +142,43 @@ - ip: "{{ ansible_switch1 }}" loop: '{{ modify_policy_list }}' loop_control: - index_var: my_idx + index_var: my_idx register: result # Assert for description being non-empty - - assert: - that: - - 'item["description"] != ""' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["description"] != ""' when: (my_idx < (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0]["diff"][0]["merged"] }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for Create responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' when: (my_idx < (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0].response }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' when: (my_idx == (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0].response }}' loop_control: - index_var: my_idx + index_var: my_idx -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -186,10 +193,10 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_query.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_query.yaml index 35635d198..1cb8d97ca 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_query.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_query.yaml @@ -19,17 +19,18 @@ - ip: "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing policies cisco.dcnm.dcnm_policy: @@ -43,7 +44,7 @@ - name: template_102 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists - description: 102 - No piority given + description: 102 - false priority given - name: template_103 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists @@ -52,16 +53,17 @@ - switch: - ip: "{{ ansible_switch1 }}" - policies: - - name: template_104 # This must be a valid template name - create_additional_policy: false # Do not create a policy if it already exists + policies: + - name: template_104 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists - - name: template_105 # This must be a valid template name - create_additional_policy: false # Do not create a policy if it already exists + - name: template_105 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists - ip: "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -70,7 +72,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -80,34 +82,35 @@ index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Setting fact - set_fact: + ansible.builtin.set_fact: query_policy_list: "{{ (query_policy_list | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Show the policy_list information - debug: + ansible.builtin.debug: var: query_policy_list - name: Setting fact - set_fact: + ansible.builtin.set_fact: list_len: "{{ query_policy_list | length }}" -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query all policies from the specified switches cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" @@ -117,14 +120,15 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) != 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["response"] | length) != 0' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) != 0' + - '(result["diff"][0]["deploy"] | length) == 0' + - '(result["response"] | length) != 0' - name: Query specific policies cisco.dcnm.dcnm_policy: @@ -138,14 +142,15 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 3' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["response"] | length) == 3' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 3' + - '(result["diff"][0]["deploy"] | length) == 0' + - '(result["response"] | length) == 3' - name: Create additional policies same as existing policies cisco.dcnm.dcnm_policy: @@ -162,43 +167,45 @@ - name: template_102 # This must be a valid template name create_additional_policy: true # Create a policy if it already exists - description: 102 - No piority given + description: 102 - false piority given - name: template_102 # This must be a valid template name create_additional_policy: true # Create a policy if it already exists - description: 102 - No piority given + description: 102 - false piority given - switch: - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 4' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 4' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 4' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 4' # Assert for Create responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '"Success" in item["DATA"]["successList"][0]["status"]' + - ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"Success" in item["DATA"]["successList"][0]["status"]' when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 4' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 4' when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Query with template names matching multiple policies cisco.dcnm.dcnm_policy: @@ -212,14 +219,15 @@ state: query register: result - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 3' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["response"] | length) == 7' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 3' + - '(result["diff"][0]["deploy"] | length) == 0' + - '(result["response"] | length) == 7' - name: Query policies with policy ID cisco.dcnm.dcnm_policy: @@ -232,19 +240,20 @@ loop: '{{ query_policy_list }}' register: result - - assert: - that: - - 'item["changed"] == false' - - '(item["diff"][0]["merged"] | length) == 0' - - '(item["diff"][0]["deleted"] | length) == 0' - - '(item["diff"][0]["query"] | length) == 1' - - '(item["diff"][0]["deploy"] | length) == 0' - - '(item["response"] | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["changed"] == false' + - '(item["diff"][0]["merged"] | length) == 0' + - '(item["diff"][0]["deleted"] | length) == 0' + - '(item["diff"][0]["query"] | length) == 1' + - '(item["diff"][0]["deploy"] | length) == 0' + - '(item["response"] | length) == 1' loop: '{{ result.results }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -259,10 +268,10 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_sanity.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_sanity.yaml index f61b3bd13..53ff04828 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_sanity.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_sanity.yaml @@ -21,19 +21,20 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' tags: sanity - tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create different non-existing policies cisco.dcnm.dcnm_policy: &dcnm_pol @@ -47,7 +48,7 @@ - name: template_102 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists - description: 102 - No piority given + description: 102 - false priority given - name: template_103 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists @@ -56,16 +57,17 @@ - switch: - ip: "{{ ansible_switch1 }}" - policies: - - name: template_104 # This must be a valid template name - create_additional_policy: false # Do not create a policy if it already exists + policies: + - name: template_104 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists - - name: template_105 # This must be a valid template name - create_additional_policy: false # Do not create a policy if it already exists + - name: template_105 # This must be a valid template name + create_additional_policy: false # Do not create a policy if it already exists - ip: "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -74,7 +76,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -84,34 +86,35 @@ index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 5' when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: SANITY- Setting fact - set_fact: + ansible.builtin.set_fact: modify_policy_list: "{{ ( modify_policy_list | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: SANITY- Show the policy_list information - debug: + ansible.builtin.debug: var: modify_policy_list - name: SANITY- Setting fact - set_fact: + ansible.builtin.set_fact: list_len: "{{ modify_policy_list | length }}" -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: SANITY- Query all policies from the specified switches cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" @@ -121,14 +124,15 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) != 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["response"] | length) != 0' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) != 0' + - '(result["diff"][0]["deploy"] | length) == 0' + - '(result["response"] | length) != 0' - name: SANITY- Query specific policies cisco.dcnm.dcnm_policy: @@ -144,18 +148,19 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 5' - - '(result["diff"][0]["deploy"] | length) == 0' - - '(result["response"] | length) == 5' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 5' + - '(result["diff"][0]["deploy"] | length) == 0' + - '(result["response"] | length) == 5' -############################################## -## MODIFY ## -############################################## + ############################################## + ## MODIFY ## + ############################################## - name: SANITY- Modify existing policy using template name - should create the policy cisco.dcnm.dcnm_policy: @@ -171,13 +176,14 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 1' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 1' - name: SANITY- Modify policies - using policy IDs cisco.dcnm.dcnm_policy: @@ -191,40 +197,43 @@ - ip: "{{ ansible_switch1 }}" loop: '{{ modify_policy_list }}' loop_control: - index_var: my_idx + index_var: my_idx register: result # Assert for description being non-empty - - assert: - that: - - 'item["description"] != ""' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["description"] != ""' when: (my_idx < (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0]["diff"][0]["merged"] }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for Create responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' when: (my_idx < (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0].response }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' when: (my_idx == (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0].response }}' loop_control: - index_var: my_idx + index_var: my_idx -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -239,10 +248,10 @@ - name: template_104 # This can either be a policy name like POLICY-xxxxx or template name - name: template_105 # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_with_vars_merge.yaml b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_with_vars_merge.yaml index 66c20fb29..c30d6564b 100644 --- a/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_with_vars_merge.yaml +++ b/tests/integration/targets/dcnm_policy/tests/dcnm/dcnm_policy_with_vars_merge.yaml @@ -15,17 +15,18 @@ - ip: "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create policy without including required variables cisco.dcnm.dcnm_policy: @@ -40,14 +41,15 @@ - switch: - ip: "{{ ansible_switch1 }}" register: result - ignore_errors: yes + ignore_errors: true # Assert for Create responses - - assert: - that: - - 'result["msg"]["RETURN_CODE"] != 200' - - '"OSPF_TAG" in result["msg"]["DATA"]["failureList"][0]["message"]' - - '"LOOPBACK_IP" in result["msg"]["DATA"]["failureList"][0]["message"]' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result["msg"]["RETURN_CODE"] != 200' + - '"OSPF_TAG" in result["msg"]["DATA"]["failureList"][0]["message"]' + - '"LOOPBACK_IP" in result["msg"]["DATA"]["failureList"][0]["message"]' - name: Create multiple policies including required variables with the same template cisco.dcnm.dcnm_policy: @@ -73,16 +75,17 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 2' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 2' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 2' # Assert for Create responses - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -92,14 +95,15 @@ index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 2' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 2' when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Create additional policies including required variables with the same template but different priority and description cisco.dcnm.dcnm_policy: @@ -127,48 +131,50 @@ - ip: "{{ ansible_switch1 }}" register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 2' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 2' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 2' # Assert for Create responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '"Success" in item["DATA"]["successList"][0]["status"]' + - ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"Success" in item["DATA"]["successList"][0]["status"]' when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) >= 2' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) >= 2' when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Setting fact - set_fact: + ansible.builtin.set_fact: mergev_policy_list: "{{ (mergev_policy_list | default([])) + [item['DATA']['successList'][0]['message'].split(' ')[0]] }}" when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: - index_var: my_idx + index_var: my_idx - name: Show the policy_list information - debug: + ansible.builtin.debug: var: mergev_policy_list - name: Setting fact - set_fact: + ansible.builtin.set_fact: list_len: "{{ mergev_policy_list | length }}" - name: Modify policy with variables - using policy IDs @@ -188,31 +194,33 @@ loop: '{{ mergev_policy_list }}' loop_control: - index_var: my_idx + index_var: my_idx register: result # Assert for Create responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' when: (my_idx < (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0].response }}' loop_control: - index_var: my_idx + index_var: my_idx # Assert for deploy responses - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' when: (my_idx == (result.results[0]["diff"][0]["merged"] | length)) loop: '{{ result.results[0].response }}' loop_control: - index_var: my_idx + index_var: my_idx -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -223,10 +231,10 @@ config: - name: my_base_ospf # This can either be a policy name like POLICY-xxxxx or template name - switch: - - ip: "{{ ansible_switch1 }}" + - ip: "{{ ansible_switch1 }}" register: result - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - 'item["MESSAGE"] == "OK"' diff --git a/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml b/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml index a92ff1618..e7e82086e 100644 --- a/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tasks/dcnm.yaml @@ -1,23 +1,25 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml index 78c5fb834..ca7cc9a10 100644 --- a/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tasks/main.yaml @@ -1,2 +1,5 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include tasks + ansible.builtin.include_tasks: + ansible.builtin.file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_delete.yaml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_delete.yaml index 5a3d36757..c2ebb64b7 100644 --- a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_delete.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_delete.yaml @@ -24,7 +24,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" @@ -32,7 +32,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" @@ -45,27 +45,28 @@ pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" # A unique name to identify the resource pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Resources cisco.dcnm.dcnm_resource_manager: &rm_merge @@ -88,7 +89,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" # provide the switch information to which the given resource is to be attached - "{{ ansible_switch2 }}" # provide the switch information to which the given resource is to be attached resource: "200" # The value of the resource being created @@ -97,7 +98,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" # provide the switch information to which the given resource is to be attached - "{{ ansible_switch2 }}" # provide the switch information to which the given resource is to be attached resource: "500" # The value of the resource being created @@ -112,7 +113,7 @@ pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" # provide the switch information to which the given resource is to be attached resource: "fe:80::04" # The value of the resource being created @@ -120,65 +121,71 @@ pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" resource: "fe:80:0505::05/64" # The value of the resource being created register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 9' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["response"] | length) == 9' - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete Resources cisco.dcnm.dcnm_resource_manager: *rm_delete register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 9' - '(result["response"][0]["DATA"]["successList"] | length) == 9' - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Delete Resources - Idempotence cisco.dcnm.dcnm_resource_manager: *rm_delete register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' -############################################## -## MISSING PARAMS IN DELETE ## -############################################## + ############################################## + ## MISSING PARAMS IN DELETE ## + ############################################## - name: Delete Resources - scope_type missing cisco.dcnm.dcnm_resource_manager: @@ -187,15 +194,16 @@ config: - entity_name: "l3_vni_fabric" # A unique name to identify the resource register: result - ignore_errors: yes + ignore_errors: true - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''scope_type'' missing"' -############################################## -## MISSING PARAMS IN DELETE ## -############################################## + ############################################## + ## MISSING PARAMS IN DELETE ## + ############################################## - name: Delete Resources - pool_type missing cisco.dcnm.dcnm_resource_manager: @@ -204,15 +212,16 @@ config: - scope_type: "fabric" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''pool_type'' missing"' - ############################################## -## MISSING PARAMS IN DELETE ## -############################################## + ############################################## + ## MISSING PARAMS IN DELETE ## + ############################################## - name: Delete Resources - entity_name missing cisco.dcnm.dcnm_resource_manager: @@ -220,18 +229,19 @@ fabric: "{{ ansible_it_fabric }}" config: - pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] - pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name - scope_type: "fabric" + pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name + scope_type: "fabric" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''entity_name'' missing"' -############################################## -## MISSING PARAMS IN DELETE ## -############################################## + ############################################## + ## MISSING PARAMS IN DELETE ## + ############################################## - name: Delete Resources - pool_name missing cisco.dcnm.dcnm_resource_manager: @@ -242,15 +252,16 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] scope_type: "fabric" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''pool_name'' missing"' -############################################## -## MISSING PARAMS IN DELETE ## -############################################## + ############################################## + ## MISSING PARAMS IN DELETE ## + ############################################## - name: Delete Resources - switch info missing cisco.dcnm.dcnm_resource_manager: @@ -258,13 +269,13 @@ fabric: "{{ ansible_it_fabric }}" config: - entity_name: "{{ ansible_sno_1 }}~{{ ansible_sno_2 }}" # A unique name to identify the resource - pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] - pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name - scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] + pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name + scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - '"switch : Required parameter not found" in result["msg"]' diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_invalid_params.yaml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_invalid_params.yaml index fa4fa65ee..2037dc6cf 100644 --- a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_invalid_params.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_invalid_params.yaml @@ -7,124 +7,124 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Resources - Invalid Pool type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "l3_vni_fabric" # A unique name to identify the resource pool_type: "IDLE" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "L3_VNI" # Based on the 'poolType', select appropriate name - scope_type: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + scope_type: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] resource: "101" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - Invalid Pool Name cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "l3_vni_fabric" # A unique name to identify the resource pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "WRONG_POOL" # Based on the 'poolType', select appropriate name - scope_type: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + scope_type: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] resource: "101" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - L3 VNI wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "l3_vni_fabric" # A unique name to identify the resource pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "L3_VNI" # Based on the 'poolType', select appropriate name - scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] resource: "102" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - L2VNI - wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "l2_vni_fabric" # A unique name to identify the resource pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "L2_VNI" # Based on the 'poolType', select appropriate name - scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] resource: "102" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - LOOPBACK_ID wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "loopback_dev" # A unique name to identify the resource pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name - scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached - - "{{ ansible_switch1 }}" - - "{{ ansible_switch2 }}" + scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + switch: # provide the switch information to which the given resource is to be attached + - "{{ ansible_switch1 }}" + - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - VPC_ID wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "{{ ansible_sno_1 }}~{{ ansible_sno_2 }}" # A unique name to identify the resource pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name - scope_type: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached - - "{{ ansible_switch1 }}" - - "{{ ansible_switch2 }}" + scope_type: "fabric" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + switch: # provide the switch information to which the given resource is to be attached + - "{{ ansible_switch1 }}" + - "{{ ansible_switch2 }}" resource: "500" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - LOOPBACK0_IP_POOL wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "mmudigon-2" # A unique name to identify the resource pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK0_IP_POOL" # Based on the 'poolType', select appropriate name - scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] resource: "110.1.1.1" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - LOOPBACK1_IP_POOL wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_10 }}" # A unique name to identify the resource pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name - scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached - - "{{ ansible_switch1 }}" + scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + switch: # provide the switch information to which the given resource is to be attached + - "{{ ansible_switch1 }}" resource: "fe:80::04" # The value of the resource being created - ignore_errors: yes + ignore_errors: true - name: Create Resources - SUBNET wrong scope type cisco.dcnm.dcnm_resource_manager: state: merged # choose form [merged, deleted, query] - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" config: - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" # A unique name to identify the resource pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name - scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached - - "{{ ansible_switch1 }}" + scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] + switch: # provide the switch information to which the given resource is to be attached + - "{{ ansible_switch1 }}" resource: "fe:80:0505::05/64" # The value of the resource being created - ignore_errors: yes + ignore_errors: true diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml index daf3ded9e..5a7d98be0 100644 --- a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_merge.yaml @@ -56,16 +56,16 @@ - "{{ ansible_switch1 }}" register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Resources cisco.dcnm.dcnm_resource_manager: &rm_merge @@ -125,41 +125,41 @@ resource: "fe:80:0505::05/64" # The value of the resource being created register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 9' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["response"] | length) == 9' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## IDEMPOTENCE ## -############################################## + ############################################## + ## IDEMPOTENCE ## + ############################################## - name: Create Resources - Idempotence cisco.dcnm.dcnm_resource_manager: *rm_merge register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MODIFY EXISTING RESOURCES ## -############################################## + ############################################## + ## MODIFY EXISTING RESOURCES ## + ############################################## - name: Modify Resources cisco.dcnm.dcnm_resource_manager: @@ -219,21 +219,21 @@ resource: "fe:81:0505::05/64" # The value of the resource being modified register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 9' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["response"] | length) == 9' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE - MISSING PARAMS ## -############################################## + ############################################## + ## MERGE - MISSING PARAMS ## + ############################################## - name: Create Resources - Missing switch info cisco.dcnm.dcnm_resource_manager: @@ -246,9 +246,9 @@ scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] resource: "200" # The value of the resource being created register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - '"switch : Required parameter not found" in result["msg"]' @@ -265,9 +265,9 @@ - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''scope_type'' missing"' @@ -284,9 +284,9 @@ - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''pool_type'' missing"' @@ -303,9 +303,9 @@ - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''pool_name'' missing"' @@ -322,9 +322,9 @@ - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - 'result["msg"] == "Mandatory parameter ''entity_name'' missing"' @@ -341,15 +341,15 @@ - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" register: result - ignore_errors: yes + ignore_errors: true - - assert: + - ansible.builtin.assert: that: - '"resource : Required parameter not found" in result["msg"]' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -358,7 +358,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -366,7 +366,7 @@ - '(result["response"][0]["DATA"]["successList"] | length) == 9' when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_query.yaml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_query.yaml index 8591b2646..c9e9d08e5 100644 --- a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_query.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_query.yaml @@ -24,7 +24,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" @@ -32,7 +32,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" @@ -45,27 +45,28 @@ pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" # A unique name to identify the resource pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Resources cisco.dcnm.dcnm_resource_manager: &rm_merge @@ -88,7 +89,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created @@ -97,7 +98,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" resource: "500" # The value of the resource being created @@ -112,7 +113,7 @@ pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" resource: "fe:80::04" # The value of the resource being created @@ -120,39 +121,42 @@ pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" resource: "fe:80:0505::05/64" # The value of the resource being created register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 9' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["response"] | length) == 9' - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - - name: Query all Resources - no filters + - name: Query all Resources - false filters cisco.dcnm.dcnm_resource_manager: state: query # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - '(result["response"] | length) != 0' - name: Creating entity_names - set_fact: + ansible.builtin.set_fact: entity_names: - "l3_vni_fabric" - "l2_vni_fabric" @@ -181,7 +185,8 @@ register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["entityName"] in {{ entity_names }}' loop: '{{ result.response }}' @@ -191,11 +196,12 @@ state: query # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" config: - - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["ipAddress"] == "{{ ansible_switch1 }}"' loop: '{{ result.response }}' @@ -205,11 +211,12 @@ state: query # choose form [merged, deleted, query] fabric: "{{ ansible_it_fabric }}" config: - - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch2 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["ipAddress"] == "{{ ansible_switch2 }}"' loop: '{{ result.response }}' @@ -230,11 +237,11 @@ - pool_name: "SUBNET" # Based on the 'poolType', select appropriate name register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["resourcePool"]["fabricName"] == "{{ ansible_it_fabric }}"' - - 'item["resourcePool"]["poolName"] in [ - "BGP_ASN_ID", + - 'item["resourcePool"]["poolName"] in ["BGP_ASN_ID", "L3_VNI", "L2_VNI", "LOOPBACK_ID", @@ -242,8 +249,7 @@ "VPC_ID", "LOOPBACK0_IP_POOL", "LOOPBACK1_IP_POOL", - "SUBNET" - ]' + "SUBNET"]' loop: '{{ result.response }}' - name: Query Resources - filter by switch and pool name @@ -252,35 +258,36 @@ fabric: "{{ ansible_it_fabric }}" config: - pool_name: "BGP_ASN_ID" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "L3_VNI" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "L2_VNI" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "VPC_PEER_LINK_VLAN" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "LOOPBACK0_IP_POOL" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - pool_name: "SUBNET" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["ipAddress"] == "{{ ansible_switch1 }}"' loop: '{{ result.response }}' @@ -291,41 +298,44 @@ fabric: "{{ ansible_it_fabric }}" config: - entity_name: "l2_vni_fabric" # A unique name to identify the resource - - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch2 }}" - pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name - pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name - switch: # provide the switch information to which the given resource is attached + - switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - '(result["response"] | length) != 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: Delete Resources cisco.dcnm.dcnm_resource_manager: *rm_delete register: result - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 9' - '(result["response"][0]["DATA"]["successList"] | length) == 9' - when: IT_CONTEXT is not defined + when: it_context is not defined - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_sanity.yaml b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_sanity.yaml index 6b634bd37..b91196b6b 100644 --- a/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_sanity.yaml +++ b/tests/integration/targets/dcnm_resource_manager/tests/dcnm/dcnm_res_manager_sanity.yaml @@ -5,7 +5,7 @@ - name: SANITY- Remove local log file local_action: command rm -f res_mgr.log tags: sanity - + - name: SANITY- Delete Resources cisco.dcnm.dcnm_resource_manager: &rm_delete state: deleted # choose form [merged, deleted, query] @@ -25,7 +25,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" @@ -33,7 +33,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" @@ -46,30 +46,31 @@ pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" # A unique name to identify the resource pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is attached + switch: # provide the switch information to which the given resource is attached - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' tags: sanity - tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create Resources cisco.dcnm.dcnm_resource_manager: &rm_merge @@ -92,7 +93,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK_ID" # Based on the 'poolType', select appropriate name scope_type: "device" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" resource: "200" # The value of the resource being created @@ -101,7 +102,7 @@ pool_type: "ID" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "VPC_ID" # Based on the 'poolType', select appropriate name scope_type: "device_pair" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" - "{{ ansible_switch2 }}" resource: "500" # The value of the resource being created @@ -116,7 +117,7 @@ pool_type: "IP" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "LOOPBACK1_IP_POOL" # Based on the 'poolType', select appropriate name scope_type: "device_interface" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" resource: "fe:80::04" # The value of the resource being created @@ -124,49 +125,52 @@ pool_type: "SUBNET" # choose from ['ID', 'IP', 'SUBNET'] pool_name: "SUBNET" # Based on the 'poolType', select appropriate name scope_type: "link" # choose from ['fabric', 'device', device_interface', 'device_pair', 'link'] - switch: # provide the switch information to which the given resource is to be attached + switch: # provide the switch information to which the given resource is to be attached - "{{ ansible_switch1 }}" resource: "fe:80:0505::05/64" # The value of the resource being created register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 9' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["response"] | length) == 9' - - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 9' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["response"] | length) == 9' + + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - - name: SANITY- Query all Resources - no filters + - name: SANITY- Query all Resources - false filters cisco.dcnm.dcnm_resource_manager: - state: query # choose form [merged, deleted, query] + state: query fabric: "{{ ansible_it_fabric }}" register: result - - assert: - that: - - '(result["response"] | length) != 0' + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - '(result["response"] | length) != 0' - name: SANITY- Creating entity_names - set_fact: - entity_names: - - "l3_vni_fabric" - - "l2_vni_fabric" - - "loopback_dev" - - "{{ ansible_sno_1 }}~{{ ansible_sno_2 }}" - - "{{ ansible_sno_2 }}~{{ ansible_sno_1 }}" - - "{{ ansible_sno_1 }}~{{ intf_1_10 }}" - - "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" - - "{{ ansible_sno_2 }}~{{ intf_1_3 }}~{{ ansible_sno_1 }}~{{ intf_1_3 }}" - - "mmudigon-2" + ansible.builtin.set_fact: + entity_names: + - "l3_vni_fabric" + - "l2_vni_fabric" + - "loopback_dev" + - "{{ ansible_sno_1 }}~{{ ansible_sno_2 }}" + - "{{ ansible_sno_2 }}~{{ ansible_sno_1 }}" + - "{{ ansible_sno_1 }}~{{ intf_1_10 }}" + - "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" + - "{{ ansible_sno_2 }}~{{ intf_1_3 }}~{{ ansible_sno_1 }}~{{ intf_1_3 }}" + - "mmudigon-2" - name: SANITY- Query Resources - filter by entity name cisco.dcnm.dcnm_resource_manager: @@ -182,37 +186,38 @@ - entity_name: "mmudigon-2" # A unique name to identify the resource - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_2 }}" # A unique name to identify the resource - entity_name: "{{ ansible_sno_1 }}~{{ intf_1_3 }}~{{ ansible_sno_2 }}~{{ intf_1_3 }}" # A unique name to identify the resource - register: result - - assert: + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["entityName"] in {{ entity_names }}' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - name: SANITY- Delete Resources cisco.dcnm.dcnm_resource_manager: *rm_delete register: result - when: IT_CONTEXT is not defined - - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 9' - - '(result["response"][0]["DATA"]["successList"] | length) == 9' - when: IT_CONTEXT is not defined - - - assert: + when: it_context is not defined + + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 9' + - '(result["response"][0]["DATA"]["successList"] | length) == 9' + when: it_context is not defined + + - name: ASSERT - Check condition + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined + when: it_context is not defined diff --git a/tests/integration/targets/dcnm_service_node/defaults/main.yaml b/tests/integration/targets/dcnm_service_node/defaults/main.yaml index 55a93fc23..5f709c5aa 100644 --- a/tests/integration/targets/dcnm_service_node/defaults/main.yaml +++ b/tests/integration/targets/dcnm_service_node/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "*" \ No newline at end of file +testcase: "*" diff --git a/tests/integration/targets/dcnm_service_node/meta/main.yaml b/tests/integration/targets/dcnm_service_node/meta/main.yaml index 5514b6a40..32cf5dda7 100644 --- a/tests/integration/targets/dcnm_service_node/meta/main.yaml +++ b/tests/integration/targets/dcnm_service_node/meta/main.yaml @@ -1 +1 @@ -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml b/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml index 0b3e57db2..73b00c62c 100644 --- a/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_service_node/tasks/dcnm.yaml @@ -1,23 +1,25 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ dcnm }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }} ansible_connection=httpapi connection={{ dcnm }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_service_node/tasks/main.yaml b/tests/integration/targets/dcnm_service_node/tasks/main.yaml index e2c92c5f8..34f74092e 100644 --- a/tests/integration/targets/dcnm_service_node/tasks/main.yaml +++ b/tests/integration/targets/dcnm_service_node/tasks/main.yaml @@ -1,6 +1,7 @@ --- -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "Unable to determine controller version" tags: sanity @@ -9,13 +10,14 @@ method: GET path: /appcenter/cisco/ndfc/api/about/version register: result - ignore_errors: yes + failed_when: false tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false tags: sanity - name: Determine version of DCNM or NDFC @@ -23,19 +25,24 @@ method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false tags: sanity # No need to continue if we cannot determine the DCNM/NDFC controller version -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'controller_version != "Unable to determine controller version"' + - 'controller_version != "Unable to determine controller version"' tags: sanity -- { include: dcnm.yaml, tags: ['dcnm'] } +- name: Include tasks + ansible.builtin.include_tasks: + ansible.builtin.file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/deleted.yaml b/tests/integration/targets/dcnm_service_node/tests/dcnm/deleted.yaml index d2af4e4d0..3513ac63d 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/deleted.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/deleted.yaml @@ -2,12 +2,14 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version >= "12" @@ -18,9 +20,10 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: DELETED - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: @@ -28,9 +31,10 @@ path: "{{ rest_ext_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: DELETED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -56,31 +60,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 ############################################### @@ -93,44 +98,48 @@ service_fabric: "{{ ansible_ext_fabric }}" state: deleted config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == ""' - when: controller_version == "11" + - 'result.response[0].MESSAGE == ""' + when: controller_version == "11" -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == "OK"' - when: controller_version == "12" + - 'result.response[0].MESSAGE == "OK"' + when: controller_version == "12" - name: DELETED - sleep for 40 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 40 - name: DELETED - conf - Idempotence cisco.dcnm.dcnm_service_node: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' - - 'result.diff|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' + - 'result.diff|length == 0' - name: DELETED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: @@ -150,30 +159,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 - name: DELETED - Delete Service Node with single switch @@ -182,43 +192,47 @@ service_fabric: "{{ ansible_ext_fabric }}" state: deleted config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == ""' - when: controller_version == "11" + - 'result.response[0].MESSAGE == ""' + when: controller_version == "11" -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == "OK"' - when: controller_version >= "12" + - 'result.response[0].MESSAGE == "OK"' + when: controller_version >= "12" - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 - name: DELETED - conf1 - Idempotence cisco.dcnm.dcnm_service_node: *conf1 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' - - 'result.diff|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' + - 'result.diff|length == 0' - name: DELETED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: @@ -238,31 +252,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 - name: DELETED - Delete Service Node - WITHOUT ANY CONFIG ELEMENT @@ -271,34 +286,38 @@ service_fabric: "{{ ansible_ext_fabric }}" state: deleted -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == ""' - when: controller_version == "11" + - 'result.response[0].MESSAGE == ""' + when: controller_version == "11" -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == "OK"' - when: controller_version >= "12" + - 'result.response[0].MESSAGE == "OK"' + when: controller_version >= "12" - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 - name: DELETED - conf2 - Idempotence cisco.dcnm.dcnm_service_node: *conf2 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' - - 'result.diff|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' + - 'result.diff|length == 0' - name: DELETED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: @@ -318,30 +337,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 - name: DELETED - Delete Service Node - WITHOUT ANY CONFIG ELEMENT @@ -350,34 +370,38 @@ service_fabric: "{{ ansible_ext_fabric }}" state: deleted -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == ""' - when: controller_version == "11" + - 'result.response[0].MESSAGE == ""' + when: controller_version == "11" -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == "OK"' - when: controller_version >= "12" + - 'result.response[0].MESSAGE == "OK"' + when: controller_version >= "12" - name: DELETED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 - name: DELETED - conf3 - Idempotence cisco.dcnm.dcnm_service_node: *conf3 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' - - 'result.diff|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' + - 'result.diff|length == 0' ################################################ #### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/merged.yaml b/tests/integration/targets/dcnm_service_node/tests/dcnm/merged.yaml index f79ac8a7f..223e4b769 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/merged.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/merged.yaml @@ -18,9 +18,9 @@ path: "{{ rest_path }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: MERGED - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: @@ -28,9 +28,9 @@ path: "{{ rest_ext_path }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -60,36 +60,36 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf - Idempotence cisco.dcnm.dcnm_service_node: *conf register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -115,36 +115,36 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf1 - Idempotence cisco.dcnm.dcnm_service_node: *conf1 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -170,36 +170,36 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: load_balancer - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: load_balancer + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "ADC"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "ADC"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf2 - Idempotence cisco.dcnm.dcnm_service_node: *conf2 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -225,36 +225,36 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: virtual_network_function + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf3 - Idempotence cisco.dcnm.dcnm_service_node: *conf3 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -280,37 +280,37 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf - Idempotence cisco.dcnm.dcnm_service_node: *conf4 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -324,37 +324,37 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: load_balancer - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: load_balancer + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "ADC"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "ADC"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf5 - Idempotence cisco.dcnm.dcnm_service_node: *conf5 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -368,37 +368,37 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - conf - Idempotence cisco.dcnm.dcnm_service_node: *conf6 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -411,28 +411,28 @@ fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -446,62 +446,62 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" - - name: SN-12 - type: firewall - form_factor: virtual - svc_int_name: svc2 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" - - name: SN-13 - type: load_balancer - form_factor: virtual - svc_int_name: svc3 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" + - name: SN-12 + type: firewall + form_factor: virtual + svc_int_name: svc2 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" + - name: SN-13 + type: load_balancer + form_factor: virtual + svc_int_name: svc3 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].DATA.formFactor == "Virtual"' - - 'result.response[1].DATA.interfaceName == "svc2"' - - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[1].DATA.type == "Firewall"' - - 'result.response[1].DATA.name == "SN-12"' - - 'result.response[2].RETURN_CODE == 200' - - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[2].DATA.formFactor == "Virtual"' - - 'result.response[2].DATA.interfaceName == "svc3"' - - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[2].DATA.type == "ADC"' - - 'result.response[2].DATA.name == "SN-13"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].DATA.formFactor == "Virtual"' + - 'result.response[1].DATA.interfaceName == "svc2"' + - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[1].DATA.type == "Firewall"' + - 'result.response[1].DATA.name == "SN-12"' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[2].DATA.formFactor == "Virtual"' + - 'result.response[2].DATA.interfaceName == "svc3"' + - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[2].DATA.type == "ADC"' + - 'result.response[2].DATA.name == "SN-13"' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -515,62 +515,62 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" - - name: SN-12 - type: firewall - form_factor: physical - svc_int_name: svc2 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" - - name: SN-13 - type: load_balancer - form_factor: physical - svc_int_name: svc3 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: virtual_network_function + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" + - name: SN-12 + type: firewall + form_factor: physical + svc_int_name: svc2 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" + - name: SN-13 + type: load_balancer + form_factor: physical + svc_int_name: svc3 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].DATA.formFactor == "Physical"' - - 'result.response[1].DATA.interfaceName == "svc2"' - - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[1].DATA.type == "Firewall"' - - 'result.response[1].DATA.name == "SN-12"' - - 'result.response[2].RETURN_CODE == 200' - - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[2].DATA.formFactor == "Physical"' - - 'result.response[2].DATA.interfaceName == "svc3"' - - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[2].DATA.type == "ADC"' - - 'result.response[2].DATA.name == "SN-13"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].DATA.formFactor == "Physical"' + - 'result.response[1].DATA.interfaceName == "svc2"' + - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[1].DATA.type == "Firewall"' + - 'result.response[1].DATA.name == "SN-12"' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[2].DATA.formFactor == "Physical"' + - 'result.response[2].DATA.interfaceName == "svc3"' + - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[2].DATA.type == "ADC"' + - 'result.response[2].DATA.name == "SN-13"' - name: MERGED - Clean up any existing service node cisco.dcnm.dcnm_service_node: @@ -584,21 +584,21 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc2 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc2 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result - ignore_errors: yes + ignore_errors: true when: controller_version == "11" -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' when: controller_version == "11" - name: MERGED - Create Service Node with 2 switches and invalid vpc name @@ -607,21 +607,21 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: vPortchannel12 - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: vPortchannel12 + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - '"if two switches are provided, vpc is only interface option" in result.msg' + - 'result.changed == false' + - '"if two switches are provided, vpc is only interface option" in result.msg' - name: MERGED - Create Service Node with 1 switch and valid vpc name cisco.dcnm.dcnm_service_node: @@ -629,20 +629,20 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - '"For 1 switch, vpc is not the interface option" in result.msg' + - 'result.changed == false' + - '"For 1 switch, vpc is not the interface option" in result.msg' - name: MERGED - Create Service Node with more than 2 switch and valid vpc name cisco.dcnm.dcnm_service_node: @@ -650,22 +650,22 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch1 }}" - - "{{ ansible_switch2 }}" - - "{{ ansible_switch4 }}" + - name: SN-11 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch1 }}" + - "{{ ansible_switch2 }}" + - "{{ ansible_switch4 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - '"Upto 2 switches only allowed" in result.msg' + - 'result.changed == false' + - '"Upto 2 switches only allowed" in result.msg' - name: MERGED - Create Service Node without required parameter cisco.dcnm.dcnm_service_node: @@ -673,20 +673,20 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - '"Required parameter not found" in result.msg' + - 'result.changed == false' + - '"Required parameter not found" in result.msg' - name: MERGED - Create Service Node with wrong type cisco.dcnm.dcnm_service_node: @@ -694,20 +694,20 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: karth - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: karth + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - '"Invalid choice provided" in result.msg' + - 'result.changed == false' + - '"Invalid choice provided" in result.msg' - name: MERGED - Create Service Node with wrong formfactor cisco.dcnm.dcnm_service_node: @@ -715,20 +715,20 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: not - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: not + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - '"Invalid choice provided" in result.msg' + - 'result.changed == false' + - '"Invalid choice provided" in result.msg' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/overridden.yaml b/tests/integration/targets/dcnm_service_node/tests/dcnm/overridden.yaml index bed6b71e3..438715650 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/overridden.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/overridden.yaml @@ -2,12 +2,14 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version >= "12" @@ -18,21 +20,23 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' -- name: OVERRIDDEN - Verify if service fabric is deployed. + - name: OVERRIDDEN - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_ext_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' -- name: OVERRIDDEN - Clean up any existing service node + - name: OVERRIDDEN - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -56,31 +60,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 ############################################### @@ -93,46 +98,48 @@ service_fabric: "{{ ansible_ext_fabric }}" state: overridden config: - - name: SN-12 - type: load_balancer - form_factor: physical - svc_int_name: svc12 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-12 + type: load_balancer + form_factor: physical + svc_int_name: svc12 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].METHOD == "DELETE"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].DATA.formFactor == "Physical"' - - 'result.response[1].DATA.interfaceName == "svc12"' - - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[1].DATA.type == "ADC"' - - 'result.response[1].DATA.name == "SN-12"' - -- name: OVERRIDDEN - sleep for 40 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].METHOD == "DELETE"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].DATA.formFactor == "Physical"' + - 'result.response[1].DATA.interfaceName == "svc12"' + - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[1].DATA.type == "ADC"' + - 'result.response[1].DATA.name == "SN-12"' + + - name: OVERRIDDEN - sleep for 40 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 40 - name: OVERRIDDEN - conf - Idempotence cisco.dcnm.dcnm_service_node: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' -- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: OVERRIDDEN - Clean up any existing service node @@ -159,46 +166,47 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc11 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: SN-12 - type: load_balancer - form_factor: virtual - svc_int_name: svc12 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch2 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc11 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: SN-12 + type: load_balancer + form_factor: virtual + svc_int_name: svc12 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch2 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc11"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].DATA.formFactor == "Virtual"' - - 'result.response[1].DATA.interfaceName == "svc12"' - - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[1].DATA.type == "ADC"' - - 'result.response[1].DATA.name == "SN-12"' - -- name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc11"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].DATA.formFactor == "Virtual"' + - 'result.response[1].DATA.interfaceName == "svc12"' + - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[1].DATA.type == "ADC"' + - 'result.response[1].DATA.name == "SN-12"' + + - name: OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: OVERRIDDEN - Create and Delete new service nodes @@ -207,62 +215,64 @@ service_fabric: "{{ ansible_ext_fabric }}" state: overridden config: - - name: SN-13 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc13 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: SN-14 - type: firewall - form_factor: virtual - svc_int_name: svc14 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch2 }}" + - name: SN-13 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc13 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: SN-14 + type: firewall + form_factor: virtual + svc_int_name: svc14 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch2 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].METHOD == "DELETE"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].METHOD == "DELETE"' - - 'result.response[2].RETURN_CODE == 200' - - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[2].DATA.formFactor == "Virtual"' - - 'result.response[2].DATA.interfaceName == "svc13"' - - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[2].DATA.type == "VNF"' - - 'result.response[2].DATA.name == "SN-13"' - - 'result.response[3].RETURN_CODE == 200' - - 'result.response[3].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[3].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[3].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[3].DATA.formFactor == "Virtual"' - - 'result.response[3].DATA.interfaceName == "svc14"' - - 'result.response[3].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[3].DATA.type == "Firewall"' - - 'result.response[3].DATA.name == "SN-14"' - -- name: OVERRIDDEN - sleep for 40 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].METHOD == "DELETE"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].METHOD == "DELETE"' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[2].DATA.formFactor == "Virtual"' + - 'result.response[2].DATA.interfaceName == "svc13"' + - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[2].DATA.type == "VNF"' + - 'result.response[2].DATA.name == "SN-13"' + - 'result.response[3].RETURN_CODE == 200' + - 'result.response[3].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[3].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[3].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[3].DATA.formFactor == "Virtual"' + - 'result.response[3].DATA.interfaceName == "svc14"' + - 'result.response[3].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[3].DATA.type == "Firewall"' + - 'result.response[3].DATA.name == "SN-14"' + + - name: OVERRIDDEN - sleep for 40 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 40 - name: OVERRIDDEN - conf1 - Idempotence cisco.dcnm.dcnm_service_node: *conf1 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' -- name: OVERRIDDEN - Clean up any existing service node + - name: OVERRIDDEN - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/query.yaml b/tests/integration/targets/dcnm_service_node/tests/dcnm/query.yaml index da9be5c12..ba8ee19c5 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/query.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/query.yaml @@ -2,12 +2,14 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version >= "12" @@ -18,21 +20,23 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' -- name: QUERY - Verify if service fabric is deployed. + - name: QUERY - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_ext_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' -- name: QUERY - Clean up any existing service node + - name: QUERY - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -56,31 +60,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 ############################################### @@ -93,30 +98,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: QUERY - Clean up any existing service node @@ -126,20 +132,23 @@ state: deleted register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == ""' - when: controller_version == "11" + - 'result.response[0].MESSAGE == ""' + when: controller_version == "11" -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response[0].MESSAGE == "OK"' - when: controller_version >= "12" + - 'result.response[0].MESSAGE == "OK"' + when: controller_version >= "12" - name: QUERY - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: @@ -147,7 +156,6 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query register: result - until: - 'result.response|length == 0' retries: 10 @@ -159,30 +167,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: QUERY - Query the - Create Service Node with single switch @@ -191,29 +200,30 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: QUERY - Query without the config element @@ -222,20 +232,21 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: QUERY - Clean up any existing service node @@ -262,47 +273,48 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: SN-12 - type: firewall - form_factor: virtual - svc_int_name: svc2 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: SN-12 + type: firewall + form_factor: virtual + svc_int_name: svc2 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].DATA.formFactor == "Virtual"' - - 'result.response[1].DATA.interfaceName == "svc2"' - - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[1].DATA.type == "Firewall"' - - 'result.response[1].DATA.name == "SN-12"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].DATA.formFactor == "Virtual"' + - 'result.response[1].DATA.interfaceName == "svc2"' + - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[1].DATA.type == "Firewall"' + - 'result.response[1].DATA.name == "SN-12"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: QUERY - Query the - Create Service Node with single/mutiple switch - 2 tasks @@ -311,45 +323,46 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: Ethernet1/1 - switches: - - "{{ ansible_switch1 }}" - - name: SN-12 - type: firewall - form_factor: virtual - svc_int_name: svc2 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: Ethernet1/1 + switches: + - "{{ ansible_switch1 }}" + - name: SN-12 + type: firewall + form_factor: virtual + svc_int_name: svc2 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' - - 'result.response[1].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[1].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].formFactor == "Virtual"' - - 'result.response[1].interfaceName == "svc2"' - - 'result.response[1].linkTemplateName == "service_link_trunk"' - - 'result.response[1].type == "Firewall"' - - 'result.response[1].name == "SN-12"' - -- name: QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' + - 'result.response[1].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[1].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].formFactor == "Virtual"' + - 'result.response[1].interfaceName == "svc2"' + - 'result.response[1].linkTemplateName == "service_link_trunk"' + - 'result.response[1].type == "Firewall"' + - 'result.response[1].name == "SN-12"' + + - name: QUERY - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: QUERY - Query without the config element - 2 tasks @@ -358,27 +371,28 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' - - 'result.response[1].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[1].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].formFactor == "Virtual"' - - 'result.response[1].interfaceName == "svc2"' - - 'result.response[1].linkTemplateName == "service_link_trunk"' - - 'result.response[1].type == "Firewall"' - - 'result.response[1].name == "SN-12"' - -- name: QUERY - Clean up any existing service node + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' + - 'result.response[1].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[1].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].formFactor == "Virtual"' + - 'result.response[1].interfaceName == "svc2"' + - 'result.response[1].linkTemplateName == "service_link_trunk"' + - 'result.response[1].type == "Firewall"' + - 'result.response[1].name == "SN-12"' + + - name: QUERY - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -390,19 +404,20 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query config: - - name: SN-11111111 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11111111 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/replaced.yaml b/tests/integration/targets/dcnm_service_node/tests/dcnm/replaced.yaml index 332be3465..63115b856 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/replaced.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/replaced.yaml @@ -2,12 +2,14 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version >= "12" @@ -18,21 +20,23 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' -- name: REPLACED - Verify if service fabric is deployed. + - name: REPLACED - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_ext_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' -- name: REPLACED - Clean up any existing service node + - name: REPLACED - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -56,31 +60,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 ############################################### @@ -93,43 +98,45 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 40 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 40 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 40 - name: REPLACED - conf - Idempotence cisco.dcnm.dcnm_service_node: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: REPLACED - Replace Service Node with form factor virtual @@ -138,42 +145,44 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_vpc1 }}" - switches: - - "{{ ansible_switch4 }}" - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_vpc1 }}" + switches: + - "{{ ansible_switch4 }}" + - "{{ ansible_switch5 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 40 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_vpc1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 40 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 40 - name: REPLACED - conf1 - Idempotence cisco.dcnm.dcnm_service_node: *conf1 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' -- name: REPLACED - Clean up any existing service node + - name: REPLACED - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -197,30 +206,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch4 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: REPLACED - Replace Service Node with form factor physical @@ -229,42 +239,44 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch4 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: REPLACED - conf2 - Idempotence cisco.dcnm.dcnm_service_node: *conf2 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: REPLACED - Replace Service Node with type load balancer @@ -273,30 +285,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: load_balancer - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: load_balancer + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch4 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "ADC"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "ADC"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: REPLACED - Replace Service Node with type virtual network function @@ -305,30 +318,31 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: virtual_network_function - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: virtual_network_function + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch4 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' - -- name: REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' + + - name: REPLACED - sleep for 20 seconds for DCNM to completely update the state + ansible.builtin.wait_for: timeout: 20 - name: REPLACED - Replace Service Node with a new creation of service node, since the sn is not created already @@ -337,88 +351,92 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11111111111 - type: firewall - form_factor: physical - svc_int_name: svc11 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11111111111 + type: firewall + form_factor: physical + svc_int_name: svc11 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch4 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc11"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11111111111"' - -- name: REPLACED - Replace Service Node with not supported change of already created svc int name + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc11"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11111111111"' + + - name: REPLACED - Replace Service Node with not supported change of already created svc int name cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc111111111 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc111111111 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch4 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' -- name: REPLACED - Replace Service Node with not supported change of already created attach interface + - name: REPLACED - Replace Service Node with not supported change of already created attach interface cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc11 - attach_interface: "{{ ansible_int2 }}" - switches: - - "{{ ansible_switch4 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc11 + attach_interface: "{{ ansible_int2 }}" + switches: + - "{{ ansible_switch4 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' -- name: REPLACED - Replace Service Node with not supported change of already created attached switch + - name: REPLACED - Replace Service Node with not supported change of already created attached switch cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc11 - attach_interface: "{{ ansible_int2 }}" - switches: - - "{{ ansible_switch5 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc11 + attach_interface: "{{ ansible_int2 }}" + switches: + - "{{ ansible_switch5 }}" register: result - ignore_errors: yes + ignore_errors: true -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml index aa7ddce85..beab3a651 100644 --- a/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_service_node/tests/dcnm/sanity.yaml @@ -2,13 +2,15 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version == "11" tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_it_fabric }}" rest_ext_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ ansible_ext_fabric }}" when: controller_version >= "12" @@ -21,10 +23,11 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' - tags: sanity + - 'result.response.DATA != None' + tags: sanity - name: SANITY- REPLACED - Verify if service fabric is deployed. cisco.dcnm.dcnm_rest: @@ -33,17 +36,18 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' - tags: sanity + - 'result.response.DATA != None' + tags: sanity - name: SANITY- REPLACED - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" state: deleted - tags: sanity + tags: sanity - name: SANITY- REPLACED - Query fabric state before proceeding cisco.dcnm.dcnm_service_node: @@ -68,32 +72,33 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' tags: sanity - name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -103,31 +108,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' - name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -136,9 +142,10 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' + - 'result.changed == false' tags: sanity - name: SANITY- REPLACED - Replace Service Node with type load balancer @@ -147,32 +154,33 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: load_balancer - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: load_balancer + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "ADC"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "ADC"' + - 'result.response[0].DATA.name == "SN-11"' tags: sanity - name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -182,32 +190,33 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11 - type: virtual_network_function - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: virtual_network_function + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "VNF"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "VNF"' + - 'result.response[0].DATA.name == "SN-11"' tags: sanity - name: SANITY- REPLACED - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -217,31 +226,32 @@ service_fabric: "{{ ansible_ext_fabric }}" state: replaced config: - - name: SN-11111111111 - type: firewall - form_factor: physical - svc_int_name: svc11 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11111111111 + type: firewall + form_factor: physical + svc_int_name: svc11 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result - ignore_errors: yes + ignore_errors: true tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Physical"' - - 'result.response[0].DATA.interfaceName == "svc11"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11111111111"' - -- name: SANITY- REPLACED - Clean up any existing service node + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Physical"' + - 'result.response[0].DATA.interfaceName == "svc11"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11111111111"' + + - name: SANITY- REPLACED - Clean up any existing service node cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_ext_fabric }}" @@ -271,48 +281,49 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc11 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: SN-12 - type: load_balancer - form_factor: virtual - svc_int_name: svc12 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch2 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc11 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: SN-12 + type: load_balancer + form_factor: virtual + svc_int_name: svc12 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch2 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc11"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[1].DATA.formFactor == "Virtual"' - - 'result.response[1].DATA.interfaceName == "svc12"' - - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[1].DATA.type == "ADC"' - - 'result.response[1].DATA.name == "SN-12"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc11"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[1].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[1].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[1].DATA.formFactor == "Virtual"' + - 'result.response[1].DATA.interfaceName == "svc12"' + - 'result.response[1].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[1].DATA.type == "ADC"' + - 'result.response[1].DATA.name == "SN-12"' tags: sanity - name: SANITY- OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -322,52 +333,53 @@ service_fabric: "{{ ansible_ext_fabric }}" state: overridden config: - - name: SN-13 - type: virtual_network_function - form_factor: virtual - svc_int_name: svc13 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: SN-14 - type: firewall - form_factor: virtual - svc_int_name: svc14 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch2 }}" + - name: SN-13 + type: virtual_network_function + form_factor: virtual + svc_int_name: svc13 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: SN-14 + type: firewall + form_factor: virtual + svc_int_name: svc14 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch2 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].METHOD == "DELETE"' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[1].METHOD == "DELETE"' - - 'result.response[2].RETURN_CODE == 200' - - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[2].DATA.formFactor == "Virtual"' - - 'result.response[2].DATA.interfaceName == "svc13"' - - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[2].DATA.type == "VNF"' - - 'result.response[2].DATA.name == "SN-13"' - - 'result.response[3].RETURN_CODE == 200' - - 'result.response[3].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[3].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[3].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[3].DATA.formFactor == "Virtual"' - - 'result.response[3].DATA.interfaceName == "svc14"' - - 'result.response[3].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[3].DATA.type == "Firewall"' - - 'result.response[3].DATA.name == "SN-14"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].METHOD == "DELETE"' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[1].METHOD == "DELETE"' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[2].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[2].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[2].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[2].DATA.formFactor == "Virtual"' + - 'result.response[2].DATA.interfaceName == "svc13"' + - 'result.response[2].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[2].DATA.type == "VNF"' + - 'result.response[2].DATA.name == "SN-13"' + - 'result.response[3].RETURN_CODE == 200' + - 'result.response[3].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[3].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[3].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[3].DATA.formFactor == "Virtual"' + - 'result.response[3].DATA.interfaceName == "svc14"' + - 'result.response[3].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[3].DATA.type == "Firewall"' + - 'result.response[3].DATA.name == "SN-14"' tags: sanity - name: SANITY- OVERRIDDEN - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -376,10 +388,11 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' tags: sanity - name: SANITY- OVERRIDDEN - Clean up any existing service node @@ -412,32 +425,33 @@ service_fabric: "{{ ansible_ext_fabric }}" state: merged config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].DATA.formFactor == "Virtual"' - - 'result.response[0].DATA.interfaceName == "svc1"' - - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' - - 'result.response[0].DATA.type == "Firewall"' - - 'result.response[0].DATA.name == "SN-11"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[0].DATA.attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].DATA.attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].DATA.fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].DATA.formFactor == "Virtual"' + - 'result.response[0].DATA.interfaceName == "svc1"' + - 'result.response[0].DATA.linkTemplateName == "service_link_trunk"' + - 'result.response[0].DATA.type == "Firewall"' + - 'result.response[0].DATA.name == "SN-11"' tags: sanity - name: SANITY- QUERY - sleep for 20 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 20 tags: sanity @@ -447,27 +461,28 @@ service_fabric: "{{ ansible_ext_fabric }}" state: query config: - - name: SN-11 - type: firewall - form_factor: virtual - svc_int_name: svc1 - attach_interface: "{{ ansible_int1 }}" - switches: - - "{{ ansible_switch1 }}" + - name: SN-11 + type: firewall + form_factor: virtual + svc_int_name: svc1 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' tags: sanity - name: SANITY- QUERY - Query without the config element @@ -477,17 +492,18 @@ state: query tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' - - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' - - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' - - 'result.response[0].formFactor == "Virtual"' - - 'result.response[0].interfaceName == "svc1"' - - 'result.response[0].linkTemplateName == "service_link_trunk"' - - 'result.response[0].type == "Firewall"' - - 'result.response[0].name == "SN-11"' + - 'result.changed == false' + - 'result.response[0].attachedFabricName == "{{ ansible_it_fabric }}"' + - 'result.response[0].attachedSwitchInterfaceName == "{{ ansible_int1 }}"' + - 'result.response[0].fabricName == "{{ ansible_ext_fabric }}"' + - 'result.response[0].formFactor == "Virtual"' + - 'result.response[0].interfaceName == "svc1"' + - 'result.response[0].linkTemplateName == "service_link_trunk"' + - 'result.response[0].type == "Firewall"' + - 'result.response[0].name == "SN-11"' tags: sanity - name: SANITY- QUERY - Clean up any existing service node diff --git a/tests/integration/targets/dcnm_service_policy/tasks/dcnm.yaml b/tests/integration/targets/dcnm_service_policy/tasks/dcnm.yaml index b1e812a1f..ee6035417 100644 --- a/tests/integration/targets/dcnm_service_policy/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_service_policy/tasks/dcnm.yaml @@ -1,42 +1,45 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run ############################################################ ## CLEANUP ## -############################################################ +############################################################ - name: Cleanup - Delete service policies cisco.dcnm.dcnm_service_policy: - fabric: "{{ ansible_it_fabric }}" - service_fabric: "{{ ansible_it_service_fabric }}" - state: deleted + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" + state: deleted register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Cleanup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 - name: Delete feature_pbr policy @@ -48,60 +51,63 @@ - switch: - ip: "{{ ansible_switch1 }}" -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Cleanup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 - name: Cleanup - Delete route peerings - cisco.dcnm.dcnm_service_route_peering: - fabric: "{{ ansible_it_fabric }}" - service_fabric: "{{ ansible_it_service_fabric }}" + cisco.dcnm.dcnm_service_route_peering: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" state: deleted register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Cleanup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 - name: Cleanup - Delete Service Nodes - cisco.dcnm.dcnm_service_node: + cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_it_service_fabric }}" state: deleted config: - - name: "{{ ansible_snode_1 }}" - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_att_intf1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: "{{ ansible_snode_2 }}" - type: load_balancer - form_factor: physical - svc_int_name: svc2 - attach_interface: "{{ ansible_att_intf2 }}" - switches: - - "{{ ansible_switch1 }}" + - name: "{{ ansible_snode_1 }}" + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_att_intf1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: "{{ ansible_snode_2 }}" + type: load_balancer + form_factor: virtual + svc_int_name: svc12 + attach_interface: "{{ ansible_int1 }}" + switches: + - "{{ ansible_switch2 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Cleanup - sleep for 40 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 40 - name: Cleanup - Delete Networks @@ -159,39 +165,41 @@ gw_ip_subnet: '42.42.42.1/24' register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Cleanup - sleep for 40 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 40 - name: Cleanup - Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" state: deleted config: - vrf_name: "{{ ansible_vrf_11 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_21 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_21 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_31 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_31 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_41 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_41 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - register: result + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_policy/tasks/main.yaml b/tests/integration/targets/dcnm_service_policy/tasks/main.yaml index 78c5fb834..ca7cc9a10 100644 --- a/tests/integration/targets/dcnm_service_policy/tasks/main.yaml +++ b/tests/integration/targets/dcnm_service_policy/tasks/main.yaml @@ -1,2 +1,5 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include tasks + ansible.builtin.include_tasks: + ansible.builtin.file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_delete.yaml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_delete.yaml index 5c45dffa4..e4646a5a5 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_delete.yaml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_delete.yaml @@ -6,7 +6,7 @@ local_action: command rm -f sp.log - name: Delete service policies - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: deleted # optional, default merged @@ -27,235 +27,235 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result -- assert: +- ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects - cisco.dcnm.dcnm_service_policy: - fabric: "{{ ansible_it_fabric }}" # mandatory - service_fabric: "{{ ansible_it_service_fabric }}" # mandatory - attach: true # optional, default true - deploy: true # optional, default true - state: merged # optional, default merged + cisco.dcnm.dcnm_service_policy: + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + attach: true # optional, default true + deploy: true # optional, default true + state: merged # optional, default merged config: - name: service_policy_1 # mandatory - node_name: "{{ ansible_snode_1 }}" # mandatory - rp_name: "{{ ansible_fw_rp1 }}" # mandatory - src_vrf: "{{ ansible_vrf_11 }}" # mandatory - dest_vrf: "{{ ansible_vrf_11 }}" # mandatory - src_network: "{{ ansible_net_11 }}" # mandatory - dest_network: "{{ ansible_net_12 }}" # mandatory - next_hop: 192.161.1.100 # mandatory - reverse_next_hop: 192.161.2.100 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + rp_name: "{{ ansible_fw_rp1 }}" # mandatory + src_vrf: "{{ ansible_vrf_11 }}" # mandatory + dest_vrf: "{{ ansible_vrf_11 }}" # mandatory + src_network: "{{ ansible_net_11 }}" # mandatory + dest_network: "{{ ansible_net_12 }}" # mandatory + next_hop: 192.161.1.100 # mandatory + reverse_next_hop: 192.161.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_10 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated - route_map_num: 101 # optional, default value will be auto-generated - reverse_route_map_num: 102 # optional, default value will be auto-generated + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: any # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_10 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated + route_map_num: 101 # optional, default value will be auto-generated + reverse_route_map_num: 102 # optional, default value will be auto-generated - name: service_policy_2 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp4 }}" # mandatory - src_vrf: "{{ ansible_vrf_21 }}" # mandatory - dest_vrf: "{{ ansible_vrf_21 }}" # mandatory - src_network: "{{ ansible_net_21 }}" # mandatory - dest_network: "{{ ansible_net_22 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.164.1.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp4 }}" # mandatory + src_vrf: "{{ ansible_vrf_21 }}" # mandatory + dest_vrf: "{{ ansible_vrf_21 }}" # mandatory + src_network: "{{ ansible_net_21 }}" # mandatory + dest_network: "{{ ansible_net_22 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.164.1.100 # mandatory policy: - proto: udp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_20 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated - route_map_num: 201 # optional, default value will be auto-generated - reverse_route_map_num: 202 # optional, default value will be auto-generated + proto: udp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_20 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated + route_map_num: 201 # optional, default value will be auto-generated + reverse_route_map_num: 202 # optional, default value will be auto-generated register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 2' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 2' - - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 2' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["modified"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 2' + + - ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete service policies with Node Name and Policy Name - cisco.dcnm.dcnm_service_policy: &dcnm_sp_del - fabric: "{{ ansible_it_fabric }}" # mandatory - service_fabric: "{{ ansible_it_service_fabric }}" # mandatory - state: deleted # optional, default merged + cisco.dcnm.dcnm_service_policy: &dcnm_sp_del + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + state: deleted # optional, default merged config: - - name: service_policy_1 # mandatory - node_name: "{{ ansible_snode_1 }}" # mandatory + - name: service_policy_1 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory - - name: service_policy_2 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory + - name: service_policy_2 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 2' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' - - - assert: - that: - - 'item["RETURN_CODE"] == 200' + - ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 2' + - '(result["diff"][0]["modified"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 0' + + - ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Delete service policies - Idempotence cisco.dcnm.dcnm_service_policy: *dcnm_sp_del register: result - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 0' + - ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["modified"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects - cisco.dcnm.dcnm_service_policy: - fabric: "{{ ansible_it_fabric }}" # mandatory - service_fabric: "{{ ansible_it_service_fabric }}" # mandatory - attach: true # optional, default true - deploy: true # optional, default true - state: merged # optional, default merged + cisco.dcnm.dcnm_service_policy: + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + attach: true # optional, default true + deploy: true # optional, default true + state: merged # optional, default merged config: - name: service_policy_1 # mandatory - node_name: "{{ ansible_snode_1 }}" # mandatory - rp_name: "{{ ansible_fw_rp1 }}" # mandatory - src_vrf: "{{ ansible_vrf_11 }}" # mandatory - dest_vrf: "{{ ansible_vrf_11 }}" # mandatory - src_network: "{{ ansible_net_11 }}" # mandatory - dest_network: "{{ ansible_net_12 }}" # mandatory - next_hop: 192.161.1.100 # mandatory - reverse_next_hop: 192.161.2.100 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + rp_name: "{{ ansible_fw_rp1 }}" # mandatory + src_vrf: "{{ ansible_vrf_11 }}" # mandatory + dest_vrf: "{{ ansible_vrf_11 }}" # mandatory + src_network: "{{ ansible_net_11 }}" # mandatory + dest_network: "{{ ansible_net_12 }}" # mandatory + next_hop: 192.161.1.100 # mandatory + reverse_next_hop: 192.161.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_10 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated - route_map_num: 101 # optional, default value will be auto-generated - reverse_route_map_num: 102 # optional, default value will be auto-generated + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: any # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_10 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated + route_map_num: 101 # optional, default value will be auto-generated + reverse_route_map_num: 102 # optional, default value will be auto-generated - name: service_policy_2 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp4 }}" # mandatory - src_vrf: "{{ ansible_vrf_21 }}" # mandatory - dest_vrf: "{{ ansible_vrf_21 }}" # mandatory - src_network: "{{ ansible_net_21 }}" # mandatory - dest_network: "{{ ansible_net_22 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.164.1.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp4 }}" # mandatory + src_vrf: "{{ ansible_vrf_21 }}" # mandatory + dest_vrf: "{{ ansible_vrf_21 }}" # mandatory + src_network: "{{ ansible_net_21 }}" # mandatory + dest_network: "{{ ansible_net_22 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.164.1.100 # mandatory policy: - proto: udp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_20 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated - route_map_num: 201 # optional, default value will be auto-generated - reverse_route_map_num: 202 # optional, default value will be auto-generated + proto: udp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_20 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated + route_map_num: 201 # optional, default value will be auto-generated + reverse_route_map_num: 202 # optional, default value will be auto-generated - name: service_policy_3 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp5 }}" # mandatory - src_vrf: "{{ ansible_vrf_31 }}" # mandatory - dest_vrf: "{{ ansible_vrf_31 }}" # mandatory - src_network: "{{ ansible_net_31 }}" # mandatory - dest_network: "{{ ansible_net_32 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.165.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp5 }}" # mandatory + src_vrf: "{{ ansible_vrf_31 }}" # mandatory + dest_vrf: "{{ ansible_vrf_31 }}" # mandatory + src_network: "{{ ansible_net_31 }}" # mandatory + dest_network: "{{ ansible_net_32 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.165.2.100 # mandatory policy: - proto: ip # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_30 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated - route_map_num: 301 # optional, default value will be auto-generated - reverse_route_map_num: 302 # optional, default value will be auto-generated + proto: ip # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_30 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated + route_map_num: 301 # optional, default value will be auto-generated + reverse_route_map_num: 302 # optional, default value will be auto-generated - name: service_policy_4 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp6 }}" # mandatory - src_vrf: "{{ ansible_vrf_41 }}" # mandatory - dest_vrf: "{{ ansible_vrf_41 }}" # mandatory - src_network: "{{ ansible_net_41 }}" # mandatory - dest_network: "{{ ansible_net_42 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.166.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp6 }}" # mandatory + src_vrf: "{{ ansible_vrf_41 }}" # mandatory + dest_vrf: "{{ ansible_vrf_41 }}" # mandatory + src_network: "{{ ansible_net_41 }}" # mandatory + dest_network: "{{ ansible_net_42 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.166.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_40 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated - route_map_num: 401 # optional, default value will be auto-generated - reverse_route_map_num: 402 # optional, default value will be auto-generated + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_40 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated + route_map_num: 401 # optional, default value will be auto-generated + reverse_route_map_num: 402 # optional, default value will be auto-generated - name: service_policy_5 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp6 }}" # mandatory - src_vrf: "{{ ansible_vrf_41 }}" # mandatory - dest_vrf: "{{ ansible_vrf_41 }}" # mandatory - src_network: "{{ ansible_net_41 }}" # mandatory - dest_network: "{{ ansible_net_42 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.166.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp6 }}" # mandatory + src_vrf: "{{ ansible_vrf_41 }}" # mandatory + dest_vrf: "{{ ansible_vrf_41 }}" # mandatory + src_network: "{{ ansible_net_41 }}" # mandatory + dest_network: "{{ ansible_net_42 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.166.2.100 # mandatory policy: - proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_50 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated - route_map_num: 501 # optional, default value will be auto-generated - reverse_route_map_num: 502 # optional, default value will be auto-generated + proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_50 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated + route_map_num: 501 # optional, default value will be auto-generated + reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - assert: @@ -267,17 +267,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete service policies with Node names - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: deleted # optional, default merged @@ -286,7 +286,7 @@ - node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -295,125 +295,125 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects - cisco.dcnm.dcnm_service_policy: - fabric: "{{ ansible_it_fabric }}" # mandatory - service_fabric: "{{ ansible_it_service_fabric }}" # mandatory - attach: true # optional, default true - deploy: true # optional, default true - state: merged # optional, default merged + cisco.dcnm.dcnm_service_policy: + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + attach: true # optional, default true + deploy: true # optional, default true + state: merged # optional, default merged config: - name: service_policy_1 # mandatory - node_name: "{{ ansible_snode_1 }}" # mandatory - rp_name: "{{ ansible_fw_rp1 }}" # mandatory - src_vrf: "{{ ansible_vrf_11 }}" # mandatory - dest_vrf: "{{ ansible_vrf_11 }}" # mandatory - src_network: "{{ ansible_net_11 }}" # mandatory - dest_network: "{{ ansible_net_12 }}" # mandatory - next_hop: 192.161.1.100 # mandatory - reverse_next_hop: 192.161.2.100 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + rp_name: "{{ ansible_fw_rp1 }}" # mandatory + src_vrf: "{{ ansible_vrf_11 }}" # mandatory + dest_vrf: "{{ ansible_vrf_11 }}" # mandatory + src_network: "{{ ansible_net_11 }}" # mandatory + dest_network: "{{ ansible_net_12 }}" # mandatory + next_hop: 192.161.1.100 # mandatory + reverse_next_hop: 192.161.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: any # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: reverse_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated reverse_route_map_num: 102 # optional, default value will be auto-generated - name: service_policy_2 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp4 }}" # mandatory - src_vrf: "{{ ansible_vrf_21 }}" # mandatory - dest_vrf: "{{ ansible_vrf_21 }}" # mandatory - src_network: "{{ ansible_net_21 }}" # mandatory - dest_network: "{{ ansible_net_22 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.164.1.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp4 }}" # mandatory + src_vrf: "{{ ansible_vrf_21 }}" # mandatory + dest_vrf: "{{ ansible_vrf_21 }}" # mandatory + src_network: "{{ ansible_net_21 }}" # mandatory + dest_network: "{{ ansible_net_22 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.164.1.100 # mandatory policy: - proto: udp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_20 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated - route_map_num: 201 # optional, default value will be auto-generated - reverse_route_map_num: 202 # optional, default value will be auto-generated + proto: udp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_20 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated + route_map_num: 201 # optional, default value will be auto-generated + reverse_route_map_num: 202 # optional, default value will be auto-generated - name: service_policy_3 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp5 }}" # mandatory - src_vrf: "{{ ansible_vrf_31 }}" # mandatory - dest_vrf: "{{ ansible_vrf_31 }}" # mandatory - src_network: "{{ ansible_net_31 }}" # mandatory - dest_network: "{{ ansible_net_32 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.165.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp5 }}" # mandatory + src_vrf: "{{ ansible_vrf_31 }}" # mandatory + dest_vrf: "{{ ansible_vrf_31 }}" # mandatory + src_network: "{{ ansible_net_31 }}" # mandatory + dest_network: "{{ ansible_net_32 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.165.2.100 # mandatory policy: - proto: ip # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_30 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated - route_map_num: 301 # optional, default value will be auto-generated - reverse_route_map_num: 302 # optional, default value will be auto-generated + proto: ip # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_30 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated + route_map_num: 301 # optional, default value will be auto-generated + reverse_route_map_num: 302 # optional, default value will be auto-generated - name: service_policy_4 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp6 }}" # mandatory - src_vrf: "{{ ansible_vrf_41 }}" # mandatory - dest_vrf: "{{ ansible_vrf_41 }}" # mandatory - src_network: "{{ ansible_net_41 }}" # mandatory - dest_network: "{{ ansible_net_42 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.166.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp6 }}" # mandatory + src_vrf: "{{ ansible_vrf_41 }}" # mandatory + dest_vrf: "{{ ansible_vrf_41 }}" # mandatory + src_network: "{{ ansible_net_41 }}" # mandatory + dest_network: "{{ ansible_net_42 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.166.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_40 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated - route_map_num: 401 # optional, default value will be auto-generated - reverse_route_map_num: 402 # optional, default value will be auto-generated + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_40 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated + route_map_num: 401 # optional, default value will be auto-generated + reverse_route_map_num: 402 # optional, default value will be auto-generated - name: service_policy_5 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp6 }}" # mandatory - src_vrf: "{{ ansible_vrf_41 }}" # mandatory - dest_vrf: "{{ ansible_vrf_41 }}" # mandatory - src_network: "{{ ansible_net_41 }}" # mandatory - dest_network: "{{ ansible_net_42 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.166.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp6 }}" # mandatory + src_vrf: "{{ ansible_vrf_41 }}" # mandatory + dest_vrf: "{{ ansible_vrf_41 }}" # mandatory + src_network: "{{ ansible_net_41 }}" # mandatory + dest_network: "{{ ansible_net_42 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.166.2.100 # mandatory policy: - proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_50 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated - route_map_num: 501 # optional, default value will be auto-generated - reverse_route_map_num: 502 # optional, default value will be auto-generated + proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_50 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated + route_map_num: 501 # optional, default value will be auto-generated + reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -422,17 +422,17 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete service policies with Node name and RP name - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: deleted # optional, default merged @@ -444,7 +444,7 @@ rp_name: "{{ ansible_adc_rp6 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -453,85 +453,85 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects - cisco.dcnm.dcnm_service_policy: - fabric: "{{ ansible_it_fabric }}" # mandatory - service_fabric: "{{ ansible_it_service_fabric }}" # mandatory - attach: true # optional, default true - deploy: true # optional, default true - state: merged # optional, default merged + cisco.dcnm.dcnm_service_policy: + fabric: "{{ ansible_it_fabric }}" # mandatory + service_fabric: "{{ ansible_it_service_fabric }}" # mandatory + attach: true # optional, default true + deploy: true # optional, default true + state: merged # optional, default merged config: - name: service_policy_1 # mandatory - node_name: "{{ ansible_snode_1 }}" # mandatory - rp_name: "{{ ansible_fw_rp1 }}" # mandatory - src_vrf: "{{ ansible_vrf_11 }}" # mandatory - dest_vrf: "{{ ansible_vrf_11 }}" # mandatory - src_network: "{{ ansible_net_11 }}" # mandatory - dest_network: "{{ ansible_net_12 }}" # mandatory - next_hop: 192.161.1.100 # mandatory - reverse_next_hop: 192.161.2.100 # mandatory + node_name: "{{ ansible_snode_1 }}" # mandatory + rp_name: "{{ ansible_fw_rp1 }}" # mandatory + src_vrf: "{{ ansible_vrf_11 }}" # mandatory + dest_vrf: "{{ ansible_vrf_11 }}" # mandatory + src_network: "{{ ansible_net_11 }}" # mandatory + dest_network: "{{ ansible_net_12 }}" # mandatory + next_hop: 192.161.1.100 # mandatory + reverse_next_hop: 192.161.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: any # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_1 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated reverse_route_map_num: 102 # optional, default value will be auto-generated - name: service_policy_4 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp6 }}" # mandatory - src_vrf: "{{ ansible_vrf_41 }}" # mandatory - dest_vrf: "{{ ansible_vrf_41 }}" # mandatory - src_network: "{{ ansible_net_41 }}" # mandatory - dest_network: "{{ ansible_net_42 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.166.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp6 }}" # mandatory + src_vrf: "{{ ansible_vrf_41 }}" # mandatory + dest_vrf: "{{ ansible_vrf_41 }}" # mandatory + src_network: "{{ ansible_net_41 }}" # mandatory + dest_network: "{{ ansible_net_42 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.166.2.100 # mandatory policy: - proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_40 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated - route_map_num: 401 # optional, default value will be auto-generated - reverse_route_map_num: 402 # optional, default value will be auto-generated + proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_40 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated + route_map_num: 401 # optional, default value will be auto-generated + reverse_route_map_num: 402 # optional, default value will be auto-generated - name: service_policy_5 # mandatory - node_name: "{{ ansible_snode_2 }}" # mandatory - rp_name: "{{ ansible_adc_rp6 }}" # mandatory - src_vrf: "{{ ansible_vrf_41 }}" # mandatory - dest_vrf: "{{ ansible_vrf_41 }}" # mandatory - src_network: "{{ ansible_net_41 }}" # mandatory - dest_network: "{{ ansible_net_42 }}" # mandatory - next_hop: "" # mandatory - reverse_next_hop: 192.166.2.100 # mandatory + node_name: "{{ ansible_snode_2 }}" # mandatory + rp_name: "{{ ansible_adc_rp6 }}" # mandatory + src_vrf: "{{ ansible_vrf_41 }}" # mandatory + dest_vrf: "{{ ansible_vrf_41 }}" # mandatory + src_network: "{{ ansible_net_41 }}" # mandatory + dest_network: "{{ ansible_net_42 }}" # mandatory + next_hop: "" # mandatory + reverse_next_hop: 192.166.2.100 # mandatory policy: - proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] - src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] - action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] - acl_name: fwd_acl_50 # optional, default value will be auto-generated - reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated - route_map_num: 501 # optional, default value will be auto-generated - reverse_route_map_num: 502 # optional, default value will be auto-generated + proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] + src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + action: permit # optional, default=permit, choices=[permit, deny] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + acl_name: fwd_acl_50 # optional, default value will be auto-generated + reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated + route_map_num: 501 # optional, default value will be auto-generated + reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 3' @@ -540,23 +540,23 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 3' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete service policies without config - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: deleted # optional, default merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -565,7 +565,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_merge.yaml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_merge.yaml index 41530c524..f5f8c56bb 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_merge.yaml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_merge.yaml @@ -27,16 +27,16 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result -- assert: +- ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: &dcnm_sp_create_all @@ -59,9 +59,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -79,9 +79,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_20 # optional, default value will be auto-generated reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated route_map_num: 201 # optional, default value will be auto-generated @@ -100,9 +100,9 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated @@ -120,9 +120,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_40 # optional, default value will be auto-generated reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated route_map_num: 401 # optional, default value will be auto-generated @@ -140,16 +140,16 @@ policy: proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_50 # optional, default value will be auto-generated reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated route_map_num: 501 # optional, default value will be auto-generated reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -158,7 +158,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -167,7 +167,7 @@ cisco.dcnm.dcnm_service_policy: *dcnm_sp_create_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -177,7 +177,7 @@ - '(result["diff"][0]["deploy"] | length) == 0' - name: Delete a couple of service policies - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: deleted # optional, default merged @@ -192,7 +192,7 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -201,7 +201,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -226,7 +226,7 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] - name: service_policy_2 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory @@ -240,12 +240,12 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -254,7 +254,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -279,16 +279,16 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated reverse_route_map_num: 302 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -297,7 +297,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -322,16 +322,16 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated reverse_route_map_num: 302 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -340,7 +340,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -365,10 +365,10 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 4400 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4401 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4401 # mandatory, choices=[any, Min:1, Max:65535)] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -377,14 +377,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -393,7 +393,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_overridden.yaml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_overridden.yaml index 0a696e870..289ef9a09 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_overridden.yaml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_overridden.yaml @@ -27,16 +27,16 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result -- assert: +- ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: @@ -58,9 +58,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -78,9 +78,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - name: service_policy_3 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory @@ -94,9 +94,9 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated @@ -114,9 +114,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_40 # optional, default value will be auto-generated reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated route_map_num: 401 # optional, default value will be auto-generated @@ -134,16 +134,16 @@ policy: proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_50 # optional, default value will be auto-generated reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated route_map_num: 501 # optional, default value will be auto-generated reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -152,14 +152,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRRIDE ## -############################################## + ############################################## + ## OVERRRIDE ## + ############################################## - name: Override and delete all service policies without any new one cisco.dcnm.dcnm_service_policy: &dcnm_sp_create_all @@ -168,7 +168,7 @@ state: overridden # optional, default merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -177,14 +177,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: @@ -206,9 +206,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -226,9 +226,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - name: service_policy_3 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory @@ -242,9 +242,9 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated @@ -262,9 +262,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_40 # optional, default value will be auto-generated reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated route_map_num: 401 # optional, default value will be auto-generated @@ -282,16 +282,16 @@ policy: proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_50 # optional, default value will be auto-generated reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated route_map_num: 501 # optional, default value will be auto-generated reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -300,14 +300,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 5' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRRIDE ## -############################################## + ############################################## + ## OVERRRIDE ## + ############################################## - name: Override all policies with a new one modifying existing one cisco.dcnm.dcnm_service_policy: @@ -329,16 +329,16 @@ policy: proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 555 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_555 # optional, default value will be auto-generated reverse_acl_name: rev_acl_555 # optional, default value will be auto-generated route_map_num: 555 # optional, default value will be auto-generated reverse_route_map_num: 556 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -347,14 +347,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -363,7 +363,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_query.yaml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_query.yaml index fda3d39ef..b3f9b83ae 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_query.yaml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_query.yaml @@ -27,16 +27,16 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result -- assert: +- ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: &dcnm_sp_create_all @@ -58,9 +58,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -78,9 +78,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_20 # optional, default value will be auto-generated reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated route_map_num: 201 # optional, default value will be auto-generated @@ -98,9 +98,9 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated @@ -118,9 +118,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_40 # optional, default value will be auto-generated reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated route_map_num: 401 # optional, default value will be auto-generated @@ -138,16 +138,16 @@ policy: proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_50 # optional, default value will be auto-generated reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated route_map_num: 501 # optional, default value will be auto-generated reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -157,7 +157,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' - name: Query service policies based on service node and policy name - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: query # optional, default merged @@ -178,7 +178,7 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -189,7 +189,7 @@ - '(result.response | length) == 5' - name: Query service policies that does not exist - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: query # optional, default merged @@ -210,7 +210,7 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -221,7 +221,7 @@ - '(result.response | length) == 0' - name: Query service policies based on service node - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: query # optional, default merged @@ -229,7 +229,7 @@ - node_name: "{{ ansible_snode_1 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -240,7 +240,7 @@ - '(result.response | length) == 1' - name: Query service policies based on service node - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: query # optional, default merged @@ -248,7 +248,7 @@ - node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -258,9 +258,9 @@ - '(result["diff"][0]["deploy"] | length) == 0' - '(result.response | length) == 4' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -269,7 +269,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_replace.yaml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_replace.yaml index a3c910943..bdde34562 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_replace.yaml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_replace.yaml @@ -27,16 +27,16 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result -- assert: +- ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: @@ -58,9 +58,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -78,13 +78,13 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -93,14 +93,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: Replace some of the objects in already created policy cisco.dcnm.dcnm_service_policy: &dcnm_sp_replace_all @@ -122,9 +122,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 501 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 502 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 502 # mandatory, choices=[any, Min:1, Max:65535)] action: deny # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - name: service_policy_2 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory @@ -138,16 +138,16 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_21 # optional, default value will be auto-generated reverse_acl_name: rev_acl_22 # optional, default value will be auto-generated route_map_num: 2201 # optional, default value will be auto-generated reverse_route_map_num: 2202 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -156,7 +156,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -165,7 +165,7 @@ cisco.dcnm.dcnm_service_policy: *dcnm_sp_replace_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -174,9 +174,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -185,7 +185,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_sanity.yaml b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_sanity.yaml index 5c2f742a6..ffc750c9f 100644 --- a/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_sanity.yaml +++ b/tests/integration/targets/dcnm_service_policy/tests/dcnm/dcnm_service_policy_sanity.yaml @@ -1,10 +1,10 @@ ############################################## -## SETUP ## +## SETUP ## ############################################## - name: SANITY- Remove local log file local_action: command rm -f sp.log - #tags: sanity +# tags: sanity - name: SANITY- Delete service policies cisco.dcnm.dcnm_service_policy: &dcnm_sp_del_all @@ -27,20 +27,19 @@ - name: service_policy_5 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory register: result - #tags: sanity +# tags: sanity - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - #tags: sanity +# tags: sanity - #tags: sanity - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: &dcnm_sp_create_all @@ -62,9 +61,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -82,9 +81,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_20 # optional, default value will be auto-generated reverse_acl_name: rev_acl_20 # optional, default value will be auto-generated route_map_num: 201 # optional, default value will be auto-generated @@ -102,9 +101,9 @@ policy: proto: ip # mandatory, choices=[tcp, udp, icmp, ip] src_port: 3000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 3001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_30 # optional, default value will be auto-generated reverse_acl_name: rev_acl_30 # optional, default value will be auto-generated route_map_num: 301 # optional, default value will be auto-generated @@ -122,9 +121,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 4000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 4001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_40 # optional, default value will be auto-generated reverse_acl_name: rev_acl_40 # optional, default value will be auto-generated route_map_num: 401 # optional, default value will be auto-generated @@ -142,16 +141,16 @@ policy: proto: icmp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_50 # optional, default value will be auto-generated reverse_acl_name: rev_acl_50 # optional, default value will be auto-generated route_map_num: 501 # optional, default value will be auto-generated reverse_route_map_num: 502 # optional, default value will be auto-generated register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -161,7 +160,7 @@ - '(result["diff"][0]["deploy"] | length) == 5' - name: SANITY- Query service policies based on service node and policy name - cisco.dcnm.dcnm_service_policy: + cisco.dcnm.dcnm_service_policy: fabric: "{{ ansible_it_fabric }}" # mandatory service_fabric: "{{ ansible_it_service_fabric }}" # mandatory state: query # optional, default merged @@ -182,7 +181,7 @@ node_name: "{{ ansible_snode_2 }}" # mandatory register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -192,11 +191,9 @@ - '(result["diff"][0]["deploy"] | length) == 0' - '(result.response | length) == 5' - - -############################################## -## OVERRRIDE ## -############################################## + ############################################## + ## OVERRRIDE ## + ############################################## - name: SANITY- Override and delete all service policies without any new one cisco.dcnm.dcnm_service_policy: @@ -205,7 +202,7 @@ state: overridden # optional, default merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -219,9 +216,9 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create service policy including all optional objects cisco.dcnm.dcnm_service_policy: @@ -243,9 +240,9 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: any # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 22 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: none # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_10 # optional, default value will be auto-generated reverse_acl_name: rev_acl_10 # optional, default value will be auto-generated route_map_num: 101 # optional, default value will be auto-generated @@ -263,13 +260,13 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 2000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 2001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -283,9 +280,9 @@ - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE ## -############################################## + ############################################## + ## REPLACE ## + ############################################## - name: SANITY- Replace some of the objects in already created policy cisco.dcnm.dcnm_service_policy: &dcnm_sp_replace_all @@ -307,9 +304,9 @@ policy: proto: udp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 501 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 502 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 502 # mandatory, choices=[any, Min:1, Max:65535)] action: deny # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] - name: service_policy_2 # mandatory node_name: "{{ ansible_snode_2 }}" # mandatory @@ -323,25 +320,25 @@ policy: proto: tcp # mandatory, choices=[tcp, udp, icmp, ip] src_port: 5000 # mandatory, choices=[any, Min:1, Max:65535)] - dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] + dest_port: 5001 # mandatory, choices=[any, Min:1, Max:65535)] action: permit # optional, default=permit, choices=[permit, deny] - next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] + next_hop_option: drop_on_fail # optional, default=none, choices=[none, drop_on_fail, drop] acl_name: fwd_acl_21 # optional, default value will be auto-generated reverse_acl_name: rev_acl_22 # optional, default value will be auto-generated route_map_num: 2201 # optional, default value will be auto-generated reverse_route_map_num: 2202 # optional, default value will be auto-generated register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["modified"] | length) == 2' - - '(result["diff"][0]["query"] | length) == 0' - - '(result["diff"][0]["deploy"] | length) == 2' + - ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["modified"] | length) == 2' + - '(result["diff"][0]["query"] | length) == 0' + - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -350,7 +347,7 @@ cisco.dcnm.dcnm_service_policy: *dcnm_sp_replace_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -359,9 +356,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -371,7 +368,7 @@ when: IT_CONTEXT is not defined tags: sanity - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_route_peering/meta/main.yaml b/tests/integration/targets/dcnm_service_route_peering/meta/main.yaml index f280ef854..23c579a45 100644 --- a/tests/integration/targets/dcnm_service_route_peering/meta/main.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/meta/main.yaml @@ -1,2 +1,2 @@ -dependencies: +dependencies: - prepare_dcnm_service_route_peering diff --git a/tests/integration/targets/dcnm_service_route_peering/tasks/dcnm.yaml b/tests/integration/targets/dcnm_service_route_peering/tasks/dcnm.yaml index fdd3a8958..56b64190a 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tasks/dcnm.yaml @@ -1,37 +1,40 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: sanity - name: Cleanup - Delete route peerings - cisco.dcnm.dcnm_service_route_peering: - fabric: "{{ ansible_it_fabric }}" - service_fabric: "{{ ansible_it_service_fabric }}" + cisco.dcnm.dcnm_service_route_peering: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" state: deleted register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -43,100 +46,102 @@ service_fabric: "{{ ansible_it_service_fabric }}" state: deleted config: - - name: "{{ ansible_snode_1 }}" - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_att_intf1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: "{{ ansible_snode_2 }}" - type: load_balancer - form_factor: physical - svc_int_name: svc2 - attach_interface: "{{ ansible_att_intf2 }}" - switches: - - "{{ ansible_switch1 }}" + - name: "{{ ansible_snode_1 }}" + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_att_intf1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: "{{ ansible_snode_2 }}" + type: load_balancer + form_factor: physical + svc_int_name: svc2 + attach_interface: "{{ ansible_att_intf2 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity - name: Cleanup - sleep for 40 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 40 tags: sanity - name: Cleanup - Delete all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" state: deleted config: - vrf_name: "{{ ansible_vrf_11 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_12 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_12 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_21 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_21 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_22 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_22 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_31 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_31 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_32 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_32 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_41 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_41 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_42 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_42 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_51 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_51 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_52 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_52 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_61 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_61 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_62 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_62 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_71 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_71 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_72 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_72 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - register: result + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity diff --git a/tests/integration/targets/dcnm_service_route_peering/tasks/main.yaml b/tests/integration/targets/dcnm_service_route_peering/tasks/main.yaml index 78c5fb834..ca7cc9a10 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tasks/main.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tasks/main.yaml @@ -1,2 +1,5 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include tasks + ansible.builtin.include_tasks: + ansible.builtin.file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/.dcnm_service_route_peering_delete.yaml.swp b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/.dcnm_service_route_peering_delete.yaml.swp deleted file mode 100644 index 59ebb23a0..000000000 Binary files a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/.dcnm_service_route_peering_delete.yaml.swp and /dev/null differ diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_adc_po_change.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_adc_po_change.yaml index a4d20dd3e..ad3ba9223 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_adc_po_change.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_adc_po_change.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Loadbalancer One ARM Static and eBGP peerings cisco.dcnm.dcnm_service_route_peering: @@ -85,7 +85,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -94,14 +94,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CONVERT ## -############################################## + ############################################## + ## CONVERT ## + ############################################## - name: Convert Loadbalancer One ARM Static to eBGP and eBGP to Static peerings cisco.dcnm.dcnm_service_route_peering: @@ -164,7 +164,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -173,14 +173,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Loadbalancer Two ARM Static and eBGP peerings cisco.dcnm.dcnm_service_route_peering: @@ -258,7 +258,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -267,14 +267,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CONVERT ## -############################################## + ############################################## + ## CONVERT ## + ############################################## - name: Convert Loadbalancer Two ARM Static to eBGP and eBGP to Static peerings cisco.dcnm.dcnm_service_route_peering: @@ -352,7 +352,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -361,14 +361,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -403,8 +403,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_delete.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_delete.yaml index 66be11aba..0bfbf0ad0 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_delete.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_delete.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: @@ -257,7 +257,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -266,14 +266,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete route peerings cisco.dcnm.dcnm_service_route_peering: &dncm_srp_delete_all @@ -304,7 +304,7 @@ state: deleted register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -313,7 +313,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -322,7 +322,7 @@ cisco.dcnm.dcnm_service_route_peering: *dncm_srp_delete_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -331,14 +331,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: @@ -470,7 +470,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' @@ -479,14 +479,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 4' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## DELETE ## -############################################## + ############################################## + ## DELETE ## + ############################################## - name: Delete route peerings with node name - 1 cisco.dcnm.dcnm_service_route_peering: @@ -497,7 +497,7 @@ state: deleted register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -506,7 +506,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -520,7 +520,7 @@ state: deleted register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -529,7 +529,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' \ No newline at end of file + loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_fw_po_change.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_fw_po_change.yaml index b1f91a8f4..f67186fba 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_fw_po_change.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_fw_po_change.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create Intertenant Firewall SRP with Static Peering cisco.dcnm.dcnm_service_route_peering: @@ -69,7 +69,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -78,14 +78,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CONVERT ## -############################################## + ############################################## + ## CONVERT ## + ############################################## - name: Convert Intertenant Firewall SRP with Static Peering to eBGP peering cisco.dcnm.dcnm_service_route_peering: @@ -142,7 +142,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -151,14 +151,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CONVERT ## -############################################## + ############################################## + ## CONVERT ## + ############################################## - name: Convert Intertenant Firewall SRP with eBGP Peering back to Static Peering cisco.dcnm.dcnm_service_route_peering: @@ -205,7 +205,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -214,14 +214,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -256,8 +256,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge.yaml index 03b861af2..b3b81354d 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -257,7 +257,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -266,7 +266,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -275,7 +275,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -284,9 +284,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -321,8 +321,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge_existing.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge_existing.yaml index ad69e0dd9..b048fdda8 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge_existing.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_merge_existing.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -257,7 +257,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -266,14 +266,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE RP1-RP3 ## -############################################## + ############################################## + ## MERGE RP1-RP3 ## + ############################################## - name: Replace service route peerings RP1 to RP3 - not specifying optional objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_rep_13 @@ -458,7 +458,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -467,7 +467,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -476,7 +476,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_rep_13 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -486,9 +486,9 @@ - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## MERGE RP4-RP7 ## -############################################## + ############################################## + ## MERGE RP4-RP7 ## + ############################################## - name: Replace service route peerings RP4 to RP7 - not specifying optional objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_rep_47 @@ -667,7 +667,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -676,7 +676,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -685,7 +685,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_rep_47 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -695,9 +695,9 @@ - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## MERGE RP4-RP7 ## -############################################## + ############################################## + ## MERGE RP4-RP7 ## + ############################################## - name: Merge service route peerings RP4 to RP7 - modifying certain objects cisco.dcnm.dcnm_service_route_peering: @@ -776,7 +776,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -785,14 +785,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 4' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -827,8 +827,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_opt_elems.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_opt_elems.yaml index d1cf25611..b05d7570e 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_opt_elems.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_opt_elems.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects - no optional elements cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -146,7 +146,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -155,7 +155,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -164,7 +164,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -173,9 +173,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -210,8 +210,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_state.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_state.yaml index 4ae8e909e..85190f356 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_state.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_no_state.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects - State not included cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -256,7 +256,7 @@ deploy: true register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -265,7 +265,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -274,7 +274,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -283,9 +283,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -320,8 +320,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_override.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_override.yaml index f7ed49692..7a18ecb86 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_override.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_override.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -257,7 +257,7 @@ state: overridden register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -266,14 +266,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override existing route peerings with new peerings cisco.dcnm.dcnm_service_route_peering: @@ -337,7 +337,7 @@ state: overridden register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -346,14 +346,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 2' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Create RP6 peering again cisco.dcnm.dcnm_service_route_peering: @@ -390,7 +390,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -399,14 +399,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override existing route peerings with an existing peering modified cisco.dcnm.dcnm_service_route_peering: @@ -442,7 +442,7 @@ state: overridden register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -451,14 +451,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override existing route peerings with an existing peering unchanged cisco.dcnm.dcnm_service_route_peering: @@ -495,7 +495,7 @@ state: overridden register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -504,14 +504,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## OVERRIDDEN ## -############################################## + ############################################## + ## OVERRIDDEN ## + ############################################## - name: Override existing route peerings with no new peerings cisco.dcnm.dcnm_service_route_peering: @@ -524,7 +524,7 @@ register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -533,14 +533,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -581,8 +581,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_query.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_query.yaml index 12bd2ff32..596506ee9 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_query.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_query.yaml @@ -12,7 +12,7 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -20,9 +20,9 @@ - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -257,7 +257,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -266,14 +266,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY ## + ############################################## - name: Query existing route peerings with specific peering names cisco.dcnm.dcnm_service_route_peering: @@ -304,7 +304,7 @@ state: query register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -323,7 +323,7 @@ state: query register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -345,7 +345,7 @@ state: query register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -354,9 +354,9 @@ - '(result["diff"][0]["query"] | length) == 2' - '(result.response | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -391,8 +391,8 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - when: IT_CONTEXT is not defined \ No newline at end of file + when: IT_CONTEXT is not defined diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_replace.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_replace.yaml index 4822f9a68..16feaff7c 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_replace.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_replace.yaml @@ -12,17 +12,17 @@ state: deleted register: result -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -257,7 +257,7 @@ state: replaced register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -266,14 +266,14 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## REPLACE RP1-RP3 ## -############################################## + ############################################## + ## REPLACE RP1-RP3 ## + ############################################## - name: Replace service route peerings RP1 to RP3 cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_rep_13 @@ -508,7 +508,7 @@ state: replaced register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -517,7 +517,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 3' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -526,7 +526,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_rep_13 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -536,9 +536,9 @@ - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## REPLACE RP4-RP7 ## -############################################## + ############################################## + ## REPLACE RP4-RP7 ## + ############################################## - name: Replace service route peerings RP4 to RP7 cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_rep_47 @@ -774,7 +774,7 @@ state: replaced register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' @@ -783,7 +783,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 4' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -792,7 +792,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_rep_47 register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -801,9 +801,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -837,7 +837,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_sanity.yaml b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_sanity.yaml index caedfcd63..63bbc045c 100644 --- a/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_sanity.yaml +++ b/tests/integration/targets/dcnm_service_route_peering/tests/dcnm/dcnm_service_route_peering_sanity.yaml @@ -14,7 +14,7 @@ register: result tags: sanity -- assert: +- ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -24,9 +24,9 @@ - tags: sanity block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: SANITY- Create different non-existing service route peerings including all objects cisco.dcnm.dcnm_service_route_peering: &dcnm_srp_all @@ -261,7 +261,7 @@ state: merged register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 7' @@ -270,7 +270,7 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 7' - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -279,7 +279,7 @@ cisco.dcnm.dcnm_service_route_peering: *dcnm_srp_all register: result - - assert: + - ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -288,9 +288,9 @@ - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: @@ -325,7 +325,7 @@ register: result when: IT_CONTEXT is not defined - - assert: + - ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' diff --git a/tests/integration/targets/dcnm_template/meta/main.yaml b/tests/integration/targets/dcnm_template/meta/main.yaml index a8be9c534..691e3b6cd 100644 --- a/tests/integration/targets/dcnm_template/meta/main.yaml +++ b/tests/integration/targets/dcnm_template/meta/main.yaml @@ -1,2 +1,2 @@ -dependencies: +dependencies: - prepare_dcnm_template diff --git a/tests/integration/targets/dcnm_template/tasks/dcnm.yaml b/tests/integration/targets/dcnm_template/tasks/dcnm.yaml index 19e06ef74..d9c7e2a0b 100644 --- a/tests/integration/targets/dcnm_template/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_template/tasks/dcnm.yaml @@ -1,49 +1,52 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: sanity -- name: Final cleanup - delete all policies created during init +- name: Final cleanup - delete all policies created during init cisco.dcnm.dcnm_policy: - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" state: deleted # only choose form [merged, deleted, query] - config: + config: - name: template_inuse_1 # name is mandatory - name: template_inuse_2 # name is mandatory - name: my_feature_telemetry - switch: - ip: "{{ ansible_switch1 }}" - register: result + register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity -- name: Final cleanup - delete all templates created during init - cisco.dcnm.dcnm_template: +- name: Final cleanup - delete all templates created during init + cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: - name: template_inuse_1 @@ -52,8 +55,9 @@ tags: sanity register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity diff --git a/tests/integration/targets/dcnm_template/tasks/main.yaml b/tests/integration/targets/dcnm_template/tasks/main.yaml index 78c5fb834..9703fcf91 100644 --- a/tests/integration/targets/dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/dcnm_template/tasks/main.yaml @@ -1,2 +1,4 @@ --- -- { include: dcnm.yaml, tags: ['dcnm'] } \ No newline at end of file +- name: Include tasks + ansible.builtin.include_tasks: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_delete.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_delete.yaml index 07ba293d7..2533cc492 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_delete.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_delete.yaml @@ -3,30 +3,29 @@ ############################################## - name: Initialize the setup - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 - register: result -- assert: +- name: ASSERT - Initial response codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create templates - cisco.dcnm.dcnm_template: - state: merged # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: + state: merged # only choose from [merged, deleted, query] config: - name: template_101 description: "Template_101" @@ -45,6 +44,18 @@ dst-grp 1 snsr-grp 1 sample-interval 10000 + certificate /bootflash/telegraf.crt telegraf + destination-profile + use-vrf management + destination-group 1 + ip address 10.195.225.176 port 57000 protocol gRPC encoding GPB + sensor-group 1 + data-source DME + path sys/ch depth unbounded + subscription 1 + dst-grp 1 + snsr-grp 1 sample-interval 10000 + - name: template_102 description: "Template_102" tags: "internal policy 102" @@ -95,55 +106,56 @@ subscription 4 dst-grp 4 snsr-grp 4 sample-interval 40000 - register: result - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 4' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' - - - name: Delete all templates created - cisco.dcnm.dcnm_template: &temp_delete - state: deleted # only choose form [merged, deleted, query] - config: - - name: template_101 - - name: template_102 +- name: ASSERT - Creation diff + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 4' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' - - name: template_103 +- name: ASSERT - Creation response codes + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"Template Created" in item["DATA"]["status"]' + loop: '{{ result.response }}' - - name: template_104 +- name: Delete all templates created + cisco.dcnm.dcnm_template: &temp_delete + state: deleted + config: + - name: template_101 + - name: template_102 + - name: template_103 + - name: template_104 + register: result - register: result +- name: ASSERT - Deletion response codes + ansible.builtin.assert: + that: + - 'item["RETURN_CODE"] == 200' + - '"Template deletion successful" in item["DATA"]' + loop: '{{ result.response }}' - - assert: - that: - - 'item["RETURN_CODE"] == 200' - - '"Template deletion successful" in item["DATA"]' - loop: '{{ result.response }}' - - - assert: - that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 4' - - '(result["diff"][0]["query"] | length) == 0' - - - name: Delete all templates created - Idempotence - cisco.dcnm.dcnm_template: *temp_delete - register: result +- name: ASSERT - Deletion diff + ansible.builtin.assert: + that: + - 'result.changed == true' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 4' + - '(result["diff"][0]["query"] | length) == 0' - - assert: - that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' \ No newline at end of file +- name: Delete all templates created - Idempotence + cisco.dcnm.dcnm_template: *temp_delete + register: result + +- name: ASSERT - Idempotence diff + ansible.builtin.assert: + that: + - 'result.changed == false' + - '(result["diff"][0]["merged"] | length) == 0' + - '(result["diff"][0]["deleted"] | length) == 0' + - '(result["diff"][0]["query"] | length) == 0' diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_merge.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_merge.yaml index 740bddc7f..cda709b9d 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_merge.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_merge.yaml @@ -4,29 +4,28 @@ - name: Initialize the setup cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + state: deleted config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 - register: result -- assert: +- name: ASSERT - Initial response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ result.response }}' - block: - -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create templates - cisco.dcnm.dcnm_template: &temp_merge - state: merged # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: &create_templates + state: merged config: - name: template_101 description: "Template_101" @@ -61,7 +60,6 @@ subscription 2 dst-grp 2 snsr-grp 2 sample-interval 20000 - - name: template_103 description: "Template_103" tags: "internal policy 103" @@ -78,7 +76,6 @@ subscription 3 dst-grp 3 snsr-grp 2 sample-interval 30000 - - name: template_104 description: "Template_104" tags: "internal policy 104" @@ -96,24 +93,28 @@ dst-grp 4 snsr-grp 4 sample-interval 40000 register: result - - assert: + + - name: ASSERT - Creation diff + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 4' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - name: ASSERT - Creation response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' - name: Create templates again - Idempotence - cisco.dcnm.dcnm_template: *temp_merge + cisco.dcnm.dcnm_template: *create_templates register: result - - assert: + - name: ASSERT - Idempotence diff + ansible.builtin.assert: that: - 'result.changed == false' - '(result["diff"][0]["merged"] | length) == 0' @@ -123,6 +124,7 @@ # This task will generate an error and return code 500 since the template # is in use. We ignore the error for the task to continue running the # playbook but still check the error data returned by the module. + - name: Modify existing template which is in use cisco.dcnm.dcnm_template: config: @@ -143,15 +145,15 @@ dst-grp 1 snsr-grp 1 sample-interval 10000 register: result - ignore_errors: yes + ignore_errors: true -# - assert: -# that: -# - 'result.changed == false' -# - 'result.msg["RETURN_CODE"] == 500' -# - '"Template is already in use" in result.msg["DATA"]' + # - assert: + # that: + # - 'result.changed == false' + # - 'result.msg["RETURN_CODE"] == 500' + # - '"Template is already in use" in result.msg["DATA"]' - - name: Create templates without mentioning state + - name: Create template 105 without mentioning state cisco.dcnm.dcnm_template: config: - name: template_105 @@ -172,50 +174,44 @@ snsr-grp 105 sample-interval 10105 register: result - - assert: + - name: ASSERT - Template_105 creation + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - - assert: + - name: ASSERT - Response codes template_105 + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' -############################################## -## CLEANUP ## -############################################## - always: - - name: Delete all templates created cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + state: deleted config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 - - name: template_105 - register: result - - assert: + - name: ASSERT - Deletion response codes + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template deletion successful" in item["DATA"]' loop: '{{ result.response }}' - - assert: + - name: ASSERT - Deletion diff + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 0' - '(result["diff"][0]["deleted"] | length) == 5' - - '(result["diff"][0]["query"] | length) == 0' \ No newline at end of file + - '(result["diff"][0]["query"] | length) == 0' diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_modify_properties.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_modify_properties.yaml index 6b8625ebb..76f4aede0 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_modify_properties.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_modify_properties.yaml @@ -2,33 +2,34 @@ ## SETUP ## ############################################## -- name: Initialize the setup - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] +- name: Initialize templates (ensure clean slate) + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 + register: init_result - register: result - -- assert: +- name: Assert initialization responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ init_result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create all templates - cisco.dcnm.dcnm_template: - state: merged # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: + state: merged config: - name: template_101 + tags: "internal policy 101" content: | telemetry certificate /bootflash/telegraf.crt telegraf @@ -89,24 +90,30 @@ subscription 4 dst-grp 4 snsr-grp 4 sample-interval 40000 + register: create_result - register: result - - assert: + - name: Assert create diff and responses + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 4' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'create_result.changed == true' + - '(create_result.diff[0].merged | length) == 4' + - '(create_result.diff[0].deleted | length) == 0' + - '(create_result.diff[0].query | length) == 0' - - assert: + - name: Assert create RETURN_CODE and status + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' + loop: '{{ create_result.response }}' - - name: Modifying existing templates - cisco.dcnm.dcnm_template: &temp_repl - state: merged # only choose form [merged, deleted, query] + ############################################## + ## MODIFY PROPERTIES ## + ############################################## + + - name: Modify selected templates + cisco.dcnm.dcnm_template: &modify_set + state: merged config: - name: template_101 description: "Template_101 - added this description" @@ -144,7 +151,7 @@ - name: template_103 description: "Template_103 - added this" tags: "internal policy 103 - added this" - content: | # Content modified + content: | telemetry certificate /bootflash/telegraf.crt telegraf destination-profile @@ -158,7 +165,7 @@ dst-grp 10 snsr-grp 10 sample-interval 30010 - - name: template_104 # No modifications + - name: template_104 description: "Template_104" tags: "internal policy 104" content: | @@ -174,92 +181,92 @@ subscription 4 dst-grp 4 snsr-grp 4 sample-interval 40000 + register: modify_result - register: result - - - assert: + - name: Assert modify diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 3' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'modify_result.changed == true' + - '(modify_result.diff[0].merged | length) == 3' + - '(modify_result.diff[0].deleted | length) == 0' + - '(modify_result.diff[0].query | length) == 0' - - assert: + - name: Assert modify RESULT codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' + loop: '{{ modify_result.response }}' - - name: Modifying existing templates - Idempotence - cisco.dcnm.dcnm_template: *temp_repl - register: result + - name: Idempotence check for modify + cisco.dcnm.dcnm_template: *modify_set + register: modify_idem_result - - assert: + - name: Assert idempotence modify + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'modify_idem_result.changed == false' + - '(modify_idem_result.diff[0].merged | length) == 0' + - '(modify_idem_result.diff[0].deleted | length) == 0' + - '(modify_idem_result.diff[0].query | length) == 0' + + ############################################## + ## QUERY ## + ############################################## - name: Query modified templates - cisco.dcnm.dcnm_template: - state: query # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: + state: query config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 + register: query_result - register: result - - - assert: + - name: Assert query results + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 4' - - '("Template_101 - added this description" in result["response"][0]["description"])' - - '("Template_102 - added this" in result["response"][1]["description"])' - - '("internal policy 102 - added this" in result["response"][1]["tags"])' - - '("Template_103 - added this" in result["response"][2]["description"])' - - '("internal policy 103 - added this" in result["response"][2]["tags"])' - - '("Template_104" in result["response"][3]["description"])' - - '("internal policy 104" in result["response"][3]["tags"])' - - '("port 54000" in result["response"][3]["content"])' - - '("sample-interval 40000" in result["response"][3]["content"])' - -############################################## -## CLEANUP ## -############################################## + - 'query_result.changed == false' + - '(query_result["diff"][0]["merged"] | length) == 0' + - '(query_result["diff"][0]["deleted"] | length) == 0' + - '(query_result.diff[0].query | length) == 4' + - '("Template_101 - added this description" in query_result.response[0].description)' + - '("Template_102 - added this" in query_result.response[1].description)' + - '("internal policy 102 - added this" in query_result.response[1].tags)' + - '("Template_103 - added this" in query_result.response[2].description)' + - '("internal policy 103 - added this" in query_result.response[2].tags)' + - '("Template_104" in query_result.response[3].description)' + - '("internal policy 104" in query_result.response[3].tags)' + - '("port 54000" in query_result.response[3].content)' + - '("sample-interval 40000" in query_result.response[3].content)' + + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete all templates created - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 + register: delete_result - register: result - - - assert: + - name: Assert deletion responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template deletion successful" in item["DATA"]' - loop: '{{ result.response }}' + loop: '{{ delete_result.response }}' - - assert: + - name: Assert deletion diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 4' - - '(result["diff"][0]["query"] | length) == 0' \ No newline at end of file + - 'delete_result.changed == true' + - '(delete_result.diff[0].deleted | length) == 4' + - '(delete_result.diff[0].merged | length) == 0' + - '(delete_result.diff[0].query | length) == 0' diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_no_delete.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_no_delete.yaml index c9acaa0d9..e1e49dab5 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_no_delete.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_no_delete.yaml @@ -2,28 +2,28 @@ ## SETUP ## ############################################## -- name: Initialize the setup - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] +- name: Initialize template_101 (pre-test) + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_101 + register: init_result - register: result - -- assert: +- name: Assert initialization responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ init_result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - - name: Create a template - cisco.dcnm.dcnm_template: &temp_merge - state: merged # only choose form [merged, deleted, query] + - name: Create template_101 + cisco.dcnm.dcnm_template: + state: merged config: - name: template_101 description: "Template_101" @@ -41,51 +41,60 @@ subscription 1 dst-grp 1 snsr-grp 1 sample-interval 10000 + register: create_result - register: result - - - assert: + - name: Assert create diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'create_result.changed == true' + - '(create_result.diff[0].merged | length) == 1' + - '(create_result.diff[0].deleted | length) == 0' + - '(create_result.diff[0].query | length) == 0' - - assert: + - name: Assert create responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' + loop: '{{ create_result.response }}' - - name: Delete templates along with the template which is already installed on a switch - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + ############################################## + ## DELETE (IN-USE) ## + ############################################## + + - name: Attempt delete of in-use templates plus created one + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_inuse_1 - name: template_inuse_2 - name: template_101 + register: delete_inuse_result - register: result - - - assert: + - name: Assert in-use deletion behavior + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '("Templates in use, not deleted" in item["DATA"]) and ("template_inuse_1" in item["DATA"])' - '("Templates in use, not deleted" in item["DATA"]) and ("template_inuse_2" in item["DATA"])' - - '(result["template-policy-map"] | length == 2)' - - '"template_inuse_1" in result["template-policy-map"].keys()' - - '"template_inuse_2" in result["template-policy-map"].keys()' - loop: '{{ result.response }}' + - '(delete_inuse_result["template-policy-map"] | length) == 2' + - '"template_inuse_1" in delete_inuse_result["template-policy-map"].keys()' + - '"template_inuse_2" in delete_inuse_result["template-policy-map"].keys()' + loop: '{{ delete_inuse_result.response }}' - - name: Delete a template which is not existing - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + ############################################## + ## DELETE (NON-EXISTENT) ## + ############################################## + + - name: Delete non-existent template + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_1000 + register: delete_missing_result - register: result - - - assert: + - name: Assert delete non-existent response codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' \ No newline at end of file + - 'item["RETURN_CODE"] == 200' + loop: '{{ delete_missing_result.response }}' diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_query.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_query.yaml index 749034fd2..c6f29b46e 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_query.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_query.yaml @@ -2,31 +2,31 @@ ## SETUP ## ############################################## -- name: Initialize the setup - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] +- name: Initialize templates for query test + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 + register: init_result - register: result - -- assert: +- name: Assert init responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ init_result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create templates - cisco.dcnm.dcnm_template: - state: merged # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: + state: merged config: - name: template_101 description: "Template_101" @@ -95,75 +95,73 @@ subscription 4 dst-grp 4 snsr-grp 4 sample-interval 40000 + register: create_result - register: result - - assert: + - name: Assert create diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 4' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'create_result.changed == true' + - '(create_result.diff[0].merged | length) == 4' + - '(create_result.diff[0].deleted | length) == 0' + - '(create_result.diff[0].query | length) == 0' - - - assert: + - name: Assert create responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' + loop: '{{ create_result.response }}' + + ############################################## + ## QUERY ## + ############################################## - - name: Query a template - cisco.dcnm.dcnm_template: - state: query # only choose form [merged, deleted, query] + - name: Query templates (including inuse) + cisco.dcnm.dcnm_template: + state: query config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 - - name: template_inuse_1 + register: query_result - register: result - - - assert: + - name: Assert query results + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 5' - - '"template_inuse_1" in result["template-policy-map"].keys()' + - 'query_result.changed == false' + - '(query_result["diff"][0]["merged"] | length) == 0' + - '(query_result["diff"][0]["deleted"] | length) == 0' + - '(query_result["diff"][0]["query"] | length) == 5' + - '"template_inuse_1" in query_result["template-policy-map"].keys()' -############################################## -## CLEANUP ## -############################################## + ############################################## + ## CLEANUP ## + ############################################## always: - - name: Delete all templates created - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 + register: delete_result - register: result - - - assert: + - name: Assert deletion responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template deletion successful" in item["DATA"]' - loop: '{{ result.response }}' + loop: '{{ delete_result.response }}' - - assert: + - name: Assert deletion diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 4' - - '(result["diff"][0]["query"] | length) == 0' \ No newline at end of file + - 'delete_result.changed == true' + - '(delete_result.diff[0].deleted | length) == 4' + - '(delete_result.diff[0].merged | length) == 0' + - '(delete_result.diff[0].query | length) == 0' diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_sanity.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_sanity.yaml index 3e93da5ea..1da7102b4 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_sanity.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_sanity.yaml @@ -1,34 +1,29 @@ ############################################## -## SETUP ## +## SETUP (SANITY) ## ############################################## -- name: SANITY- Initialize the setup +- name: SANITY - Initialize templates cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + state: deleted config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 - - register: result + register: init_result tags: sanity -- assert: +- name: SANITY - Assert initialization + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + loop: '{{ init_result.response }}' tags: sanity - block: - -############################################## -## MERGE ## -############################################## - - - name: SANITY- Create templates - cisco.dcnm.dcnm_template: &temp_merge - state: merged # only choose form [merged, deleted, query] + - name: SANITY - Create templates + cisco.dcnm.dcnm_template: &sanity_create_set + state: merged config: - name: template_101 description: "Template_101" @@ -63,7 +58,6 @@ subscription 2 dst-grp 2 snsr-grp 2 sample-interval 20000 - - name: template_103 description: "Template_103" tags: "internal policy 103" @@ -80,7 +74,6 @@ subscription 3 dst-grp 3 snsr-grp 2 sample-interval 30000 - - name: template_104 description: "Template_104" tags: "internal policy 104" @@ -97,48 +90,66 @@ subscription 4 dst-grp 4 snsr-grp 4 sample-interval 40000 - register: result - - assert: + register: sanity_create_result + + - name: SANITY - Assert create diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 4' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'sanity_create_result.changed == true' + - '(sanity_create_result.diff[0].merged | length) == 4' + - '(sanity_create_result.diff[0].deleted | length) == 0' + - '(sanity_create_result.diff[0].query | length) == 0' - - assert: + - name: SANITY - Assert create responses + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' + loop: '{{ sanity_create_result.response }}' - - name: Cleanup - sleep for 100 seconds for DCNM to completely update the state - wait_for: + - name: SANITY - Wait for controller state sync + ansible.builtin.wait_for: timeout: 100 - - name: Create templates again - Idempotence - cisco.dcnm.dcnm_template: *temp_merge - register: result + - name: SANITY - Idempotence create + cisco.dcnm.dcnm_template: *sanity_create_set + register: sanity_create_idem - - assert: + - name: SANITY - Assert idempotence create + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - -############################################## -## MODIFY PROPERTIES ## -############################################## - - - - name: SANITY- Modifying existing templates - cisco.dcnm.dcnm_template: &temp_repl - state: merged # only choose form [merged, deleted, query] + - 'sanity_create_idem.changed == false' + - '(sanity_create_idem.diff[0].merged | length) == 0' + - '(sanity_create_idem.diff[0].deleted | length) == 0' + - '(sanity_create_idem.diff[0].query | length) == 0' + + ############################################## + ## MODIFY PROPERTIES ## + ############################################## + + - name: SANITY - Modify templates + cisco.dcnm.dcnm_template: &sanity_modify_set + state: merged config: - name: template_101 description: "Template_101 - added this description" tags: "internal policy 101" + content: | + telemetry + certificate /bootflash/telegraf.crt telegraf + destination-profile + use-vrf management + destination-group 1 + ip address 10.195.225.176 port 57000 protocol gRPC encoding GPB + sensor-group 1 + data-source DME + path sys/ch depth unbounded + subscription 1 + dst-grp 1 + snsr-grp 1 sample-interval 10000 + - name: template_102 + description: "Template_102 - added this" + tags: "internal policy 102 - added this" content: | telemetry certificate /bootflash/telegraf.crt telegraf @@ -153,27 +164,10 @@ dst-grp 1 snsr-grp 1 sample-interval 10000 - - name: template_102 - description: "Template_102 - added this" - tags: "internal policy 102 - added this" - content: | - telemetry - certificate /bootflash/telegraf.crt telegraf - destination-profile - use-vrf management - destination-group 2 - ip address 10.195.224.176 port 52000 protocol gRPC encoding GPB - sensor-group 2 - data-source DME - path sys/ch depth unbounded - subscription 2 - dst-grp 2 - snsr-grp 2 sample-interval 20000 - - name: template_103 description: "Template_103 - added this" tags: "internal policy 103 - added this" - content: | # Content modified + content: | telemetry certificate /bootflash/telegraf.crt telegraf destination-profile @@ -186,8 +180,7 @@ subscription 10 dst-grp 10 snsr-grp 10 sample-interval 30010 - - - name: template_104 # No modifications + - name: template_104 description: "Template_104" tags: "internal policy 104" content: | @@ -203,51 +196,51 @@ subscription 4 dst-grp 4 snsr-grp 4 sample-interval 40000 + register: sanity_modify_result - register: result - - - assert: + - name: SANITY - Assert modify diff + ansible.builtin.assert: that: - - 'result.changed == true' - - '(result["diff"][0]["merged"] | length) == 3' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'sanity_modify_result.changed == true' + - '(sanity_modify_result.diff[0].merged | length) == 3' + - '(sanity_modify_result.diff[0].deleted | length) == 0' + - '(sanity_modify_result.diff[0].query | length) == 0' - - assert: + - name: SANITY - Assert modify responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' - loop: '{{ result.response }}' + loop: '{{ sanity_modify_result.response }}' - - name: Modifying existing templates - Idempotence - cisco.dcnm.dcnm_template: *temp_repl - register: result + - name: SANITY - Idempotence modify + cisco.dcnm.dcnm_template: *sanity_modify_set + register: sanity_modify_idem - - assert: + - name: SANITY - Assert idempotence modify + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'sanity_modify_idem.changed == false' + - '(sanity_modify_idem.diff[0].merged | length) == 0' + - '(sanity_modify_idem.diff[0].deleted | length) == 0' + - '(sanity_modify_idem.diff[0].query | length) == 0' + ############################################## + ## CLEANUP ## + ############################################## -############################################## -## CLEANUP ## -############################################## - - - - name: SANITY- Initialize the setup + - name: SANITY - Delete templates including in-use cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + state: deleted config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 -############################################## -## NO DELETE ## -############################################## + ############################################## + ## NO DELETE ## + ############################################## - name: SANITY- Create a template cisco.dcnm.dcnm_template: &temp_merge2 @@ -281,79 +274,75 @@ - assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' - name: SANITY- Delete templates along with the template which is already installed on a switch - cisco.dcnm.dcnm_template: + cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] + config: - name: template_inuse_1 - name: template_inuse_2 - name: template_101 + register: delete_inuse_result - register: result - - - assert: + - name: SANITY - Assert in-use deletion responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' - '("Templates in use, not deleted" in item["DATA"]) and ("template_inuse_1" in item["DATA"])' - '("Templates in use, not deleted" in item["DATA"]) and ("template_inuse_2" in item["DATA"])' - - '(result["template-policy-map"] | length == 2)' - - '"template_inuse_1" in result["template-policy-map"].keys()' - - '"template_inuse_2" in result["template-policy-map"].keys()' - loop: '{{ result.response }}' + - '(delete_inuse_result["template-policy-map"] | length) == 2' + - '"template_inuse_1" in delete_inuse_result["template-policy-map"].keys()' + - '"template_inuse_2" in delete_inuse_result["template-policy-map"].keys()' + loop: '{{ delete_inuse_result.response }}' - - name: SANITY- Delete a template which is not existing - cisco.dcnm.dcnm_template: - state: deleted # only choose form [merged, deleted, query] + - name: SANITY - Delete non-existent template + cisco.dcnm.dcnm_template: + state: deleted config: - name: template_1000 + register: delete_missing_result - register: result - - - assert: + - name: SANITY - Assert delete missing response codes + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ delete_missing_result.response }}' -############################################## -## QUERY ## -############################################## + ############################################## + ## QUERY INUSE ## + ############################################## - - name: SANITY- Query a template - cisco.dcnm.dcnm_template: - state: query # only choose form [merged, deleted, query] + - name: SANITY - Query in-use template only + cisco.dcnm.dcnm_template: + state: query config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 - - name: template_inuse_1 + register: query_inuse_result - register: result - - - assert: + - name: SANITY - Assert query in-use + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 1' - - '"template_inuse_1" in result["template-policy-map"].keys()' - -############################################## -## TEMPLATE VALIDATION FAIL ## -############################################## + - 'query_inuse_result.changed == false' + - '(query_inuse_result["diff"][0]["merged"] | length) == 0' + - '(query_inuse_result["diff"][0]["deleted"] | length) == 0' + - '(query_inuse_result.diff[0].query | length) == 1' + - '"template_inuse_1" in query_inuse_result["template-policy-map"].keys()' + ############################################## + ## TEMPLATE VALIDATION FAIL ## + ############################################## - - name: SANITY- Create templates - cisco.dcnm.dcnm_template: &temp_merge3 - state: merged # only choose form [merged, deleted, query] + - name: SANITY - Attempt invalid template creation + cisco.dcnm.dcnm_template: + state: merged config: - name: test_fail description: "test_fail" @@ -372,35 +361,35 @@ }; aaa group server radius $$AAA_GROUP$$ server $$AAA_SERVER$$ - register: result + register: validation_fail_result - - assert: + - name: SANITY - Assert validation failure diff + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["failed"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - - - name: SANITY- set_fact when error found - set_fact: + - 'validation_fail_result.changed == false' + - '(validation_fail_result.diff[0].failed | length) == 1' + - '(validation_fail_result.diff[0].merged | length) == 0' + - '(validation_fail_result.diff[0].deleted | length) == 0' + - '(validation_fail_result.diff[0].query | length) == 0' + + - name: SANITY - Flag error_exists + ansible.builtin.set_fact: error_exists: true loop: "{{ lookup('list', result['response'][0]['DATA']) }}" when: '"ERROR" == item.get("reportItemType")' - - assert: + - name: SANITY - Assert error flag + ansible.builtin.assert: that: - 'error_exists == true' -############################################## -## WRONG STATE ## -############################################## - - + ############################################## + ## WRONG STATE TEST ## + ############################################## - - name: SANITY- Create templates - cisco.dcnm.dcnm_template: &temp_merge4 - state: replaced # only choose form [merged, deleted, query] + - name: SANITY - Wrong state invocation + cisco.dcnm.dcnm_template: + state: replaced # invalid on purpose config: - name: template_101 description: "Template_101" @@ -419,38 +408,34 @@ dst-grp 1 snsr-grp 1 sample-interval 10000 - register: result - ignore_errors: yes + register: wrong_state_result + ignore_errors: true - - assert: + - name: SANITY - Assert wrong state message + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result["msg"] == "value of state must be one of: merged, deleted, query, got: replaced"' - -############################################## -## DELETED ## -############################################## + - 'wrong_state_result.changed == false' + - 'wrong_state_result.msg == "value of state must be one of: merged, deleted, query, got: replaced"' + ############################################## + ## DELETE ALL ## + ############################################## - - name: SANITY- Delete all templates created - cisco.dcnm.dcnm_template: &temp_delete - state: deleted # only choose form [merged, deleted, query] + - name: SANITY - Delete all templates + cisco.dcnm.dcnm_template: &temp_delete + state: deleted config: - name: template_101 - - name: template_102 - - name: template_103 - - name: template_104 + register: delete_all_result - register: result - - - assert: + - name: SANITY - Assert delete all outcome + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' - + - 'delete_all_result.changed == false' # already deleted during previous steps + - '(delete_all_result.diff[0].merged | length) == 0' + - '(delete_all_result.diff[0].deleted | length) == 0' + - '(delete_all_result.diff[0].query | length) == 0' tags: sanity diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_validation_fail.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_validation_fail.yaml index 6e5ce6daa..133adb1d3 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_validation_fail.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_validation_fail.yaml @@ -1,36 +1,37 @@ +--- ############################################## ## SETUP ## ############################################## -- name: Initialize the setup - cisco.dcnm.dcnm_template: +- name: Initialize template test context + cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: - name: template_101 - name: template_102 - name: template_103 - name: template_104 + register: init_result - register: result - -- assert: +- name: Assert initialization responses + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ init_result.response }}' -- name: set_fact when error found - set_fact: +- name: Initialize error flag + ansible.builtin.set_fact: error_exists: false - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## VALIDATION FAILURE TEST ## + ############################################## - - name: Create templates - cisco.dcnm.dcnm_template: &temp_merge - state: merged # only choose form [merged, deleted, query] + - name: Attempt to create invalid template + cisco.dcnm.dcnm_template: + state: merged config: - name: test_fail description: "test_fail" @@ -49,26 +50,28 @@ }; aaa group server radius $$AAA_GROUP$$ server $$AAA_SERVER$$ - register: result + register: fail_result - - assert: + - name: Assert template validation failure diff + ansible.builtin.assert: that: - - 'result.changed == false' - - '(result["diff"][0]["merged"] | length) == 0' - - '(result["diff"][0]["failed"] | length) == 1' - - '(result["diff"][0]["deleted"] | length) == 0' - - '(result["diff"][0]["query"] | length) == 0' + - 'fail_result.changed == false' + - '(fail_result.diff[0].failed | length) == 1' + - '(fail_result.diff[0].merged | length) == 0' + - '(fail_result.diff[0].deleted | length) == 0' + - '(fail_result.diff[0].query | length) == 0' - - name: set_fact when error found - set_fact: + - name: Flag error_exists when ERROR present + ansible.builtin.set_fact: error_exists: true loop: "{{ lookup('list', result['response'][0]['DATA']) }}" when: '"ERROR" == item.get("reportItemType")' - - assert: + - name: Assert error flag + ansible.builtin.assert: that: - 'error_exists == true' ############################################## ## CLEANUP ## -############################################## \ No newline at end of file +############################################## diff --git a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_wrong_state.yaml b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_wrong_state.yaml index e8244b8af..6d71f28d7 100644 --- a/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_wrong_state.yaml +++ b/tests/integration/targets/dcnm_template/tests/dcnm/dcnm_template_wrong_state.yaml @@ -3,7 +3,7 @@ ############################################## - name: Initialize the setup - cisco.dcnm.dcnm_template: + cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: - name: template_101 @@ -13,25 +13,26 @@ register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' - loop: '{{ result.response }}' + - 'item["RETURN_CODE"] == 200' + loop: '{{ result.response }}' - block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create templates cisco.dcnm.dcnm_template: &temp_merge state: replaced # only choose form [merged, deleted, query] config: - name: template_101 - description: "Template_101" - tags: "internal policy 101" - content: | + description: "Template_101" + tags: "internal policy 101" + content: | telemetry certificate /bootflash/telegraf.crt telegraf destination-profile @@ -46,9 +47,10 @@ snsr-grp 1 sample-interval 10000 register: result - ignore_errors: yes + ignore_errors: true - - assert: - that: - - 'result.changed == false' - - 'result["msg"] == "value of state must be one of: merged, deleted, query, got: replaced"' \ No newline at end of file + - name: ASSERT - Check condition + ansible.builtin.assert: + that: + - 'result.changed == false' + - 'result["msg"] == "value of state must be one of: merged, deleted, query, got: replaced"' diff --git a/tests/integration/targets/dcnm_vpc_pair/tasks/main.yaml b/tests/integration/targets/dcnm_vpc_pair/tasks/main.yaml index 13120fea5..a194380ea 100644 --- a/tests/integration/targets/dcnm_vpc_pair/tasks/main.yaml +++ b/tests/integration/targets/dcnm_vpc_pair/tasks/main.yaml @@ -2,9 +2,9 @@ - name: MAIN - Setup Internal TestCase Variables ansible.builtin.set_fact: test_data_setup: - #---------------------------------- - # No setup templates needed for VPC pair tests - #---------------------------------- + # ---------------------------------- + # No setup templates needed for VPC pair tests + # ---------------------------------- delegate_to: localhost tags: always @@ -17,14 +17,14 @@ tags: always - name: MAIN - ASSERT - Fabric Found - assert: + ansible.builtin.assert: that: - result.result[0].found == true fail_msg: "Fabric '{{ test_data_common.fabric }}' not found." tags: always - name: MAIN - Collect DCNM VPC Pair Test Cases - find: + ansible.builtin.find: paths: "{{ role_path }}/tests/dcnm" patterns: "{{ testcase }}.yaml" connection: local @@ -33,19 +33,20 @@ tags: always - name: MAIN - Set Test Cases Fact - set_fact: + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" delegate_to: localhost tags: always - name: MAIN - Build List of Test Items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" delegate_to: localhost tags: always - name: MAIN - Run Test Cases - include_tasks: "{{ test_case_to_run }}" + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run @@ -55,5 +56,5 @@ cisco.dcnm.dcnm_vpc_pair: src_fabric: "{{ test_data_common.fabric }}" state: deleted - when: IT_CONTEXT is not defined - tags: always \ No newline at end of file + when: it_context is not defined + tags: always diff --git a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_delete.yaml b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_delete.yaml index b1d97f8dc..598cdd56d 100644 --- a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_delete.yaml +++ b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_delete.yaml @@ -17,11 +17,11 @@ ansible.builtin.set_fact: # some cases are for a specific deploy state deploy_local: true - + test_data_deleted: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - VPC Pair Configuration for deletion tests vpc_pair_setup_template: "merged/dcnm_vpc_pair_merged_full_conf.j2" vpc_pair_setup_file: "{{ role_path }}/files/dcnm_vpc_pair_deleted_setup_conf.yaml" @@ -65,7 +65,7 @@ tags: deleted - name: DELETED - TC1 - ASSERT - Check if creation successful - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -108,7 +108,7 @@ tags: deleted - name: DELETED - TC2 - ASSERT - Check if deletion successful - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -147,7 +147,7 @@ tags: deleted - name: DELETED - TC3 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -167,7 +167,7 @@ tags: deleted - name: DELETED - TC4 - ASSERT - Check if creation successful - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -207,7 +207,7 @@ tags: deleted - name: DELETED - TC5 - ASSERT - Check if bulk deletion successful - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -248,7 +248,7 @@ tags: deleted - name: DELETED - TC6 - ASSERT - Check if no change occurred - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -273,5 +273,5 @@ cisco.dcnm.dcnm_vpc_pair: src_fabric: "{{ test_data_common.fabric }}" state: deleted - when: IT_CONTEXT is not defined + when: it_context is not defined tags: deleted diff --git a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_merge.yaml b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_merge.yaml index ab35f8bda..c5cce0527 100644 --- a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_merge.yaml +++ b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_merge.yaml @@ -18,24 +18,24 @@ ansible.builtin.set_fact: # some cases are for a specific deploy state deploy_local: false - + test_data_merged: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - Full VPC Pair Configuration vpc_pair_full_template: "merged/dcnm_vpc_pair_merged_full_conf.j2" vpc_pair_full_file: "{{ role_path }}/files/dcnm_vpc_pair_merged_full_conf.yaml" vpc_pair_full_deployed_file: "{{ role_path }}/files/dcnm_vpc_pair_merged_full_conf_deployed.yaml" - #---------------------------------- - # TC2 - Modified VPC Pair Configuration + # ---------------------------------- + # TC2 - Modified VPC Pair Configuration vpc_pair_modified_template: "merged/dcnm_vpc_pair_merged_modified_conf.j2" vpc_pair_modified_file: "{{ role_path }}/files/dcnm_vpc_pair_merged_modified_conf.yaml" - #---------------------------------- + # ---------------------------------- # TC3 - Minimal VPC Pair Configuration vpc_pair_minimal_template: "merged/dcnm_vpc_pair_merged_minimal_conf.j2" vpc_pair_minimal_file: "{{ role_path }}/files/dcnm_vpc_pair_merged_minimal_conf.yaml" - #---------------------------------- + # ---------------------------------- # TC4 - VPC Pair without deploy flag vpc_pair_no_deploy_template: "merged/dcnm_vpc_pair_merged_no_deploy_conf.j2" vpc_pair_no_deploy_file: "{{ role_path }}/files/dcnm_vpc_pair_merged_no_deploy_conf.yaml" @@ -114,7 +114,7 @@ tags: merged - name: MERGED - TC1 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -144,7 +144,7 @@ tags: merged - name: MERGED - TC1 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - result.changed == false tags: merged @@ -167,7 +167,7 @@ tags: merged - name: MERGED - TC2 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -175,7 +175,7 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - when: (fabric_type == "LANClassic") + when: (fabric_type == "LANClassic") tags: merged - name: MERGED - TC2 - QUERY - Get VPC pair state in NDFC @@ -207,7 +207,7 @@ tags: merged - name: MERGED - TC2b - ASSERT - Check if changed flag is false for VXLAN - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -215,7 +215,7 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - when: (fabric_type == "VXLANFabric") + when: (fabric_type == "VXLANFabric") tags: merged - name: MERGED - TC2b - QUERY - Get VPC pair state in NDFC @@ -238,7 +238,7 @@ tags: merged - name: MERGED - TC3 - ASSERT - Check if deleted successfully - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -280,7 +280,7 @@ tags: merged - name: MERGED - TC4 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -288,7 +288,7 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - when: (fabric_type == "LANClassic") + when: (fabric_type == "LANClassic") tags: merged - name: MERGED - TC4 - QUERY - Get VPC pair state in NDFC @@ -320,7 +320,7 @@ tags: merged - name: MERGED - TC4b - ASSERT - Check if deleted successfully - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -328,7 +328,7 @@ - '(result["diff"][0]["deleted"] | length) == 1' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - when: (fabric_type == "LANClassic") + when: (fabric_type == "LANClassic") tags: merged # TC5 - Create VPC Pair without state and deploy flag (defaults) @@ -340,7 +340,7 @@ tags: merged - name: MERGED - TC5 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -376,7 +376,7 @@ tags: merged - name: MERGED - TC5b - ASSERT - Check if deleted successfully - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -403,7 +403,7 @@ tags: merged - name: MERGED - TC6 - ASSERT - Check if changed flag is true and no deploy - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -445,11 +445,11 @@ PEER1_KEEP_ALIVE_LOCAL_IP: "{{ test_data_common.peer1_ip }}" PEER2_KEEP_ALIVE_LOCAL_IP: "{{ test_data_common.peer2_ip }}" register: result - ignore_errors: yes + ignore_errors: true tags: merged - name: MERGED - TC7 - ASSERT - Check invalid peer IP error - assert: + ansible.builtin.assert: that: - result.changed == false tags: merged @@ -462,5 +462,5 @@ cisco.dcnm.dcnm_vpc_pair: src_fabric: "{{ test_data_common.fabric }}" state: deleted - when: IT_CONTEXT is not defined + when: it_context is not defined tags: merged diff --git a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_override.yaml b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_override.yaml index 87002f866..487761a5f 100644 --- a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_override.yaml +++ b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_override.yaml @@ -17,16 +17,16 @@ ansible.builtin.set_fact: # some cases are for a specific deploy state deploy_local: true - + test_data_overridden: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - Initial VPC Pair Configuration for override vpc_pair_initial_template: "overridden/dcnm_vpc_pair_overridden_initial_conf.j2" vpc_pair_initial_file: "{{ role_path }}/files/dcnm_vpc_pair_overridden_initial_conf.yaml" - #---------------------------------- - # TC2 - Overridden VPC Pair Configuration + # ---------------------------------- + # TC2 - Overridden VPC Pair Configuration vpc_pair_overridden_template: "overridden/dcnm_vpc_pair_overridden_conf.j2" vpc_pair_overridden_file: "{{ role_path }}/files/dcnm_vpc_pair_overridden_conf.yaml" delegate_to: localhost @@ -76,7 +76,7 @@ tags: overridden - name: OVERRIDDEN - TC1 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -123,7 +123,7 @@ tags: overridden - name: OVERRIDDEN - TC2 - ASSERT - Check if changed flag is true for LANClassic - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -131,11 +131,11 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - when: (fabric_type == "LANClassic") + when: (fabric_type == "LANClassic") tags: overridden - name: OVERRIDDEN - TC2 - ASSERT - Check if changed flag is false for VXLANFabric - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -143,7 +143,7 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - when: (fabric_type == "VXLANFabric") + when: (fabric_type == "VXLANFabric") tags: overridden - name: OVERRIDDEN - TC2 - QUERY - Get VPC pair state in NDFC @@ -175,7 +175,7 @@ tags: overridden - name: OVERRIDDEN - TC3 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -196,7 +196,7 @@ tags: overridden - name: OVERRIDDEN - TC4 - ASSERT - Check if deletion successful - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -254,7 +254,7 @@ tags: overridden - name: OVERRIDDEN - TC6 - ASSERT - Check if no change occurred - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -287,5 +287,5 @@ cisco.dcnm.dcnm_vpc_pair: src_fabric: "{{ test_data_common.fabric }}" state: deleted - when: IT_CONTEXT is not defined + when: it_context is not defined tags: overridden diff --git a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_query.yaml b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_query.yaml index fd5cce204..88eb40985 100644 --- a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_query.yaml +++ b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_query.yaml @@ -17,11 +17,11 @@ ansible.builtin.set_fact: # some cases are for a specific deploy state deploy_local: true - + test_data_query: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - VPC Pair Configuration for query tests vpc_pair_setup_template: "merged/dcnm_vpc_pair_merged_full_conf.j2" vpc_pair_setup_file: "{{ role_path }}/files/dcnm_vpc_pair_query_setup_conf.yaml" @@ -65,7 +65,7 @@ tags: query - name: QUERY - TC1 - ASSERT - Check if creation successful - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -105,7 +105,7 @@ tags: query - name: QUERY - TC2 - ASSERT - Check query results - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["response"] | length) == 1' @@ -135,7 +135,7 @@ tags: query - name: QUERY - TC3 - ASSERT - Check query results with both peers - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["response"] | length) == 1' @@ -164,7 +164,7 @@ tags: query - name: QUERY - TC4 - ASSERT - Check query results with one peer - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["response"] | length) == 1' @@ -193,7 +193,7 @@ tags: query - name: QUERY - TC5 - ASSERT - Check query results with second peer - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["response"] | length) == 1' @@ -223,7 +223,7 @@ ignore_errors: true - name: QUERY - TC6 - ASSERT - Check query results with non-existent peer - assert: + ansible.builtin.assert: that: - result.msg is search("not a valid one") or result.msg is search("Error") tags: query @@ -236,5 +236,5 @@ cisco.dcnm.dcnm_vpc_pair: src_fabric: "{{ test_data_common.fabric }}" state: deleted - when: IT_CONTEXT is not defined + when: it_context is not defined tags: query diff --git a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_replace.yaml b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_replace.yaml index e6e6b17ce..1a47c5398 100644 --- a/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_replace.yaml +++ b/tests/integration/targets/dcnm_vpc_pair/tests/dcnm/dcnm_vpc_pair_replace.yaml @@ -17,16 +17,16 @@ ansible.builtin.set_fact: # some cases are for a specific deploy state deploy_local: true - + test_data_replaced: - #---------------------------------- + # ---------------------------------- # config templates and auto generated file location for test cases - #---------------------------------- + # ---------------------------------- # TC1 - Initial VPC Pair Configuration for replacement vpc_pair_initial_template: "replaced/dcnm_vpc_pair_replaced_initial_conf.j2" vpc_pair_initial_file: "{{ role_path }}/files/dcnm_vpc_pair_replaced_initial_conf.yaml" - #---------------------------------- - # TC2 - Replaced VPC Pair Configuration + # ---------------------------------- + # TC2 - Replaced VPC Pair Configuration vpc_pair_replaced_template: "replaced/dcnm_vpc_pair_replaced_conf.j2" vpc_pair_replaced_file: "{{ role_path }}/files/dcnm_vpc_pair_replaced_conf.yaml" delegate_to: localhost @@ -76,7 +76,7 @@ tags: replaced - name: REPLACED - TC1 - ASSERT - Check if changed flag is true - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 1' @@ -123,7 +123,7 @@ tags: replaced - name: REPLACED - TC2 - ASSERT - Check if changed flag is true for LANClassic - assert: + ansible.builtin.assert: that: - result.changed == true - '(result["diff"][0]["merged"] | length) == 0' @@ -131,11 +131,11 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 1' - when: (fabric_type == "LANClassic") + when: (fabric_type == "LANClassic") tags: replaced - name: REPLACED - TC2 - ASSERT - Check if changed flag is false for VXLANFabric - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -143,7 +143,7 @@ - '(result["diff"][0]["deleted"] | length) == 0' - '(result["diff"][0]["query"] | length) == 0' - '(result["diff"][0]["deploy"] | length) == 0' - when: (fabric_type == "VXLANFabric") + when: (fabric_type == "VXLANFabric") tags: replaced - name: REPLACED - TC2 - QUERY - Get VPC pair state in NDFC @@ -175,7 +175,7 @@ tags: replaced - name: REPLACED - TC3 - ASSERT - Check if changed flag is false - assert: + ansible.builtin.assert: that: - result.changed == false - '(result["diff"][0]["merged"] | length) == 0' @@ -193,5 +193,5 @@ cisco.dcnm.dcnm_vpc_pair: src_fabric: "{{ test_data_common.fabric }}" state: deleted - when: IT_CONTEXT is not defined + when: it_context is not defined tags: replaced diff --git a/tests/integration/targets/dcnm_vrf/defaults/main.yaml b/tests/integration/targets/dcnm_vrf/defaults/main.yaml index e1439f84a..39c95d03c 100644 --- a/tests/integration/targets/dcnm_vrf/defaults/main.yaml +++ b/tests/integration/targets/dcnm_vrf/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: "scale" \ No newline at end of file +testcase: "scale" diff --git a/tests/integration/targets/dcnm_vrf/meta/main.yaml b/tests/integration/targets/dcnm_vrf/meta/main.yaml index 5514b6a40..32cf5dda7 100644 --- a/tests/integration/targets/dcnm_vrf/meta/main.yaml +++ b/tests/integration/targets/dcnm_vrf/meta/main.yaml @@ -1 +1 @@ -dependencies: [] \ No newline at end of file +dependencies: [] diff --git a/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml b/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml index 90fdd832c..827341bbf 100644 --- a/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml +++ b/tests/integration/targets/dcnm_vrf/tasks/dcnm.yaml @@ -1,31 +1,33 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: ["{{ role_path }}/tests/dcnm", "{{ role_path }}/tests/dcnm/self-contained-tests"] patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" tags: sanity -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" tags: sanity -- name: debug - debug: - var: test_items +- name: Debug test_items + ansible.builtin.debug: + var: test_items -- name: debug - debug: - var: testcase +- name: Debug testcase + ansible.builtin.debug: + var: testcase -- name: run test cases (connection=httpapi) - include_tasks: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/dcnm_vrf/tasks/main.yaml b/tests/integration/targets/dcnm_vrf/tasks/main.yaml index 22b634ff4..3fcbc500e 100644 --- a/tests/integration/targets/dcnm_vrf/tasks/main.yaml +++ b/tests/integration/targets/dcnm_vrf/tasks/main.yaml @@ -1,6 +1,7 @@ --- -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "Unable to determine controller version" tags: sanity @@ -9,13 +10,14 @@ method: GET path: /appcenter/cisco/ndfc/api/about/version register: result - ignore_errors: yes + failed_when: false tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false tags: sanity - name: Determine version of DCNM or NDFC @@ -23,21 +25,23 @@ method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false tags: sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false tags: sanity # No need to continue if we cannot determine the DCNM/NDFC controller version -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'controller_version != "Unable to determine controller version"' + - 'controller_version != "Unable to determine controller version"' tags: sanity - name: Import Role Tasks ansible.builtin.import_tasks: dcnm.yaml - tags: ['dcnm'] \ No newline at end of file + tags: ['dcnm'] diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml index f3e3e3c6d..7b42656e2 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/deleted.yaml @@ -27,74 +27,74 @@ - set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version == "11" + when: controller_version == "11" - set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version >= "12" + when: controller_version >= "12" - name: SETUP.0 - DELETED - print vars ansible.builtin.debug: var: item - with_items: - - "fabric_1 : {{ fabric_1 }}" - - "switch_1 : {{ switch_1 }}" - - "switch_2 : {{ switch_2 }}" - - "interface_2a : {{ interface_2a }}" + with_items: + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - DELETED - [dcnm_rest.GET] Verify fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" - register: result_setup_1 + register: result_setup_1 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_setup_1.response.DATA != None' - name: SETUP.2 - DELETED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted - register: result_setup_2 + register: result_setup_2 - name: SETUP.2a - DELETED - [wait_for] Wait 40 seconds for controller and switch to sync wait_for: timeout: 40 - when: result_setup_2.changed == true + when: result_setup_2.changed == true - name: SETUP.3 - DELETED - [merged] Create, Attach, Deploy VLAN+VRF ansible-vrf cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true - register: result_setup_3 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true + register: result_setup_3 - name: SETUP.4 - DELETED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_setup_4 - until: - - "result_setup_4.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_setup_4 + until: + - "result_setup_4.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: SETUP.4a - DELETED - [debug] print result_setup_3 debug: var: result_setup_3 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_setup_3.changed == true' - 'result_setup_3.response[0].RETURN_CODE == 200' - 'result_setup_3.response[1].RETURN_CODE == 200' @@ -116,11 +116,11 @@ fabric: "{{ fabric_1 }}" state: deleted config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - register: result_1 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + register: result_1 - name: TEST.1a - DELETED - [wait_for] Wait 60 seconds for controller and switch to sync wait_for: @@ -130,8 +130,8 @@ debug: var: result_1 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1.changed == true' - 'result_1.response[0].RETURN_CODE == 200' - 'result_1.response[1].RETURN_CODE == 200' @@ -152,8 +152,8 @@ debug: var: result_1c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1c.changed == false' - 'result_1c.response|length == 0' - 'result_1c.diff|length == 0' @@ -163,29 +163,29 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: false + deploy: false register: result_1e - name: TEST.1f - DELETED - [query] query VRF state cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_1f + register: result_1f - name: TEST.1g - DELETED - [debug] print result_1e debug: var: result_1e -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1e.changed == true' - 'result_1e.response[0].RETURN_CODE == 200' - 'result_1e.response[1].RETURN_CODE == 200' @@ -201,18 +201,18 @@ fabric: "{{ fabric_1 }}" state: deleted config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal register: result_1h - name: TEST.1j - DELETED - [debug] print result_1 debug: var: result_1h -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1h.changed == true' - 'result_1h.response[0].RETURN_CODE == 200' - 'result_1h.response[1].RETURN_CODE == 200' @@ -233,8 +233,8 @@ debug: var: result_1k -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1k.changed == false' - 'result_1k.response|length == 0' - 'result_1k.diff|length == 0' @@ -244,41 +244,41 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: true register: result_2 - name: TEST.2a - DELETED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_2a - until: - - "result_2a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_2a + until: + - "result_2a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.2b - DELETED - [debug] print result_2 debug: var: result_2 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2.changed == true' - 'result_2.response[0].RETURN_CODE == 200' - 'result_2.response[1].RETURN_CODE == 200' @@ -296,31 +296,31 @@ fabric: "{{ fabric_1 }}" state: deleted config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # controller can provide dot1q - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # controller can provide dot1q + deploy: true register: result_2b - name: TEST.2c - DELETED - [debug] print result_2b debug: var: result_2b -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2b.changed == true' - 'result_2b.response[0].RETURN_CODE == 200' - 'result_2b.response[1].RETURN_CODE == 200' @@ -348,8 +348,8 @@ debug: var: result_2e -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2e.changed == false' - 'result_2e.response|length == 0' - 'result_2e.diff|length == 0' @@ -359,41 +359,41 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: true register: result_3 - name: TEST.3a - DELETED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_3a - until: - - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_3a + until: + - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.3b - DELETED - [debug] print result_3 debug: var: result_3 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_3.changed == true' - 'result_3.response[0].RETURN_CODE == 200' - 'result_3.response[1].RETURN_CODE == 200' @@ -411,14 +411,14 @@ fabric: "{{ fabric_1 }}" state: deleted config: - register: result_3c + register: result_3c - name: TEST.3d - DELETED - [debug] print result_3c debug: var: result_3c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_3c.changed == true' - 'result_3c.response[0].RETURN_CODE == 200' - 'result_3c.response[1].RETURN_CODE == 200' @@ -446,8 +446,8 @@ debug: var: result_3e -- assert: - that: +- ansible.builtin.assert: + that: - 'result_3e.changed == false' - 'result_3e.response|length == 0' - 'result_3e.diff|length == 0' diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml index e5f1033f1..d2445ba70 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/merged.yaml @@ -46,12 +46,12 @@ ansible.builtin.debug: var: item with_items: - - "fabric_1 : {{ fabric_1 }}" - - "switch_1 : {{ switch_1 }}" - - "switch_2 : {{ switch_2 }}" - - "switch_3 : {{ switch_3 }}" - - "interface_2a : {{ interface_2a }}" - - "interface_3a : {{ interface_3a }}" + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" + - "switch_3 : {{ switch_3 }}" + - "interface_2a : {{ interface_2a }}" + - "interface_3a : {{ interface_3a }}" - name: SETUP.1 - MERGED - [dcnm_rest.GET] Verify fabric is deployed. cisco.dcnm.dcnm_rest: @@ -61,7 +61,7 @@ - assert: that: - - result.response.DATA != None + - result.response.DATA != None - name: SETUP.2 - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -86,15 +86,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 600 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 600 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result_1 - name: TEST.1a - MERGED - [query] Wait for vrfStatus == DEPLOYED @@ -113,17 +113,17 @@ - assert: that: - - result_1.changed == true - - result_1.response[0].RETURN_CODE == 200 - - result_1.response[1].RETURN_CODE == 200 - - result_1.response[2].RETURN_CODE == 200 - - (result_1.response[1].DATA|dict2items)[0].value == "SUCCESS" - - (result_1.response[1].DATA|dict2items)[1].value == "SUCCESS" - - result_1.diff[0].attach[0].deploy == true - - result_1.diff[0].attach[1].deploy == true - - switch_1 in result_1.diff[0].attach[0].ip_address - - switch_2 in result_1.diff[0].attach[1].ip_address - - result_1.diff[0].vrf_name == "ansible-vrf-int1" + - result_1.changed == true + - result_1.response[0].RETURN_CODE == 200 + - result_1.response[1].RETURN_CODE == 200 + - result_1.response[2].RETURN_CODE == 200 + - (result_1.response[1].DATA|dict2items)[0].value == "SUCCESS" + - (result_1.response[1].DATA|dict2items)[1].value == "SUCCESS" + - result_1.diff[0].attach[0].deploy == true + - result_1.diff[0].attach[1].deploy == true + - switch_1 in result_1.diff[0].attach[0].ip_address + - switch_2 in result_1.diff[0].attach[1].ip_address + - result_1.diff[0].vrf_name == "ansible-vrf-int1" - name: TEST.1c - MERGED - [merged] conf1 - Idempotence cisco.dcnm.dcnm_vrf: *conf1 @@ -135,8 +135,8 @@ - assert: that: - - result_1c.changed == false - - result_1c.response|length == 0 + - result_1c.changed == false + - result_1c.response|length == 0 - name: TEST.1e - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -157,15 +157,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: false + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: false register: result_2 - name: TEST.2a - MERGED - [query] query VRF state @@ -180,15 +180,15 @@ - assert: that: - - result_2.changed == true - - result_2.response[0].RETURN_CODE == 200 - - result_2.response[1].RETURN_CODE == 200 - - (result_2.response[1].DATA|dict2items)[0].value == "SUCCESS" - - (result_2.response[1].DATA|dict2items)[1].value == "SUCCESS" - - '"{{ switch_1 }}" in result_2.diff[0].attach[0].ip_address or "{{ switch_1 }}" in result_2.diff[0].attach[1].ip_address' - - '"{{ switch_2 }}" in result_2.diff[0].attach[0].ip_address or "{{ switch_2 }}" in result_2.diff[0].attach[1].ip_address' - - result_2.diff[0].vrf_name == "ansible-vrf-int1" - - '"enableL3VniNoVlan\":\"true\"" in result_2a.response[0].parent.vrfTemplateConfig' + - result_2.changed == true + - result_2.response[0].RETURN_CODE == 200 + - result_2.response[1].RETURN_CODE == 200 + - (result_2.response[1].DATA|dict2items)[0].value == "SUCCESS" + - (result_2.response[1].DATA|dict2items)[1].value == "SUCCESS" + - '"{{ switch_1 }}" in result_2.diff[0].attach[0].ip_address or "{{ switch_1 }}" in result_2.diff[0].attach[1].ip_address' + - '"{{ switch_2 }}" in result_2.diff[0].attach[0].ip_address or "{{ switch_2 }}" in result_2.diff[0].attach[1].ip_address' + - result_2.diff[0].vrf_name == "ansible-vrf-int1" + - '"enableL3VniNoVlan\":\"true\"" in result_2a.response[0].parent.vrfTemplateConfig' - name: TEST.2c - MERGED - [merged] conf2 - Idempotence cisco.dcnm.dcnm_vrf: *conf2 @@ -200,8 +200,8 @@ - assert: that: - - result_2c.changed == false - - result_2c.response|length == 0 + - result_2c.changed == false + - result_2c.response|length == 0 - name: TEST.2e - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -213,14 +213,14 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result_3 - name: TEST.3a - MERGED - [query] Wait for vrfStatus == DEPLOYED @@ -239,17 +239,17 @@ - assert: that: - - result_3.changed == true - - result_3.response[0].RETURN_CODE == 200 - - result_3.response[1].RETURN_CODE == 200 - - result_3.response[2].RETURN_CODE == 200 - - (result_3.response[1].DATA|dict2items)[0].value == "SUCCESS" - - (result_3.response[1].DATA|dict2items)[1].value == "SUCCESS" - - result_3.diff[0].attach[0].deploy == true - - result_3.diff[0].attach[1].deploy == true - - switch_1 in result_3.diff[0].attach[0].ip_address - - switch_2 in result_3.diff[0].attach[1].ip_address - - result_3.diff[0].vrf_name == "ansible-vrf-int1" + - result_3.changed == true + - result_3.response[0].RETURN_CODE == 200 + - result_3.response[1].RETURN_CODE == 200 + - result_3.response[2].RETURN_CODE == 200 + - (result_3.response[1].DATA|dict2items)[0].value == "SUCCESS" + - (result_3.response[1].DATA|dict2items)[1].value == "SUCCESS" + - result_3.diff[0].attach[0].deploy == true + - result_3.diff[0].attach[1].deploy == true + - switch_1 in result_3.diff[0].attach[0].ip_address + - switch_2 in result_3.diff[0].attach[1].ip_address + - result_3.diff[0].vrf_name == "ansible-vrf-int1" - name: TEST.3c - MERGED - [merged] conf3 - Idempotence cisco.dcnm.dcnm_vrf: *conf3 @@ -261,8 +261,8 @@ - assert: that: - - result_3c.changed == false - - result_3c.response|length == 0 + - result_3c.changed == false + - result_3c.response|length == 0 - name: TEST.3e - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -280,23 +280,23 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + deploy: true register: result_4 - name: TEST.4a - MERGED - [query] Wait for vrfStatus == DEPLOYED @@ -315,17 +315,17 @@ - assert: that: - - result_4.changed == true - - result_4.response[0].RETURN_CODE == 200 - - result_4.response[1].RETURN_CODE == 200 - - result_4.response[2].RETURN_CODE == 200 - - (result_4.response[1].DATA|dict2items)[0].value == "SUCCESS" - - (result_4.response[1].DATA|dict2items)[1].value == "SUCCESS" - - result_4.diff[0].attach[0].deploy == true - - result_4.diff[0].attach[1].deploy == true - - switch_1 in result_4.diff[0].attach[0].ip_address - - switch_2 in result_4.diff[0].attach[1].ip_address - - result_4.diff[0].vrf_name == "ansible-vrf-int1" + - result_4.changed == true + - result_4.response[0].RETURN_CODE == 200 + - result_4.response[1].RETURN_CODE == 200 + - result_4.response[2].RETURN_CODE == 200 + - (result_4.response[1].DATA|dict2items)[0].value == "SUCCESS" + - (result_4.response[1].DATA|dict2items)[1].value == "SUCCESS" + - result_4.diff[0].attach[0].deploy == true + - result_4.diff[0].attach[1].deploy == true + - switch_1 in result_4.diff[0].attach[0].ip_address + - switch_2 in result_4.diff[0].attach[1].ip_address + - result_4.diff[0].vrf_name == "ansible-vrf-int1" - name: TEST.4c - MERGED - [merged] conf4 - Idempotence cisco.dcnm.dcnm_vrf: *conf4 @@ -337,8 +337,8 @@ - assert: that: - - result_4c.changed == false - - result_4c.response|length == 0 + - result_4c.changed == false + - result_4c.response|length == 0 - name: TEST.4e - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -357,17 +357,17 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - interface: "{{ interface_2a }}" # mandatory - deploy: false + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - interface: "{{ interface_2a }}" # mandatory + deploy: false register: result_5 - name: TEST.5a - MERGED - [query] query VRF state @@ -382,15 +382,15 @@ - assert: that: - - result_5.changed == true - - result_5.response[0].RETURN_CODE == 200 - - result_5.response[1].RETURN_CODE == 200 - - (result_5.response[1].DATA|dict2items)[0].value == "SUCCESS" - - (result_5.response[1].DATA|dict2items)[1].value == "SUCCESS" - - '"{{ switch_1 }}" in result_5.diff[0].attach[0].ip_address or "{{ switch_1 }}" in result_5.diff[0].attach[1].ip_address' - - '"{{ switch_2 }}" in result_5.diff[0].attach[0].ip_address or "{{ switch_2 }}" in result_5.diff[0].attach[1].ip_address' - - result_5.diff[0].vrf_name == "ansible-vrf-int1" - - '"enableL3VniNoVlan\":\"true\"" in result_5a.response[0].parent.vrfTemplateConfig' + - result_5.changed == true + - result_5.response[0].RETURN_CODE == 200 + - result_5.response[1].RETURN_CODE == 200 + - (result_5.response[1].DATA|dict2items)[0].value == "SUCCESS" + - (result_5.response[1].DATA|dict2items)[1].value == "SUCCESS" + - '"{{ switch_1 }}" in result_5.diff[0].attach[0].ip_address or "{{ switch_1 }}" in result_5.diff[0].attach[1].ip_address' + - '"{{ switch_2 }}" in result_5.diff[0].attach[0].ip_address or "{{ switch_2 }}" in result_5.diff[0].attach[1].ip_address' + - result_5.diff[0].vrf_name == "ansible-vrf-int1" + - '"enableL3VniNoVlan\":\"true\"" in result_5a.response[0].parent.vrfTemplateConfig' - name: TEST.5c - MERGED - [merged] conf5 - Idempotence cisco.dcnm.dcnm_vrf: *conf5 @@ -402,8 +402,8 @@ - assert: that: - - result_5c.changed == false - - result_5c.response|length == 0 + - result_5c.changed == false + - result_5c.response|length == 0 - name: TEST.5e - MERGED - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: @@ -422,16 +422,16 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - interface: "{{ interface_2a }}" # mandatory - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - interface: "{{ interface_2a }}" # mandatory + deploy: true register: result_6 - name: TEST.6a - MERGED - [query] Wait for vrfStatus == DEPLOYED @@ -450,16 +450,16 @@ - assert: that: - - result_6.changed == true - - result_6.response[0].RETURN_CODE == 200 - - result_6.response[1].RETURN_CODE == 200 - - (result_6.response[1].DATA|dict2items)[0].value == "SUCCESS" - - (result_6.response[1].DATA|dict2items)[1].value == "SUCCESS" - - result_6.diff[0].attach[0].deploy == true - - result_6.diff[0].attach[1].deploy == true - - switch_1 in result_6.diff[0].attach[0].ip_address - - switch_2 in result_6.diff[0].attach[1].ip_address - - result_6.diff[0].vrf_name == "ansible-vrf-int1" + - result_6.changed == true + - result_6.response[0].RETURN_CODE == 200 + - result_6.response[1].RETURN_CODE == 200 + - (result_6.response[1].DATA|dict2items)[0].value == "SUCCESS" + - (result_6.response[1].DATA|dict2items)[1].value == "SUCCESS" + - result_6.diff[0].attach[0].deploy == true + - result_6.diff[0].attach[1].deploy == true + - switch_1 in result_6.diff[0].attach[0].ip_address + - switch_2 in result_6.diff[0].attach[1].ip_address + - result_6.diff[0].vrf_name == "ansible-vrf-int1" - name: TEST.7 - MERGED - [merged] Create, Attach, Deploy VRF - Update with incorrect VRF ID. cisco.dcnm.dcnm_vrf: @@ -475,7 +475,7 @@ - ip_address: "{{ switch_2 }}" deploy: true register: result_7 - ignore_errors: yes + ignore_errors: true - name: TEST.7a - MERGED - [debug] print result_7 ansible.builtin.debug: @@ -487,8 +487,8 @@ - assert: that: - - result_7.changed == false - - TEST_PHRASE in result_7.msg + - result_7.changed == false + - TEST_PHRASE in result_7.msg - name: TEST.8 - MERGED - [merged] Create, Attach, Deploy VRF - Update with Out of Range VRF ID. cisco.dcnm.dcnm_vrf: @@ -504,7 +504,7 @@ - ip_address: "{{ switch_2 }}" deploy: true register: result_8 - ignore_errors: yes + ignore_errors: true - name: TEST.8a - MERGED - [debug] print result_8 ansible.builtin.debug: @@ -516,27 +516,27 @@ - assert: that: - - result_8.changed == false - - TEST_PHRASE in result_8.msg + - result_8.changed == false + - TEST_PHRASE in result_8.msg - name: TEST.9 - MERGED - [merged] Create, Attach, Deploy VRF - VRF LITE missing required parameter cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + deploy: true register: result_9 - ignore_errors: yes + ignore_errors: true - name: TEST.9a - MERGED - [debug] print result_9 ansible.builtin.debug: @@ -548,32 +548,32 @@ - assert: that: - - result_9.changed == false - - TEST_PHRASE in result_9.msg + - result_9.changed == false + - TEST_PHRASE in result_9.msg - name: TEST.10 - MERGED - [merged] Create, Attach and Deploy VRF - configure VRF LITE on non border switch cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_3 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_3a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_3 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_3a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + deploy: true register: result_10 - ignore_errors: yes + ignore_errors: true - name: TEST.10a - MERGED - [debug] print result_10 ansible.builtin.debug: @@ -585,8 +585,8 @@ - assert: that: - - result_10.changed == false - - TEST_PHRASE in result_10.msg + - result_10.changed == false + - TEST_PHRASE in result_10.msg ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml index fa7b2a448..a8112b353 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/overridden.yaml @@ -38,36 +38,36 @@ - set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version == "11" + when: controller_version == "11" - set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version >= "12" + when: controller_version >= "12" - name: SETUP.0 - OVERRIDDEN - print vars ansible.builtin.debug: var: item - with_items: - - "fabric_1 : {{ fabric_1 }}" - - "switch_1 : {{ switch_1 }}" - - "switch_2 : {{ switch_2 }}" - - "interface_2a : {{ interface_2a }}" + with_items: + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - OVERRIDDEN - [dcnn_rest.GET] Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" - register: result + register: result -- assert: - that: +- ansible.builtin.assert: + that: - 'result.response.DATA != None' - name: SETUP.2 - OVERRIDDEN - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted - register: result_setup_2 + register: result_setup_2 - name: SETUP.2a - OVERRIDDEN - [wait_for] Wait 60 seconds for controller and switch to sync # The vrf lite profile removal returns ok for deployment, but the switch @@ -75,23 +75,23 @@ # a new vrf, else the switch goes into OUT-OF-SYNC state wait_for: timeout: 60 - when: result_setup_2.changed == true + when: result_setup_2.changed == true - name: SETUP.3 OVERRIDDEN - [merged] Create, Attach VLAN+VRF ansible-vrf-int1 cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: false - register: result_setup_3 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: false + register: result_setup_3 - name: SETUP.3a - OVERRIDDEN - [debug] print result_setup_3 debug: @@ -101,10 +101,10 @@ cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_setup_4 + register: result_setup_4 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_setup_3.changed == true' - 'result_setup_3.response[0].RETURN_CODE == 200' - 'result_setup_3.response[1].RETURN_CODE == 200' @@ -125,29 +125,29 @@ fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: false - register: result_1 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: false + register: result_1 - name: TEST.1a - OVERRIDDEN - [query] query VRF state cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_1a + register: result_1a - name: TEST.1b - OVERRIDDEN - [debug] print result_1 debug: var: result_1 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1.changed == true' - 'result_1.response[0].RETURN_CODE == 200' - 'result_1.response[1].RETURN_CODE == 200' @@ -173,8 +173,8 @@ debug: var: result_1c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1c.changed == false' - 'result_1c.response|length == 0' @@ -182,23 +182,23 @@ cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted - register: result_1f + register: result_1f - name: TEST.2 OVERRIDDEN - [merged] Create, Attach, Deploy VLAN+VRF ansible-vrf-int1 cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true - register: result_2 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true + register: result_2 - name: TEST.2a - OVERRIDDEN - [debug] print result_2 debug: @@ -208,14 +208,14 @@ cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_2b - until: - - "result_2b.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 - -- assert: - that: + register: result_2b + until: + - "result_2b.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 + +- ansible.builtin.assert: + that: - 'result_2.changed == true' - 'result_2.response[0].RETURN_CODE == 200' - 'result_2.response[1].RETURN_CODE == 200' @@ -233,33 +233,33 @@ fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true - register: result_2c + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true + register: result_2c - name: TEST.2d - OVERRIDDEN - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_2d - until: - - "result_2d.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_2d + until: + - "result_2d.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.2e - OVERRIDDEN - [debug] print result_2c debug: var: result_2c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2c.changed == true' - 'result_2c.response[0].RETURN_CODE == 200' - 'result_2c.response[1].RETURN_CODE == 200' @@ -287,8 +287,8 @@ debug: var: result_2f -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2f.changed == false' - 'result_2f.response|length == 0' @@ -297,24 +297,24 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 1500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int2 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.1/24 # optional - neighbor_ipv4: 10.33.0.0 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true - register: result_3 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 1500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int2 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.1/24 # optional + neighbor_ipv4: 10.33.0.0 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: true + register: result_3 - name: TEST.3a - OVERRIDDEN - [wait_for] Wait 60 seconds for controller and switch to sync # The vrf lite profile removal returns ok for deployment, but the switch @@ -322,24 +322,24 @@ # a new vrf, else the switch goes into OUT-OF-SYNC state wait_for: timeout: 60 - when: result_3.changed == true + when: result_3.changed == true - name: TEST.3b - OVERRIDDEN - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_3b - until: - - "result_3b.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_3b + until: + - "result_3b.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.3c - OVERRIDDEN - [debug] print result_3 debug: var: result_3 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_3.changed == true' - 'result_3.response[0].RETURN_CODE == 200' - 'result_3.response[1].RETURN_CODE == 200' @@ -357,24 +357,24 @@ fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 1500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int2 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.1/24 # optional - neighbor_ipv4: 10.33.0.0 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 21 # optional controller can provide - deploy: true - register: result_4 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 1500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int2 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.1/24 # optional + neighbor_ipv4: 10.33.0.0 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 21 # optional controller can provide + deploy: true + register: result_4 - name: TEST.4a - OVERRIDDEN - [wait_for] Wait 60 seconds for controller and switch to sync # The vrf lite profile removal returns ok for deployment, but the switch @@ -382,7 +382,7 @@ # a new vrf, else the switch goes into OUT-OF-SYNC state wait_for: timeout: 60 - when: result_4.changed == true + when: result_4.changed == true # In step TEST.4, NDFC issues an NX-OS CLI that immediately switches # from configure profile mode, to configure terminal; vrf context . @@ -396,29 +396,29 @@ cisco.dcnm.dcnm_rest: method: POST path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}/config-deploy?forceShowRun=false" - when: result_4.changed == true + when: result_4.changed == true - name: TEST.4c - OVERRIDDEN - [wait_for] Wait 60 for vrfStatus == DEPLOYED wait_for: timeout: 60 - when: result_4.changed == true + when: result_4.changed == true - name: TEST.4d - OVERRIDDEN - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_4d - until: - - "result_4d.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_4d + until: + - "result_4d.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.4e - OVERRIDDEN - [debug] print result_4 debug: var: result_4 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_4.changed == true' - 'result_4.response[0].RETURN_CODE == 200' - 'result_4.response[1].RETURN_CODE == 200' @@ -434,8 +434,8 @@ debug: var: result_4f -- assert: - that: +- ansible.builtin.assert: + that: - 'result_4f.changed == false' - 'result_4f.response|length == 0' @@ -444,24 +444,24 @@ fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.1/24 # optional - neighbor_ipv4: 10.33.0.0 # optional - ipv6_addr: 2010::10:34:0:1/64 # optional - neighbor_ipv6: 2010::10:34:0:2 # optional - dot1q: 31 # optional controller can provide - deploy: true - register: result_5 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.1/24 # optional + neighbor_ipv4: 10.33.0.0 # optional + ipv6_addr: 2010::10:34:0:1/64 # optional + neighbor_ipv6: 2010::10:34:0:2 # optional + dot1q: 31 # optional controller can provide + deploy: true + register: result_5 - name: TEST.5a - OVERRIDDEN - [wait_for] Wait 60 seconds for controller and switch to sync # The vrf lite profile removal returns ok for deployment, but the switch @@ -469,24 +469,24 @@ # a new vrf, else the switch goes into OUT-OF-SYNC state wait_for: timeout: 60 - when: result_5.changed == true + when: result_5.changed == true - name: TEST.5b - OVERRIDDEN - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_5b - until: - - "result_5b.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_5b + until: + - "result_5b.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.5c - OVERRIDDEN - [debug] print result_5 debug: var: result_5 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_5.changed == true' - 'result_5.response[0].RETURN_CODE == 200' - 'result_5.response[1].RETURN_CODE == 200' @@ -515,8 +515,8 @@ debug: var: result_5d -- assert: - that: +- ansible.builtin.assert: + that: - 'result_5d.changed == false' - 'result_5d.response|length == 0' diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml index aa8298ec5..8de08c05e 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/query.yaml @@ -25,36 +25,36 @@ - set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version == "11" + when: controller_version == "11" - set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version >= "12" + when: controller_version >= "12" - name: SETUP.0 - QUERY - [with_items] print vars ansible.builtin.debug: var: item - with_items: - - "fabric_1 : {{ fabric_1 }}" - - "switch_1 : {{ switch_1 }}" - - "switch_2 : {{ switch_2 }}" - - "interface_2a : {{ interface_2a }}" + with_items: + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - QUERY - [dcnm_rest.GET] Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" - register: result + register: result -- assert: - that: +- ansible.builtin.assert: + that: - 'result.response.DATA != None' - name: SETUP.2 - QUERY - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted - register: result_setup_2 + register: result_setup_2 - name: SETUP.2a - QUERY - Wait 60 seconds for controller and switch to sync # The vrf lite profile removal returns ok for deployment, but the switch @@ -62,40 +62,40 @@ # a new vrf, else the switch goes into OUT-OF-SYNC state wait_for: timeout: 60 - when: result_setup_2.changed == true + when: result_setup_2.changed == true - name: SETUP.3 - QUERY - [merged] Create, Attach, Deploy VLAN+VRF ansible-vrf-int1 cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true - register: result_setup_3 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true + register: result_setup_3 - name: SETUP.3a - QUERY - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_setup_3a - until: - - "result_setup_3a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_setup_3a + until: + - "result_setup_3a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: SETUP.3b - QUERY - [debug] print result_setup_3 ansible.builtin.debug: var: result_setup_3 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_setup_3.changed == true' - 'result_setup_3.response[0].RETURN_CODE == 200' - 'result_setup_3.response[1].RETURN_CODE == 200' @@ -125,15 +125,15 @@ attach: - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true - register: result_1 + deploy: true + register: result_1 - name: TEST.1b - QUERY - [debug] print result_1 debug: var: result_1 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1.changed == false' - 'result_1.response[0].parent.vrfName == "ansible-vrf-int1"' - 'result_1.response[0].parent.vrfId == 9008011' @@ -149,14 +149,14 @@ cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted - register: result_2 + register: result_2 - name: TEST.2a - QUERY - [debug] print result_2 debug: var: result_2 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2.changed == true' - 'result_2.response[0].RETURN_CODE == 200' - 'result_2.response[1].RETURN_CODE == 200' @@ -178,33 +178,33 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 1500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true - register: result_3 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 1500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true + register: result_3 - name: TEST.3a - QUERY - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_3a - until: - - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_3a + until: + - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.3b - QUERY - [debug] print result_3 debug: var: result_3 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_3.changed == true' - 'result_3.response[0].RETURN_CODE == 200' - 'result_3.response[1].RETURN_CODE == 200' @@ -220,41 +220,41 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 1500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true - register: result_4 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 1500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 10.33.0.0 # optional + dot1q: 2 # optional controller can provide + deploy: true + register: result_4 - name: TEST.4a - QUERY - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_4a - until: - - "result_4a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_4a + until: + - "result_4a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.4b - QUERY - [debug] print result_4 debug: var: result_4 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_4.changed == true' - 'result_4.response[0].RETURN_CODE == 200' - 'result_4.response[1].RETURN_CODE == 200' @@ -268,31 +268,31 @@ fabric: "{{ fabric_1 }}" state: query config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 1500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true - register: result_5 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 1500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: true + register: result_5 - name: TEST.5a - QUERY - [debug] print result_5 debug: var: result_5 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_5.changed == false' - 'result_5.response[0].parent.vrfName == "ansible-vrf-int2"' - 'result_5.response[0].parent.vrfId == 9008012' @@ -308,14 +308,14 @@ cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_6 + register: result_6 - name: TEST.6a - QUERY - [debug] print result_6 debug: var: result_6 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_6.changed == false' - 'result_6.response[0].parent.vrfName == "ansible-vrf-int2"' - 'result_6.response[0].parent.vrfId == 9008012' @@ -340,15 +340,15 @@ attach: - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true - register: result_7 + deploy: true + register: result_7 - name: TEST.7a - QUERY - [debug] print result_7 debug: var: result_7 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_7.changed == false' - 'result_7.response|length == 0' @@ -366,37 +366,37 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: false - register: result_8 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: false + register: result_8 - name: TEST.8a - QUERY - [query] query VRF state cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_8a + register: result_8a - name: TEST.8b - QUERY - [debug] print result_8 debug: var: result_8 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_8.changed == true' - 'result_8.response[0].RETURN_CODE == 200' - 'result_8.response[1].RETURN_CODE == 200' @@ -413,31 +413,31 @@ fabric: "{{ fabric_1 }}" state: query config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: false - register: result_9 + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int2 # peer_vrf is mandatory + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: false + register: result_9 - name: TEST.9a - QUERY - [debug] print result_9 debug: var: result_9 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_9.changed == false' - 'result_9.response[0].parent.vrfName == "ansible-vrf-int2"' - 'result_9.response[0].parent.vrfId == 9008012' diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml index d37199d57..6f2c083fa 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/replaced.yaml @@ -27,29 +27,29 @@ - set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version == "11" + when: controller_version == "11" - set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" - when: controller_version >= "12" + when: controller_version >= "12" - name: SETUP.0 - REPLACED - [with_items] print vars ansible.builtin.debug: var: item - with_items: - - "fabric_1 : {{ fabric_1 }}" - - "switch_1 : {{ switch_1 }}" - - "switch_2 : {{ switch_2 }}" - - "interface_2a : {{ interface_2a }}" + with_items: + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" + - "interface_2a : {{ interface_2a }}" - name: SETUP.1 - REPLACED - [dcnm_rest.GET] Verify if fabric is deployed. cisco.dcnm.dcnm_rest: method: GET path: "{{ rest_path }}" - register: result + register: result -- assert: - that: +- ansible.builtin.assert: + that: - 'result.response.DATA != None' - name: SETUP.2 - REPLACED - [deleted] Delete all VRFs @@ -66,26 +66,26 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true - register: result_setup_4 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true + register: result_setup_4 - name: SETUP.4a - REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_setup_4a - until: - - "result_setup_4a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_setup_4a + until: + - "result_setup_4a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: SETUP.4b - REPLACED - [debug] print result_setup_4 ansible.builtin.debug: @@ -95,8 +95,8 @@ debug: var: result_setup_4 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_setup_4.changed == true' - 'result_setup_4.response[0].RETURN_CODE == 200' - 'result_setup_4.response[1].RETURN_CODE == 200' @@ -116,29 +116,29 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - register: result_1 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + register: result_1 - name: TEST.1a - REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_1a - until: - - "result_1a.response[0].parent.vrfStatus is search('NA')" - retries: 30 - delay: 2 + register: result_1a + until: + - "result_1a.response[0].parent.vrfStatus is search('NA')" + retries: 30 + delay: 2 - name: TEST.1b - REPLACED - [debug] print result_1 debug: var: result_1 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1.changed == true' - 'result_1.response[0].RETURN_CODE == 200' - 'result_1.response[1].RETURN_CODE == 200' @@ -156,8 +156,8 @@ debug: var: result_1c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_1c.changed == false' - name: TEST.2 - REPLACED - [replaced] Update existing VRF using replace - create attachments @@ -165,33 +165,33 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_2 - name: TEST.2a - REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_2a - until: - - "result_2a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_2a + until: + - "result_2a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.2b - REPLACED - [debug] print result_2 debug: var: result_2 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2.changed == true' - 'result_2.response[0].RETURN_CODE == 200' - 'result_2.response[1].RETURN_CODE == 200' @@ -211,8 +211,8 @@ debug: var: result_2c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_2c.changed == false' - name: TEST.2e - REPLACED - [deleted] Delete all VRFs @@ -229,41 +229,41 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true - register: result_3 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: true + register: result_3 - name: TEST.3a - REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_3a - until: - - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_3a + until: + - "result_3a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.3b - REPLACED - [debug] print result_3 debug: var: result_3 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_3.changed == true' - 'result_3.response[0].RETURN_CODE == 200' - 'result_3.response[1].RETURN_CODE == 200' @@ -281,15 +281,15 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - deploy: true - register: result_4 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + deploy: true + register: result_4 - name: TEST.4a - REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync wait_for: @@ -299,18 +299,18 @@ cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_4b - until: - - "result_4b.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_4b + until: + - "result_4b.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.4c - REPLACED - [debug] print result_4 debug: var: result_4 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_4.changed == true' - 'result_4.response[0].RETURN_CODE == 200' - 'result_4.response[1].RETURN_CODE == 200' @@ -326,8 +326,8 @@ debug: var: result_4d -- assert: - that: +- ansible.builtin.assert: + that: - 'result_4d.changed == false' - name: TEST.5 - REPLACED - [replaced] Update existing VRF - Create VRF LITE Attachment @@ -335,41 +335,41 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: true - register: result_5 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: true + register: result_5 - name: TEST.5a - REPLACED - [query] Wait for vrfStatus == DEPLOYED cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_5a - until: - - "result_5a.response[0].parent.vrfStatus is search('DEPLOYED')" - retries: 30 - delay: 2 + register: result_5a + until: + - "result_5a.response[0].parent.vrfStatus is search('DEPLOYED')" + retries: 30 + delay: 2 - name: TEST.5b - REPLACED - [debug] print result_5 debug: var: result_5 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_5.changed == true' - 'result_5.response[0].RETURN_CODE == 200' - 'result_5.response[1].RETURN_CODE == 200' @@ -386,8 +386,8 @@ debug: var: result_5c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_5c.changed == false' - name: TEST.5e - REPLACED - [deleted] Delete all VRFs @@ -404,37 +404,37 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: false - register: result_6 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: false + register: result_6 - name: TEST.6a - REPLACED - [query] query VRF state cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_6a + register: result_6a - name: TEST.6b - REPLACED - [debug] print result_6 debug: var: result_6 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_6.changed == true' - 'result_6.response[0].RETURN_CODE == 200' - 'result_6.response[1].RETURN_CODE == 200' @@ -451,28 +451,28 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - deploy: false + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + deploy: false register: result_7 - name: TEST.7b - REPLACED - [query] query VRF state cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_7b + register: result_7b - name: TEST.7c - REPLACED - [debug] print result_7 debug: var: result_7 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_7.changed == true' - 'result_7.response[0].RETURN_CODE == 200' - 'result_7.response[1].RETURN_CODE == 200' @@ -489,8 +489,8 @@ debug: var: result_7d -- assert: - that: +- ansible.builtin.assert: + that: - 'result_7d.changed == false' - name: TEST.8 - REPLACED - [replaced] Update existing VRF - Create VRF LITE Attachment @@ -498,37 +498,37 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/30 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # optional controller can provide - deploy: false - register: result_8 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/30 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # optional controller can provide + deploy: false + register: result_8 - name: TEST.8a - REPLACED - [query] query VRF state cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: query - register: result_8a + register: result_8a - name: TEST.8b - REPLACED - [debug] print result_8 debug: var: result_8 -- assert: - that: +- ansible.builtin.assert: + that: - 'result_8.changed == true' - 'result_8.response[0].RETURN_CODE == 200' - '(result_8.response[0].DATA|dict2items)[0].value == "SUCCESS"' @@ -544,8 +544,8 @@ debug: var: result_8c -- assert: - that: +- ansible.builtin.assert: + that: - 'result_8c.changed == false' ############################################### diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml index 52aa69b34..4a79654aa 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/sanity.yaml @@ -21,13 +21,15 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" tags: - sanity -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" tags: @@ -37,9 +39,9 @@ ansible.builtin.debug: var: item with_items: - - "fabric_1 : {{ fabric_1 }}" - - "switch_1 : {{ switch_1 }}" - - "switch_2 : {{ switch_2 }}" + - "fabric_1 : {{ fabric_1 }}" + - "switch_1 : {{ switch_1 }}" + - "switch_2 : {{ switch_2 }}" - name: SETUP.1 - SANITY - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: @@ -48,9 +50,10 @@ register: result_setup_1 tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_setup_1.response.DATA != None' + - 'result_setup_1.response.DATA != None' tags: sanity - name: SETUP.2 - SANITY - [deleted] Delete all VRFs @@ -60,7 +63,7 @@ tags: sanity - name: SETUP.3 - SANITY - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -73,15 +76,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_1 tags: sanity @@ -101,19 +104,20 @@ var: result_1 tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_1.changed == true' - - 'result_1.response[0].RETURN_CODE == 200' - - 'result_1.response[1].RETURN_CODE == 200' - - 'result_1.response[2].RETURN_CODE == 200' - - '(result_1.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_1.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_1.diff[0].attach[0].deploy == true' - - 'result_1.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" in result_1.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" in result_1.diff[0].attach[1].ip_address' - - 'result_1.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_1.changed == true' + - 'result_1.response[0].RETURN_CODE == 200' + - 'result_1.response[1].RETURN_CODE == 200' + - 'result_1.response[2].RETURN_CODE == 200' + - '(result_1.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_1.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_1.diff[0].attach[0].deploy == true' + - 'result_1.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_1.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_1.diff[0].attach[1].ip_address' + - 'result_1.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.1c - SANITY MERGED - conf1 - Idempotence @@ -126,10 +130,11 @@ var: result_1c tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_1c.changed == false' - - 'result_1c.response|length == 0' + - 'result_1c.changed == false' + - 'result_1c.response|length == 0' tags: sanity - name: TEST.1e - SANITY MERGED - [deleted] Delete all VRFs @@ -139,7 +144,7 @@ tags: sanity - name: TEST.1f - SANITY MERGED - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -148,15 +153,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - l3vni_wo_vlan: true - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + l3vni_wo_vlan: true + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: false + deploy: false register: result_1g tags: sanity @@ -172,17 +177,18 @@ var: result_1g tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_1g.changed == true' - - 'result_1g.response[0].RETURN_CODE == 200' - - 'result_1g.response[1].RETURN_CODE == 200' - - '(result_1g.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_1g.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - '"{{ switch_1 }}" in result_1g.diff[0].attach[0].ip_address or "{{ switch_1 }}" in result_1g.diff[0].attach[1].ip_address' - - '"{{ switch_2 }}" in result_1g.diff[0].attach[0].ip_address or "{{ switch_2 }}" in result_1g.diff[0].attach[1].ip_address' - - 'result_1g.diff[0].vrf_name == "ansible-vrf-int1"' - - '"enableL3VniNoVlan\":\"true\"" in result_1h.response[0].parent.vrfTemplateConfig' + - 'result_1g.changed == true' + - 'result_1g.response[0].RETURN_CODE == 200' + - 'result_1g.response[1].RETURN_CODE == 200' + - '(result_1g.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_1g.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - '"{{ switch_1 }}" in result_1g.diff[0].attach[0].ip_address or "{{ switch_1 }}" in result_1g.diff[0].attach[1].ip_address' + - '"{{ switch_2 }}" in result_1g.diff[0].attach[0].ip_address or "{{ switch_2 }}" in result_1g.diff[0].attach[1].ip_address' + - 'result_1g.diff[0].vrf_name == "ansible-vrf-int1"' + - '"enableL3VniNoVlan\": \"true\"" in result_1h.response[0].parent.vrfTemplateConfig' tags: sanity - name: TEST.1j - SANITY MERGED - conf1 - Idempotence @@ -195,10 +201,11 @@ var: result_1j tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_1j.changed == false' - - 'result_1j.response|length == 0' + - 'result_1j.changed == false' + - 'result_1j.response|length == 0' tags: sanity - name: TEST.1k - SANITY MERGED - [deleted] Delete all VRFs @@ -216,15 +223,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_2 tags: sanity @@ -244,17 +251,18 @@ var: result_2 tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2.changed == true' - - 'result_2.response[0].RETURN_CODE == 200' - - 'result_2.response[1].RETURN_CODE == 200' - - 'result_2.response[2].RETURN_CODE == 200' - - '(result_2.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_2.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_2.diff[0].attach[0].deploy == true' - - 'result_2.diff[0].attach[1].deploy == true' - - 'result_2.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_2.changed == true' + - 'result_2.response[0].RETURN_CODE == 200' + - 'result_2.response[1].RETURN_CODE == 200' + - 'result_2.response[2].RETURN_CODE == 200' + - '(result_2.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_2.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_2.diff[0].attach[0].deploy == true' + - 'result_2.diff[0].attach[1].deploy == true' + - 'result_2.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.2c - SANITY REPLACED - [replaced] Update existing VRF - delete attachments @@ -262,16 +270,16 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 register: result_2c tags: sanity - name: TEST.2d - SANITY REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -291,16 +299,17 @@ var: result_2c tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2c.changed == true' - - 'result_2c.response[0].RETURN_CODE == 200' - - 'result_2c.response[1].RETURN_CODE == 200' - - '(result_2c.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_2c.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_2c.diff[0].attach[0].deploy == false' - - 'result_2c.diff[0].attach[1].deploy == false' - - 'result_2c.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_2c.changed == true' + - 'result_2c.response[0].RETURN_CODE == 200' + - 'result_2c.response[1].RETURN_CODE == 200' + - '(result_2c.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_2c.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_2c.diff[0].attach[0].deploy == false' + - 'result_2c.diff[0].attach[1].deploy == false' + - 'result_2c.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.2g - SANITY REPLACED - conf2c - Idempotence @@ -313,9 +322,10 @@ var: result_2g tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2g.changed == false' + - 'result_2g.changed == false' tags: sanity - name: TEST.2i - SANITY REPLACED - [replaced] Update existing VRF - create attachments @@ -323,20 +333,20 @@ fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_2i tags: sanity - name: TEST.2j - SANITY REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -356,18 +366,19 @@ var: result_2i tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2i.changed == true' - - 'result_2i.response[0].RETURN_CODE == 200' - - 'result_2i.response[1].RETURN_CODE == 200' - - '(result_2i.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_2i.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_2i.diff[0].attach[0].deploy == true' - - 'result_2i.diff[0].attach[1].deploy == true' - - 'result_2i.diff[0].vrf_name == "ansible-vrf-int1"' - - 'result_2i.diff[0].attach[0].vlan_id == 500' - - 'result_2i.diff[0].attach[1].vlan_id == 500' + - 'result_2i.changed == true' + - 'result_2i.response[0].RETURN_CODE == 200' + - 'result_2i.response[1].RETURN_CODE == 200' + - '(result_2i.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_2i.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_2i.diff[0].attach[0].deploy == true' + - 'result_2i.diff[0].attach[1].deploy == true' + - 'result_2i.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_2i.diff[0].attach[0].vlan_id == 500' + - 'result_2i.diff[0].attach[1].vlan_id == 500' tags: sanity - name: TEST.2m - SANITY REPLACED - [replaced] conf2i - Idempotence @@ -380,9 +391,10 @@ var: result_2m tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2m.changed == false' + - 'result_2m.changed == false' tags: sanity - name: TEST.2o - SANITY REPLACED - [deleted] Delete all VRFs @@ -392,7 +404,7 @@ tags: sanity - name: TEST.2p - SANITY REPLACED - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -405,15 +417,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_3 tags: sanity @@ -433,19 +445,20 @@ var: result_3 tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_3.changed == true' - - 'result_3.response[0].RETURN_CODE == 200' - - 'result_3.response[1].RETURN_CODE == 200' - - 'result_3.response[2].RETURN_CODE == 200' - - '(result_3.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_3.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_3.diff[0].attach[0].deploy == true' - - 'result_3.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" in result_3.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" in result_3.diff[0].attach[1].ip_address' - - 'result_3.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_3.changed == true' + - 'result_3.response[0].RETURN_CODE == 200' + - 'result_3.response[1].RETURN_CODE == 200' + - 'result_3.response[2].RETURN_CODE == 200' + - '(result_3.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_3.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_3.diff[0].attach[0].deploy == true' + - 'result_3.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_3.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_3.diff[0].attach[1].ip_address' + - 'result_3.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.3c - SANITY OVERRIDDEN - [overridden] Update existing VRF - delete and create @@ -453,15 +466,15 @@ fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008012 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int2 + vrf_id: 9008012 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_3c tags: sanity @@ -481,25 +494,26 @@ var: result_3c tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_3c.changed == true' - - 'result_3c.response[0].RETURN_CODE == 200' - - 'result_3c.response[1].RETURN_CODE == 200' - - 'result_3c.response[2].RETURN_CODE == 200' - - 'result_3c.response[3].RETURN_CODE == 200' - - 'result_3c.response[4].RETURN_CODE == 200' - - 'result_3c.response[5].RETURN_CODE == 200' - - '(result_3c.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_3c.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - '(result_3c.response[5].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_3c.response[5].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_3c.diff[0].attach[0].deploy == true' - - 'result_3c.diff[0].attach[1].deploy == true' - - 'result_3c.diff[0].vrf_name == "ansible-vrf-int2"' - - 'result_3c.diff[1].attach[0].deploy == false' - - 'result_3c.diff[1].attach[1].deploy == false' - - 'result_3c.diff[1].vrf_name == "ansible-vrf-int1"' + - 'result_3c.changed == true' + - 'result_3c.response[0].RETURN_CODE == 200' + - 'result_3c.response[1].RETURN_CODE == 200' + - 'result_3c.response[2].RETURN_CODE == 200' + - 'result_3c.response[3].RETURN_CODE == 200' + - 'result_3c.response[4].RETURN_CODE == 200' + - 'result_3c.response[5].RETURN_CODE == 200' + - '(result_3c.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_3c.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - '(result_3c.response[5].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_3c.response[5].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_3c.diff[0].attach[0].deploy == true' + - 'result_3c.diff[0].attach[1].deploy == true' + - 'result_3c.diff[0].vrf_name == "ansible-vrf-int2"' + - 'result_3c.diff[1].attach[0].deploy == false' + - 'result_3c.diff[1].attach[1].deploy == false' + - 'result_3c.diff[1].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.3f - SANITY OVERRIDDEN - [overridden] conf3c - Idempotence @@ -512,10 +526,11 @@ var: result_3f tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_3f.changed == false' - - 'result_3f.response|length == 0' + - 'result_3f.changed == false' + - 'result_3f.response|length == 0' tags: sanity - name: TEST.3h - SANITY OVERRIDDEN - [deleted] Delete all VRFs @@ -525,7 +540,7 @@ tags: sanity - name: TEST.3i - SANITY OVERRIDDEN - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -538,15 +553,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_4 tags: sanity @@ -566,19 +581,20 @@ var: result_4 tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_4.changed == true' - - 'result_4.response[0].RETURN_CODE == 200' - - 'result_4.response[1].RETURN_CODE == 200' - - 'result_4.response[2].RETURN_CODE == 200' - - '(result_4.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_4.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_4.diff[0].attach[0].deploy == true' - - 'result_4.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" in result_4.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" in result_4.diff[0].attach[1].ip_address' - - 'result_4.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_4.changed == true' + - 'result_4.response[0].RETURN_CODE == 200' + - 'result_4.response[1].RETURN_CODE == 200' + - 'result_4.response[2].RETURN_CODE == 200' + - '(result_4.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_4.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_4.diff[0].attach[0].deploy == true' + - 'result_4.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_4.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_4.diff[0].attach[1].ip_address' + - 'result_4.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.4c - SANITY QUERY - [query] Query the VRF @@ -603,18 +619,19 @@ var: result_4c tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_4c.changed == false' - - 'result_4c.response[0].parent.vrfName == "ansible-vrf-int1"' - - 'result_4c.response[0].parent.vrfId == 9008011' - - 'result_4c.response[0].parent.vrfStatus == "DEPLOYED"' - - 'result_4c.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result_4c.response[0].attach[0].switchDetailsList[0].lanAttachedState == "DEPLOYED"' - - 'result_4c.response[0].attach[0].switchDetailsList[0].vlan == 500' - - 'result_4c.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result_4c.response[0].attach[1].switchDetailsList[0].lanAttachedState == "DEPLOYED"' - - 'result_4c.response[0].attach[1].switchDetailsList[0].vlan == 500' + - 'result_4c.changed == false' + - 'result_4c.response[0].parent.vrfName == "ansible-vrf-int1"' + - 'result_4c.response[0].parent.vrfId == 9008011' + - 'result_4c.response[0].parent.vrfStatus == "DEPLOYED"' + - 'result_4c.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result_4c.response[0].attach[0].switchDetailsList[0].lanAttachedState == "DEPLOYED"' + - 'result_4c.response[0].attach[0].switchDetailsList[0].vlan == 500' + - 'result_4c.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result_4c.response[0].attach[1].switchDetailsList[0].lanAttachedState == "DEPLOYED"' + - 'result_4c.response[0].attach[1].switchDetailsList[0].vlan == 500' tags: sanity - name: TEST.4e - SANITY QUERY - [deleted] Delete all VRFs @@ -624,7 +641,7 @@ tags: sanity - name: TEST.4f - SANITY QUERY - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -637,15 +654,15 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result_5 tags: sanity @@ -665,19 +682,20 @@ var: result_5 tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_5.changed == true' - - 'result_5.response[0].RETURN_CODE == 200' - - 'result_5.response[1].RETURN_CODE == 200' - - 'result_5.response[2].RETURN_CODE == 200' - - '(result_5.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_5.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_5.diff[0].attach[0].deploy == true' - - 'result_5.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" in result_5.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" in result_5.diff[0].attach[1].ip_address' - - 'result_5.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_5.changed == true' + - 'result_5.response[0].RETURN_CODE == 200' + - 'result_5.response[1].RETURN_CODE == 200' + - 'result_5.response[2].RETURN_CODE == 200' + - '(result_5.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_5.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_5.diff[0].attach[0].deploy == true' + - 'result_5.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" in result_5.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result_5.diff[0].attach[1].ip_address' + - 'result_5.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.5c - SANITY DELETED - [deleted] Delete the VRF @@ -685,10 +703,10 @@ fabric: "{{ fabric_1 }}" state: deleted config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal register: result_5c tags: sanity @@ -697,19 +715,20 @@ var: result_5c tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_5c.changed == true' - - 'result_5c.response[0].RETURN_CODE == 200' - - 'result_5c.response[1].RETURN_CODE == 200' - - 'result_5c.response[1].MESSAGE == "OK"' - - 'result_5c.response[2].RETURN_CODE == 200' - - 'result_5c.response[2].METHOD == "DELETE"' - - '(result_5c.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result_5c.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - 'result_5c.diff[0].attach[0].deploy == false' - - 'result_5c.diff[0].attach[1].deploy == false' - - 'result_5c.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result_5c.changed == true' + - 'result_5c.response[0].RETURN_CODE == 200' + - 'result_5c.response[1].RETURN_CODE == 200' + - 'result_5c.response[1].MESSAGE == "OK"' + - 'result_5c.response[2].RETURN_CODE == 200' + - 'result_5c.response[2].METHOD == "DELETE"' + - '(result_5c.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result_5c.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result_5c.diff[0].attach[0].deploy == false' + - 'result_5c.diff[0].attach[1].deploy == false' + - 'result_5c.diff[0].vrf_name == "ansible-vrf-int1"' tags: sanity - name: TEST.5e - SANITY DELETED - conf5c - Idempotence @@ -722,9 +741,10 @@ var: result_5e tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_5e.changed == false' - - 'result_5e.response|length == 0' - - 'result_5e.diff|length == 0' + - 'result_5e.changed == false' + - 'result_5e.response|length == 0' + - 'result_5e.diff|length == 0' tags: sanity diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml index 5748884fc..865853dbb 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/deleted_vrf_all.yaml @@ -21,11 +21,13 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" @@ -35,9 +37,10 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: DELETE_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: @@ -53,30 +56,30 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - source: null - service_vrf_template: null - vrf_vlan_name: "test" - vrf_intf_desc: "test vrf interface" - vrf_description: "test vrf" - vrf_int_mtu: 2100 - loopback_route_tag: 54321 - max_bgp_paths: 6 - max_ibgp_paths: 7 - ipv6_linklocal_enable: false - adv_host_routes: true - adv_default_routes: false - static_default_route: false - bgp_password: "74657374" - bgp_passwd_encrypt: 7 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + source: null + service_vrf_template: null + vrf_vlan_name: "test" + vrf_intf_desc: "test vrf interface" + vrf_description: "test vrf" + vrf_int_mtu: 2100 + loopback_route_tag: 54321 + max_bgp_paths: 6 + max_ibgp_paths: 7 + ipv6_linklocal_enable: false + adv_host_routes: true + adv_default_routes: false + static_default_route: false + bgp_password: "74657374" + bgp_passwd_encrypt: 7 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -89,19 +92,20 @@ retries: 30 delay: 2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: DELETE_ALL - Clean existing vrfs cisco.dcnm.dcnm_vrf: &conf @@ -109,26 +113,28 @@ state: deleted register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - -- name: DELETE_ALL - conf - Idempotence + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + + - name: DELETE_ALL - conf - Idempotence cisco.dcnm.dcnm_vrf: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml index 733e3d0a4..beb1b5e3e 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/merged_vrf_all.yaml @@ -21,11 +21,13 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" @@ -35,9 +37,10 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: MERGED_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: @@ -53,30 +56,30 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - source: null - service_vrf_template: null - vrf_vlan_name: "test" - vrf_intf_desc: "test vrf interface" - vrf_description: "test vrf" - vrf_int_mtu: 2100 - loopback_route_tag: 54321 - max_bgp_paths: 6 - max_ibgp_paths: 7 - ipv6_linklocal_enable: false - adv_host_routes: true - adv_default_routes: false - static_default_route: false - bgp_password: "74657374" - bgp_passwd_encrypt: 7 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + source: null + service_vrf_template: null + vrf_vlan_name: "test" + vrf_intf_desc: "test vrf interface" + vrf_description: "test vrf" + vrf_int_mtu: 2100 + loopback_route_tag: 54321 + max_bgp_paths: 6 + max_ibgp_paths: 7 + ipv6_linklocal_enable: false + adv_host_routes: true + adv_default_routes: false + static_default_route: false + bgp_password: "74657374" + bgp_passwd_encrypt: 7 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -89,28 +92,30 @@ retries: 30 delay: 2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: MERGED_ALL - conf - Idempotence cisco.dcnm.dcnm_vrf: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml index 11b543b57..b182db729 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/overridden_vrf_all.yaml @@ -21,11 +21,13 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" @@ -35,9 +37,10 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: OVERRIDDEN_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: @@ -53,30 +56,30 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - source: null - service_vrf_template: null - vrf_vlan_name: "test" - vrf_intf_desc: "test vrf interface" - vrf_description: "test vrf" - vrf_int_mtu: 2100 - loopback_route_tag: 54321 - max_bgp_paths: 6 - max_ibgp_paths: 7 - ipv6_linklocal_enable: false - adv_host_routes: true - adv_default_routes: false - static_default_route: false - bgp_password: "74657374" - bgp_passwd_encrypt: 7 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + source: null + service_vrf_template: null + vrf_vlan_name: "test" + vrf_intf_desc: "test vrf interface" + vrf_description: "test vrf" + vrf_int_mtu: 2100 + loopback_route_tag: 54321 + max_bgp_paths: 6 + max_ibgp_paths: 7 + ipv6_linklocal_enable: false + adv_host_routes: true + adv_default_routes: false + static_default_route: false + bgp_password: "74657374" + bgp_passwd_encrypt: 7 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -89,58 +92,60 @@ retries: 30 delay: 2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: OVERRIDDEN_ALL - conf - Idempotence cisco.dcnm.dcnm_vrf: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' -- name: OVERRIDDEN_ALL - Override a existing VRF with a new one +- name: OVERRIDDEN_ALL - Override a existing VRF with a new one cisco.dcnm.dcnm_vrf: &conf1 fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - source: null - service_vrf_template: null - vrf_vlan_name: "testvlan" - vrf_intf_desc: "test interface" - vrf_description: "vrf" - vrf_int_mtu: 2100 - loopback_route_tag: 54321 - max_bgp_paths: 6 - max_ibgp_paths: 7 - ipv6_linklocal_enable: true - adv_host_routes: true - adv_default_routes: false - static_default_route: false - bgp_password: "74657374" - bgp_passwd_encrypt: 7 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int2 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + source: null + service_vrf_template: null + vrf_vlan_name: "testvlan" + vrf_intf_desc: "test interface" + vrf_description: "vrf" + vrf_int_mtu: 2100 + loopback_route_tag: 54321 + max_bgp_paths: 6 + max_ibgp_paths: 7 + ipv6_linklocal_enable: true + adv_host_routes: true + adv_default_routes: false + static_default_route: false + bgp_password: "74657374" + bgp_passwd_encrypt: 7 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -181,10 +186,11 @@ cisco.dcnm.dcnm_vrf: *conf1 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml index 7645e5f00..5fbd4b255 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/replaced_vrf_all.yaml @@ -21,11 +21,13 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" @@ -35,9 +37,10 @@ path: "{{ rest_path }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: REPLACED_ALL - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: @@ -53,30 +56,30 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - source: null - service_vrf_template: null - vrf_vlan_name: "test" - vrf_intf_desc: "test vrf interface" - vrf_description: "test vrf" - vrf_int_mtu: 2100 - loopback_route_tag: 54321 - max_bgp_paths: 6 - max_ibgp_paths: 7 - ipv6_linklocal_enable: false - adv_host_routes: true - adv_default_routes: false - static_default_route: false - bgp_password: "74657374" - bgp_passwd_encrypt: 7 - attach: - - ip_address: "{{ switch_1 }}" - - ip_address: "{{ switch_2 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + source: null + service_vrf_template: null + vrf_vlan_name: "test" + vrf_intf_desc: "test vrf interface" + vrf_description: "test vrf" + vrf_int_mtu: 2100 + loopback_route_tag: 54321 + max_bgp_paths: 6 + max_ibgp_paths: 7 + ipv6_linklocal_enable: false + adv_host_routes: true + adv_default_routes: false + static_default_route: false + bgp_password: "74657374" + bgp_passwd_encrypt: 7 + attach: + - ip_address: "{{ switch_1 }}" + - ip_address: "{{ switch_2 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -89,58 +92,60 @@ retries: 30 delay: 2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ switch_1 }}" or "{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" or "{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - name: REPLACED_ALL - conf - Idempotence cisco.dcnm.dcnm_vrf: *conf register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' -- name: REPLACED_ALL - Replace VRF with all values + - name: REPLACED_ALL - Replace VRF with all values cisco.dcnm.dcnm_vrf: &conf1 fabric: "{{ fabric_1 }}" state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - source: null - service_vrf_template: null - vrf_vlan_name: "testvlan" - vrf_intf_desc: "test interface" - vrf_description: "vrf" - vrf_int_mtu: 2100 - loopback_route_tag: 54321 - max_bgp_paths: 6 - max_ibgp_paths: 7 - ipv6_linklocal_enable: true - adv_host_routes: true - adv_default_routes: false - static_default_route: false - bgp_password: "74657374" - bgp_passwd_encrypt: 7 - attach: - - ip_address: "{{ switch_1 }}" + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + source: null + service_vrf_template: null + vrf_vlan_name: "testvlan" + vrf_intf_desc: "test interface" + vrf_description: "vrf" + vrf_int_mtu: 2100 + loopback_route_tag: 54321 + max_bgp_paths: 6 + max_ibgp_paths: 7 + ipv6_linklocal_enable: true + adv_host_routes: true + adv_default_routes: false + static_default_route: false + bgp_password: "74657374" + bgp_passwd_encrypt: 7 + attach: + - ip_address: "{{ switch_1 }}" - ip_address: "{{ switch_2 }}" - deploy: true + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -153,21 +158,23 @@ retries: 30 delay: 2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' -- name: REPLACED_ALL - conf1 - Idempotence + - name: REPLACED_ALL - conf1 - Idempotence cisco.dcnm.dcnm_vrf: *conf1 register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml index 43f751325..f85b61418 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/scale.yaml @@ -11,11 +11,13 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/rest/control/fabrics/{{ fabric_1 }}" when: controller_version == "11" -- set_fact: +- name: Set fact + ansible.builtin.set_fact: rest_path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ fabric_1 }}" when: controller_version >= "12" @@ -23,7 +25,7 @@ ansible.builtin.debug: var: item with_items: - - "fabric_1 : {{ fabric_1 }}" + - "fabric_1 : {{ fabric_1 }}" - name: SETUP.1 - SCALE - Verify if fabric is deployed. cisco.dcnm.dcnm_rest: @@ -31,11 +33,12 @@ path: "{{ rest_path }}" register: setup_result_1 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'setup_result_1.response.DATA != None' + - 'setup_result_1.response.DATA != None' -- name: SETUP.2 - SCALE - [deleted] Delete all VRFs + - name: SETUP.2 - SCALE - [deleted] Delete all VRFs cisco.dcnm.dcnm_vrf: fabric: "{{ fabric_1 }}" state: deleted @@ -43,18 +46,28 @@ tags: sanity - name: SETUP.3 - SCALE - [wait_for] Wait 60 seconds for controller and switch to sync - wait_for: + ansible.builtin.wait_for: timeout: 60 when: setup_result_2.changed == false tags: sanity - name: SETUP.4 - SCALE - [set_fact] Dummy set fact for leaf_attach_list - set_fact: + ansible.builtin.set_fact: leaf_vrf_attach: [] -- name: SETUP.5 - SCALE - [set_fact] Build list of VRFs to be deployed - set_fact: - vrfs_list: "{{ vrfs_list|default([]) + [{ 'vrf_name': 'TEST_VRF%03d' | format(item), 'deploy': 'no', 'vrf_id': (item | int + 60000) | int, 'vlan_id': (item | int + 2000) | int, 'attach': leaf_vrf_attach }] }}" +- name: SETUP.5 - SCALE - [set_fact] Build single VRF dict per item + ansible.builtin.set_fact: + new_vrf: + vrf_name: "{{ 'TEST_VRF%03d' | format(item) }}" + deploy: "no" + vrf_id: "{{ (item | int + 60000) | int }}" + vlan_id: "{{ (item | int + 2000) | int }}" + attach: "{{ leaf_vrf_attach }}" + loop: '{{ range(0, 800) | list }}' + +- name: SETUP.5b - SCALE - [set_fact] Append VRF dict to list + ansible.builtin.set_fact: + vrfs_list: "{{ (vrfs_list | default([])) + [ new_vrf ] }}" loop: '{{ range(0, 800) | list }}' - name: TEST.1 - SCALE - [merged] Push all VRFs to the controller @@ -65,7 +78,7 @@ register: result - name: TEST.1a - SCALE - [wait_for] Wait 60 seconds - wait_for: + ansible.builtin.wait_for: timeout: 60 tags: sanity @@ -79,11 +92,12 @@ ansible.builtin.debug: var: result_2 -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2.changed == true' + - 'result_2.changed == true' -- name: TEST.2b - SCALE - [deleted] conf2 - Idempotence + - name: TEST.2b - SCALE - [deleted] conf2 - Idempotence cisco.dcnm.dcnm_vrf: *conf2 register: result_2b @@ -91,11 +105,12 @@ ansible.builtin.debug: var: result_2b -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'result_2b.changed == false' - - 'result_2b.response|length == 0' - - 'result_2b.diff|length == 0' + - 'result_2b.changed == false' + - 'result_2b.response|length == 0' + - 'result_2b.diff|length == 0' ################################################ #### CLEAN-UP ## diff --git a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml index 38bb637fe..3153882d9 100644 --- a/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml +++ b/tests/integration/targets/dcnm_vrf/tests/dcnm/self-contained-tests/vrf_lite.yaml @@ -5,7 +5,7 @@ # A VXLAN_EVPN fabric # # switch_1 -# +# # - A vrf-lite capable switch # # switch_2 @@ -49,9 +49,9 @@ path: "{{ rest_path }}" register: result -- assert: +- ansible.builtin.assert: that: - - 'result.response.DATA != None' + - 'result.response.DATA != None' - name: MERGED - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: @@ -66,7 +66,7 @@ timeout: 40 ############################################### -### TESTS ## +## TESTS ## ############################################### - name: VRF LITE- Create, Attach and Deploy new VRF - VLAN/VRF LITE EXTENSION Provided by the User in one switch @@ -74,23 +74,23 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/24 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - - ip_address: "{{ switch_3 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/24 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + - ip_address: "{{ switch_3 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -103,61 +103,61 @@ retries: 30 delay: 2 -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ switch_3 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_2 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ switch_3 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_2 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - name: MERGED - conf1 - Idempotence cisco.dcnm.dcnm_vrf: *conf1 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: VRF LITE- Attach and Deploy second VRF LITE EXTENSION Provided by the User in one switch cisco.dcnm.dcnm_vrf: &conf2 fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/24 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2b }}" # mandatory - ipv4_addr: 20.33.0.2/24 # optional - neighbor_ipv4: 20.33.0.1 # optional - ipv6_addr: 3010::10:34:0:7/64 # optional - neighbor_ipv6: 3010::10:34:0:3 # optional - dot1q: 21 # dot1q can be got from dcnm - - ip_address: "{{ switch_3 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/24 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2b }}" # mandatory + ipv4_addr: 20.33.0.2/24 # optional + neighbor_ipv4: 20.33.0.1 # optional + ipv6_addr: 3010::10:34:0:7/64 # optional + neighbor_ipv6: 3010::10:34:0:3 # optional + dot1q: 21 # dot1q can be got from dcnm + - ip_address: "{{ switch_3 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -170,52 +170,52 @@ retries: 30 delay: 2 -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"{{ interface_2b }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"20.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2b }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"20.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - name: VRF LITE - conf2 - Idempotence cisco.dcnm.dcnm_vrf: *conf2 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: VRF LITE- Replace VRF LITE Attachment and Deploy by the User in one switch cisco.dcnm.dcnm_vrf: &conf3 fabric: "{{ fabric_1 }}" - state: replaced + state: replaced config: - - vrf_name: ansible-vrf-int1 - vrf_id: 9008011 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 500 - attach: - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/24 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - - ip_address: "{{ switch_3 }}" - deploy: true + - vrf_name: ansible-vrf-int1 + vrf_id: 9008011 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 500 + attach: + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/24 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + - ip_address: "{{ switch_3 }}" + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -228,56 +228,56 @@ retries: 30 delay: 2 -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int1"' - - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int1"' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - name: MERGED - conf3 - Idempotence cisco.dcnm.dcnm_vrf: *conf3 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: VRF LITE- Override VRF and VRF LITE EXTENSION Provided by the User cisco.dcnm.dcnm_vrf: &conf4 fabric: "{{ fabric_1 }}" state: overridden config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008013 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 400 - attach: - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/24 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2b }}" # mandatory - ipv4_addr: 20.33.0.2/24 # optional - neighbor_ipv4: 20.33.0.1 # optional - ipv6_addr: 3010::10:34:0:7/64 # optional - neighbor_ipv6: 3010::10:34:0:3 # optional - dot1q: 21 # dot1q can be got from dcnm - deploy: true + - vrf_name: ansible-vrf-int2 + vrf_id: 9008013 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 400 + attach: + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/24 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2b }}" # mandatory + ipv4_addr: 20.33.0.2/24 # optional + neighbor_ipv4: 20.33.0.1 # optional + ipv6_addr: 3010::10:34:0:7/64 # optional + neighbor_ipv6: 3010::10:34:0:3 # optional + dot1q: 21 # dot1q can be got from dcnm + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -290,39 +290,39 @@ retries: 30 delay: 2 -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - 'result.response[3].RETURN_CODE == 200' - - 'result.response[4].RETURN_CODE == 200' - - 'result.response[5].RETURN_CODE == 200' - - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[1].attach[0].deploy == false' - - 'result.diff[1].attach[1].deploy == false' - - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_3 }}" in result.diff[1].attach[0].ip_address' - - '"{{ switch_2 }}" in result.diff[1].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int2"' - - 'result.diff[1].vrf_name == "ansible-vrf-int1"' - - '"{{ interface_2a }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"ansible-vrf-int1" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"10.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"{{ interface_2b }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"20.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[3].RETURN_CODE == 200' + - 'result.response[4].RETURN_CODE == 200' + - 'result.response[5].RETURN_CODE == 200' + - '(result.response[0].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[0].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[1].attach[0].deploy == false' + - 'result.diff[1].attach[1].deploy == false' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_3 }}" in result.diff[1].attach[0].ip_address' + - '"{{ switch_2 }}" in result.diff[1].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int2"' + - 'result.diff[1].vrf_name == "ansible-vrf-int1"' + - '"{{ interface_2a }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"ansible-vrf-int1" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"10.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"{{ interface_2b }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"20.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - name: VRF LITE - conf4 - Idempotence cisco.dcnm.dcnm_vrf: *conf4 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' - name: VRF LITE - Clean up any existing vrfs cisco.dcnm.dcnm_vrf: @@ -341,38 +341,38 @@ fabric: "{{ fabric_1 }}" state: merged config: - - vrf_name: ansible-vrf-int2 - vrf_id: 9008015 - vrf_template: Default_VRF_Universal - vrf_extension_template: Default_VRF_Extension_Universal - vlan_id: 400 - attach: - - ip_address: "{{ switch_1 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int3 # optional - interface: "{{ interface_1a }}" # mandatory - ipv4_addr: 40.33.0.2/24 # optional - neighbor_ipv4: 40.33.0.1 # optional - ipv6_addr: 5010::10:34:0:7/64 # optional - neighbor_ipv6: 5010::10:34:0:3 # optional - dot1q: 4 # dot1q can be got from dcnm - - ip_address: "{{ switch_2 }}" - vrf_lite: - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2a }}" # mandatory - ipv4_addr: 10.33.0.2/24 # optional - neighbor_ipv4: 10.33.0.1 # optional - ipv6_addr: 2010::10:34:0:7/64 # optional - neighbor_ipv6: 2010::10:34:0:3 # optional - dot1q: 2 # dot1q can be got from dcnm - - peer_vrf: ansible-vrf-int1 # optional - interface: "{{ interface_2b }}" # mandatory - ipv4_addr: 20.33.0.2/24 # optional - neighbor_ipv4: 20.33.0.1 # optional - ipv6_addr: 3010::10:34:0:7/64 # optional - neighbor_ipv6: 3010::10:34:0:3 # optional - dot1q: 21 # dot1q can be got from dcnm - deploy: true + - vrf_name: ansible-vrf-int2 + vrf_id: 9008015 + vrf_template: Default_VRF_Universal + vrf_extension_template: Default_VRF_Extension_Universal + vlan_id: 400 + attach: + - ip_address: "{{ switch_1 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int3 # optional + interface: "{{ interface_1a }}" # mandatory + ipv4_addr: 40.33.0.2/24 # optional + neighbor_ipv4: 40.33.0.1 # optional + ipv6_addr: 5010::10:34:0:7/64 # optional + neighbor_ipv6: 5010::10:34:0:3 # optional + dot1q: 4 # dot1q can be got from dcnm + - ip_address: "{{ switch_2 }}" + vrf_lite: + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2a }}" # mandatory + ipv4_addr: 10.33.0.2/24 # optional + neighbor_ipv4: 10.33.0.1 # optional + ipv6_addr: 2010::10:34:0:7/64 # optional + neighbor_ipv6: 2010::10:34:0:3 # optional + dot1q: 2 # dot1q can be got from dcnm + - peer_vrf: ansible-vrf-int1 # optional + interface: "{{ interface_2b }}" # mandatory + ipv4_addr: 20.33.0.2/24 # optional + neighbor_ipv4: 20.33.0.1 # optional + ipv6_addr: 3010::10:34:0:7/64 # optional + neighbor_ipv6: 3010::10:34:0:3 # optional + dot1q: 21 # dot1q can be got from dcnm + deploy: true register: result - name: Query fabric state until vrfStatus transitions to DEPLOYED state @@ -385,36 +385,36 @@ retries: 30 delay: 2 -- assert: +- ansible.builtin.assert: that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' - - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' - - 'result.diff[0].attach[0].deploy == true' - - 'result.diff[0].attach[1].deploy == true' - - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' - - '"{{ switch_1 }}" in result.diff[0].attach[1].ip_address' - - 'result.diff[0].vrf_name == "ansible-vrf-int2"' - - '"{{ interface_1a }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"ansible-vrf-int3" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"40.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' - - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"{{ interface_2b }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - - '"20.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - '(result.response[1].DATA|dict2items)[0].value == "SUCCESS"' + - '(result.response[1].DATA|dict2items)[1].value == "SUCCESS"' + - 'result.diff[0].attach[0].deploy == true' + - 'result.diff[0].attach[1].deploy == true' + - '"{{ switch_2 }}" in result.diff[0].attach[0].ip_address' + - '"{{ switch_1 }}" in result.diff[0].attach[1].ip_address' + - 'result.diff[0].vrf_name == "ansible-vrf-int2"' + - '"{{ interface_1a }}" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"ansible-vrf-int3" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"40.33.0.2/24" in query_result.response[0].attach[0].switchDetailsList[0].extensionValues' + - '"{{ interface_2a }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"ansible-vrf-int1" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"10.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"{{ interface_2b }}" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' + - '"20.33.0.2/24" in query_result.response[0].attach[1].switchDetailsList[0].extensionValues' - name: VRF LITE - conf5 - Idempotence cisco.dcnm.dcnm_vrf: *conf5 register: result -- assert: +- ansible.builtin.assert: that: - - 'result.changed == false' - - 'result.response|length == 0' + - 'result.changed == false' + - 'result.response|length == 0' ############################################### ### CLEAN-UP ## diff --git a/tests/integration/targets/module_integration/tasks/dcnm.yaml b/tests/integration/targets/module_integration/tasks/dcnm.yaml index 0f3410d0f..8b35d98d4 100644 --- a/tests/integration/targets/module_integration/tasks/dcnm.yaml +++ b/tests/integration/targets/module_integration/tasks/dcnm.yaml @@ -1,20 +1,22 @@ --- -- name: collect dcnm test cases - find: +- name: Collect dcnm test cases + ansible.builtin.find: paths: "{{ role_path }}/tests" patterns: "{{ testcase }}.yaml" connection: local register: dcnm_cases -- set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ dcnm_cases.files }}" -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" -- name: run test cases (connection=httpapi) - include: "{{ test_case_to_run }}" +- name: Run test cases (connection=httpapi) + ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run diff --git a/tests/integration/targets/module_integration/tasks/fabric_setup.yaml b/tests/integration/targets/module_integration/tasks/fabric_setup.yaml index 4cdb36a43..2c51c37bc 100644 --- a/tests/integration/targets/module_integration/tasks/fabric_setup.yaml +++ b/tests/integration/targets/module_integration/tasks/fabric_setup.yaml @@ -1,86 +1,92 @@ ---- -- debug: msg="Start adding spine and leaf devices to fabric {{ fabric_name }}" +- name: Start fabric device onboarding message + ansible.builtin.debug: + msg: "Start adding spine and leaf devices to fabric {{ fabric_name }}" - name: PreTest Cleanup - Remove all spine and leaf devices from fabric cisco.dcnm.dcnm_inventory: fabric: cisco-live-virtual state: deleted -- block: - - name: Test Case Setup - Add Spine and Leaf devices to fabric - cisco.dcnm.dcnm_inventory: &spine_leaf_merged - fabric: "{{ fabric_name }}" - state: merged - config: - - seed_ip: "{{ spine1 }}" - auth_proto: MD5 - user_name: "{{ username }}" - password: "{{ password }}" - max_hops: 0 - role: spine - preserve_config: false - - seed_ip: "{{ spine2 }}" - auth_proto: MD5 - user_name: "{{ username }}" - password: "{{ password }}" - max_hops: 0 - role: spine - preserve_config: false - - seed_ip: "{{ leaf1 }}" - auth_proto: MD5 - user_name: "{{ username }}" - password: "{{ password }}" - max_hops: 0 - role: leaf - preserve_config: false - - seed_ip: "{{ leaf2 }}" - auth_proto: MD5 - user_name: "{{ username }}" - password: "{{ password }}" - max_hops: 0 - role: leaf - preserve_config: false - - seed_ip: "{{ leaf3 }}" - auth_proto: MD5 - user_name: "{{ username }}" - password: "{{ password }}" - max_hops: 0 - role: leaf - preserve_config: false - - seed_ip: "{{ leaf4 }}" - auth_proto: MD5 - user_name: "{{ username }}" - password: "{{ password }}" - max_hops: 0 - role: leaf - preserve_config: false - vars: +- name: Add spine and leaf devices to fabric + block: + - name: Test Case Setup - Add Spine and Leaf devices to fabric + cisco.dcnm.dcnm_inventory: &spine_leaf_merged + fabric: "{{ fabric_name }}" + state: merged + config: + - seed_ip: "{{ spine1 }}" + auth_proto: MD5 + user_name: "{{ username }}" + password: "{{ password }}" + max_hops: 0 + role: spine + preserve_config: false + - seed_ip: "{{ spine2 }}" + auth_proto: MD5 + user_name: "{{ username }}" + password: "{{ password }}" + max_hops: 0 + role: spine + preserve_config: false + - seed_ip: "{{ leaf1 }}" + auth_proto: MD5 + user_name: "{{ username }}" + password: "{{ password }}" + max_hops: 0 + role: leaf + preserve_config: false + - seed_ip: "{{ leaf2 }}" + auth_proto: MD5 + user_name: "{{ username }}" + password: "{{ password }}" + max_hops: 0 + role: leaf + preserve_config: false + - seed_ip: "{{ leaf3 }}" + auth_proto: MD5 + user_name: "{{ username }}" + password: "{{ password }}" + max_hops: 0 + role: leaf + preserve_config: false + - seed_ip: "{{ leaf4 }}" + auth_proto: MD5 + user_name: "{{ username }}" + password: "{{ password }}" + max_hops: 0 + role: leaf + preserve_config: false + vars: ansible_command_timeout: 1000 ansible_connect_timeout: 1000 - register: result + register: result - - assert: - that: - - 'result.changed == true' + - name: ASSERT - Initial add changed + ansible.builtin.assert: + that: + - 'result.changed == true' - - name: Add spine and leaf devices to fabric - idempotence check - cisco.dcnm.dcnm_inventory: *spine_leaf_merged - vars: + - name: Add spine and leaf devices to fabric - idempotence check + cisco.dcnm.dcnm_inventory: *spine_leaf_merged + vars: ansible_command_timeout: 1000 ansible_connect_timeout: 1000 - register: result + register: result - - assert: - that: - - 'result.changed == false' + - name: ASSERT - Idempotence unchanged + ansible.builtin.assert: + that: + - 'result.changed == false' - - name: Query Spine Leaf Fabric - cisco.dcnm.dcnm_inventory: - fabric: "{{ fabric_name }}" - state: query - register: result - - - meta: end_play + - name: Query Spine Leaf Fabric + cisco.dcnm.dcnm_inventory: + fabric: "{{ fabric_name }}" + state: query + register: result + - name: End play when query succeeds + ansible.builtin.meta: end_play always: - - debug: msg="Finished adding spine and leaf devices to fabirc {{ fabric_name }}" + - name: Finish fabric device onboarding message + ansible.builtin.debug: + msg: "Finished adding spine and leaf devices to fabric {{ fabric_name }}" diff --git a/tests/integration/targets/module_integration/tasks/main.yaml b/tests/integration/targets/module_integration/tasks/main.yaml index d4334011f..0790accc4 100644 --- a/tests/integration/targets/module_integration/tasks/main.yaml +++ b/tests/integration/targets/module_integration/tasks/main.yaml @@ -1,3 +1,5 @@ --- -- { include: fabric_setup.yaml, tags: ['dcnm_setup'] } -- { include: dcnm.yaml, tags: ['dcnm_integration_tests'] } +- name: Include tasks + ansible.builtin.include_tasks: + file: dcnm.yaml + tags: ['dcnm'] diff --git a/tests/integration/targets/module_integration/tests/spine_leaf_basic.yaml b/tests/integration/targets/module_integration/tests/spine_leaf_basic.yaml index f4a5f10f4..caec6a69d 100644 --- a/tests/integration/targets/module_integration/tests/spine_leaf_basic.yaml +++ b/tests/integration/targets/module_integration/tests/spine_leaf_basic.yaml @@ -1,6 +1,10 @@ ---- -- debug: msg="Starting dcnm_fabric spine_leaf_basic test" -- debug: msg="Role Path {{ role_path }}" +- name: Start dcnm_fabric spine_leaf_basic test + ansible.builtin.debug: + msg: "Starting dcnm_fabric spine_leaf_basic test" + +- name: Display role path + ansible.builtin.debug: + msg: "Role Path {{ role_path }}" - name: Cleanup - Reset or Default Ethernet Interfaces cisco.dcnm.dcnm_interface: @@ -20,145 +24,152 @@ fabric: "{{ fabric_name }}" state: deleted -- block: - - - name: Configure access ethernet interfaces - cisco.dcnm.dcnm_interface: &config_interfaces - fabric: "{{ fabric_name }}" - state: merged - config: - - name: "Ethernet1/3" - type: eth - switch: - - "{{ leaf1 }}" - - "{{ leaf3 }}" - deploy: true - profile: - admin_state: true - mode: access - speed: 'Auto' - bpdu_guard: true - port_type_fast: true - mtu: default - access_vlan: 55 - cmds: - - no shutdown - description: "Access interface for vlan55" - - name: "Ethernet1/4" - type: eth - switch: - - "{{ leaf1 }}" - - "{{ leaf3 }}" - deploy: true - profile: - admin_state: true - mode: access - speed: 'Auto' - bpdu_guard: true - port_type_fast: true - mtu: default - access_vlan: 65 - cmds: - - no shutdown - description: "Access interface for vlan65" - register: result - - - assert: - that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - - name: Configure access ethernet interfaces - Idempotence - cisco.dcnm.dcnm_interface: *config_interfaces - register: result - - - assert: - that: - - 'result.changed == false' - - 'result.response|length == 0' - - - name: Add Tenant VRF - cisco.dcnm.dcnm_vrf: &add_vrf - fabric: "{{ fabric_name }}" - state: merged - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf3 }}" - deploy: true - register: result - - - assert: - that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - - name: Add Tenant VRF - Idempotence - cisco.dcnm.dcnm_vrf: *add_vrf - register: result - - - assert: - that: - - 'result.changed == false' - - 'result.response|length == 0' - - - name: Add Networks - cisco.dcnm.dcnm_network: &add_networks - fabric: "{{ fabric_name }}" - state: merged - config: - - net_name: l2vni_4000 - vrf_name: green_red - net_id: 4000 - vlan_id: 55 - gw_ip_subnet: '192.168.1.1/24' - attach: - - ip_address: "{{ leaf1 }}" - ports: [ Ethernet1/3 ] - deploy: true - - ip_address: "{{ leaf3 }}" - ports: [ Ethernet1/3 ] +- name: Execute spine_leaf_basic workflow + block: + - name: Configure access ethernet interfaces + cisco.dcnm.dcnm_interface: &config_interfaces + fabric: "{{ fabric_name }}" + state: merged + config: + - name: "Ethernet1/3" + type: eth + switch: + - "{{ leaf1 }}" + - "{{ leaf3 }}" deploy: true - - net_name: l2vni_7000 - vrf_name: green_red - net_id: 7000 - vlan_id: 65 - gw_ip_subnet: '192.168.2.1/24' - attach: - - ip_address: "{{ leaf1 }}" - ports: [ ] + profile: + admin_state: true + mode: access + speed: 'Auto' + bpdu_guard: true + port_type_fast: true + mtu: default + access_vlan: 55 + cmds: + - no shutdown + description: "Access interface for vlan55" + - name: "Ethernet1/4" + type: eth + switch: + - "{{ leaf1 }}" + - "{{ leaf3 }}" deploy: true - - ip_address: "{{ leaf3 }}" - ports: [ ] + profile: + admin_state: true + mode: access + speed: 'Auto' + bpdu_guard: true + port_type_fast: true + mtu: default + access_vlan: 65 + cmds: + - no shutdown + description: "Access interface for vlan65" + register: result + + - name: ASSERT - Interfaces created + ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + + - name: Configure access ethernet interfaces - Idempotence + cisco.dcnm.dcnm_interface: *config_interfaces + register: result + + - name: ASSERT - Interface idempotence + ansible.builtin.assert: + that: + - 'result.changed == false' + - 'result.response | length == 0' + + - name: Add Tenant VRF + cisco.dcnm.dcnm_vrf: &add_vrf + fabric: "{{ fabric_name }}" + state: merged + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf3 }}" deploy: true - register: result - - - assert: - that: - - 'result.changed == true' - - 'result.response[0].RETURN_CODE == 200' - - 'result.response[1].RETURN_CODE == 200' - - 'result.response[2].RETURN_CODE == 200' - - 'result.response[3].RETURN_CODE == 200' - - - name: Sleep for 30 seconds before checking idempotence state - wait_for: - timeout: 30 - - - name: Add Networks - Idempotence - cisco.dcnm.dcnm_network: *add_networks - register: result - - - assert: - that: - - 'result.changed == false' - - 'result.response|length == 0' - + register: result + + - name: ASSERT - VRF created + ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + + - name: Add Tenant VRF - Idempotence + cisco.dcnm.dcnm_vrf: *add_vrf + register: result + + - name: ASSERT - VRF idempotence + ansible.builtin.assert: + that: + - 'result.changed == false' + - 'result.response | length == 0' + + - name: Add Networks + cisco.dcnm.dcnm_network: &add_networks + fabric: "{{ fabric_name }}" + state: merged + config: + - net_name: l2vni_4000 + vrf_name: green_red + net_id: 4000 + vlan_id: 55 + gw_ip_subnet: '192.168.1.1/24' + attach: + - ip_address: "{{ leaf1 }}" + ports: [Ethernet1/3] + deploy: true + - ip_address: "{{ leaf3 }}" + ports: [Ethernet1/3] + deploy: true + - net_name: l2vni_7000 + vrf_name: green_red + net_id: 7000 + vlan_id: 65 + gw_ip_subnet: '192.168.2.1/24' + attach: + - ip_address: "{{ leaf1 }}" + ports: [] + deploy: true + - ip_address: "{{ leaf3 }}" + ports: [] + deploy: true + register: result + + - name: ASSERT - Networks created + ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response[0].RETURN_CODE == 200' + - 'result.response[1].RETURN_CODE == 200' + - 'result.response[2].RETURN_CODE == 200' + - 'result.response[3].RETURN_CODE == 200' + + - name: Sleep before checking network idempotence + ansible.builtin.wait_for: + timeout: 30 + + - name: Add Networks - Idempotence + cisco.dcnm.dcnm_network: *add_networks + register: result + + - name: ASSERT - Network idempotence + ansible.builtin.assert: + that: + - 'result.changed == false' + - 'result.response | length == 0' always: - - debug: msg="End dcnm_fabric spine_leaf_basic test" + - name: End dcnm_fabric spine_leaf_basic test + ansible.builtin.debug: + msg: "End dcnm_fabric spine_leaf_basic test" diff --git a/tests/integration/targets/module_integration/tests/spine_leaf_merged.yaml b/tests/integration/targets/module_integration/tests/spine_leaf_merged.yaml index 511de0b13..3782ea8f9 100644 --- a/tests/integration/targets/module_integration/tests/spine_leaf_merged.yaml +++ b/tests/integration/targets/module_integration/tests/spine_leaf_merged.yaml @@ -1,9 +1,14 @@ ---- -- debug: msg="Starting dcnm_fabric spine_leaf_merged test" -- debug: msg="Role Path {{ role_path }}" +- name: Start dcnm_fabric spine_leaf_merged test + ansible.builtin.debug: + msg: "Starting dcnm_fabric spine_leaf_merged test" -- name: Include VRF List Items - include_vars: ./exec_vars/vrfs.yaml +- name: Display role path + ansible.builtin.debug: + msg: "Role Path {{ role_path }}" + +- name: Include VRF list items + ansible.builtin.include_vars: + file: ./exec_vars/vrfs.yaml - name: Cleanup - Delete Networks cisco.dcnm.dcnm_network: @@ -15,329 +20,334 @@ fabric: "{{ fabric_name }}" state: deleted -- block: - - - name: Add Tenant VRF Objects - cisco.dcnm.dcnm_vrf: &add_vrfs - fabric: "{{ fabric_name }}" - state: merged - config: "{{ vrfs }}" - register: result - - - assert: - that: - - 'result.changed == true' - - 'result.response|length == 3' +- name: Execute spine_leaf_merged workflow + block: + - name: Add Tenant VRF objects + cisco.dcnm.dcnm_vrf: &add_vrfs + fabric: "{{ fabric_name }}" + state: merged + config: "{{ vrfs }}" + register: result - - name: Add Tenant VRF Objects - Idempotence - cisco.dcnm.dcnm_vrf: *add_vrfs - register: result + - name: ASSERT - VRF objects created + ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response | length == 3' - - assert: - that: - - 'result.changed == false' + - name: Add Tenant VRF objects - Idempotence + cisco.dcnm.dcnm_vrf: *add_vrfs + register: result - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: ASSERT - VRF objects idempotence + ansible.builtin.assert: + that: + - 'result.changed == false' - - assert: &vrf_created_no_attach_deploy - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - 'result.response[0].parent.vrfStatus == "NA"' - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == false' - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - 'result.response[1].parent.vrfStatus == "NA"' - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == false' - - 'result.response[2].parent.vrfName == "sales"' - - 'result.response[2].parent.vrfId == 550000' - - 'result.response[2].parent.vrfStatus == "NA"' - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == false' + - name: Query VRF state + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Specify attachments to switches with global deploy flag set to false - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: merged - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - register: result + - name: ASSERT - VRF state with no attachments deployed + ansible.builtin.assert: &vrf_created_no_attach_deploy + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - 'result.response[0].parent.vrfStatus == "NA"' + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == false' + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - 'result.response[1].parent.vrfStatus == "NA"' + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == false' + - 'result.response[2].parent.vrfName == "sales"' + - 'result.response[2].parent.vrfId == 550000' + - 'result.response[2].parent.vrfStatus == "NA"' + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == false' - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Specify attachments with global deploy disabled + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: merged + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + register: result - - assert: *vrf_created_no_attach_deploy + - name: Query VRF state after deploy false + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Specify attachments to switches with global deploy flag set to true - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: merged - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - register: result + - name: ASSERT - VRF state remains not deployed + ansible.builtin.assert: *vrf_created_no_attach_deploy - - assert: - that: - - 'result.changed == true' + - name: Specify attachments with global deploy enabled + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: merged + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + register: result - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: ASSERT - Deploy true results changed + ansible.builtin.assert: + that: + - 'result.changed == true' - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until deployed (all VRFs) + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[2].parent.vrfName == "sales"' - - 'result.response[2].parent.vrfId == 550000' - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' + - name: Query VRF state after deploy true + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Cleanup - Delete Tenant VRFs - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: deleted + - name: ASSERT - VRFs deployed with attachments + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[2].parent.vrfName == "sales"' + - 'result.response[2].parent.vrfId == 550000' + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' - - name: Add vrfs with global and per attach deploy override - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: merged - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - deploy: true - - ip_address: "{{ leaf2 }}" - deploy: true - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - # vrf green_red should be deployed on leaf1, leaf2 - # vrf green_red should not be deployed on leaf3, leaf4 - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - deploy: false - - ip_address: "{{ leaf2 }}" - deploy: false - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - # vrf engineering should be deployed on leaf3, leaf4 - # vrf engineering should not be deployed on leaf1, leaf2 + - name: Cleanup - Delete Tenant VRFs after deploy true + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: deleted - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: Add VRFs with per-attachment deploy overrides + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: merged + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + deploy: true + - ip_address: "{{ leaf2 }}" + deploy: true + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + deploy: false + - ip_address: "{{ leaf2 }}" + deploy: false + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until targeted deploy complete + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - name: Query VRF state after targeted deploy + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Cleanup - Delete Tenant VRFs - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: deleted + - name: ASSERT - Targeted deploy results + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - name: Add VRFs with vrf_id and vlan_id autoselection by DCNM - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: merged - config: - - vrf_name: green_red - # vrf_id: 470000 - # vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: engineering - # vrf_id: 480000 - # vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: sales - # vrf_id: 550000 - # vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - register: result + - name: Cleanup - Delete Tenant VRFs (post targeted deploy) + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: deleted - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: Add VRFs allowing DCNM to auto-select IDs + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: merged + config: + - vrf_name: green_red + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: engineering + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: sales + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + register: result - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query fabric state until vrfStatus transitions to DEPLOYED state + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[1].parent.vrfName == "engineering"' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[2].parent.vrfName == "sales"' - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' + - name: Query VRF state until auto-selected deploy completes + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 + - name: ASSERT - Auto-selected VRFs deployed + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[1].parent.vrfName == "engineering"' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[2].parent.vrfName == "sales"' + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' always: - - debug: msg="End dcnm_fabric spine_leaf_merged test" + - name: End dcnm_fabric spine_leaf_merged test + ansible.builtin.debug: + msg: "End dcnm_fabric spine_leaf_merged test" diff --git a/tests/integration/targets/module_integration/tests/spine_leaf_overridden.yaml b/tests/integration/targets/module_integration/tests/spine_leaf_overridden.yaml index e313f4b9c..9f4255a3b 100644 --- a/tests/integration/targets/module_integration/tests/spine_leaf_overridden.yaml +++ b/tests/integration/targets/module_integration/tests/spine_leaf_overridden.yaml @@ -1,9 +1,14 @@ ---- -- debug: msg="Starting dcnm_fabric spine_leaf_overridden test" -- debug: msg="Role Path {{ role_path }}" +- name: Start dcnm_fabric spine_leaf_overridden test + ansible.builtin.debug: + msg: "Starting dcnm_fabric spine_leaf_overridden test" -- name: Include VRF List Items - include_vars: ./exec_vars/vrfs.yaml +- name: Display role path + ansible.builtin.debug: + msg: "Role Path {{ role_path }}" + +- name: Include VRF list items + ansible.builtin.include_vars: + file: ./exec_vars/vrfs.yaml - name: Cleanup - Delete Networks cisco.dcnm.dcnm_network: @@ -15,329 +20,328 @@ fabric: "{{ fabric_name }}" state: deleted -- block: - - - name: Add Tenant VRF Objects - cisco.dcnm.dcnm_vrf: &add_vrfs - fabric: "{{ fabric_name }}" - state: overridden - config: "{{ vrfs }}" - register: result - - - assert: - that: - - 'result.changed == true' - - 'result.response|length == 3' +- name: Execute spine_leaf_overridden workflow + block: + - name: Add Tenant VRF objects + cisco.dcnm.dcnm_vrf: &add_vrfs + fabric: "{{ fabric_name }}" + state: overridden + config: "{{ vrfs }}" + register: result - - name: Add Tenant VRF Objects - Idempotence - cisco.dcnm.dcnm_vrf: *add_vrfs - register: result + - name: ASSERT - VRF objects created + ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response | length == 3' - - assert: - that: - - 'result.changed == false' + - name: Add Tenant VRF objects - Idempotence + cisco.dcnm.dcnm_vrf: *add_vrfs + register: result - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: ASSERT - VRF objects idempotence + ansible.builtin.assert: + that: + - 'result.changed == false' - - assert: &vrf_created_no_attach_deploy - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - 'result.response[0].parent.vrfStatus == "NA"' - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == false' - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - 'result.response[1].parent.vrfStatus == "NA"' - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == false' - - 'result.response[2].parent.vrfName == "sales"' - - 'result.response[2].parent.vrfId == 550000' - - 'result.response[2].parent.vrfStatus == "NA"' - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == false' + - name: Query VRF state + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Specify attachments to switches with global deploy flag set to false - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: overridden - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - register: result + - name: ASSERT - VRF state with no attachments deployed + ansible.builtin.assert: &vrf_created_no_attach_deploy + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - 'result.response[0].parent.vrfStatus == "NA"' + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == false' + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - 'result.response[1].parent.vrfStatus == "NA"' + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == false' + - 'result.response[2].parent.vrfName == "sales"' + - 'result.response[2].parent.vrfId == 550000' + - 'result.response[2].parent.vrfStatus == "NA"' + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == false' - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Specify attachments with global deploy disabled + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: overridden + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + register: result - - assert: *vrf_created_no_attach_deploy + - name: Query VRF state after deploy false + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Specify attachments to switches with global deploy flag set to true - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: overridden - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - register: result + - name: ASSERT - VRF state remains not deployed + ansible.builtin.assert: *vrf_created_no_attach_deploy - - assert: - that: - - 'result.changed == true' + - name: Specify attachments with global deploy enabled + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: overridden + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + register: result - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: ASSERT - Deploy true results changed + ansible.builtin.assert: + that: + - 'result.changed == true' - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until deployed (all VRFs) + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[2].parent.vrfName == "sales"' - - 'result.response[2].parent.vrfId == 550000' - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' + - name: Query VRF state after deploy true + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Cleanup - Delete Tenant VRFs - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: deleted + - name: ASSERT - VRFs deployed with attachments + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[2].parent.vrfName == "sales"' + - 'result.response[2].parent.vrfId == 550000' + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' - - name: Add vrfs with global and per attach deploy override - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: overridden - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - deploy: true - - ip_address: "{{ leaf2 }}" - deploy: true - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - # vrf green_red should be deployed on leaf1, leaf2 - # vrf green_red should not be deployed on leaf3, leaf4 - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - deploy: false - - ip_address: "{{ leaf2 }}" - deploy: false - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - # vrf engineering should be deployed on leaf3, leaf4 - # vrf engineering should not be deployed on leaf1, leaf2 + - name: Cleanup - Delete Tenant VRFs after deploy true + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: deleted - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: Add VRFs with per-attachment deploy overrides + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: overridden + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + deploy: true + - ip_address: "{{ leaf2 }}" + deploy: true + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + deploy: false + - ip_address: "{{ leaf2 }}" + deploy: false + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until targeted deploy complete + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - name: Query VRF state after targeted deploy + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Cleanup - Delete Tenant VRFs - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: deleted + - name: ASSERT - Targeted deploy results + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - name: Add VRFs with vrf_id and vlan_id autoselection by DCNM - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: overridden - config: - - vrf_name: green_red - # vrf_id: 470000 - # vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: engineering - # vrf_id: 480000 - # vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: sales - # vrf_id: 550000 - # vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - register: result + - name: Cleanup - Delete Tenant VRFs (post targeted deploy) + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: deleted - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: Add VRFs allowing DCNM to auto-select IDs + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: overridden + config: + - vrf_name: green_red + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: engineering + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: sales + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + register: result - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until auto-selected deploy completes + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[1].parent.vrfName == "engineering"' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[2].parent.vrfName == "sales"' - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' + - name: Query VRF state after auto-selected deploy + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + - name: ASSERT - Auto-selected VRFs deployed + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[1].parent.vrfName == "engineering"' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[2].parent.vrfName == "sales"' + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' always: - - debug: msg="End dcnm_fabric spine_leaf_overridden test" + - name: End dcnm_fabric spine_leaf_overridden test + ansible.builtin.debug: + msg: "End dcnm_fabric spine_leaf_overridden test" diff --git a/tests/integration/targets/module_integration/tests/spine_leaf_replaced.yaml b/tests/integration/targets/module_integration/tests/spine_leaf_replaced.yaml index cf599cb3d..dcb02c3c4 100644 --- a/tests/integration/targets/module_integration/tests/spine_leaf_replaced.yaml +++ b/tests/integration/targets/module_integration/tests/spine_leaf_replaced.yaml @@ -1,9 +1,14 @@ ---- -- debug: msg="Starting dcnm_fabric spine_leaf_replaced test" -- debug: msg="Role Path {{ role_path }}" +- name: Start dcnm_fabric spine_leaf_replaced test + ansible.builtin.debug: + msg: "Starting dcnm_fabric spine_leaf_replaced test" -- name: Include VRF List Items - include_vars: ./exec_vars/vrfs.yaml +- name: Display role path + ansible.builtin.debug: + msg: "Role Path {{ role_path }}" + +- name: Include VRF list items + ansible.builtin.include_vars: + file: ./exec_vars/vrfs.yaml - name: Cleanup - Delete Networks cisco.dcnm.dcnm_network: @@ -15,329 +20,328 @@ fabric: "{{ fabric_name }}" state: deleted -- block: - - - name: Add Tenant VRF Objects - cisco.dcnm.dcnm_vrf: &add_vrfs - fabric: "{{ fabric_name }}" - state: replaced - config: "{{ vrfs }}" - register: result - - - assert: - that: - - 'result.changed == true' - - 'result.response|length == 3' +- name: Execute spine_leaf_replaced workflow + block: + - name: Add Tenant VRF objects + cisco.dcnm.dcnm_vrf: &add_vrfs + fabric: "{{ fabric_name }}" + state: replaced + config: "{{ vrfs }}" + register: result - - name: Add Tenant VRF Objects - Idempotence - cisco.dcnm.dcnm_vrf: *add_vrfs - register: result + - name: ASSERT - VRF objects created + ansible.builtin.assert: + that: + - 'result.changed == true' + - 'result.response | length == 3' - - assert: - that: - - 'result.changed == false' + - name: Add Tenant VRF objects - Idempotence + cisco.dcnm.dcnm_vrf: *add_vrfs + register: result - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: ASSERT - VRF objects idempotence + ansible.builtin.assert: + that: + - 'result.changed == false' - - assert: &vrf_created_no_attach_deploy - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - 'result.response[0].parent.vrfStatus == "NA"' - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == false' - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - 'result.response[1].parent.vrfStatus == "NA"' - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == false' - - 'result.response[2].parent.vrfName == "sales"' - - 'result.response[2].parent.vrfId == 550000' - - 'result.response[2].parent.vrfStatus == "NA"' - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == false' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == false' + - name: Query VRF state + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Specify attachments to switches with global deploy flag set to false - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: replaced - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - register: result + - name: ASSERT - VRF state with no attachments deployed + ansible.builtin.assert: &vrf_created_no_attach_deploy + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - 'result.response[0].parent.vrfStatus == "NA"' + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == false' + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - 'result.response[1].parent.vrfStatus == "NA"' + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == false' + - 'result.response[2].parent.vrfName == "sales"' + - 'result.response[2].parent.vrfId == 550000' + - 'result.response[2].parent.vrfStatus == "NA"' + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == false' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == false' - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Specify attachments with global deploy disabled + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: replaced + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + register: result - - assert: *vrf_created_no_attach_deploy + - name: Query VRF state after deploy false + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Specify attachments to switches with global deploy flag set to true - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: replaced - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - register: result + - name: ASSERT - VRF state remains not deployed + ansible.builtin.assert: *vrf_created_no_attach_deploy - - assert: - that: - - 'result.changed == true' + - name: Specify attachments with global deploy enabled + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: replaced + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + register: result - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: ASSERT - Deploy true results changed + ansible.builtin.assert: + that: + - 'result.changed == true' - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until deployed (all VRFs) + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[2].parent.vrfName == "sales"' - - 'result.response[2].parent.vrfId == 550000' - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' + - name: Query VRF state after deploy true + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Cleanup - Delete Tenant VRFs - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: deleted + - name: ASSERT - VRFs deployed with attachments + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[2].parent.vrfName == "sales"' + - 'result.response[2].parent.vrfId == 550000' + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' - - name: Add vrfs with global and per attach deploy override - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: replaced - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - deploy: true - - ip_address: "{{ leaf2 }}" - deploy: true - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: false - # vrf green_red should be deployed on leaf1, leaf2 - # vrf green_red should not be deployed on leaf3, leaf4 - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - deploy: false - - ip_address: "{{ leaf2 }}" - deploy: false - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - # vrf engineering should be deployed on leaf3, leaf4 - # vrf engineering should not be deployed on leaf1, leaf2 + - name: Cleanup - Delete Tenant VRFs after deploy true + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: deleted - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: Add VRFs with per-attachment deploy overrides + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: replaced + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + deploy: true + - ip_address: "{{ leaf2 }}" + deploy: true + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: false + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + deploy: false + - ip_address: "{{ leaf2 }}" + deploy: false + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until targeted deploy complete + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - 'result.response[0].parent.vrfId == 470000' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].parent.vrfName == "engineering"' - - 'result.response[1].parent.vrfId == 480000' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - name: Query VRF state after targeted deploy + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result - - name: Cleanup - Delete Tenant VRFs - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: deleted + - name: ASSERT - Targeted deploy results + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - 'result.response[0].parent.vrfId == 470000' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].parent.vrfName == "engineering"' + - 'result.response[1].parent.vrfId == 480000' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - name: Add VRFs with vrf_id and vlan_id autoselection by DCNM - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: replaced - config: - - vrf_name: green_red - # vrf_id: 470000 - # vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: engineering - # vrf_id: 480000 - # vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - - vrf_name: sales - # vrf_id: 550000 - # vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - deploy: true - register: result + - name: Cleanup - Delete Tenant VRFs (post targeted deploy) + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: deleted - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 + - name: Add VRFs allowing DCNM to auto-select IDs + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: replaced + config: + - vrf_name: green_red + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: engineering + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + - vrf_name: sales + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + deploy: true + register: result - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Query VRF state until auto-selected deploy completes + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - assert: - that: - - 'result.response[0].parent.vrfName == "green_red"' - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[0].attach|length == 4' - - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[1].parent.vrfName == "engineering"' - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[1].attach|length == 4' - - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' - - 'result.response[2].parent.vrfName == "sales"' - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - - 'result.response[2].attach|length == 4' - - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' - - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' + - name: Query VRF state after auto-selected deploy + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + - name: ASSERT - Auto-selected VRFs deployed + ansible.builtin.assert: + that: + - 'result.response[0].parent.vrfName == "green_red"' + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[0].attach | length == 4' + - 'result.response[0].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[0].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[1].parent.vrfName == "engineering"' + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[1].attach | length == 4' + - 'result.response[1].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[1].attach[3].switchDetailsList[0].islanAttached == true' + - 'result.response[2].parent.vrfName == "sales"' + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + - 'result.response[2].attach | length == 4' + - 'result.response[2].attach[0].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[1].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[2].switchDetailsList[0].islanAttached == true' + - 'result.response[2].attach[3].switchDetailsList[0].islanAttached == true' always: - - debug: msg="End dcnm_fabric spine_leaf_replaced test" + - name: End dcnm_fabric spine_leaf_replaced test + ansible.builtin.debug: + msg: "End dcnm_fabric spine_leaf_replaced test" diff --git a/tests/integration/targets/module_integration/tests/spine_leaf_replaced_2.yaml b/tests/integration/targets/module_integration/tests/spine_leaf_replaced_2.yaml index 03ac0ccb3..a963917f2 100644 --- a/tests/integration/targets/module_integration/tests/spine_leaf_replaced_2.yaml +++ b/tests/integration/targets/module_integration/tests/spine_leaf_replaced_2.yaml @@ -1,6 +1,10 @@ ---- -- debug: msg="Starting dcnm_fabric spine_leaf_replaced_2 test" -- debug: msg="Role Path {{ role_path }}" +- name: Start dcnm_fabric spine_leaf_replaced_2 test + ansible.builtin.debug: + msg: "Starting dcnm_fabric spine_leaf_replaced_2 test" + +- name: Display role path + ansible.builtin.debug: + msg: "Role Path {{ role_path }}" - name: Cleanup - Delete Networks cisco.dcnm.dcnm_network: @@ -12,68 +16,69 @@ fabric: "{{ fabric_name }}" state: deleted -- block: - - - name: Add 3 VRFs and deploy them to all leaf devices - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: replaced - config: - - vrf_name: green_red - vrf_id: 470000 - vlan_id: 201 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - - vrf_name: sales - vrf_id: 550000 - vlan_id: 501 - attach: - - ip_address: "{{ leaf1 }}" - - ip_address: "{{ leaf2 }}" - - ip_address: "{{ leaf3 }}" - - ip_address: "{{ leaf4 }}" - register: result - - - name: Query fabric state until vrfStatus transitions to DEPLOYED state - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result - until: - - "result.response[0].parent.vrfStatus is search('DEPLOYED')" - - "result.response[1].parent.vrfStatus is search('DEPLOYED')" - - "result.response[2].parent.vrfStatus is search('DEPLOYED')" - retries: 20 - delay: 5 +- name: Execute spine_leaf_replaced_2 workflow + block: + - name: Add 3 VRFs and deploy them to all leaf devices + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: replaced + config: + - vrf_name: green_red + vrf_id: 470000 + vlan_id: 201 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + - vrf_name: sales + vrf_id: 550000 + vlan_id: 501 + attach: + - ip_address: "{{ leaf1 }}" + - ip_address: "{{ leaf2 }}" + - ip_address: "{{ leaf3 }}" + - ip_address: "{{ leaf4 }}" + register: result - - name: Replace engineering VRF to remove attachments - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: replaced - config: - - vrf_name: engineering - vrf_id: 480000 - vlan_id: 401 - deploy: true - register: result + - name: Query fabric state until vrfStatus transitions to DEPLOYED + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result + until: + - "result.response[0].parent.vrfStatus is search('DEPLOYED')" + - "result.response[1].parent.vrfStatus is search('DEPLOYED')" + - "result.response[2].parent.vrfStatus is search('DEPLOYED')" + retries: 20 + delay: 5 - - name: Query VRF State - cisco.dcnm.dcnm_vrf: - fabric: "{{ fabric_name }}" - state: query - register: result + - name: Replace engineering VRF to remove attachments + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: replaced + config: + - vrf_name: engineering + vrf_id: 480000 + vlan_id: 401 + deploy: true + register: result + - name: Query VRF state after replacement + cisco.dcnm.dcnm_vrf: + fabric: "{{ fabric_name }}" + state: query + register: result always: - - debug: msg="End dcnm_fabric spine_leaf_replaced_2 test" + - name: End dcnm_fabric spine_leaf_replaced_2 test + ansible.builtin.debug: + msg: "End dcnm_fabric spine_leaf_replaced_2 test" diff --git a/tests/integration/targets/ndfc_interface/tasks/main.yaml b/tests/integration/targets/ndfc_interface/tasks/main.yaml index be78bc9d0..cbac4f0ae 100644 --- a/tests/integration/targets/ndfc_interface/tasks/main.yaml +++ b/tests/integration/targets/ndfc_interface/tasks/main.yaml @@ -6,15 +6,17 @@ connection: local register: ndfc_testcases -- ansible.builtin.set_fact: +- name: Set fact + ansible.builtin.set_fact: test_cases: files: "{{ ndfc_testcases.files }}" - name: Build List of Test Items - ansible.builtin.set_fact: test_items="{{ ndfc_testcases.files | map(attribute='path') | list }}" + ansible.builtin.set_fact: + test_items: "{{ ndfc_testcases.files | map(attribute='path') | list }}" - name: Run NDFC Test Cases ansible.builtin.include_tasks: "{{ test_case_to_run }}" with_items: "{{ test_items }}" loop_control: - loop_var: test_case_to_run \ No newline at end of file + loop_var: test_case_to_run diff --git a/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml b/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml index 6256986bb..415eafc71 100644 --- a/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml +++ b/tests/integration/targets/ndfc_interface/tests/ndfc_pc_members.yaml @@ -127,7 +127,8 @@ config: "{{ ndfc_pc_members_data }}" register: update_result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'create_result.changed == false' - - 'update_result.changed == false' \ No newline at end of file + - 'update_result.changed == false' diff --git a/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml index 422bd60db..a1145a045 100644 --- a/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_intf/tasks/main.yaml @@ -8,41 +8,41 @@ description: "internal template for enabling VPC feature" content: | ## - ##template content + ## template content feature vpc - ## + ## - name: my_lacp tags: "lacp" description: "internal template for enabling LACP feature" content: | ## - ##template content + ## template content feature lacp - ## + ## - name: my_interface_vlan tags: "interface_vlan" description: "internal template for enabling interface-vlan feature" content: | ## - ##template content + ## template content feature interface-vlan - ## + ## - name: my_hsrp tags: "hsrp" description: "internal template for enabling hsrp feature" content: | ## - ##template content + ## template content feature hsrp - ## + ## tags: sanity register: result @@ -67,7 +67,7 @@ - switch: - ip: "{{ test_data_common.switch1 }}" - ip: "{{ test_data_common.switch2 }}" - deploy: "{{ test_data_common.deploy | bool }}" + deploy: "{{ test_data_common.deploy == true }}" state: merged register: result tags: sanity @@ -78,7 +78,7 @@ method: GET path: /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.fabric }}/inventory/switchesByFabric register: switch_inventory_result - ignore_errors: yes + failed_when: false # Fallback for older NDFC versions or different API paths - name: Get switch inventory from fabric (fallback) @@ -87,48 +87,48 @@ path: /rest/control/fabrics/{{ test_data_common.fabric }}/inventory/switchesByFabric register: switch_inventory_result_fallback when: switch_inventory_result.failed | default(false) - ignore_errors: yes + failed_when: false # Use fallback result if primary failed - name: Set switch inventory result - set_fact: + ansible.builtin.set_fact: switch_inventory_result: "{{ switch_inventory_result_fallback }}" when: switch_inventory_result.failed | default(false) and not switch_inventory_result_fallback.failed | default(false) - ignore_errors: yes + failed_when: false # Create IP to serial number mapping from switch inventory - name: Create IP to serial number mapping - set_fact: + ansible.builtin.set_fact: sw_sn_mapping: "{{ sw_sn_mapping | default({}) | combine({item.ipAddress: item.serialNumber}) }}" loop: "{{ switch_inventory_result.response.DATA | default([]) }}" - when: + when: - switch_inventory_result is defined - switch_inventory_result.response is defined - switch_inventory_result.response.RETURN_CODE == 200 - switch_inventory_result.response.DATA is defined - item.ipAddress is defined - item.serialNumber is defined - ignore_errors: yes + failed_when: false # Show the created mapping for debugging - name: Show IP to Serial Number mapping - debug: + ansible.builtin.debug: var: sw_sn_mapping when: sw_sn_mapping is defined # Update test_data_common with the dynamically created mapping - name: Update test_data_common with dynamic sw_sn mapping - set_fact: + ansible.builtin.set_fact: test_data_common: "{{ test_data_common | combine({'sw_sn': sw_sn_mapping}) }}" when: sw_sn_mapping is defined - ignore_errors: yes + failed_when: false # Also set as a global fact for cross-play access - name: Set dynamic sw_sn as global fact - set_fact: + ansible.builtin.set_fact: global_sw_sn_mapping: "{{ sw_sn_mapping }}" when: sw_sn_mapping is defined - ignore_errors: yes + failed_when: false # Determine the version of Controller - name: Determine version of DCNM or NDFC @@ -136,41 +136,45 @@ method: GET path: /appcenter/cisco/ndfc/api/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: '11' when: ( result.response['DATA']['version'] == 'DEVEL' ) - ignore_errors: yes + failed_when: false ############################################### ## FACTS ## ############################################### -- set_fact: +- name: Set fact + ansible.builtin.set_fact: vpc_create_path: {} vpc_vxlan_deploy_path: {} cxt_create_path: {} @@ -178,57 +182,76 @@ vxlan_config_save_path: {} cxt_config_save_path: {} -- set_fact: - vxlan_config_save_path: "{{ vxlan_config_save_path | combine (item) }}" +- name: Set fact + ansible.builtin.set_fact: + vxlan_config_save_path: "{{ vxlan_config_save_path | combine(item) }}" with_items: - {'12': '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.vxlan_fabric }}/config-save'} - {'11': '/rest/control/fabrics/{{ test_data_common.vxlan_fabric }}/config-save'} when: (test_data_common.vxlan_fabric is defined) -- set_fact: - cxt_config_save_path: "{{ cxt_config_save_path | combine (item) }}" +- name: Set fact + ansible.builtin.set_fact: + cxt_config_save_path: "{{ cxt_config_save_path | combine(item) }}" with_items: - {'12': '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.cxt_fabric }}/config-save'} - {'11': '/rest/control/fabrics/{{ test_data_common.cxt_fabric }}/config-save'} when: (test_data_common.cxt_fabric is defined) -- set_fact: - vpc_create_path: "{{ vpc_create_path | combine (item) }}" +- name: Set fact + ansible.builtin.set_fact: + vpc_create_path: "{{ vpc_create_path | combine(item) }}" with_items: - - {'12': '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair'} - - {'11': '/rest/vpcpair'} + - '12': >- + /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/vpcpair + - '11': '/rest/vpcpair' -- set_fact: - vpc_vxlan_deploy_path: "{{ vpc_vxlan_deploy_path | combine (item) }}" +- name: Set fact + ansible.builtin.set_fact: + vpc_vxlan_deploy_path: "{{ vpc_vxlan_deploy_path | combine(item) }}" with_items: - - {'12': '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.vxlan_fabric }}/config-deploy/{{ test_data_common.vxlan_fabric_sno1 }},{{ test_data_common.vxlan_fabric_sno2 }}'} - - {'11': '/rest/control/fabrics/{{ test_data_common.vxlan_fabric }}/config-deploy/{{ test_data_common.vxlan_fabric_sno1 }},{{ test_data_common.vxlan_fabric_sno2 }}'} + - '12': >- + /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ + test_data_common.vxlan_fabric }}/config-deploy/{{ + test_data_common.vxlan_fabric_sno1 }},{{ test_data_common.vxlan_fabric_sno2 }} + - '11': >- + /rest/control/fabrics/{{ test_data_common.vxlan_fabric }}/config-deploy/{{ + test_data_common.vxlan_fabric_sno1 }},{{ test_data_common.vxlan_fabric_sno2 }} when: (test_data_common.vxlan_fabric is defined) -- set_fact: - vpc_cxt_deploy_path: "{{ vpc_cxt_deploy_path | combine (item) }}" +- name: Set fact + ansible.builtin.set_fact: + vpc_cxt_deploy_path: "{{ vpc_cxt_deploy_path | combine(item) }}" with_items: - - {'12': '/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.cxt_fabric }}/config-deploy/{{ test_data_common.cxt_fabric_sno1 }},{{ test_data_common.cxt_fabric_sno2 }}'} - - {'11': '/rest/control/fabrics/{{ test_data_common.cxt_fabric }}/config-deploy/{{ test_data_common.cxt_fabric_sno1 }},{{ test_data_common.cxt_fabric_sno2 }}'} + - '12': >- + /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ + test_data_common.cxt_fabric }}/config-deploy/{{ + test_data_common.cxt_fabric_sno1 }},{{ test_data_common.cxt_fabric_sno2 }} + - '11': >- + /rest/control/fabrics/{{ test_data_common.cxt_fabric }}/config-deploy/{{ + test_data_common.cxt_fabric_sno1 }},{{ test_data_common.cxt_fabric_sno2 }} when: (test_data_common.cxt_fabric is defined) -- set_fact: - vxlan_vpc_create: False - vxlan_vpc_deploy: False - cxt_vpc_create: False - cxt_vpc_deploy: False +- name: Set fact + ansible.builtin.set_fact: + vxlan_vpc_create: false + vxlan_vpc_deploy: false + cxt_vpc_create: false + cxt_vpc_deploy: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: vpc_vxlan_data: { "peerOneId": "{{ sw_sn_mapping[test_data_common.vxlan_fabric_sw1] | default(test_data_common.vxlan_fabric_sno1) }}", "peerTwoId": "{{ sw_sn_mapping[test_data_common.vxlan_fabric_sw2] | default(test_data_common.vxlan_fabric_sno2) }}", "useVirtualPeerlink": false } - vxlan_vpc_create: True - vxlan_vpc_deploy: "{{ test_data_common.deploy | bool }}" + vxlan_vpc_create: true + vxlan_vpc_deploy: "{{ test_data_common.deploy == true }}" when: (test_data_common.vxlan_fabric is defined and test_data_common.vxlan_fabric_sno1 is defined and test_data_common.vxlan_fabric_sno2 is defined) -- set_fact: +- name: Set fact + ansible.builtin.set_fact: vpc_cxt_data: { "peerOneId": "{{ sw_sn_mapping[test_data_common.cxt_fabric_sw1] | default(test_data_common.cxt_fabric_sno1) }}", "peerTwoId": "{{ sw_sn_mapping[test_data_common.cxt_fabric_sw2] | default(test_data_common.cxt_fabric_sno2) }}", @@ -265,8 +288,8 @@ "PEER2_PO_CONF": "" } } - cxt_vpc_create: True - cxt_vpc_deploy: "{{ test_data_common.deploy | bool }}" + cxt_vpc_create: true + cxt_vpc_deploy: "{{ test_data_common.deploy == true }}" when: (test_data_common.cxt_fabric is defined and test_data_common.cxt_fabric_sno1 is defined and test_data_common.cxt_fabric_sno2 is defined) ############################################## @@ -278,15 +301,15 @@ method: POST path: "{{ vpc_create_path[controller_version] }}" json_data: - "{{ vpc_vxlan_data | to_json}}" + "{{ vpc_vxlan_data | to_json }}" register: result - when: (vxlan_vpc_create == True) - ignore_errors: yes + when: vxlan_vpc_create | bool + failed_when: false - name: Wait for 10 secs - wait_for: + ansible.builtin.wait_for: timeout: 10 - when: (vxlan_vpc_create == True) + when: vxlan_vpc_create | bool ############################################## ## CONFIG SAVE ## @@ -297,8 +320,8 @@ method: POST path: "{{ vxlan_config_save_path[controller_version] }}" register: result - when: (vxlan_vpc_create == True) - ignore_errors: yes + when: vxlan_vpc_create | bool + failed_when: false ############################################## ## DEPLOY VXLAN VPC PAIR ## @@ -307,18 +330,18 @@ - name: Deploy VPC switch pair cisco.dcnm.dcnm_rest: method: POST - path: "{{ vpc_vxlan_deploy_path[controller_version] }}" + path: "{{ vpc_vxlan_deploy_path[controller_version] }}" register: result with_sequence: count=1 loop_control: pause: 5 - when: (vxlan_vpc_deploy == True) - ignore_errors: yes + when: vxlan_vpc_deploy | bool + failed_when: false - name: Wait for 30 secs - wait_for: + ansible.builtin.wait_for: timeout: 30 - when: (vxlan_vpc_deploy == True) + when: vxlan_vpc_deploy | bool ############################################## ## CREATE CXT VPC PAIR ## @@ -329,15 +352,15 @@ method: POST path: "{{ vpc_create_path[controller_version] }}" json_data: - "{{ vpc_cxt_data | to_json}}" + "{{ vpc_cxt_data | to_json }}" register: result - when: (cxt_vpc_create == True) - ignore_errors: yes + when: cxt_vpc_create | bool + failed_when: false - name: Wait for 20 secs - wait_for: + ansible.builtin.wait_for: timeout: 10 - when: (cxt_vpc_create == True) + when: cxt_vpc_create | bool ############################################## ## CONFIG SAVE ## @@ -348,8 +371,8 @@ method: POST path: "{{ cxt_config_save_path[controller_version] }}" register: result - when: (cxt_vpc_create == True) - ignore_errors: yes + when: cxt_vpc_create | bool + failed_when: false ############################################## ## DEPLOY CXT VPC PAIR ## @@ -358,15 +381,15 @@ - name: Deploy VPC switch pair cisco.dcnm.dcnm_rest: method: POST - path: "{{ vpc_cxt_deploy_path[controller_version] }}" + path: "{{ vpc_cxt_deploy_path[controller_version] }}" register: result with_sequence: count=1 loop_control: pause: 5 - when: (cxt_vpc_deploy == True) - ignore_errors: yes + when: cxt_vpc_deploy | bool + failed_when: false - name: Wait for 30 secs - wait_for: + ansible.builtin.wait_for: timeout: 30 - when: (cxt_vpc_deploy == True) + when: cxt_vpc_deploy | bool diff --git a/tests/integration/targets/prepare_dcnm_links/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_links/tasks/main.yaml index dd144ca9c..186141ee5 100644 --- a/tests/integration/targets/prepare_dcnm_links/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_links/tasks/main.yaml @@ -7,75 +7,78 @@ method: GET path: /appcenter/cisco/ndfc/api/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: '11' when: ( result.response['DATA']['version'] == 'DEVEL' ) - ignore_errors: yes + failed_when: false - name: Initialise ms_fabric_list - set_fact: + ansible.builtin.set_fact: ms_fabric_list: [] - name: Get the Fabric associations cisco.dcnm.dcnm_rest: method: GET - path: /rest/control/fabrics/msd/fabric-associations + path: /rest/control/fabrics/msd/fabric-associations when: controller_version == '11' register: result - ignore_errors: yes + failed_when: false - name: Setting fact - set_fact: + ansible.builtin.set_fact: ms_fabric_list: "{{ (ms_fabric_list | default([])) + [item['fabricName']] }}" when: (controller_version == '11' and result.response["RETURN_CODE"] == 200) and (item['fabricParent'] != 'None') loop: '{{ result.response["DATA"] }}' - ignore_errors: yes + failed_when: false - name: Show the multisite fabric list information - debug: + ansible.builtin.debug: var: ms_fabric_list - name: Get the Fabric associations cisco.dcnm.dcnm_rest: method: GET - path: /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations + path: /appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/msd/fabric-associations when: controller_version == '12' register: result - ignore_errors: yes + failed_when: false - name: Setting fact - set_fact: + ansible.builtin.set_fact: ms_fabric_list: "{{ (ms_fabric_list | default([])) + [item['fabricName']] }}" when: (controller_version == '12' and result.response["RETURN_CODE"] == 200) and (item['fabricParent'] != 'None') loop: '{{ result.response["DATA"] }}' - ignore_errors: yes + failed_when: false - name: Show the multisite fabric list information - debug: + ansible.builtin.debug: var: ms_fabric_list diff --git a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml index 8cc405d90..c49103e55 100644 --- a/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_policy/tasks/main.yaml @@ -20,12 +20,14 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -46,17 +48,19 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity -- block: +- name: Create and deploy templates + block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create templates cisco.dcnm.dcnm_template: &temp_merge @@ -149,7 +153,8 @@ register: result tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 5' @@ -157,7 +162,8 @@ - '(result["diff"][0]["query"] | length) == 0' tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' @@ -172,7 +178,7 @@ tags: "base_ospf clone" description: "template which is a clone of base_ospf" content: | - ##template variables + ## template variables # Copyright (c) 2018 by Cisco Systems, Inc. # All rights reserved. @@ -187,15 +193,16 @@ ipV4Address LOOPBACK_IP; ## - ##template content + ## template content router ospf $$OSPF_TAG$$ router-id $$LOOPBACK_IP$$ - ## + ## register: result tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -203,15 +210,16 @@ - '(result["diff"][0]["query"] | length) == 0' tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' tags: sanity -# Policy IT cases depend on telemetry feature being enabled on the switches. So create a policy for -# deploying the telemetry feature on the switches before starting the tests + # Policy IT cases depend on telemetry feature being enabled on the switches. So create a policy for + # deploying the telemetry feature on the switches before starting the tests - name: Create template for telemetry feature cisco.dcnm.dcnm_template: @@ -222,14 +230,15 @@ description: "internal template for enabling telemetry feature" content: | ## - ##template content + ## template content feature telemetry - ## + ## register: result tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -237,14 +246,15 @@ - '(result["diff"][0]["query"] | length) == 0' tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' tags: sanity -# Create the policy to deploy telemetry feature on the switches + # Create the policy to deploy telemetry feature on the switches - name: Create telemetry policy cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" @@ -261,7 +271,8 @@ register: result tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -271,7 +282,8 @@ tags: sanity # Assert for Create responses - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -282,7 +294,8 @@ tags: sanity # Assert for deploy responses - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' diff --git a/tests/integration/targets/prepare_dcnm_service_policy/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_service_policy/tasks/main.yaml index 8f96658e8..638456ce7 100644 --- a/tests/integration/targets/prepare_dcnm_service_policy/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_service_policy/tasks/main.yaml @@ -16,7 +16,8 @@ - ip: "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -32,13 +33,14 @@ state: deleted # optional, default merged register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 ############################################### @@ -52,13 +54,14 @@ state: deleted register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 ############################################### @@ -87,9 +90,10 @@ - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' ############################################### @@ -97,7 +101,7 @@ ############################################### - name: Initialize the setup - Delete Networks - cisco.dcnm.dcnm_network: + cisco.dcnm.dcnm_network: fabric: "{{ ansible_it_fabric }}" state: deleted config: @@ -151,13 +155,14 @@ gw_ip_subnet: '42.42.42.1/24' register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 40 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 40 ############################################### @@ -166,34 +171,35 @@ - name: Initialize the setup - Delete VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" state: deleted config: - vrf_name: "{{ ansible_vrf_11 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_21 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_21 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_31 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_31 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - - vrf_name: "{{ ansible_vrf_41 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + - vrf_name: "{{ ansible_vrf_41 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" - register: result + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 10 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 10 ############################################## @@ -202,30 +208,31 @@ - name: Initialize the setup - Create all VRFs cisco.dcnm.dcnm_vrf: - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" state: merged config: - vrf_name: "{{ ansible_vrf_11 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - vrf_name: "{{ ansible_vrf_21 }}" + - ip_address: "{{ ansible_switch1 }}" + - vrf_name: "{{ ansible_vrf_21 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - vrf_name: "{{ ansible_vrf_31 }}" + - ip_address: "{{ ansible_switch1 }}" + - vrf_name: "{{ ansible_vrf_31 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - vrf_name: "{{ ansible_vrf_41 }}" + - ip_address: "{{ ansible_switch1 }}" + - vrf_name: "{{ ansible_vrf_41 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - register: result + - ip_address: "{{ ansible_switch1 }}" + register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 10 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 10 ############################################### @@ -244,7 +251,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 111 gw_ip_subnet: '11.11.11.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_12 }}" vrf_name: "{{ ansible_vrf_11 }}" net_id: 120 @@ -252,7 +259,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 121 gw_ip_subnet: '12.12.12.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_21 }}" vrf_name: "{{ ansible_vrf_21 }}" net_id: 210 @@ -260,7 +267,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 211 gw_ip_subnet: '21.21.21.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_22 }}" vrf_name: "{{ ansible_vrf_21 }}" net_id: 220 @@ -268,7 +275,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 221 gw_ip_subnet: '22.22.22.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_31 }}" vrf_name: "{{ ansible_vrf_31 }}" net_id: 310 @@ -276,7 +283,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 311 gw_ip_subnet: '31.31.31.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_32 }}" vrf_name: "{{ ansible_vrf_31 }}" net_id: 320 @@ -284,7 +291,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 321 gw_ip_subnet: '32.32.32.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_41 }}" vrf_name: "{{ ansible_vrf_41 }}" net_id: 410 @@ -292,7 +299,7 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 411 gw_ip_subnet: '41.41.41.1/24' - deploy: True + deploy: true - net_name: "{{ ansible_net_42 }}" vrf_name: "{{ ansible_vrf_41 }}" net_id: 420 @@ -300,16 +307,17 @@ net_extension_template: Default_Network_Extension_Universal vlan_id: 421 gw_ip_subnet: '42.42.42.1/24' - deploy: True + deploy: true register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 40 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 40 ############################################### @@ -317,7 +325,7 @@ ############################################### - name: Initialize the setup - Create all Service Nodes - cisco.dcnm.dcnm_service_node: + cisco.dcnm.dcnm_service_node: fabric: "{{ ansible_it_fabric }}" service_fabric: "{{ ansible_it_service_fabric }}" state: merged @@ -338,9 +346,10 @@ - "{{ ansible_switch1 }}" register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' ############################################### @@ -348,24 +357,24 @@ ############################################### - name: Initialize the setup - Create service route peerings - cisco.dcnm.dcnm_service_route_peering: - fabric: "{{ ansible_it_fabric }}" - service_fabric: "{{ ansible_it_service_fabric }}" + cisco.dcnm.dcnm_service_route_peering: + fabric: "{{ ansible_it_fabric }}" + service_fabric: "{{ ansible_it_service_fabric }}" state: merged - config: + config: - name: IT-FW-RP1 # mandatory node_name: "{{ ansible_snode_1 }}" # mandatory deploy_mode: intra_tenant_fw # mandatory, choices=[intra_tenant_fw, inter_tenant_fw] - inside_network: # + inside_network: # vrf: "{{ ansible_vrf_11 }}" # mandatory - name: rp1-sn1-inside-net # mandatory + name: Rp1-sn1-inside-net # mandatory vlan_id: 101 # mandatory - profile: + profile: ipv4_gw: 192.161.1.1/24 # mandatory next_hop: 192.161.1.100 # mandatory - outside_network: # + outside_network: # vrf: "{{ ansible_vrf_11 }}" # mandatory - name: rp1-sn1-outside-net # mandatory + name: Rp1-sn1-outside-net # mandatory vlan_id: 102 # mandatory profile: ipv4_gw: 192.161.2.1/24 # mandatory @@ -375,11 +384,11 @@ node_name: "{{ ansible_snode_2 }}" # mandatory deploy_mode: one_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] peering_option: ebgp # optional, default is static, choices=[static, ebgp] - first_arm: + first_arm: vrf: "{{ ansible_vrf_21 }}" # mandatory - name: rp4-sn2-first-arm # mandatory + name: Rp4-sn2-first-arm # mandatory vlan_id: 401 # mandatory - profile: + profile: ipv4_gw: 192.164.1.1/24 # mandatory ipv4_neighbor: 41.41.41.1 # mandatory ipv4_lo: 41.41.41.2 # mandatory @@ -389,19 +398,19 @@ node_name: "{{ ansible_snode_2 }}" # mandatory deploy_mode: two_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] peering_option: ebgp # optional, default is static, choices=[static, ebgp] - first_arm: + first_arm: vrf: "{{ ansible_vrf_31 }}" # mandatory - name: rp5-sn2-first-arm # mandatory + name: Rp5-sn2-first-arm # mandatory vlan_id: 501 # mandatory - profile: + profile: ipv4_gw: 192.165.1.1/24 # mandatory ipv4_neighbor: 51.51.51.1 # mandatory ipv4_lo: 51.51.51.2 # mandatory second_arm: vrf: "{{ ansible_vrf_31 }}" # mandatory - name: rp5-sn2-second-arm # mandatory + name: Rp5-sn2-second-arm # mandatory vlan_id: 502 # mandatory - profile: + profile: ipv4_gw: 192.165.2.1/24 # mandatory reverse_next_hop: 192.165.2.100 # mandatory @@ -409,17 +418,18 @@ node_name: "{{ ansible_snode_2 }}" # mandatory deploy_mode: one_arm_adc # mandatory, choices=[one_arm_adc, two_arm_adc] peering_option: static # optional, default is static, choices=[static, ebgp] - first_arm: + first_arm: vrf: "{{ ansible_vrf_41 }}" # mandatory - name: rp6-sn2-first-arm # mandatory + name: Rp6-sn2-first-arm # mandatory vlan_id: 601 # mandatory - profile: + profile: ipv4_gw: 192.166.2.1/24 # mandatory reverse_next_hop: 192.166.2.100 # mandatory -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' ############################################### @@ -440,11 +450,12 @@ state: merged register: result -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 diff --git a/tests/integration/targets/prepare_dcnm_service_route_peering/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_service_route_peering/tasks/main.yaml index 339f49bab..2cacdae81 100644 --- a/tests/integration/targets/prepare_dcnm_service_route_peering/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_service_route_peering/tasks/main.yaml @@ -10,7 +10,8 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' @@ -22,26 +23,27 @@ service_fabric: "{{ ansible_it_service_fabric }}" state: deleted config: - - name: "{{ ansible_snode_1 }}" - type: firewall - form_factor: physical - svc_int_name: svc1 - attach_interface: "{{ ansible_att_intf1 }}" - switches: - - "{{ ansible_switch1 }}" - - name: "{{ ansible_snode_2 }}" - type: load_balancer - form_factor: physical - svc_int_name: svc2 - attach_interface: "{{ ansible_att_intf2 }}" - switches: - - "{{ ansible_switch1 }}" + - name: "{{ ansible_snode_1 }}" + type: firewall + form_factor: physical + svc_int_name: svc1 + attach_interface: "{{ ansible_att_intf1 }}" + switches: + - "{{ ansible_switch1 }}" + - name: "{{ ansible_snode_2 }}" + type: load_balancer + form_factor: physical + svc_int_name: svc2 + attach_interface: "{{ ansible_att_intf2 }}" + switches: + - "{{ ansible_switch1 }}" register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity @@ -52,80 +54,82 @@ config: - vrf_name: "{{ ansible_vrf_11 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_12 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_21 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_22 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_31 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_32 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_41 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_42 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_51 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_52 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_61 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_62 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_71 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_72 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" register: result tags: sanity -- assert: +- name: Assert response + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity - name: Initialize the setup - sleep for 10 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 10 tags: sanity -- tags: sanity +- name: MERGE VRF and Service Node setup + tags: sanity test block: -############################################## -## MERGE VRFs ## -############################################## + ############################################## + ## MERGE VRFs ## + ############################################## - name: Initialize the setup - Create all VRFs cisco.dcnm.dcnm_vrf: @@ -134,70 +138,71 @@ config: - vrf_name: "{{ ansible_vrf_11 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_12 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_21 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_22 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_31 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_32 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_41 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_42 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_51 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_52 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_61 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_62 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_71 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" - vrf_name: "{{ ansible_vrf_72 }}" attach: - - ip_address: "{{ ansible_switch1 }}" - - ip_address: "{{ ansible_switch2 }}" + - ip_address: "{{ ansible_switch1 }}" + - ip_address: "{{ ansible_switch2 }}" register: result - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' -############################################## -## MERGE SERVICE NODES ## -############################################## + ############################################## + ## MERGE SERVICE NODES ## + ############################################## - name: Initialize the setup - Create all Service Nodes cisco.dcnm.dcnm_service_node: @@ -221,11 +226,12 @@ - "{{ ansible_switch1 }}" register: result - - assert: + - name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' - name: Initialize the setup - sleep for 180 seconds for DCNM to completely update the state - wait_for: + ansible.builtin.wait_for: timeout: 180 diff --git a/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml index ba64b7fc2..ecd7299cd 100644 --- a/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_template/tasks/main.yaml @@ -4,25 +4,26 @@ - name: Put the fabric to default state cisco.dcnm.dcnm_policy: - fabric: "{{ ansible_it_fabric }}" + fabric: "{{ ansible_it_fabric }}" state: deleted # only choose form [merged, deleted, query] - config: + config: - name: template_inuse_1 # name is mandatory - name: template_inuse_2 # name is mandatory - name: my_feature_telemetry - switch: - ip: "{{ ansible_switch1 }}" - register: result + register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity - name: Initialize - Delete the templates - cisco.dcnm.dcnm_template: + cisco.dcnm.dcnm_template: state: deleted # only choose form [merged, deleted, query] config: - name: template_101 @@ -36,20 +37,22 @@ register: result tags: sanity -- assert: +- name: Assert + ansible.builtin.assert: that: - - 'item["RETURN_CODE"] == 200' + - 'item["RETURN_CODE"] == 200' loop: '{{ result.response }}' tags: sanity -- block: +- name: Prepare DCNM templates and policies + block: -############################################## -## MERGE ## -############################################## + ############################################## + ## MERGE ## + ############################################## - name: Create templates to be used by policies below - cisco.dcnm.dcnm_template: + cisco.dcnm.dcnm_template: state: merged # only choose form [merged, deleted, query] config: - name: template_inuse_1 @@ -87,8 +90,8 @@ snsr-grp 8 sample-interval 8000 tags: sanity -# Policy IT cases depend on telemetry feature being enabled on the switches. So create a policy for -# deploying the telemetry feature on the switches before starting the tests + # Policy IT cases depend on telemetry feature being enabled on the switches. So create a policy for + # deploying the telemetry feature on the switches before starting the tests - name: Create template for telemetry feature cisco.dcnm.dcnm_template: @@ -99,15 +102,16 @@ description: "internal template for enabling telemetry feature" content: | ## - ##template content + ## template content feature telemetry - ## + ## register: result tags: sanity - - assert: + - name: Asserting results + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -115,14 +119,15 @@ - '(result["diff"][0]["query"] | length) == 0' tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Template Created" in item["DATA"]["status"]' loop: '{{ result.response }}' tags: sanity -# Create the policy to deploy telemetry feature on the switches + # Create the policy to deploy telemetry feature on the switches - name: Create telemetry policy cisco.dcnm.dcnm_policy: fabric: "{{ ansible_it_fabric }}" @@ -138,7 +143,8 @@ register: result tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 1' @@ -148,7 +154,8 @@ tags: sanity # Assert for Create responses - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' @@ -159,7 +166,8 @@ tags: sanity # Assert for deploy responses - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 1' @@ -170,12 +178,12 @@ tags: sanity - name: Create and deploy the policies using created templates - cisco.dcnm.dcnm_policy: - fabric: "{{ ansible_it_fabric }}" - config: + cisco.dcnm.dcnm_policy: + fabric: "{{ ansible_it_fabric }}" + config: - name: template_inuse_1 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists - priority: 101 + priority: 101 - name: template_inuse_2 # This must be a valid template name create_additional_policy: false # Do not create a policy if it already exists @@ -188,7 +196,8 @@ register: result tags: sanity - - assert: + - name: Assert + ansible.builtin.assert: that: - 'result.changed == true' - '(result["diff"][0]["merged"] | length) == 2' @@ -198,22 +207,24 @@ tags: sanity # Assert for Create responses - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '"Success" in item["DATA"]["successList"][0]["status"]' - when: (my_idx < (result["diff"][0]["merged"] | length)) + when: (my_idx < (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: index_var: my_idx tags: sanity # Assert for deploy responses - - assert: + - name: Assert + ansible.builtin.assert: that: - 'item["RETURN_CODE"] == 200' - '(item["DATA"][0]["successPTIList"].split(",") | length) == 2' - when: (my_idx == (result["diff"][0]["merged"] | length)) + when: (my_idx == (result["diff"][0]["merged"] | length)) loop: '{{ result.response }}' loop_control: index_var: my_idx diff --git a/tests/integration/targets/prepare_dcnm_vpc_pair/tasks/main.yaml b/tests/integration/targets/prepare_dcnm_vpc_pair/tasks/main.yaml index 97d1a7ea1..ba1888e79 100644 --- a/tests/integration/targets/prepare_dcnm_vpc_pair/tasks/main.yaml +++ b/tests/integration/targets/prepare_dcnm_vpc_pair/tasks/main.yaml @@ -2,7 +2,8 @@ ## SETUP ## ############################################## -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: '12' - name: Determine version of DCNM or NDFC @@ -10,39 +11,42 @@ method: GET path: /appcenter/cisco/ndfc/api/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( 'response' in result and result.response['RETURN_CODE'] == 200 and result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: "{{ result.response['DATA']['version'][0:2] | int }}" when: ( 'response' in result and result.response['RETURN_CODE'] == 200 and result.response['DATA']['version'] is search("\d\d.\d+") ) - ignore_errors: yes + failed_when: false - name: Determine version of DCNM or NDFC cisco.dcnm.dcnm_rest: method: GET path: /fm/fmrest/about/version register: result - ignore_errors: yes + failed_when: false -- set_fact: +- name: Set fact + ansible.builtin.set_fact: controller_version: '11' when: ( 'response' in result and result.response['RETURN_CODE'] == 200 and result.response['DATA']['version'] == 'DEVEL' ) - ignore_errors: yes + failed_when: false - name: Initialise fabric type - set_fact: + ansible.builtin.set_fact: fabric_type: "" - name: Get the Fabric associations @@ -51,16 +55,16 @@ path: "/rest/control/fabrics/{{ test_data_common.fabric }}" when: controller_version == '11' register: result - ignore_errors: yes + failed_when: false - name: Setting fact - set_fact: + ansible.builtin.set_fact: fabric_type: "{{ result.response['DATA']['fabricTechnology'] }}" when: (controller_version == '11' and 'response' in result and result.response['RETURN_CODE'] == 200) - ignore_errors: yes + failed_when: false - name: Show the Fabric Type - debug: + ansible.builtin.debug: var: fabric_type - name: Get the Fabric Type @@ -69,16 +73,16 @@ path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.fabric }}" when: controller_version == '12' register: result - ignore_errors: yes + failed_when: false - name: Setting fact - set_fact: + ansible.builtin.set_fact: fabric_type: "{{ result.response['DATA']['fabricTechnology'] }}" when: (controller_version == '12' and 'response' in result and result.response['RETURN_CODE'] == 200) - ignore_errors: yes + failed_when: false - name: Show the fabric type - debug: + ansible.builtin.debug: var: fabric_type - name: Get switch inventory from fabric @@ -86,13 +90,13 @@ method: GET path: "/appcenter/cisco/ndfc/api/v1/lan-fabric/rest/control/fabrics/{{ test_data_common.fabric }}/inventory/switchesByFabric" register: switch_inventory_result - ignore_errors: yes + failed_when: false - name: Create IP to Serial Number mapping - set_fact: + ansible.builtin.set_fact: ip_to_sn_mapping: "{{ ip_to_sn_mapping | default({}) | combine({item.ipAddress: item.serialNumber}) }}" loop: "{{ switch_inventory_result.response.DATA | default([]) }}" - when: + when: - switch_inventory_result is defined - switch_inventory_result.response is defined - switch_inventory_result.response.RETURN_CODE == 200 @@ -101,11 +105,11 @@ - item.serialNumber is defined - name: Show IP to Serial Number mapping - debug: + ansible.builtin.debug: var: ip_to_sn_mapping when: ip_to_sn_mapping is defined - name: Update test_data_common with fabric_type and ip_to_sn_mapping - set_fact: + ansible.builtin.set_fact: test_data_common: "{{ test_data_common | combine({'fabric_type': fabric_type, 'ip_to_sn_mapping': ip_to_sn_mapping | default({})}) }}" when: fabric_type is defined